using PMS.BusinessModels.Person; using PMS.EntityModels.PersonManager; using PMS.Interface; using PMS.Interface.PresonManager; using PMS.Interface.ProManager; using PMS.Interface.SysManager; using QWPlatform.SystemLibrary.Security; using QWPlatform.SystemLibrary.Web; using System; using System.Collections.Generic; using System.Linq; using System.Web; using System.Web.Mvc; namespace PMS.WebUI.Controllers { /// /// 创建人:王璐 /// 创建日期:2018/12/30 /// 模块功能:机构人员 /// public class PersonManagerController : BaseController { /// /// 实例接口 /// IPersonModule PersonModule = InterfaceFactory.CreateBusinessInstance(); [HttpGet] public ActionResult Index() { return View(); } #region 信息显示以及查询 /// /// 获取权限渠道 /// public ActionResult ChannelInfo() { string json = PersonModule.GetAll_Channel(GetAuthDats().Channel); return Content(json, "application/json"); } /// /// 渠道下的人员 /// /// /// public ActionResult PersonInfo(string id, int page, int rows, string Search, string Nature, string Project) { string json = PersonModule.GetAll_PersonInfo(id, page, rows, Search, Nature, Project); return Content(json, "application/json"); } /// /// 根据人员ID获取对应的人员信息 /// /// public ActionResult GetInfoByID(string id) { var json = PersonModule.GetInfoByID(id); return Content(json, "text/json"); } #endregion #region 人员添加 /// /// 增加人员的窗口 /// public ActionResult PersonInfoWindow(string channelId) { ViewBag.id = channelId; return View(); } /// /// 保存人员信息 /// public int SavePerson(PersonBusinessModel model, string type) { //判断为说明操作 1:增加 2:修改 if (type == "1") { return PersonModule.SaveAddPerson(model); } if (type == "2") { return PersonModule.SaveUpdatePerson(model); } return 0; } /// /// 创建人员时勾选自动生成账户 /// /// /// public int AutoAccount(PersonBusinessModel model) { return PersonModule.AutoAccount(model); } /// /// 获取性别 /// /// public ActionResult GetSex() { var dt = PersonModule.GetSex(); return Content(dt, "application/json"); } /// /// 获取人员性质 /// /// public ActionResult GetXZ() { var user = GetCurrentUser(); var dt = PersonModule.GetXZ(user.PersonProperty); return Content(dt, "application/json"); } /// /// 获取职务 /// /// public ActionResult GetJob() { var user = GetCurrentUser(); var dt = PersonModule.GetJob(user); return Content(dt, "application/json"); } /// /// 根据渠道ID获取项目 /// /// public ActionResult GetProject(string id) { var dt = PersonModule.GetProject(id, "", GetAuthDats().Project); return Content(dt, "application/json"); } /// /// 根据项目ID获取机构 /// /// public ActionResult GetStation(string id) { var dt = PersonModule.GetStation(id); return Content(dt, "application/json"); } public ActionResult GetCurrentProject(string id) { var dt = PersonModule.GetCurrentProject(id); return Content(dt, "application/json"); } /// /// 通过性质,职务提取人员信息(combobox) /// /// 职务 /// 性质 /// public ActionResult GetPersonByJob(string Nature, string job) { string json = PersonModule.GetPersonByJob(Nature, job); return Content(json, "application/json"); } /// /// 获取角色 /// /// public ActionResult GetRole() { var user = GetCurrentUser(); var dt = PersonModule.GetRole(user.PersonProperty); return Content(dt, "application/json"); } #endregion #region 人员修改 /// /// 修改人员的窗口 /// public ActionResult UpdateInfoWindow(string ID,int Type,string ChannelID,string RYID) { if(Type == 1) { var dt = PersonModule.GetChannelID(ID); ViewBag.channelID = dt.Rows[0]["渠道ID"]; ViewBag.id = ID; } else { ViewBag.RYID = RYID; ViewBag.channelID = ChannelID; ViewBag.id = ID; } return View(); } /// /// /批量修改 /// /// /// /// [HttpPost] public int Batch_Save(PersonBusinessModel model,string RYID) { return PersonModule.Batch_Save(model, RYID); } #endregion #region 人员删除 //单个删除 public int Delete_Person(string id) { int r = PersonModule.Delete_Person(id); return r; } //批量删除 public int Delete_Batch(string id) { return PersonModule.Delete_Batch(id); } #endregion #region 生成单个账户 //添加账户的弹窗 public ActionResult Account_Window(string id) { ViewBag.id = id; return View(); } //生成账号(单个) public int Add_Account(PersonBusinessModel model,string role) { return PersonModule.Add_Account(model, role); } //判断是否有账号 public int CheckAccount(string id) { return PersonModule.CheckAccount(id); } #endregion #region 修改账号 //修改账户的弹窗 public ActionResult Account_Window_Update(string id) { ViewBag.id = id; return View(); } //执行修改操作 public int Update_Account(PersonBusinessModel model,string role) { return PersonModule.Update_Account(model,role); } // 根据人员ID获取系统账户的信息 public ActionResult GetSysAccountInfo(string id) { var json = PersonModule.GetSysAccountInfo(id); return Content(json, "text/json"); } // 根据账户ID获取系统账户的角色信息 public ActionResult GetRoleInfo(string id) { var json = PersonModule.GetRoleInfo(id); return Content(json, "text/json"); } //激活/停用 public int ChangeActive(string id) { return PersonModule.ChangeActive(id); } #endregion #region 根据公司批量生成账户 //弹窗 public ActionResult Account_Window_Batch(string id) { ViewBag.id = id; return View(); } //生成账号(批量) public int Add_Account_Batch(string id) { return PersonModule.Add_Account_Batch(id); } #endregion } }