public static EffectivePerformanceSalaryInput AddEffectivePerformanceSalaryInput(string number, string empNo, bool isVerify) { EffectivePerformanceSalaryInput item = Get(number, isVerify); if (item == null) { item = new EffectivePerformanceSalaryInput(); item.标识 = Guid.NewGuid(); item.编号 = number; item.员工编号 = empNo; item.是验证录入 = isVerify; item.双人录入结果 = ""; item.录入人 = ""; item.录入时间 = DateTime.Now; EffectivePerformanceSalaryInput otherItem = Get(number, !isVerify); if (otherItem != null) { item.姓名 = otherItem.姓名; item.年 = otherItem.年; item.月 = otherItem.月; } item.Save(); } return(item); }
protected override void OnDeleted() { EffectivePerformanceSalaryInputGroup inputGroup = GetEffectivePerformanceSalaryInputGroup(this.编号); EffectivePerformanceSalaryInput anotherInput = this.是验证录入 ? inputGroup.A : inputGroup.B; //删除对向记录 if (anotherInput != null) { anotherInput.Delete(); } base.OnDeleted(); }
protected override void OnSaving() { if (string.IsNullOrEmpty(this.员工编号)) { throw new Exception("员工编号不能为空。"); } if (PsHelper.GetEmplName(this.员工编号) == "") { throw new Exception("找不到指定员工编号的员工。"); } if (string.IsNullOrEmpty(编号)) { if (this.标识 == Guid.Empty) { this.标识 = Guid.NewGuid(); } this.编号 = GetNewNumber(); //如果是新编号,更新编号信息的当前序号 this.NumberInfo.UpdateCurrentSN(); EffectivePerformanceSalaryInput found = Get(this.编号, this.是验证录入); if (found != null && found.标识 != this.标识) { throw new Exception(String.Format("同一编号【{0}】不能重复创建,请稍后重试。", this.编号)); } found = GetEditing(this.员工编号, this.年, this.月, this.是验证录入); if (found != null && found.标识 != this.标识) { throw new Exception(String.Format("该员工【{0}】已经有一条执行的绩效工资记录正在录入,不能重复。", this.员工编号)); } } if (this.双人录入结果 == null) { this.双人录入结果 = ""; } base.OnSaving(); }
/// <param name="id"></param> /// <returns></returns> public static EffectivePerformanceSalaryInput Get(Guid id) { EffectivePerformanceSalaryInput obj = (EffectivePerformanceSalaryInput)MyHelper.XpoSession.GetObjectByKey(typeof(EffectivePerformanceSalaryInput), id); return(obj); }