コード例 #1
0
        /// <summary>
        /// 修改排班模板及明细
        /// </summary>
        /// <param name="entMasterTemp"></param>
        /// <param name="entDetailTemps"></param>
        /// <returns></returns>
        public string ModifySchedulingTemplateMasterAndDetail(T_HR_SCHEDULINGTEMPLATEMASTER entMasterTemp, List <T_HR_SCHEDULINGTEMPLATEDETAIL> entDetailTemps)
        {
            string strMsg = string.Empty;

            try
            {
                strMsg = ModifyTemplateMaster(entMasterTemp);

                if (strMsg != "{SAVESUCCESSED}")
                {
                    return(strMsg);
                }

                if (entDetailTemps.Count() == 0)
                {
                    return(strMsg);
                }
                SchedulingTemplateDetailBLL bllTemplateDetail = new SchedulingTemplateDetailBLL();

                bllTemplateDetail.DeleteByTemplateMasterID(entMasterTemp.TEMPLATEMASTERID);

                foreach (T_HR_SCHEDULINGTEMPLATEDETAIL item in entDetailTemps)
                {
                    if (item.EntityKey != null)
                    {
                        item.EntityKey = null;  //清除EntityKey不为null的情况
                    }

                    if (item.T_HR_SCHEDULINGTEMPLATEMASTER == null)
                    {
                        item.T_HR_SCHEDULINGTEMPLATEMASTER = entMasterTemp;
                    }

                    bllTemplateDetail.AddTemplateDetail(item);
                }

                strMsg = "{SAVESUCCESSED}";
            }
            catch (Exception ex)
            {
                strMsg = ex.Message.ToString();
            }

            return(strMsg);
        }
コード例 #2
0
        /// <summary>
        /// 根据主键索引,删除排班模板信息(注:暂定为物理删除)
        /// </summary>
        /// <param name="strVacationId">主键索引</param>
        /// <returns></returns>
        public string DeleteTemplateMaster(string strSchedulingTemplateMasterId)
        {
            string strMsg = string.Empty;

            try
            {
                if (string.IsNullOrEmpty(strSchedulingTemplateMasterId))
                {
                    return("{REQUIREDFIELDS}");
                }

                bool          flag      = false;
                StringBuilder strFilter = new StringBuilder();
                List <string> objArgs   = new List <string>();

                strFilter.Append(" TEMPLATEMASTERID == @0");

                objArgs.Add(strSchedulingTemplateMasterId);

                SchedulingTemplateMasterDAL dalSchedulingTemplateMaster = new SchedulingTemplateMasterDAL();
                flag = dalSchedulingTemplateMaster.IsExistsRd(strFilter.ToString(), objArgs.ToArray());

                if (!flag)
                {
                    return("{NOTFOUND}");
                }

                //先删除明细表记录
                SchedulingTemplateDetailBLL bllSchedulingTemplateDetail = new SchedulingTemplateDetailBLL();
                bllSchedulingTemplateDetail.DeleteByTemplateMasterID(strSchedulingTemplateMasterId);

                //无异常出现,即删除主表记录
                T_HR_SCHEDULINGTEMPLATEMASTER entDel = dalSchedulingTemplateMaster.GetSchedulingTemplateMasterRdByMultSearch(strFilter.ToString(), objArgs.ToArray());
                dalSchedulingTemplateMaster.Delete(entDel);

                strMsg = "{DELETESUCCESSED}";
            }
            catch (Exception ex)
            {
                strMsg = ex.Message.ToString();
            }

            return(strMsg);
        }