/// <summary> /// /// </summary> /// <param name="entTemp"></param> /// <param name="entAttendanceSolutionDeducts"></param> /// <param name="entAttendFreeLeaves"></param> /// <returns></returns> public string AddAndCreateRelation(T_HR_ATTENDANCESOLUTION entTemp, List <T_HR_ATTENDANCESOLUTIONDEDUCT> entAttendanceSolutionDeducts, List <T_HR_ATTENDFREELEAVE> entAttendFreeLeaves) { string strMsg = string.Empty; try { strMsg = AddAttSol(entTemp); if (strMsg != "{SAVESUCCESSED}") { if (string.IsNullOrEmpty(strMsg)) { strMsg = "{ADDERROR}"; } return(strMsg); } foreach (T_HR_ATTENDANCESOLUTIONDEDUCT item in entAttendanceSolutionDeducts) { AttendanceSolutionDeductBLL bllAttendanceSolutionDeduct = new AttendanceSolutionDeductBLL(); bllAttendanceSolutionDeduct.AddAttSolDeduct(item); } foreach (T_HR_ATTENDFREELEAVE item in entAttendFreeLeaves) { AttendFreeLeaveBLL bllAttendFreeLeave = new AttendFreeLeaveBLL(); bllAttendFreeLeave.AddAttendFreeLeave(item); } strMsg = "{SAVESUCCESSED}"; } catch (Exception ex) { strMsg = ex.Message.ToString(); } return(strMsg); }
/// <summary> /// 修改考勤方案信息,并更改其关联设置的关系 /// </summary> /// <param name="entTemp"></param> /// <param name="entAttendanceSolutionDeducts"></param> /// <param name="entAttendFreeLeaves"></param> /// <returns></returns> public string ModifyAndChangeRelation(T_HR_ATTENDANCESOLUTION entTemp, List <T_HR_ATTENDANCESOLUTIONDEDUCT> entAttendanceSolutionDeducts, List <T_HR_ATTENDFREELEAVE> entAttendFreeLeaves) { string strMsg = string.Empty; try { strMsg = ModifyAttSol(entTemp); if (strMsg != "{SAVESUCCESSED}") { return("{EDITERROR}"); } AttendanceSolutionDeductBLL bllAttendanceSolutionDeduct = new AttendanceSolutionDeductBLL(); bllAttendanceSolutionDeduct.DeleteAttSolDeductByAttSolID(entTemp.ATTENDANCESOLUTIONID); foreach (T_HR_ATTENDANCESOLUTIONDEDUCT itemDeduct in entAttendanceSolutionDeducts) { if (itemDeduct.EntityKey != null) { itemDeduct.EntityKey = null; //清除EntityKey不为null的情况 } if (itemDeduct.T_HR_ATTENDANCESOLUTION == null) { itemDeduct.T_HR_ATTENDANCESOLUTION = entTemp; } strMsg = bllAttendanceSolutionDeduct.AddAttSolDeduct(itemDeduct); } AttendFreeLeaveBLL bllAttendFreeLeave = new AttendFreeLeaveBLL(); bllAttendFreeLeave.ModifyAttendFreeLeaveByAttSolID(entTemp.ATTENDANCESOLUTIONID); foreach (T_HR_ATTENDFREELEAVE itemFL in entAttendFreeLeaves) { if (itemFL.EntityKey != null) { itemFL.EntityKey = null; //清除EntityKey不为null的情况 } if (itemFL.T_HR_ATTENDANCESOLUTION == null) { itemFL.T_HR_ATTENDANCESOLUTION = entTemp; } strMsg = bllAttendFreeLeave.AddAttendFreeLeave(itemFL); } strMsg = "{SAVESUCCESSED}"; } catch (Exception ex) { strMsg = ex.Message.ToString(); if (ex.InnerException == null) { Utility.SaveLog(strMsg); } else { Utility.SaveLog(ex.InnerException.Message); } } return(strMsg); }