/// <summary> /// 修改签卡记录信息 /// </summary> /// <param name="entity"></param> /// <param name="entityList"></param> public void EmployeeSigninRecordUpdate(T_HR_EMPLOYEESIGNINRECORD entTemp, List <T_HR_EMPLOYEESIGNINDETAIL> entityList) { try { if (entTemp == null) { return; } EmployeeSignInDetailBLL bllDetail = new EmployeeSignInDetailBLL(); bllDetail.RemoveSignInDetailsBySignInId(entTemp.SIGNINID); bllDetail.AddEmployeeSignInDetails(entityList); if (entTemp.CHECKSTATE == Convert.ToInt32(CheckStates.UnSubmit).ToString()) { dal.UpdateFromContext(entTemp); dal.SaveContextChanges(); SaveMyRecord(entTemp); } else if (entTemp.CHECKSTATE == Convert.ToInt32(CheckStates.Approving).ToString())//待办任务提交审核时使用 { EmployeeSigninRecordAudit(entTemp.SIGNINID, entTemp.CHECKSTATE); } } catch (Exception ex) { throw ex; } }
/// <summary> /// 修改签卡记录信息 /// </summary> /// <param name="entity"></param> /// <param name="entityList"></param> public string EmployeeSigninRecordUpdate(T_HR_EMPLOYEESIGNINRECORD entTemp, List <T_HR_EMPLOYEESIGNINDETAIL> entityList) { try { if (entTemp == null) { return(string.Empty); } if (!string.IsNullOrEmpty(isHuNanHangXingSalary) && isHuNanHangXingSalary != "true") { foreach (var entDetail in entityList) { if (entDetail.REASONCATEGORY == "3") //因公外出 { #region //外出开始时间必须是最近两天(跳过周六周日) DateTime dtNow = DateTime.Now; DateTime dtsartCheck = entDetail.ABNORMALDATE.Value; int step = 0; while (step < 3) { dtsartCheck = dtsartCheck.AddDays(1); if (IsVacationDay(dtsartCheck, entDetail.OWNERCOMPANYID)) { continue; //假期 } else { step = step + 1; } } dtsartCheck = new DateTime(dtsartCheck.Year, dtsartCheck.Month, dtsartCheck.Day).AddDays(1).AddSeconds(-1); if (dtNow > dtsartCheck)//外出时间只能是今天或者明天23:59:59之前 { string msg = entDetail.ABNORMALDATE.Value.ToString("yyyy-MM-dd") + "签卡因公外出异常:超出三个工作日系统中将不能提交“因公外出”的签卡申请。"; return(msg); } #endregion } } } EmployeeSignInDetailBLL bllDetail = new EmployeeSignInDetailBLL(); bllDetail.RemoveSignInDetailsBySignInId(entTemp.SIGNINID); bllDetail.AddEmployeeSignInDetails(entityList); if (entTemp.CHECKSTATE == Convert.ToInt32(CheckStates.UnSubmit).ToString()) { if (entTemp.EntityKey == null) { T_HR_EMPLOYEESIGNINRECORD updateSign = GetEmployeeSigninRecordByID(entTemp.SIGNINID); Utility.CloneEntity(updateSign, entTemp); entTemp.UPDATEDATE = DateTime.Now; } dal.UpdateFromContext(entTemp); dal.SaveContextChanges(); SaveMyRecord(entTemp); } else if (entTemp.CHECKSTATE == Convert.ToInt32(CheckStates.Approving).ToString())//待办任务提交审核时使用 { EmployeeSigninRecordAudit(entTemp.SIGNINID, entTemp.CHECKSTATE); } } catch (Exception ex) { Tracer.Debug(ex.ToString()); throw ex; } return(string.Empty); }