public void ProcessRequest(HttpContext context)
        {
            context.Response.ContentType = "text/plain";
            NFMT.Common.UserModel user = Utility.UserUtility.CurrentUser;

            int pageIndex = 1, pageSize = 10;
            string orderStr = string.Empty, whereStr = string.Empty;

            string clauseText = context.Request.QueryString["t"];
            bool isHas = false;
            int masterId = 0;

            if (!string.IsNullOrEmpty(context.Request.QueryString["mi"]))
            {
                if (!int.TryParse(context.Request.QueryString["mi"], out masterId))
                {
                    context.Response.Write("未选择合约模板");
                    context.Response.End();
                }
            }

            if (!string.IsNullOrEmpty(context.Request.QueryString["ih"]))
            {
                int intHas = 0;
                if (!int.TryParse(context.Request.QueryString["ih"], out intHas))
                    intHas = 0;
                if (intHas == 1)
                    isHas = true;
                else
                    isHas = false;
            }

            if (!string.IsNullOrEmpty(context.Request.QueryString["pagenum"]))
                int.TryParse(context.Request.QueryString["pagenum"], out pageIndex);
            pageIndex++;
            if (!string.IsNullOrEmpty(context.Request.QueryString["pagesize"]))
                int.TryParse(context.Request.QueryString["pagesize"], out pageSize);
            if (!string.IsNullOrEmpty(context.Request.QueryString["sortdatafield"]) && !string.IsNullOrEmpty(context.Request.QueryString["sortorder"]))
            {
                string sortDataField = context.Request.QueryString["sortdatafield"].Trim();
                string sortOrder = context.Request.QueryString["sortorder"].Trim();

                switch (sortDataField)
                {
                    case "ClauseText":
                        sortDataField = "cc.ClauseText";
                        break;
                    case "ClauseEnText":
                        sortDataField = "cc.ClauseEnText";
                        break;
                    case "Sort":
                        sortDataField = "ccr.Sort";
                        break;
                    case "IsChose":
                        sortDataField = "ccr.IsChose";
                        break;
                    case "ClauseId":
                        sortDataField = "cc.ClauseId";
                        break;
                    case "RefId":
                        sortDataField = "ccr.RefId";
                        break;
                }

                orderStr = string.Format("{0} {1}", sortDataField, sortOrder);
            }

            NFMT.Data.BLL.ClauseContractBLL refBLL = new NFMT.Data.BLL.ClauseContractBLL();

            NFMT.Common.SelectModel select = refBLL.GetSelectModel(pageIndex, pageSize, orderStr, masterId, isHas, clauseText);
            NFMT.Common.ResultModel result = refBLL.Load(user, select);
            System.Data.DataTable dt = result.ReturnValue as System.Data.DataTable;
            if (result.ResultStatus != 0)
            {
                context.Response.Write(result.Message);
                context.Response.End();
            }
            Dictionary<string, object> dic = new Dictionary<string, object>();
            dic.Add("count", result.AffectCount);
            dic.Add("data", dt);

            string postData = Newtonsoft.Json.JsonConvert.SerializeObject(dic);
            context.Response.Write(postData);
        }
Exemple #2
0
        /// <summary>
        /// 获取所有已生效模版条款关联数据
        /// </summary>
        /// <param name="user"></param>
        /// <returns></returns>
        private List<NFMT.Data.Model.ClauseContract> GetClauseContracts(UserModel user)
        {
            NFMT.Data.BLL.ClauseContractBLL clauseContractBLL = new NFMT.Data.BLL.ClauseContractBLL();
            NFMT.Common.ResultModel result = clauseContractBLL.Load(user, NFMT.Common.StatusEnum.已生效);
            if (result.ResultStatus != 0)
                return null;

            List<NFMT.Data.Model.ClauseContract> clauseContracts = result.ReturnValue as List<NFMT.Data.Model.ClauseContract>;
            if (clauseContracts == null || !clauseContracts.Any())
                return null;

            return clauseContracts;
        }