예제 #1
0
        public void ProcessRequest(HttpContext context)
        {
            AjaxReceive receive = new AjaxReceive();

            receive.Fill(context);
            NameValueCollection cc          = context.Request.Form;
            StoreParams         storeParams = new StoreParams();

            if (!string.IsNullOrEmpty(cc["page"]))
            {
                storeParams.page = int.Parse(cc["page"]);
            }
            if (!string.IsNullOrEmpty(cc["start"]))
            {
                storeParams.start = int.Parse(cc["start"]);
            }
            if (!string.IsNullOrEmpty(cc["limit"]))
            {
                storeParams.limit = int.Parse(cc["limit"]);
            }
            if (!string.IsNullOrEmpty(cc["query"]))
            {
                storeParams.query = cc["query"];
            }
            if (!string.IsNullOrEmpty(cc["group"]))
            {
                GroupParam grouper = JsonConvert.DeserializeObject <GroupParam>(cc["group"]);
                if (grouper != null)
                {
                    storeParams.group = new List <GroupParam>(new GroupParam[] { grouper });
                }
            }
            if (!string.IsNullOrEmpty(cc["sort"]))
            {
                storeParams.sort = JsonConvert.DeserializeObject <List <SortParam> >(cc["sort"]);
            }
            if (!string.IsNullOrEmpty(cc["filter"]))
            {
                storeParams.filter = JsonConvert.DeserializeObject <List <FilterParam> >(cc["filter"]);
            }
            if (string.IsNullOrEmpty(receive.Data))
            {
                receive.Data = JsonConvert.SerializeObject(new
                {
                    StoreParams = storeParams
                });
            }
            else if (receive.Data.StartsWith("{") && receive.Data.EndsWith("}"))
            {
                string restJsonStr = receive.Data.Substring(1);
                if (restJsonStr != "}")
                {
                    restJsonStr = "," + restJsonStr;
                }

                receive.Data = string.Format("{{\"StoreParams\":{0}{1}", JsonConvert.SerializeObject(storeParams), restJsonStr);
            }
            AjaxResult result = ContextFactory.AjaxProcess.DoProcess(receive);
        }
예제 #2
0
            /// <summary>
            /// 获取分组详情
            /// </summary>
            /// <param name="code">分组唯一标志</param>
            /// <param name="cancellationToken"></param>
            /// <returns></returns>
            public async Task <Group> Detail(string code, CancellationToken cancellationToken = default)
            {
                var param = new GroupParam(code);

                var res = await client.Request <GroupResponse>(param.CreateRequest(), cancellationToken);

                return(res.Result);
            }
예제 #3
0
        public override bool Equals(object obj)
        {
            if (obj as GroupParam == null)
            {
                return(false);
            }
            GroupParam otherGroupParam = obj as GroupParam;

            return(ParamName.Equals(otherGroupParam.ParamName) && ParamValue == otherGroupParam.ParamValue);
        }