コード例 #1
0
 protected void btnBatchStop_Click(object sender, EventArgs e)
 {
     if (base.Request.Form["CheckBoxGroup"] != null)
     {
         string productIds = base.Request.Form["CheckBoxGroup"].ToString();
         if (!string.IsNullOrEmpty(base.Request["id"].ToString()))
         {
             if (PointExChangeHelper.SetProductsStatus(int.Parse(base.Request["id"]), 1, productIds))
             {
                 this.ShowMsg("暂停商品成功", true);
                 this.BindProducts(this.exchangeId);
             }
             else
             {
                 this.ShowMsg("暂停商品失败", false);
             }
         }
     }
     else
     {
         this.ShowMsg("请先选择商品", false);
     }
 }
コード例 #2
0
 protected void btnBatchOpen_Click(object sender, System.EventArgs e)
 {
     if (base.Request.Form["CheckBoxGroup"] != null)
     {
         string productIds = base.Request.Form["CheckBoxGroup"].ToString();
         if (!string.IsNullOrEmpty(base.Request["id"].ToString()))
         {
             int  num  = int.Parse(base.Request["id"]);
             bool flag = PointExChangeHelper.SetProductsStatus(num, 0, productIds);
             if (flag)
             {
                 this.ShowMsg("恢复商品成功", true);
                 this.BindProducts(this.exchangeId);
                 return;
             }
             this.ShowMsg("恢复商品失败", false);
             return;
         }
     }
     else
     {
         this.ShowMsg("请先选择商品", false);
     }
 }
コード例 #3
0
        public void ProcessRequest(HttpContext context)
        {
            context.Response.ContentType = "text/plain";
            try
            {
                if (Globals.GetCurrentManagerUserId() <= 0)
                {
                    context.Response.Write("{\"type\":\"error\",\"data\":\"请先登录\"}");
                    context.Response.End();
                }
                int    num        = int.Parse(context.Request["actType"].ToString());
                int    couponId   = int.Parse(context.Request["id"].ToString());
                string productIds = context.Request["products"];
                int    num3       = int.Parse(context.Request["type"].ToString());
                bool   flag       = false;
                if (num == 0)
                {
                    switch (num3)
                    {
                    case 0:
                        flag = CouponHelper.SetProductsStatus(couponId, 1, productIds);
                        break;

                    case 1:
                        flag = CouponHelper.SetProductsStatus(couponId, 0, productIds);
                        break;

                    case 2:
                        flag = CouponHelper.DeleteProducts(couponId, productIds);
                        break;
                    }
                }
                else if (num == 1)
                {
                    switch (num3)
                    {
                    case 0:
                        flag = ActivityHelper.SetProductsStatus(couponId, 1, productIds);
                        break;

                    case 1:
                        flag = ActivityHelper.SetProductsStatus(couponId, 0, productIds);
                        break;

                    case 2:
                        flag = ActivityHelper.DeleteProducts(couponId, productIds);
                        break;
                    }
                }
                else if (num == 2)
                {
                    switch (num3)
                    {
                    case 0:
                        flag = PointExChangeHelper.SetProductsStatus(couponId, 1, productIds);
                        break;

                    case 1:
                        flag = PointExChangeHelper.SetProductsStatus(couponId, 0, productIds);
                        break;

                    case 2:
                        flag = PointExChangeHelper.DeleteProducts(couponId, productIds);
                        break;
                    }
                }
                if (flag)
                {
                    context.Response.Write("{\"type\":\"success\",\"data\":\"\"}");
                }
                else
                {
                    context.Response.Write("{\"type\":\"success\",\"data\":\"写数据库失败\"}");
                }
            }
            catch (Exception exception)
            {
                context.Response.Write("{\"type\":\"error\",\"data\":\"" + exception.Message + "\"}");
            }
        }
コード例 #4
0
        protected void grdProducts_ItemCommand(object source, RepeaterCommandEventArgs e)
        {
            string commandName = e.CommandName;

            switch (commandName)
            {
            case "Renew":
                if (!string.IsNullOrEmpty(base.Request["id"].ToString()))
                {
                    int    exchangeId = int.Parse(base.Request["id"]);
                    string productIds = e.CommandArgument.ToString();
                    if (PointExChangeHelper.SetProductsStatus(exchangeId, 0, productIds))
                    {
                        this.ShowMsg("恢复商品成功", true);
                        this.BindProducts(this.exchangeId);
                        return;
                    }
                    this.ShowMsg("恢复商品失败", false);
                    return;
                }
                break;

            case "Pause":
                if (!string.IsNullOrEmpty(base.Request["id"].ToString()))
                {
                    int    num2 = int.Parse(base.Request["id"]);
                    string str3 = e.CommandArgument.ToString();
                    if (PointExChangeHelper.SetProductsStatus(num2, 1, str3))
                    {
                        this.ShowMsg("暂停商品成功", true);
                        this.BindProducts(this.exchangeId);
                        return;
                    }
                    this.ShowMsg("暂停商品失败", false);
                    return;
                }
                break;

            default:
                if ((commandName == "Delete") && !string.IsNullOrEmpty(base.Request["id"].ToString()))
                {
                    int    num3 = int.Parse(base.Request["id"]);
                    string str4 = e.CommandArgument.ToString();
                    if (!string.IsNullOrEmpty(str4))
                    {
                        if (PointExChangeHelper.GetProductExchangedCount(num3, int.Parse(str4)) > 0)
                        {
                            this.ShowMsg("该商品已经存在兑换记录,不能移除!", false);
                            return;
                        }
                        if (PointExChangeHelper.DeleteProducts(num3, str4))
                        {
                            this.ShowMsg("删除商品成功", true);
                            this.BindProducts(this.exchangeId);
                            return;
                        }
                        this.ShowMsg("删除商品失败", false);
                    }
                }
                break;
            }
        }
