/// <summary> /// 根据条件,获取考勤异常扣款明细信息 /// </summary> /// <param name="strOwnerID">登录用户的员工ID(权限控制)</param> /// <param name="strDeductMasterID">外键索引</param> /// <param name="strSortKey">排序字段</param> /// <returns></returns> public IQueryable <T_HR_ATTENDANCEDEDUCTDETAIL> GetAllAttendanceDeductDetailRdListByMultSearch(string strOwnerID, string strDeductMasterID, string strSortKey) { AttendanceDeductDetailDAL dalAttendanceDeductDetail = new AttendanceDeductDetailDAL(); StringBuilder strfilter = new StringBuilder(); List <object> objArgs = new List <object>(); string strOrderBy = string.Empty; if (!string.IsNullOrEmpty(strDeductMasterID)) { strfilter.Append(" T_HR_ATTENDANCEDEDUCTMASTER.DEDUCTMASTERID == @0"); objArgs.Add(strDeductMasterID); } if (!string.IsNullOrEmpty(strSortKey)) { strOrderBy = strSortKey; } else { strOrderBy = " DEDUCTDETAILID "; } string filterString = strfilter.ToString(); //SetOrganizationFilter(ref filterString, ref objArgs, strOwnerID, "T_HR_ATTENDANCEDEDUCTDETAIL"); var q = dalAttendanceDeductDetail.GetAttendanceDeductDetailRdListByMultSearch(strOrderBy, filterString, objArgs.ToArray()); return(q); }
public string DeleteDeductDetailByMasterID(string strAttendanceDeductMasterId) { string strMsg = string.Empty; try { if (string.IsNullOrEmpty(strAttendanceDeductMasterId)) { return("{REQUIREDFIELDS}"); } bool flag = false; StringBuilder strFilter = new StringBuilder(); List <string> objArgs = new List <string>(); strFilter.Append(" T_HR_ATTENDANCEDEDUCTMASTER.DEDUCTMASTERID == @0"); objArgs.Add(strAttendanceDeductMasterId); AttendanceDeductDetailDAL dalDeductDetail = new AttendanceDeductDetailDAL(); flag = dalDeductDetail.IsExistsRd(strFilter.ToString(), objArgs.ToArray()); if (!flag) { return("{NOTFOUND}"); } string strOrderBy = " DEDUCTMASTERID "; var q = dalDeductDetail.GetAttendanceDeductDetailRdListByMultSearch(strOrderBy, strFilter.ToString(), objArgs.ToArray()); if (q == null) { return(strMsg); } if (q.Count() == 0) { return(strMsg); } foreach (T_HR_ATTENDANCEDEDUCTDETAIL item in q) { dalDeductDetail.Delete(item); } strMsg = "{DELETESUCCESSED}"; } catch (Exception ex) { strMsg = ex.Message.ToString(); } return(strMsg); }
/// <summary> /// 修改考勤异常扣款明细信息 /// </summary> /// <param name="entLTRd"></param> /// <returns></returns> public string ModifyDeductDetail(T_HR_ATTENDANCEDEDUCTDETAIL 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(" DEDUCTDETAILID == @0"); objArgs.Add(entTemp.DEDUCTDETAILID); AttendanceDeductDetailDAL dalAttendanceDeductDetail = new AttendanceDeductDetailDAL(); flag = dalAttendanceDeductDetail.IsExistsRd(strFilter.ToString(), objArgs.ToArray()); if (!flag) { return("{NOTFOUND}"); } //检查提交的记录的次数范围是否与已有记录的次数范围有重叠 strMsg = CheckIsLimitTimes(entTemp); if (!string.IsNullOrEmpty(strMsg)) { return(strMsg); } T_HR_ATTENDANCEDEDUCTDETAIL entUpdate = dalAttendanceDeductDetail.GetAttendanceDeductDetailRdByMultSearch(strFilter.ToString(), objArgs.ToArray()); Utility.CloneEntity(entTemp, entUpdate); dalAttendanceDeductDetail.Update(entUpdate); strMsg = "{SAVESUCCESSED}"; } catch (Exception ex) { strMsg = ex.Message.ToString(); } return(strMsg); }
/// <summary> /// 根据参数,检查是否存在指定记录(方便进行数据增删改) /// </summary> /// <param name="strFilter">查询语句</param> /// <param name="objArgs">查询参数集合</param> /// <returns>True/False(是/否)</returns> public bool IsExistsRd(string strFilter, params object[] objArgs) { bool flag = false; if (string.IsNullOrEmpty(strFilter) && objArgs == null) { return(false); } if (objArgs.Count() == 0) { return(false); } AttendanceDeductDetailDAL dalAttendanceDeductDetail = new AttendanceDeductDetailDAL(); flag = dalAttendanceDeductDetail.IsExistsRd(strFilter, objArgs); return(flag); }
/// <summary> /// 获取考勤异常扣款明细信息 /// </summary> /// <param name="strAttendanceDeductDetailId">主键索引</param> /// <returns></returns> public T_HR_ATTENDANCEDEDUCTDETAIL GetAttendanceDeductDetailByID(string strAttendanceDeductDetailId) { if (string.IsNullOrEmpty(strAttendanceDeductDetailId)) { return(null); } AttendanceDeductDetailDAL dalAttendanceDeductDetail = new AttendanceDeductDetailDAL(); StringBuilder strfilter = new StringBuilder(); List <string> objArgs = new List <string>(); if (!string.IsNullOrEmpty(strAttendanceDeductDetailId)) { strfilter.Append(" DEDUCTDETAILID == @0"); objArgs.Add(strAttendanceDeductDetailId); } T_HR_ATTENDANCEDEDUCTDETAIL entRd = dalAttendanceDeductDetail.GetAttendanceDeductDetailRdByMultSearch(strfilter.ToString(), objArgs.ToArray()); return(entRd); }
/// <summary> /// 根据主键索引,删除考勤异常扣款明细信息(注:暂定为物理删除) /// </summary> /// <param name="strVacationId">主键索引</param> /// <returns></returns> public string DeleteDeductDetail(string strAttendanceDeductDetailId) { string strMsg = string.Empty; try { if (string.IsNullOrEmpty(strAttendanceDeductDetailId)) { return("{REQUIREDFIELDS}"); } bool flag = false; StringBuilder strFilter = new StringBuilder(); List <string> objArgs = new List <string>(); strFilter.Append(" DEDUCTDETAILID == @0"); objArgs.Add(strAttendanceDeductDetailId); AttendanceDeductDetailDAL dalAttendanceDeductDetail = new AttendanceDeductDetailDAL(); flag = dalAttendanceDeductDetail.IsExistsRd(strFilter.ToString(), objArgs.ToArray()); if (!flag) { return("{NOTFOUND}"); } T_HR_ATTENDANCEDEDUCTDETAIL entDel = dalAttendanceDeductDetail.GetAttendanceDeductDetailRdByMultSearch(strFilter.ToString(), objArgs.ToArray()); dalAttendanceDeductDetail.Delete(entDel); strMsg = "{DELETESUCCESSED}"; } catch (Exception ex) { strMsg = ex.Message.ToString(); } return(strMsg); }
/// <summary> /// 新增考勤异常扣款明细信息 /// </summary> /// <param name="entLTRd"></param> /// <returns></returns> public string AddDeductDetail(T_HR_ATTENDANCEDEDUCTDETAIL entTemp) { string strMsg = string.Empty; try { if (entTemp == null) { return("{REQUIREDFIELDS}"); } AttendanceDeductDetailDAL dalAttendanceDeductDetail = new AttendanceDeductDetailDAL(); bool flag = false; StringBuilder strFilter = new StringBuilder(); List <string> objArgs = new List <string>(); if (entTemp.FINETYPE == (Convert.ToInt32(Common.AttexFineType.LateFineType1) + 1).ToString() || entTemp.FINETYPE == (Convert.ToInt32(Common.AttexFineType.LateFineType2) + 1).ToString() || entTemp.FINETYPE == (Convert.ToInt32(Common.AttexFineType.LeaveEarly1) + 1).ToString() || entTemp.FINETYPE == (Convert.ToInt32(Common.AttexFineType.LeaveEarly2) + 1).ToString() || entTemp.FINETYPE == (Convert.ToInt32(Common.AttexFineType.SkipWork) + 1).ToString()) { strFilter.Append(" T_HR_ATTENDANCEDEDUCTMASTER.DEDUCTMASTERID == @0"); strFilter.Append(" && FINETYPE == @1"); objArgs.Add(entTemp.T_HR_ATTENDANCEDEDUCTMASTER.DEDUCTMASTERID); objArgs.Add(entTemp.FINETYPE); flag = dalAttendanceDeductDetail.IsExistsRd(strFilter.ToString(), objArgs.ToArray()); } if (flag) { return("{ALREADYEXISTSRECORD}"); } if (entTemp.FINETYPE == (Convert.ToInt32(Common.AttexFineType.LateFineType3) + 1).ToString() || entTemp.FINETYPE == (Convert.ToInt32(Common.AttexFineType.LateFineType4) + 1).ToString() || entTemp.FINETYPE == (Convert.ToInt32(Common.AttexFineType.LeaveEarly3) + 1).ToString() || entTemp.FINETYPE == (Convert.ToInt32(Common.AttexFineType.LeaveEarly4) + 1).ToString() || entTemp.FINETYPE == (Convert.ToInt32(Common.AttexFineType.DrainPunch) + 1).ToString()) { //分段扣款的,检查新加记录的最低次数是否小于已有记录中最高次数,如果小于,则提示用户修改最低次数 strMsg = CheckIsLimitTimes(entTemp); } if (!string.IsNullOrEmpty(strMsg)) { return(strMsg); } T_HR_ATTENDANCEDEDUCTDETAIL ent = new T_HR_ATTENDANCEDEDUCTDETAIL(); Utility.CloneEntity <T_HR_ATTENDANCEDEDUCTDETAIL>(entTemp, ent); ent.T_HR_ATTENDANCEDEDUCTMASTERReference.EntityKey = new System.Data.EntityKey("TM_SaaS_OA_EFModelContext.T_HR_ATTENDANCEDEDUCTMASTER", "DEDUCTMASTERID", entTemp.T_HR_ATTENDANCEDEDUCTMASTER.DEDUCTMASTERID); Utility.RefreshEntity(ent); dalAttendanceDeductDetail.Add(ent); strMsg = "{SAVESUCCESSED}"; } catch (Exception ex) { strMsg = ex.Message.ToString(); } return(strMsg); }