protected override void OnSaving()
        {
            if (string.IsNullOrEmpty(this.员工编号))
            {
                throw new Exception("员工编号不能为空");
            }
            if (string.IsNullOrEmpty(this.可查公司名称))
            {
                throw new Exception("可查公司名称不能为空");
            }
            if (string.IsNullOrEmpty(this.可查部门编号))
            {
                throw new Exception("可查部门编号不能为空");
            }

            MemberDeptInput found = GetMemberDeptInput(this.员工编号, this.可查公司名称, this.可查部门编号, this.是验证录入);

            if (found != null && found.标识 != this.标识)
            {
                throw new Exception("已存在这个权限,不能重复创建。");
            }
            else
            {
                base.OnSaving();
            }

            contentDifferentFields = null;
            MEMBER_DEPT_INPUT_CACHE.Set(CacheKey, this, TimeSpan.FromHours(1));
        }
        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);
        }
        //更新到正式表
        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 MemberDeptInput GetMemberDeptInput(Guid id)
        {
            MemberDeptInput obj = (MemberDeptInput)Session.DefaultSession.GetObjectByKey(typeof(MemberDeptInput), id);

            return(obj);
        }