コード例 #5
0
 public void ProcessRequest(System.Web.HttpContext context)
 {
     context.Response.ContentType = "text/plain";
     context.Response.ContentType = "text/plain";
     try
     {
         int    num        = int.Parse(context.Request["actType"].ToString());
         int    num2       = int.Parse(context.Request["id"].ToString());
         string productIds = context.Request["products"];
         int    num3       = int.Parse(context.Request["type"].ToString());
         bool   flag       = false;
         if (num == 0)
         {
             if (num3 == 0)
             {
                 flag = CouponHelper.SetProductsStatus(num2, 1, productIds);
             }
             else if (num3 == 1)
             {
                 flag = CouponHelper.SetProductsStatus(num2, 0, productIds);
             }
             else if (num3 == 2)
             {
                 flag = CouponHelper.DeleteProducts(num2, productIds);
             }
         }
         else if (num == 1)
         {
             if (num3 == 0)
             {
                 flag = ActivityHelper.SetProductsStatus(num2, 1, productIds);
             }
             else if (num3 == 1)
             {
                 flag = ActivityHelper.SetProductsStatus(num2, 0, productIds);
             }
             else if (num3 == 2)
             {
                 flag = ActivityHelper.DeleteProducts(num2, productIds);
             }
         }
         else if (num == 2)
         {
             if (num3 == 0)
             {
                 flag = PointExChangeHelper.SetProductsStatus(num2, 1, productIds);
             }
             else if (num3 == 1)
             {
                 flag = PointExChangeHelper.SetProductsStatus(num2, 0, productIds);
             }
             else if (num3 == 2)
             {
                 flag = PointExChangeHelper.DeleteProducts(num2, productIds);
             }
         }
         if (flag)
         {
             context.Response.Write("{\"type\":\"success\",\"data\":\"\"}");
         }
         else
         {
             context.Response.Write("{\"type\":\"success\",\"data\":\"写数据库失败\"}");
         }
     }
     catch (System.Exception ex)
     {
         context.Response.Write("{\"type\":\"error\",\"data\":\"" + ex.Message + "\"}");
     }
 }
コード例 #6
0
        protected void grdProducts_ItemCommand(object source, System.Web.UI.WebControls.RepeaterCommandEventArgs e)
        {
            string commandName = e.CommandName;

            if (commandName == "Renew")
            {
                if (!string.IsNullOrEmpty(base.Request["id"].ToString()))
                {
                    int    num        = int.Parse(base.Request["id"]);
                    string productIds = e.CommandArgument.ToString();
                    bool   flag       = PointExChangeHelper.SetProductsStatus(num, 0, productIds);
                    if (flag)
                    {
                        this.ShowMsg("恢复商品成功", true);
                        this.BindProducts(this.exchangeId);
                        return;
                    }
                    this.ShowMsg("恢复商品失败", false);
                    return;
                }
            }
            else if (commandName == "Pause")
            {
                if (!string.IsNullOrEmpty(base.Request["id"].ToString()))
                {
                    int    num2        = int.Parse(base.Request["id"]);
                    string productIds2 = e.CommandArgument.ToString();
                    bool   flag2       = PointExChangeHelper.SetProductsStatus(num2, 1, productIds2);
                    if (flag2)
                    {
                        this.ShowMsg("暂停商品成功", true);
                        this.BindProducts(this.exchangeId);
                        return;
                    }
                    this.ShowMsg("暂停商品失败", false);
                    return;
                }
            }
            else if (commandName == "Delete" && !string.IsNullOrEmpty(base.Request["id"].ToString()))
            {
                int    num3 = int.Parse(base.Request["id"]);
                string text = e.CommandArgument.ToString();
                if (!string.IsNullOrEmpty(text))
                {
                    int productExchangedCount = PointExChangeHelper.GetProductExchangedCount(num3, int.Parse(text));
                    if (productExchangedCount > 0)
                    {
                        this.ShowMsg("该商品已经存在兑换记录,不能移除!", false);
                        return;
                    }
                    bool flag3 = PointExChangeHelper.DeleteProducts(num3, text);
                    if (flag3)
                    {
                        this.ShowMsg("删除商品成功", true);
                        this.BindProducts(this.exchangeId);
                        return;
                    }
                    this.ShowMsg("删除商品失败", false);
                }
            }
        }