/// <summary> /// 修改请假类型设置信息 /// </summary> /// <param name="entTemp"></param> /// <returns></returns> public string ModifyLeaveTypeSet(T_HR_LEAVETYPESET entTemp) { string strMsg = string.Empty; try { if (entTemp == null) { return("{REQUIREDFIELDS}"); } bool flag = false; StringBuilder strFilter = new StringBuilder(); List <string> objArgs = new List <string>(); strFilter.Append(" LEAVETYPESETID == @0"); objArgs.Add(entTemp.LEAVETYPESETID); LeaveTypeSetDAL dalLeaveTypeSet = new LeaveTypeSetDAL(); flag = dalLeaveTypeSet.IsExistsRd(strFilter.ToString(), objArgs.ToArray()); if (!flag) { return("{NOTFOUND}"); } T_HR_LEAVETYPESET entUpdate = dalLeaveTypeSet.GetLeaveTypeSetRdByMultSearch(strFilter.ToString(), objArgs.ToArray()); Utility.CloneEntity(entTemp, entUpdate); dalLeaveTypeSet.Update(entUpdate); strMsg = "{SAVESUCCESSED}"; } catch (Exception ex) { strMsg = ex.Message.ToString(); } return(strMsg); }
/// <summary> /// 修改请假类型设置信息 /// </summary> /// <param name="entTemp"></param> /// <returns></returns> public string ModifyLeaveTypeSet(T_HR_LEAVETYPESET entTemp) { string strMsg = string.Empty; try { if (entTemp == null) { return("{REQUIREDFIELDS}"); } bool flag = false; StringBuilder strFilter = new StringBuilder(); List <string> objArgs = new List <string>(); strFilter.Append(" LEAVETYPESETID == @0"); objArgs.Add(entTemp.LEAVETYPESETID); LeaveTypeSetDAL dalLeaveTypeSet = new LeaveTypeSetDAL(); flag = dalLeaveTypeSet.IsExistsRd(strFilter.ToString(), objArgs.ToArray()); if (!flag) { return("{NOTFOUND}"); } T_HR_LEAVETYPESET entUpdate = dalLeaveTypeSet.GetLeaveTypeSetRdByMultSearch(strFilter.ToString(), objArgs.ToArray()); Utility.CloneEntity(entTemp, entUpdate); if (entTemp.LEAVETYPEVALUE != (Convert.ToInt32(Common.LeaveTypeValue.AdjustLeave) + 1).ToString() && entTemp.LEAVETYPEVALUE != (Convert.ToInt32(Common.LeaveTypeValue.AnnualLeave) + 1).ToString()) { try { DateTime dtNow = DateTime.Now; var entFrees = from ent in dal.GetObjects <T_HR_FREELEAVEDAYSET>() where ent.T_HR_LEAVETYPESET.LEAVETYPESETID == entTemp.LEAVETYPESETID select ent; //不存在设置的情况则修改最大请假天数 if (entFrees.Count() == 0) { //格式化为当前年份 //dtNow = DateTime.Parse(dtNow.Year.ToString() + "-01-01"); var ents = from ent in dal.GetObjects <T_HR_EMPLOYEELEVELDAYCOUNT>() where ent.LEAVETYPESETID == entTemp.LEAVETYPESETID && ent.EFFICDATE.Value.Year == dtNow.Year select ent; if (ents.Count() > 0) { foreach (var ent in ents) { ent.REMARK += "原来为:" + ent.DAYS.ToString() + ";修改后重新设置天数:" + entTemp.MAXDAYS.ToString(); ent.DAYS = entTemp.MAXDAYS; dal.UpdateFromContext(ent); } int intResult = dal.SaveContextChanges(); if (intResult > 0) { SMT.Foundation.Log.Tracer.Debug("公共假期类型:" + entTemp.LEAVETYPENAME + "修改带薪假天数成功"); } else { SMT.Foundation.Log.Tracer.Debug("公共假期类型:" + entTemp.LEAVETYPENAME + "修改带薪假天数失败"); } } } } catch (Exception ex) { SMT.Foundation.Log.Tracer.Debug("公共假期类型:" + entTemp.LEAVETYPENAME + "修改带薪假天数出现错误:" + ex.ToString()); } } dalLeaveTypeSet.Update(entUpdate); strMsg = "{SAVESUCCESSED}"; } catch (Exception ex) { strMsg = ex.Message.ToString(); } return(strMsg); }