/// <summary> /// 根据排班模板主表主键索引,删除关联的排班模板明细记录 /// </summary> /// <param name="strTemplateMasterID">排班模板主表主键索引</param> /// <returns>返回处理后的消息</returns> public string DeleteByTemplateMasterID(string strTemplateMasterID) { string strMsg = string.Empty; try { if (string.IsNullOrEmpty(strTemplateMasterID)) { return("{REQUIREDFIELDS}"); } bool flag = false; StringBuilder strFilter = new StringBuilder(); List <string> objArgs = new List <string>(); strFilter.Append(" T_HR_SCHEDULINGTEMPLATEMASTER.TEMPLATEMASTERID == @0"); objArgs.Add(strTemplateMasterID); SchedulingTemplateDetailDAL dalSchedulingTemplateDetail = new SchedulingTemplateDetailDAL(); flag = dalSchedulingTemplateDetail.IsExistsRd(strFilter.ToString(), objArgs.ToArray()); if (!flag) { return("{NOTFOUND}"); } string strOrderBy = " TEMPLATEDETAILID "; var q = dalSchedulingTemplateDetail.GetSchedulingTemplateDetailRdListByMultSearch(strOrderBy, strFilter.ToString(), objArgs.ToArray()); if (q == null) { return(strMsg); } if (q.Count() == 0) { return(strMsg); } foreach (T_HR_SCHEDULINGTEMPLATEDETAIL item in q) { dalSchedulingTemplateDetail.Delete(item); } strMsg = "{DELETESUCCESSED}"; } catch (Exception ex) { strMsg = ex.Message.ToString(); } return(strMsg); }
/// <summary> /// 新增排班模板明细信息 /// </summary> /// <param name="entTemp"></param> /// <returns></returns> public string AddTemplateDetail(T_HR_SCHEDULINGTEMPLATEDETAIL 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(" T_HR_SCHEDULINGTEMPLATEMASTER.TEMPLATEMASTERID == @0"); strFilter.Append(" && T_HR_SHIFTDEFINE.SHIFTDEFINEID == @1"); strFilter.Append(" && SCHEDULINGDATE == @2"); objArgs.Add(entTemp.T_HR_SCHEDULINGTEMPLATEMASTER.TEMPLATEMASTERID); objArgs.Add(entTemp.T_HR_SHIFTDEFINE.SHIFTDEFINEID); objArgs.Add(entTemp.SCHEDULINGDATE); SchedulingTemplateDetailDAL dalSchedulingTemplateDetail = new SchedulingTemplateDetailDAL(); flag = dalSchedulingTemplateDetail.IsExistsRd(strFilter.ToString(), objArgs.ToArray()); if (flag) { return(string.Empty); } T_HR_SCHEDULINGTEMPLATEDETAIL ent = new T_HR_SCHEDULINGTEMPLATEDETAIL(); Utility.CloneEntity <T_HR_SCHEDULINGTEMPLATEDETAIL>(entTemp, ent); ent.T_HR_SCHEDULINGTEMPLATEMASTERReference.EntityKey = new System.Data.EntityKey("TM_SaaS_OA_EFModelContext.T_HR_SCHEDULINGTEMPLATEMASTER", "TEMPLATEMASTERID", entTemp.T_HR_SCHEDULINGTEMPLATEMASTER.TEMPLATEMASTERID); ent.T_HR_SHIFTDEFINEReference.EntityKey = new System.Data.EntityKey("TM_SaaS_OA_EFModelContext.T_HR_SHIFTDEFINE", "SHIFTDEFINEID", entTemp.T_HR_SHIFTDEFINE.SHIFTDEFINEID); Utility.RefreshEntity(ent); dalSchedulingTemplateDetail.Add(ent); strMsg = "{SAVESUCCESSED}"; } catch (Exception ex) { strMsg = ex.Message.ToString(); } return(strMsg); }
/// <summary> /// 修改排班模板明细信息 /// </summary> /// <param name="entTemp"></param> /// <returns></returns> public string ModifyTemplateDetail(T_HR_SCHEDULINGTEMPLATEDETAIL 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(" TEMPLATEDETAILID == @0"); objArgs.Add(entTemp.TEMPLATEDETAILID); SchedulingTemplateDetailDAL dalSchedulingTemplateDetail = new SchedulingTemplateDetailDAL(); flag = dalSchedulingTemplateDetail.IsExistsRd(strFilter.ToString(), objArgs.ToArray()); if (!flag) { return("{NOTFOUND}"); } T_HR_SCHEDULINGTEMPLATEDETAIL entUpdate = dalSchedulingTemplateDetail.GetSchedulingTemplateDetailRdByMultSearch(strFilter.ToString(), objArgs.ToArray()); Utility.RefreshEntity(entTemp); entUpdate.SCHEDULINGDATE = entTemp.SCHEDULINGDATE; entUpdate.REMARK = entTemp.REMARK; entUpdate.UPDATEDATE = entTemp.UPDATEDATE; entUpdate.UPDATEUSERID = entTemp.UPDATEUSERID; entUpdate.CREATEDATE = entTemp.CREATEDATE; entUpdate.CREATEUSERID = entTemp.CREATEUSERID; dalSchedulingTemplateDetail.Update(entUpdate); strMsg = "{SAVESUCCESSED}"; } catch (Exception ex) { strMsg = ex.Message.ToString(); } return(strMsg); }
/// <summary> /// 根据主键索引,删除T_HR_SCHEDULINGTEMPLATEDETAIL信息(注:暂定为物理删除) /// </summary> /// <param name="strTemplateDetailId">主键索引</param> /// <returns></returns> public string DeleteTemplateDetail(string strTemplateDetailId) { string strMsg = string.Empty; try { if (string.IsNullOrEmpty(strTemplateDetailId)) { return("{REQUIREDFIELDS}"); } bool flag = false; StringBuilder strFilter = new StringBuilder(); List <string> objArgs = new List <string>(); strFilter.Append(" TEMPLATEDETAILID == @0"); objArgs.Add(strTemplateDetailId); SchedulingTemplateDetailDAL dalSchedulingTemplateDetail = new SchedulingTemplateDetailDAL(); flag = dalSchedulingTemplateDetail.IsExistsRd(strFilter.ToString(), objArgs.ToArray()); if (!flag) { return("{NOTFOUND}"); } T_HR_SCHEDULINGTEMPLATEDETAIL entDel = dalSchedulingTemplateDetail.GetSchedulingTemplateDetailRdByMultSearch(strFilter.ToString(), objArgs.ToArray()); dalSchedulingTemplateDetail.Delete(entDel); strMsg = "{DELETESUCCESSED}"; } catch (Exception ex) { strMsg = ex.Message.ToString(); } return(strMsg); }