protected void InitDepartName() { Department deptInfo = new Pkurg.PWorld.Services.DepartmentService().GetByDepartCode(_BPMContext.CurrentUser.MainDeptId); BFPmsUserRoleDepartment bfurd = new BFPmsUserRoleDepartment(); Pkurg.PWorld.Entities.TList <Department> deptInfo2 = bfurd.GetDeptListByEmployeeCodeAndRoleName(_BPMContext.CurrentPWordUser.EmployeeCode, "部门成员"); ddlDepartName.Items.Add(new ListItem() { Text = deptInfo.Remark, Value = deptInfo.DepartCode }); foreach (Department deptItem in deptInfo2) { if (deptInfo.DepartCode != deptItem.DepartCode) { ListItem item = new ListItem() { Text = deptItem.Remark, Value = deptItem.DepartCode }; ddlDepartName.Items.Add(item); } } }
/// <summary> /// 初始化发起部门 /// </summary> private void InitStartDeptment() { if (!IsPostBack) { Department deptInfo = new Pkurg.PWorld.Services.DepartmentService().GetByDepartCode(_BPMContext.CurrentUser.MainDeptId); BFPmsUserRoleDepartment bfurd = new BFPmsUserRoleDepartment(); Pkurg.PWorld.Entities.TList <Department> deptInfo2 = bfurd.GetDeptListByEmployeeCodeAndRoleName(_BPMContext.CurrentPWordUser.EmployeeCode, "部门成员"); ddlDepartName.Items.Add(new ListItem() { Text = deptInfo.Remark, Value = deptInfo.DepartCode }); //初始化发起人所属“部门成员”的部门 //首先初始化发起人所在部门,然后在加上发起人所属“部门成员”的部门,需要去重 //解决了一个系统的bug[有个人,他的所在部门A“部门成员”为空,他是部门B的“部门成员“,部门A没有会签部门,部门B有, //初始化会签部门时,默认初始化他的所在部门A,发起部门初始化成部门B,这样导致他发流程没有会签部门可以勾选] foreach (Department DeptItem in deptInfo2) { if (deptInfo.DepartCode != DeptItem.DepartCode) { ListItem item = new ListItem() { Text = DeptItem.Remark, Value = DeptItem.DepartCode }; ddlDepartName.Items.Add(item); } } } }
/// <summary> /// 初始化经办部门 /// </summary> private void InitStartDeptment() { if (!IsPostBack) { Department deptInfo = new Pkurg.PWorld.Services.DepartmentService().GetByDepartCode(_BPMContext.CurrentUser.MainDeptId); BFPmsUserRoleDepartment bfurd = new BFPmsUserRoleDepartment(); Pkurg.PWorld.Entities.TList <Department> deptInfo2 = bfurd.GetDeptListByEmployeeCodeAndRoleName(_BPMContext.CurrentPWordUser.EmployeeCode, "部门成员"); //初始化发起人所属“部门成员”的部门,若为空则初始化发起人所在部门 foreach (Department DeptItem in deptInfo2) { ddlDepartName.Items.Add(new ListItem() { Text = DeptItem.Remark, Value = DeptItem.DepartCode }); } if (deptInfo2.Count == 0) { ddlDepartName.Items.Add(new ListItem() { Text = deptInfo.Remark, Value = deptInfo.DepartCode }); } } }
/// <summary> /// 获取发起部门数据源 /// 部门名称:Remark /// Code:DepartCode /// </summary> /// <returns></returns> protected List <Department> GetStartDeptmentDataSource() { List <Department> deptments = new List <Department>(); Department deptInfo = new Pkurg.PWorld.Services.DepartmentService().GetByDepartCode(_BPMContext.CurrentUser.MainDeptId); BFPmsUserRoleDepartment bfurd = new BFPmsUserRoleDepartment(); Pkurg.PWorld.Entities.TList <Department> deptInfo2 = bfurd.GetDeptListByEmployeeCodeAndRoleName(_BPMContext.CurrentPWordUser.EmployeeCode, "部门成员"); deptments.AddRange(deptInfo2); if (deptInfo2.Exists(x => x.DepartCode == deptInfo.DepartCode)) { deptInfo2.Remove(deptInfo); } deptments.Insert(0, deptInfo); return(deptments); }