Example #1
0
        /// <summary>
        /// 根据条件,获取排班模板明细信息
        /// </summary>
        /// <param name="strTemplateMasterId">排班模板主表主键索引</param>
        /// <param name="strSortKey">排序字段</param>
        /// <returns></returns>
        public IQueryable <T_HR_SCHEDULINGTEMPLATEDETAIL> GetAllSchedulingTemplateDetailRdListByMultSearch(string strTemplateMasterId, string strSortKey)
        {
            SchedulingTemplateDetailDAL dalSchedulingTemplateDetail = new SchedulingTemplateDetailDAL();

            StringBuilder strfilter  = new StringBuilder();
            List <string> objArgs    = new List <string>();
            string        strOrderBy = string.Empty;

            if (!string.IsNullOrEmpty(strTemplateMasterId))
            {
                strfilter.Append(" T_HR_SCHEDULINGTEMPLATEMASTER.TEMPLATEMASTERID == @0");
                objArgs.Add(strTemplateMasterId);
            }

            if (!string.IsNullOrEmpty(strSortKey))
            {
                strOrderBy = strSortKey;
            }
            else
            {
                strOrderBy = " TEMPLATEDETAILID ";
            }

            var q = dalSchedulingTemplateDetail.GetSchedulingTemplateDetailRdListByMultSearch(strOrderBy, strfilter.ToString(), objArgs.ToArray());

            return(q);
        }
Example #2
0
        /// <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);
        }