using Learun.Application.Base.SystemModule;
using Learun.Application.TwoDevelopment.ZZDT_EC;
using Learun.Cache.Base;
using Learun.Cache.Factory;
using Learun.Util;
using Learun.Util.Operat;
using System.Web.Mvc;
namespace Learun.Application.Web.Controllers
{
///
/// 版 本 PIT-ADMS V7.0.3 敏捷开发框架
/// Copyright (c) 2013-2018 Hexagon PPM
/// 创建人:研发部
/// 日 期:2017.03.09
/// 描 述:主页控制器
///
public class HomeController : MvcControllerBase
{
#region 视图功能
private AnnexesFileIBLL annexesFileIBLL = new AnnexesFileBLL();
///
/// 单位平台 框架
///
///
[HttpGet]
public ActionResult AdminSystemManage()
{
UserInfo userInfo = LoginUserInfo.Get();
if (userInfo != null)
{
ViewBag.UserId = userInfo.userId;
}
return View();
}
///
/// 网页端 公司级 首页
///
[HttpGet]
public ActionResult AdminSystemPageIndex()
{
return View();
}
///
/// 项目平台 框架
///
///
[HttpGet]
public ActionResult AdminProjectManage(string ProjectId)
{
//写入项目ID
UserInfo userInfo = LoginUserInfo.Get();
if (userInfo != null)
{
ViewBag.UserId = userInfo.userId;
}
return View();
}
///
/// 项目平台 首页
///
[HttpGet]
public ActionResult AdminProjectPageIndex()
{
return View();
}
///
/// 初始化页面(项目管理)
///
///
[HttpGet]
public ActionResult AdminProject()
{
UserInfo userInfo = LoginUserInfo.Get();
if (userInfo != null)
{
ViewBag.UserId = userInfo.userId;
}
return View();
}
#endregion
private ICache cache = CacheFactory.CaChe();
#region 清空缓存
///
/// 清空缓存
///
///
[HttpPost]
[AjaxOnly]
public ActionResult ClearRedis()
{
for (int i = 0; i < 16; i++)
{
cache.RemoveAll(i);
}
return Success("清空成功");
}
#endregion
///
/// 访问功能。点击主页面左侧导航树下的某个节点。比如点击(图纸目录、样板目录)
///
/// 功能Id
/// 功能模块
/// 访问路径
///
[HttpPost]
public ActionResult VisitModule(string moduleName, string moduleUrl)
{
UserInfo userInfo = LoginUserInfo.Get();
LogEntity logEntity = new LogEntity();
logEntity.F_CategoryId = 2;
logEntity.F_OperateTypeId = ((int)OperationType.Visit).ToString();
logEntity.F_OperateType = EnumAttribute.GetDescription(OperationType.Visit);
logEntity.F_OperateAccount = userInfo.account;
logEntity.F_OperateUserId = userInfo.userId;
logEntity.F_Module = moduleName;
logEntity.F_ExecuteResult = 1;
logEntity.F_ExecuteResultJson = "访问地址:" + moduleUrl;
logEntity.WriteLog();
return Success("ok");
}
///
/// 获取当前项目信息
///
public ActionResult GetProject()
{
string ProjectId = Request.Params["ProjectId"];
ec_projectIBLL projectIBLL = new ec_projectBLL();
var data = projectIBLL.GetEntity(ProjectId);
return Success(data);
}
#region 模拟用户跳转
public ActionResult MonitLogin(string username, string password)
{
string account = Request["account"];
Organization.UserEntity userEntity1 = new Organization.UserBLL().GetEntityByAccount(account);
if (userEntity1 != null)
{
OperatorHelper.Instance.AddLoginUser(userEntity1.F_Account, "Learun_ADMS_6.1_PC", null);//写入缓存信息
var jsonData = new
{
UpdatePassWord = true
};
return RedirectToAction("AdminSystemManage", "Home");
}
return RedirectToAction("Index", "Login");
}
#endregion
}
}