Пример #1
0
        private void GetSearchUserCount(HttpContext context)
        {
            context.Response.ContentType = "application/json";
            var type = new {
                status = "err",
                msg    = "参数错误!"
            };
            string str = context.Request["gId"];

            if (string.IsNullOrWhiteSpace(str))
            {
                context.Response.Write(JsonConvert.SerializeObject(type));
            }
            else
            {
                string str2 = context.Request["rId"];
                if (!string.IsNullOrWhiteSpace(str2))
                {
                    try
                    {
                        int.Parse(str2);
                    }
                    catch (Exception)
                    {
                        context.Response.Write(JsonConvert.SerializeObject(type));
                        return;
                    }
                }
                string str3 = context.Request["bDate"];
                if (!string.IsNullOrWhiteSpace(str3))
                {
                    try
                    {
                        DateTime.Parse(str3);
                    }
                    catch (Exception)
                    {
                        context.Response.Write(JsonConvert.SerializeObject(type));
                        return;
                    }
                }
                string str4 = context.Request["eDate"];
                if (!string.IsNullOrWhiteSpace(str4))
                {
                    try
                    {
                        DateTime.Parse(str4);
                    }
                    catch (Exception)
                    {
                        context.Response.Write(JsonConvert.SerializeObject(type));
                        return;
                    }
                }
                string str5 = context.Request["uType"];
                if (!string.IsNullOrWhiteSpace(str5))
                {
                    string str6 = context.Request["cGroup"];
                    if (string.IsNullOrWhiteSpace(str6))
                    {
                        context.Response.Write(JsonConvert.SerializeObject(type));
                    }
                    else
                    {
                        try
                        {
                            int.Parse(str5);
                        }
                        catch (Exception)
                        {
                            context.Response.Write(JsonConvert.SerializeObject(type));
                            return;
                        }
                        try
                        {
                            int num   = CouponHelper.GetMemeberNumBySearch(str, str2, str3, str4, int.Parse(str5), str6);
                            var type2 = new {
                                status = "ok",
                                msg    = "",
                                count  = num
                            };
                            context.Response.Write(JsonConvert.SerializeObject(type2));
                        }
                        catch (Exception)
                        {
                            context.Response.Write(JsonConvert.SerializeObject(new { status = "err", msg = "获取会员数出错!" }));
                            return;
                        }
                    }
                }
                else
                {
                    context.Response.Write(JsonConvert.SerializeObject(type));
                }
            }
        }
Пример #2
0
        private void GetSearchUserCount(System.Web.HttpContext context)
        {
            context.Response.ContentType = "application/json";
            var value = new
            {
                status = "err",
                msg    = "参数错误!"
            };
            string text = context.Request["gId"];

            if (string.IsNullOrWhiteSpace(text))
            {
                context.Response.Write(JsonConvert.SerializeObject(value));
                return;
            }
            string text2 = context.Request["rId"];

            if (!string.IsNullOrWhiteSpace(text2))
            {
                try
                {
                    int.Parse(text2);
                }
                catch (System.Exception)
                {
                    context.Response.Write(JsonConvert.SerializeObject(value));
                    return;
                }
            }
            string text3 = context.Request["bDate"];

            if (!string.IsNullOrWhiteSpace(text3))
            {
                try
                {
                    System.DateTime.Parse(text3);
                }
                catch (System.Exception)
                {
                    context.Response.Write(JsonConvert.SerializeObject(value));
                    return;
                }
            }
            string text4 = context.Request["eDate"];

            if (!string.IsNullOrWhiteSpace(text4))
            {
                try
                {
                    System.DateTime.Parse(text4);
                }
                catch (System.Exception)
                {
                    context.Response.Write(JsonConvert.SerializeObject(value));
                    return;
                }
            }
            string text5 = context.Request["uType"];

            if (string.IsNullOrWhiteSpace(text5))
            {
                context.Response.Write(JsonConvert.SerializeObject(value));
            }
            else
            {
                string text6 = context.Request["cGroup"];
                if (string.IsNullOrWhiteSpace(text6))
                {
                    context.Response.Write(JsonConvert.SerializeObject(value));
                    return;
                }
                try
                {
                    int.Parse(text5);
                }
                catch (System.Exception)
                {
                    context.Response.Write(JsonConvert.SerializeObject(value));
                    return;
                }
                try
                {
                    int memeberNumBySearch = CouponHelper.GetMemeberNumBySearch(text, text2, text3, text4, int.Parse(text5), text6);
                    var value2             = new
                    {
                        status = "ok",
                        msg    = "",
                        count  = memeberNumBySearch
                    };
                    context.Response.Write(JsonConvert.SerializeObject(value2));
                }
                catch (System.Exception)
                {
                    context.Response.Write(JsonConvert.SerializeObject(new
                    {
                        status = "err",
                        msg    = "获取会员数出错!"
                    }));
                }
            }
        }