123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352 |
- using PMS.Interface.PresonManager;
- using System;
- using System.Collections.Generic;
- using System.Linq;
- using System.Text;
- using PMS.EntityModels.PersonManager;
- using PMS.DBService.PersonManager;
- using QWPlatform.IService;
- using QWPlatform.SystemLibrary;
- using PMS.BusinessModels.SysManager;
- using System.Data;
- using PMS.BusinessModels.Person;
- using PMS.BusinessModels.Account;
- namespace PMS.BusinessService.PersonManager
- {
- public class PersonBuiness : IPersonModule
- {
- //提供ProService的数据服务
- private PersonService DB_PersonService = DataServiceBase.Instance<PersonService>();
- /// <summary>
- /// 获取全部渠道
- /// </summary>
- /// <param name="model"></param>
- /// <returns></returns>
- public string GetAll_Channel(string channelID)
- {
- var dt = DB_PersonService.GetAll_Channel(channelID);
- return dt.ToJson();
- }
- /// <summary>
- /// 根据渠道ID获取人员信息
- /// </summary>
- /// <param name="id"></param>
- /// <param name="page"></param>
- /// <param name="rows"></param>
- /// <returns></returns>
- public string GetAll_PersonInfo(string id, int page, int rows, string query, string nature, string project)
- {
- int defaultrow = 15;
- int startnumber = Startnumber(page, rows, defaultrow);
- int endnumber = Endnumbers(page, rows, defaultrow);
- var dt = DB_PersonService.GetAll_PersonInfo(id, startnumber, endnumber, query, nature, project);
- return dt;
- }
- /// <summary>
- /// 获取性别
- /// </summary>
- /// <returns></returns>
- public string GetSex()
- {
- return DB_PersonService.GetSex().ToJson();
- }
- /// <summary>
- /// 获取职务
- /// </summary>
- /// <returns></returns>
- public string GetJob(UserInfo user)
- {
- return DB_PersonService.GetJob(user).ToJson();
- }
- /// <summary>
- /// 获取项目
- /// </summary>
- /// <returns></returns>
- public string GetProject(string ChannelID, string query, string project)
- {
- return DB_PersonService.GetProject(ChannelID, query, project).ToJson();
- }
- /// <summary>
- /// 获取项目机构树
- /// </summary>
- /// <param name="ChannelID"></param>
- /// <param name="project"></param>
- /// <returns></returns>
- public string GetProjectTree(string project)
- {
- var dt = DB_PersonService.GetProjectTree(project);
- return dt.ToEasyUITreeJson("ID", "名称", "上级ID", null, "");
- }
- public string GetProjectTreeByCode(string project, string Code)
- {
- var dt = DB_PersonService.GetProjectTreeByCode(project, Code);
- return dt.ToEasyUITreeJson("ID", "名称", "上级ID", null, "");
- }
- /// <summary>
- /// 获取项目Combobox
- /// </summary>
- /// <returns></returns>
- public string GetProjectCobo(string ChannelID, string project)
- {
- return DB_PersonService.GetProjectCobo(ChannelID, project).ToJson();
- }
- public string GetAllProject(string project)
- {
- return DB_PersonService.GetAllProject(project).ToJson();
- }
- /// <summary>
- /// 获取角色
- /// </summary>
- /// <returns></returns>
- public string GetRole(int personproperty)
- {
- return DB_PersonService.GetRole(personproperty).ToJson();
- }
- /// <summary>
- /// 获取机构
- /// </summary>
- /// <returns></returns>
- public string GetStation(string ProjectID)
- {
- return DB_PersonService.GetStation(ProjectID).ToJson();
- }
- /// <summary>
- /// 获取人员性质
- /// </summary>
- /// <returns></returns>
- public string GetXZ(int PersonProperty)
- {
- return DB_PersonService.GetXZ(PersonProperty).ToJson();
- }
- private int Endnumbers(int page, int row, int defaultrow)
- {
- if (page == 0 && row == 0)
- {
- row = defaultrow;
- page = 1;
- }
- return (page) * row;
- }
- private int Startnumber(int page, int row, int defaultrow)
- {
- if (page == 0 && row == 0)
- {
- row = defaultrow;
- page = 1;
- }
- return (page - 1) * row + 1;
- }
- public string GetPerson(List<account_authdata_model> model)
- {
- string Channel = "";
- //string Item = "";
- if (model.Count > 0)
- {
- //便利渠道
- foreach (account_authdata_model m in model)
- {
- if (!String.IsNullOrEmpty(m.orgid))
- {
- Channel += m.orgid + ",";
- }
- ////便利项目
- //if (m.items.Count > 0)
- //{
- // foreach(string s in m.items)
- // {
- // if (!String.IsNullOrEmpty(s))
- // {
- // Item += s + ",";
- // }
- // }
- //}
- }
- }
- var dt = DB_PersonService.GetPersonByChannel(Channel);
- return dt.ToJson();
- }
- public string GetPersonByChannel(string id)
- {
- var dt = DB_PersonService.GetPersonByChannel(id);
- return dt.ToJson();
- }
- /// <summary>
- /// 添加人员
- /// </summary>
- /// <param name="model"></param>
- /// <returns></returns>
- public int SaveAddPerson(PersonBusinessModel model)
- {
- return DB_PersonService.SaveAddPerson(model);
- }
- /// <summary>
- /// 修改人员
- /// </summary>
- /// <param name="model"></param>
- /// <returns></returns>
- public int SaveUpdatePerson(PersonBusinessModel model)
- {
- return DB_PersonService.SaveUpdatePerson(model);
- }
- public string GetPersonByJob(string Nature, string job)
- {
- var dt = DB_PersonService.GetPersonByJob(Nature, job);
- return dt.ToJson();
- }
- /// <summary>
- /// 根据人员ID获取人员信息
- /// </summary>
- /// <param name="id"></param>
- /// <returns></returns>
- public string GetInfoByID(string id)
- {
- return DB_PersonService.GetInfoByID(id).ToJson();
- }
- /// <summary>
- /// 根据人员ID获取系统账户的信息
- /// </summary>
- /// <returns></returns>
- public string GetSysAccountInfo(string id)
- {
- return DB_PersonService.GetSysAccountInfo(id).ToJson();
- }
- /// <summary>
- /// 根据账户ID获取系统账户的角色信息
- /// </summary>
- /// <returns></returns>
- public string GetRoleInfo(string id)
- {
- return DB_PersonService.GetRoleInfo(id).ToJson();
- }
- /// <summary>
- /// 删除人员
- /// </summary>
- /// <param name="id"></param>
- /// <returns></returns>
- public int Delete_Person(string id)
- {
- return DB_PersonService.Delete_Person(id);
- }
- /// <summary>
- /// 生成单个账号
- /// </summary>
- /// <param name="id"></param>
- /// <returns></returns>
- public int Add_Account(PersonBusinessModel model, string role)
- {
- return DB_PersonService.Add_Account(model,role);
- }
- /// <summary>
- /// 执行修改操作
- /// </summary>
- /// <param name="model"></param>
- /// <returns></returns>
- public int Update_Account(PersonBusinessModel model, string role)
- {
- return DB_PersonService.Update_Account(model,role);
- }
- public string GetCurrentProject(string id)
- {
- return DB_PersonService.GetCurrentProject(id).ToJson();
- }
- public DataTable GetCurrentProjectInfo(string id)
- {
- return DB_PersonService.GetCurrentProject(id);
- }
- public DataTable GetChannelID(string id)
- {
- return DB_PersonService.GetChannelID(id);
- }
- /// <summary>
- /// 传人员ID字符串进行批量创建账户
- /// </summary>
- /// <param name="id"></param>
- /// <returns></returns>
- public int Add_Account_Batch(string id)
- {
- return DB_PersonService.Add_Account_Batch(id);
- }
- //批量删除
- public int Delete_Batch(string id)
- {
- return DB_PersonService.Delete_Batch(id);
- }
- //判断是否有账号
- public int CheckAccount(string id)
- {
- return DB_PersonService.CheckAccount(id);
- }
- /// <summary>
- /// 给账户添加数据权限
- /// </summary>
- /// <param name="AccountId"></param>
- /// <param name="PersonId"></param>
- /// <returns></returns>
- public bool addAccountAuthod(int AccountId, string PersonId)
- {
- return DB_PersonService.addAccountAuthod(AccountId, PersonId);
- }
- /// <summary>
- /// 创建人员时勾选自动生成账户
- /// </summary>
- /// <param name="model"></param>
- /// <returns></returns>
- public int AutoAccount(PersonBusinessModel model)
- {
- return DB_PersonService.AutoAccount(model);
- }
- /// <summary>
- /// 批量修改
- /// </summary>
- /// <param name="model"></param>
- /// <param name="RYID"></param>
- /// <returns></returns>
- public int Batch_Save(PersonBusinessModel model,string RYID)
- {
- int count = 0;
- string[] Data = RYID.Split(',');
- foreach(var item in Data)
- {
- count= DB_PersonService.Batch_Save(model, item)>0?(++count):count;
- }
- return count;
- }
- public int ChangeActive(string id)
- {
- return DB_PersonService.ChangeActive(id);
- }
- }
- }
|