protected override void OnSaving() { if (string.IsNullOrEmpty(this.员工编号)) { this.员工编号 = ""; return; } if (string.IsNullOrEmpty(this.类型)) { throw new Exception("类型不能为空."); } if (this.录入时间 == DateTime.MinValue) { this.录入时间 = DateTime.Now; } //判断已经审核的薪资组不能修改 SalaryResult salResult = SalaryResult.GetFromCache(this.员工编号, this.年, this.月); if (salResult == null) { throw new Exception("未发现【" + this.姓名 + "】的工资记录,请先生成工资表后再录入。"); } else { SalaryAuditingResult auditingResult = SalaryAuditingResult.GetSalaryAuditingResult(salResult.薪资组, this.年, this.月); if (auditingResult == null) { throw new Exception("未发现【" + salResult.薪资组名称 + "】的工资审核情况表"); } else { if (auditingResult.已审核) { throw new Exception("薪资组【" + salResult.薪资组名称 + "】的工资已经审核,不能添加或修改。"); } } } OtherMoney found = GetOtherMoney(this.员工编号, this.年, this.月, this.类型, this.项目名称); if (found != null && found.标识 != this.标识) { throw new Exception("同一个奖扣项不能重复录入."); } else { base.OnSaving(); } }
protected override void OnSaving() { if (string.IsNullOrEmpty(this.姓名)) { throw new Exception("姓名不能为空."); } if (this.录入时间 == DateTime.MinValue) { this.录入时间 = DateTime.Now; } //判断已经审核的薪资组不能修改 SalaryResult salResult = SalaryResult.GetFromCache(this.员工编号, this.年, this.月); if (salResult == null) { throw new Exception("未发现" + this.姓名 + "的工资记录."); } else { SalaryAuditingResult auditingResult = SalaryAuditingResult.GetSalaryAuditingResult(salResult.薪资组, this.年, this.月); if (auditingResult == null) { throw new Exception("未发现" + this.姓名 + "的工资审核情况表"); } else { if (auditingResult.已审核) { throw new Exception(this.姓名 + "的工资已经审核,不能添加或修改。"); } } } EmpPayRate found = GetEmpPayRate(this.员工编号, this.年, this.月); if (found != null && found.标识 != this.标识) { throw new Exception("每个员工每月只有一个工资系数."); } else { base.OnSaving(); } }