public static MemberDept AddMemberDept(string emplid, string company, string dept) { MemberDept item = GetMemberDept(emplid, company, dept); //删除原来的记录 if (item != null) { item.Delete(); } item = new MemberDept(); item.标识 = Guid.NewGuid(); item.员工编号 = emplid; item.可查公司名称 = company; item.可查部门编号 = dept; EmployeeInfo emp = EmployeeInfo.GetEmployeeInfo(emplid); if (emp != null) { item.所属公司编号 = emp.公司; item.所属部门编号 = emp.部门; item.职务等级代码 = emp.职务等级; } item.Save(); return(item); }
public static MemberDeptInput AddMemberDeptInput(string emplid, string company, string dept, bool isVerify, bool copyEffective) { MemberDeptInput item = GetMemberDeptInput(emplid, company, dept, isVerify); if (item == null) { item = new MemberDeptInput(); if (copyEffective) { //将当前执行的标准带过来 MemberDept effectiveMemberDept = MemberDept.GetMemberDept(emplid, company, dept); if (effectiveMemberDept != null) { item.CopyEffective = copyEffective; effectiveMemberDept.CopyWatchMember(item); } } item.标识 = Guid.NewGuid(); item.员工编号 = emplid; item.可查公司名称 = company; item.可查部门编号 = dept; item.是验证录入 = isVerify; item.录入人 = " "; item.录入时间 = DateTime.Now; item.Save(); } return(item); }
protected override void OnDeleting() { if (this.用户类型 == "系统管理员") { throw new Exception("不能删除系统管理员账号"); } //清空该员工的权限 MemberDept.ClearMemberDept(this.员工编号); MemberGrade.ClearMemberGrade(this.员工编号); base.OnDeleting(); }
protected override void OnSaving() { MemberDept found = GetMemberDept(this.员工编号, this.可查公司名称, this.可查部门编号); if (found != null && found.标识 != this.标识) { throw new Exception("已存在该员工的相同权限记录,不能重复创建。"); } else { base.OnSaving(); } MEMBER_DEPT_CACHE.Set(CacheKey, this, TimeSpan.FromHours(1)); }
//更新到正式表 public void UpdateToFormalTable() { if (另一人录入的记录 == null || this.内容不同的字段.Count > 0) { return; } MemberDept m = MemberDept.AddMemberDept(this.员工编号, this.可查公司名称, this.可查部门编号); //更新生效标记 if (!this.已生效) { this.生效时间 = DateTime.Now; this.Save(); MemberDeptInput opposite = 另一人录入的记录; opposite.生效时间 = DateTime.Now; opposite.Save(); } }
public static List <QueryPermission> GetAll() { List <QueryPermission> list = new List <QueryPermission>(); List <MemberDept> memDepts = MemberDept.GetMemberDepts(null, null); List <MemberGrade> memGrades = MemberGrade.GetAll(); List <Member> memberList = Member.GetAll(); //找出员工清单 var emps = from u in memDepts group u by u.员工信息 into emp select emp.Key; foreach (Member member in memberList) { EmployeeInfo employee = EmployeeInfo.GetEmployeeInfo(member.员工编号); if (employee == null) { continue; } QueryPermission qp = new QueryPermission(); List <MemberDept> list_dept = memDepts.FindAll(a => a.员工编号 == employee.员工编号); List <MemberGrade> list_grade = memGrades.FindAll(a => a.员工编号 == employee.员工编号); qp.会员 = member; qp.员工编号 = employee.员工编号; qp.姓名 = employee.姓名; qp.公司 = employee.公司名称; qp.部门 = employee.部门名称; qp.职务 = employee.职务名称; qp.职等 = employee.职等; qp.部门权限集 = list_dept; qp.职等权限集 = list_grade; qp.用户类型 = member.用户类型; list.Add(qp); } return(list); }
public QueryPermission(Member member, string company) { EmployeeInfo employee = EmployeeInfo.GetEmployeeInfo(member.员工编号); if (employee == null) { return; } List <MemberDept> list_dept = MemberDept.GetMemberDepts(employee.员工编号, company); List <MemberGrade> list_grade = MemberGrade.GetMemberGrades(employee.员工编号, company); 会员 = member; 员工编号 = employee.员工编号; 姓名 = employee.姓名; 公司 = employee.公司名称; 部门 = employee.部门名称; 职务 = employee.职务名称; 职等 = employee.职等; 部门权限集 = list_dept; 职等权限集 = list_grade; 用户类型 = member.用户类型; }
public static MemberDept GetMemberDept(Guid id) { MemberDept obj = (MemberDept)Session.DefaultSession.GetObjectByKey(typeof(MemberDept), id); return(obj); }