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

            ContractAllowance m = ContractAllowance.AddContractAllowance(this.员工编号, this.开始时间);

            this.CopyWatchMember(m);

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

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

                ContractAllowanceEntry opposite = 另一人录入的记录;
                opposite.生效时间 = DateTime.Now;
                opposite.Save();
            }
        }
        protected override void OnSaving()
        {
            ContractAllowance found = GetContractAllowance(this.员工编号, this.开始时间);
            if (found != null && found.标识 != this.标识)
                throw new Exception("已存在该员工相同的契约津贴记录,不能重复创建。");
            else
                base.OnSaving();

            CONTRACT_ALLOWANCE_CACHE.Set(CacheKey, this, TimeSpan.FromHours(1));
        }
 public static ContractAllowance AddContractAllowance(string emplid, DateTime effDate)
 {
     ContractAllowance item = GetContractAllowance(emplid, effDate);
     if (item == null)
     {
         item = new ContractAllowance();
         item.标识 = Guid.NewGuid();
         item.员工编号 = emplid;
         item.开始时间 = effDate;
         item.创建人 = AccessController.CurrentUser.姓名;
         item.创建时间 = DateTime.Now;
         item.Save();
     }
     return item;
 }
 public static ContractAllowance GetContractAllowance(Guid id)
 {
     ContractAllowance obj = (ContractAllowance)Session.DefaultSession.GetObjectByKey(typeof(ContractAllowance), id);
     return obj;
 }