//更新到正式表
        public void UpdateToFormalTable()
        {
            if (另一人录入的记录 == null || this.内容不同的字段.Count > 0)
            {
                return;
            }

            SalaryStructure m = SalaryStructure.AddSalaryStructure(this.员工编号, this.开始执行日期);

            this.CopyWatchMember(m);

            m.创建人  = this.录入人;
            m.创建时间 = DateTime.Now;
            m.Save();

            //更新生效标记
            if (!this.已生效)
            {
                this.生效时间 = DateTime.Now;
                this.Save();

                SalaryStructureEntry opposite = 另一人录入的记录;
                opposite.生效时间 = DateTime.Now;
                opposite.Save();
            }
        }
        public static SalaryStructureEntry AddSalaryStructureEntry(string emplid, DateTime effDate, bool isVerify)
        {
            SalaryStructureEntry item = GetSalaryStructureEntry(emplid, effDate, isVerify);

            if (item == null)
            {
                item = new SalaryStructureEntry();

                item.标识     = Guid.NewGuid();
                item.员工编号   = emplid;
                item.开始执行日期 = effDate;
                item.是验证录入  = isVerify;
                item.录入时间   = DateTime.Now;

                item.Save();
            }
            return(item);
        }
        protected override void OnSaved()
        {
            base.OnSaved();
            if (录入人 == null)
            {
                //如果对向没有记录,自动创建
                SalaryStructureEntry opposite = GetEditingRow(this.员工编号, !this.是验证录入);
                if (opposite == null)
                {
                    opposite = new SalaryStructureEntry();

                    opposite.标识    = Guid.NewGuid();
                    opposite.员工编号  = this.员工编号;
                    opposite.是验证录入 = !this.是验证录入;

                    opposite.录入人  = "";
                    opposite.录入时间 = DateTime.Now;
                    opposite.Save();
                }
            }
        }
        protected override void OnSaving()
        {
            if (string.IsNullOrEmpty(this.员工编号))
            {
                throw new Exception("员工编号不能为空");
            }

            SalaryStructureEntry found = GetEditingRow(this.员工编号, this.是验证录入);

            if (found != null && found.标识 != this.标识)
            {
                throw new Exception("该员工的薪资结构正在录入,不能重复创建。");
            }
            else
            {
                base.OnSaving();
            }

            contentDifferentFields = null;
            SALARY_STRUCTURE_ENTRY_CACHE.Set(CacheKey, this, TimeSpan.FromHours(1));
        }
        public static SalaryStructureEntry GetSalaryStructureEntry(Guid id)
        {
            SalaryStructureEntry obj = (SalaryStructureEntry)Session.DefaultSession.GetObjectByKey(typeof(SalaryStructureEntry), id);

            return(obj);
        }