protected override void OnSaving() { if (string.IsNullOrEmpty(this.员工编号)) { throw new Exception("员工编号不能为空."); } if (this.年份 < 2015) { throw new Exception("年份不能为空"); } if (this.季度 < 1) { throw new Exception("季度不能为空"); } ManagementTraineePayStandardInput found = GetManagementTraineePayStandardInput(this.员工编号, this.年份, this.季度, this.是验证录入); if (found != null && found.标识 != this.标识) { throw new Exception("已经存在该员工的工资标准,不能重复创建"); } else { base.OnSaving(); } contentDifferentFields = null; MANAGEMENT_TRAINEE_PAYSTANDARD_INPUT_CACHE.Set(CacheKey, this, TimeSpan.FromHours(1)); }
//更新到正式表 public void UpdateToFormalTable() { if (this.内容不同的字段.Count > 0) { return; } ManagementTraineePayStandard m = ManagementTraineePayStandard.GetManagementTraineePayStandard(this.员工编号, this.年份, this.季度); if (m == null) { m = new ManagementTraineePayStandard(); m.标识 = Guid.NewGuid(); } this.CopyWatchMember(m); m.姓名 = 员工信息.姓名; m.提资序数 = this.提资序数; m.增幅 = this.增幅; m.月薪 = this.月薪; m.开始执行时间 = this.开始执行时间; m.备注 = this.备注; m.创建人 = this.录入人; m.创建时间 = DateTime.Now; m.Save(); //更新生效标记 if (!this.已生效) { this.生效时间 = DateTime.Now; this.Save(); ManagementTraineePayStandardInput opposite = 另一人录入的记录; opposite.生效时间 = DateTime.Now; opposite.Save(); } }
public static ManagementTraineePayStandardInput AddManagementTraineePayStandardInput(string emplid, int year, int quarter, int order, int time, bool isVerify, bool copyEffective) { ManagementTraineePayStandardInput item = GetManagementTraineePayStandardInput(emplid, year, quarter, isVerify); if (item == null) { item = new ManagementTraineePayStandardInput(); if (copyEffective) { //将当前的管培生信息带进来 ManagementTraineePayStandard effectiveManagementTraineePayStandard = ManagementTraineePayStandard.GetManagementTraineePayStandard(emplid, year, quarter); if (effectiveManagementTraineePayStandard != null) { item.CopyEffective = copyEffective; effectiveManagementTraineePayStandard.CopyWatchMember(item); } } DateTime 年度开始 = new DateTime(year, 1, 1); item.标识 = Guid.NewGuid(); item.员工编号 = emplid; item.年份 = year; item.季度 = quarter; item.开始执行时间 = 年度开始.AddMonths(3 * (quarter - 1)); item.序号 = order; item.提资序数 = time; item.是验证录入 = isVerify; item.录入人 = ""; item.录入时间 = DateTime.Now; item.Save(); } return(item); }
public static ManagementTraineePayStandardInput GetManagementTraineePayStandardInput(Guid id) { ManagementTraineePayStandardInput obj = (ManagementTraineePayStandardInput)Session.DefaultSession.GetObjectByKey(typeof(ManagementTraineePayStandardInput), id); return(obj); }