/// <summary> /// 获取请假类型设置信息 /// </summary> /// <param name="strLeaveTypeSetId">主键索引</param> /// <returns></returns> public T_HR_LEAVETYPESET GetLeaveTypeSetByID(string strLeaveTypeSetId) { try { if (string.IsNullOrEmpty(strLeaveTypeSetId)) { return(null); } LeaveTypeSetDAL dalLeaveTypeSet = new LeaveTypeSetDAL(); StringBuilder strfilter = new StringBuilder(); List <string> objArgs = new List <string>(); if (!string.IsNullOrEmpty(strLeaveTypeSetId)) { strfilter.Append(" LEAVETYPESETID == @0"); objArgs.Add(strLeaveTypeSetId); } T_HR_LEAVETYPESET entLTRd = dalLeaveTypeSet.GetLeaveTypeSetRdByMultSearch(strfilter.ToString(), objArgs.ToArray()); return(entLTRd); } catch (Exception) { return(null); } }
/// <summary> /// 根据条件,获取请假类型设置信息 /// </summary> /// <param name="strOwnerID">登录人的员工ID</param> /// <param name="strLeaveTypeValue">假期类别</param> /// <param name="strSortKey">排序字段</param> /// <returns></returns> public IQueryable <T_HR_LEAVETYPESET> GetAllLeaveTypeSetRdListByMultSearch(string strOwnerID, string strLeaveTypeValue, string strSortKey) { LeaveTypeSetDAL dalLeaveTypeSet = new LeaveTypeSetDAL(); StringBuilder strfilter = new StringBuilder(); List <object> objArgs = new List <object>(); string strOrderBy = string.Empty; int iIndex = 0; if (!string.IsNullOrEmpty(strLeaveTypeValue)) { strfilter.Append(" LEAVETYPEVALUE == @0 "); objArgs.Add(strLeaveTypeValue); } if (!string.IsNullOrEmpty(strSortKey)) { strOrderBy = strSortKey; } else { strOrderBy = " LEAVETYPESETID "; } string filterString = strfilter.ToString(); SetOrganizationFilter(ref filterString, ref objArgs, strOwnerID, "T_HR_LEAVETYPESET"); var q = dalLeaveTypeSet.GetLeaveTypeSetRdListByMultSearch(strOrderBy, filterString, objArgs.ToArray()); return(q); }
public EntityObject[] GetLookupData(int pageIndex, int pageSize, string sort, string filterString, IList <object> paras, ref int pageCount, string userID) { LeaveTypeSetDAL dalLeaveTypeSet = new LeaveTypeSetDAL(); List <object> queryParas = new List <object>(); string strOrderBy = string.Empty; if (paras.Count() > 0) { for (int i = 0; i < paras.Count(); i++) { queryParas.Add(paras[i]); } } strOrderBy = " LEAVETYPESETID "; //受权限限制,假如权限不够则查询条件filterString可能为空,则要判断 if (string.IsNullOrWhiteSpace(filterString)) { filterString = string.Empty; } SetOrganizationFilter(ref filterString, ref queryParas, userID, "T_HR_LEAVETYPESET"); IQueryable <T_HR_LEAVETYPESET> ents = dalLeaveTypeSet.GetLeaveTypeSetRdListByMultSearch(strOrderBy, filterString, queryParas.ToArray()); return(ents.Count() > 0 ? ents.ToArray() : null); }
/// <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 AddLeaveTypeSet(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(" LEAVETYPENAME == @0"); strFilter.Append(" && LEAVETYPEVALUE == @1"); objArgs.Add(entTemp.LEAVETYPENAME); objArgs.Add(entTemp.LEAVETYPEVALUE); LeaveTypeSetDAL dalLeaveTypeSet = new LeaveTypeSetDAL(); flag = dalLeaveTypeSet.IsExistsRd(strFilter.ToString(), objArgs.ToArray()); if (flag) { return("{ALREADYEXISTSRECORD}"); } dalLeaveTypeSet.Add(entTemp); strMsg = "{SAVESUCCESSED}"; } catch (Exception ex) { strMsg = ex.Message.ToString(); } return(strMsg); }
/// <summary> /// 根据主键索引,删除请假类型设置信息(注:暂定为物理删除) /// </summary> /// <param name="strVacationId">主键索引</param> /// <returns></returns> public string DeleteLeaveTypeSet(string strLeaveTypeSetId) { string strMsg = string.Empty; try { if (string.IsNullOrEmpty(strLeaveTypeSetId)) { return("{REQUIREDFIELDS}"); } bool flag = false; StringBuilder strFilter = new StringBuilder(); List <string> objArgs = new List <string>(); strFilter.Append(" LEAVETYPESETID == @0"); objArgs.Add(strLeaveTypeSetId); LeaveTypeSetDAL dalLeaveTypeSet = new LeaveTypeSetDAL(); flag = dalLeaveTypeSet.IsExistsRd(strFilter.ToString(), objArgs.ToArray()); if (!flag) { return("{NOTFOUND}"); } T_HR_LEAVETYPESET entDel = dalLeaveTypeSet.GetLeaveTypeSetRdByMultSearch(strFilter.ToString(), objArgs.ToArray()); var entAL = from s in dal.GetObjects <T_HR_ATTENDFREELEAVE>().Include("T_HR_ATTENDANCESOLUTION").Include("T_HR_LEAVETYPESET") where s.T_HR_LEAVETYPESET.LEAVETYPESETID == strLeaveTypeSetId select s; if (entAL.Count() > 0) { return("{EXISTRELATIONRECORD}"); } var entLR = from r in dal.GetObjects <T_HR_EMPLOYEELEAVERECORD>().Include("T_HR_LEAVETYPESET") where r.T_HR_LEAVETYPESET.LEAVETYPESETID == strLeaveTypeSetId select r; if (entLR.Count() > 0) { return("{EXISTRELATIONRECORD}"); //dal.Delete(entLR); } entDel.T_HR_FREELEAVEDAYSET.Load(); dal.DeleteFromContext(entDel); dal.SaveContextChanges(); strMsg = "{DELETESUCCESSED}"; } catch (Exception ex) { strMsg = ex.Message.ToString(); } return(strMsg); }
public EntityObject[] GetLookupData(int pageIndex, int pageSize, string sort, string filterString, IList <object> paras, ref int pageCount, string userID) { LeaveTypeSetDAL dalLeaveTypeSet = new LeaveTypeSetDAL(); List <object> queryParas = new List <object>(); string strOrderBy = string.Empty; string strEmployeeID = string.Empty; #region 是否是从请假处传来数据 //只有从请假申请中才传来leaverecordemployeeid if (filterString != null) { if (filterString.IndexOf("leaverecordemployeeid") > 0) { strEmployeeID = paras[0].ToString(); filterString = string.Empty; //清空记录 //paras.RemoveAt(0); } else { if (paras.Count() > 0) { for (int i = 0; i < paras.Count(); i++) { queryParas.Add(paras[i]); } } } } else { if (paras.Count() > 0) { for (int i = 0; i < paras.Count(); i++) { queryParas.Add(paras[i]); } } } #endregion strOrderBy = " LEAVETYPESETID "; //受权限限制,假如权限不够则查询条件filterString可能为空,则要判断 if (string.IsNullOrWhiteSpace(filterString)) { filterString = string.Empty; } SetOrganizationFilter(ref filterString, ref queryParas, userID, "T_HR_LEAVETYPESET"); IQueryable <T_HR_LEAVETYPESET> ents = null; if (string.IsNullOrEmpty(strEmployeeID)) { ents = dalLeaveTypeSet.GetLeaveTypeSetRdListByMultSearch(strOrderBy, filterString, queryParas.ToArray()); } else { ents = GetLeaveTypeSetRdListByEmployeeID(strOrderBy, filterString, strEmployeeID, queryParas.ToArray()); } if (ents == null) { return(null); } return(ents.Count() > 0 ? ents.ToArray() : null); }
/// <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); }