123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316 |
- 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
- { /// <summary>
- /// 创建人:王璐
- /// 创建日期:2018/12/30
- /// 模块功能:机构人员
- /// </summary>
- public class PersonManagerController : BaseController
- {
- /// <summary>
- /// 实例接口
- /// </summary>
- IPersonModule PersonModule = InterfaceFactory.CreateBusinessInstance<IPersonModule>();
- [HttpGet]
- public ActionResult Index()
- {
- return View();
- }
- #region 信息显示以及查询
- /// <summary>
- /// 获取权限渠道
- /// </summary>
- public ActionResult ChannelInfo()
- {
- string json = PersonModule.GetAll_Channel(GetAuthDats().Channel);
- return Content(json, "application/json");
- }
- /// <summary>
- /// 渠道下的人员
- /// </summary>
- /// <param name="UserID"></param>
- /// <returns></returns>
- 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");
- }
- /// <summary>
- /// 根据人员ID获取对应的人员信息
- /// </summary>
- /// <returns></returns>
- public ActionResult GetInfoByID(string id)
- {
- var json = PersonModule.GetInfoByID(id);
- return Content(json, "text/json");
- }
- #endregion
- #region 人员添加
- /// <summary>
- /// 增加人员的窗口
- /// </summary>
- public ActionResult PersonInfoWindow(string channelId)
- {
- ViewBag.id = channelId;
- return View();
- }
- /// <summary>
- /// 保存人员信息
- /// </summary>
- 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;
- }
- /// <summary>
- /// 创建人员时勾选自动生成账户
- /// </summary>
- /// <param name="model"></param>
- /// <returns></returns>
- public int AutoAccount(PersonBusinessModel model)
- {
- return PersonModule.AutoAccount(model);
- }
- /// <summary>
- /// 获取性别
- /// </summary>
- /// <returns></returns>
- public ActionResult GetSex()
- {
- var dt = PersonModule.GetSex();
- return Content(dt, "application/json");
- }
- /// <summary>
- /// 获取人员性质
- /// </summary>
- /// <returns></returns>
- public ActionResult GetXZ()
- {
- var user = GetCurrentUser();
- var dt = PersonModule.GetXZ(user.PersonProperty);
- return Content(dt, "application/json");
- }
- /// <summary>
- /// 获取职务
- /// </summary>
- /// <returns></returns>
- public ActionResult GetJob()
- {
- var user = GetCurrentUser();
- var dt = PersonModule.GetJob(user);
- return Content(dt, "application/json");
- }
- /// <summary>
- /// 根据渠道ID获取项目
- /// </summary>
- /// <returns></returns>
- public ActionResult GetProject(string id)
- {
- var dt = PersonModule.GetProject(id, "", GetAuthDats().Project);
- return Content(dt, "application/json");
- }
- /// <summary>
- /// 根据项目ID获取机构
- /// </summary>
- /// <returns></returns>
- 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");
- }
- /// <summary>
- /// 通过性质,职务提取人员信息(combobox)
- /// </summary>
- /// <param name="job">职务</param>
- /// <param name="Nature">性质</param>
- /// <returns></returns>
- public ActionResult GetPersonByJob(string Nature, string job)
- {
- string json = PersonModule.GetPersonByJob(Nature, job);
- return Content(json, "application/json");
- }
- /// <summary>
- /// 获取角色
- /// </summary>
- /// <returns></returns>
- public ActionResult GetRole()
- {
- var user = GetCurrentUser();
- var dt = PersonModule.GetRole(user.PersonProperty);
- return Content(dt, "application/json");
- }
- #endregion
- #region 人员修改
- /// <summary>
- /// 修改人员的窗口
- /// </summary>
- 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();
- }
- /// <summary>
- /// /批量修改
- /// </summary>
- /// <param name="model"></param>
- /// <param name="RYID"></param>
- /// <returns></returns>
- [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
- }
- }
|