Beispiel #1
0
        protected void Page_Load(object sender, System.EventArgs e)
        {
            string text = base.Request.Form["action"];

            if (!string.IsNullOrEmpty(text))
            {
                this.AjaxAction(text);
            }
            this.EditId  = base.Request.QueryString["aid"];
            this.viewAid = base.Request.QueryString["vaid"];
            if (string.IsNullOrEmpty(this.EditId))
            {
                this.EditId = this.viewAid;
            }
            if (!string.IsNullOrEmpty(this.EditId))
            {
                OneyuanTaoInfo oneyuanTaoInfoById = OneyuanTaoHelp.GetOneyuanTaoInfoById(this.EditId);
                if (oneyuanTaoInfoById != null)
                {
                    this.SetMemberRange.Grade        = oneyuanTaoInfoById.FitMember;
                    this.SetMemberRange.DefualtGroup = oneyuanTaoInfoById.DefualtGroup;
                    this.SetMemberRange.CustomGroup  = oneyuanTaoInfoById.CustomGroup;
                    this.OneTaoState = OneyuanTaoHelp.getOneTaoState(oneyuanTaoInfoById);
                    if (this.OneTaoState == OneTaoState.已结束 && string.IsNullOrEmpty(this.viewAid))
                    {
                        base.Response.Redirect("OneyuanList.aspx");
                        base.Response.End();
                    }
                    ProductInfo productBaseInfo = ProductHelper.GetProductBaseInfo(oneyuanTaoInfoById.ProductId);
                    if (productBaseInfo != null)
                    {
                        oneyuanTaoInfoById.MaxPrice = productBaseInfo.MarketPrice.Value;
                        oneyuanTaoInfoById.storeKc  = ProductHelper.GetProductSumStock(oneyuanTaoInfoById.ProductId);
                    }
                    this.EditJsonDataStr = "EditJsonData=" + JsonConvert.SerializeObject(oneyuanTaoInfoById, new JsonConverter[]
                    {
                        new IsoDateTimeConverter
                        {
                            DateTimeFormat = "yyyy-MM-dd HH:mm:ss"
                        }
                    });
                    if (!string.IsNullOrEmpty(this.viewAid))
                    {
                        this.txtEditInfo.InnerHtml = "查看一元夺宝<small>当前为查看模式,不可编辑活动内容</small>";
                        return;
                    }
                    this.txtEditInfo.InnerHtml = "编辑一元夺宝<small>进行中的活动,只可以修改活动标题及活动详情,其它信息不能修改</small>";
                }
            }
        }
Beispiel #2
0
        void BindData()
        {
            OneyuanTaoQuery query = new OneyuanTaoQuery();

            query.PageIndex = pager.PageIndex;
            query.PageSize  = pager.PageSize;
            query.title     = atitle;
            query.state     = state;
            query.ReachType = ReachType;
            DbQueryResult ListData = OneyuanTaoHelp.GetOneyuanTao(query);

            if (ListData.Data != null)
            {
                DataTable dt = (DataTable)ListData.Data;
                dt.Columns.Add("ActionBtn");  //显示的按钮
                dt.Columns.Add("ASate");      //当前状态
                dt.Columns.Add("PrizeState"); //开奖状态
                dt.Columns.Add("CanDel");     //开奖状态

                foreach (DataRow Item in dt.Rows)
                {
                    OneyuanTaoInfo   tempItem      = OneyuanTaoHelp.DataRowToOneyuanTaoInfo(Item);
                    OneTaoState      rowState      = OneyuanTaoHelp.getOneTaoState(tempItem);
                    OneTaoPrizeState rowPrizeState = OneyuanTaoHelp.getPrizeState(tempItem);

                    Item["ASate"]      = rowState;
                    Item["PrizeState"] = rowPrizeState;
                    Item["CanDel"]     = 0;

                    if (rowPrizeState == OneTaoPrizeState.成功开奖)
                    {
                        Item["PrizeState"] = "<span class='success'>" + rowPrizeState + "<span>";
                    }
                    else if (rowPrizeState == OneTaoPrizeState.已关闭)
                    {
                        Item["PrizeState"] = "<span class='normal'>" + rowPrizeState + "<span>";
                    }
                    else if (rowPrizeState == OneTaoPrizeState.待退款)
                    {
                        Item["PrizeState"] = "<span class='green'>" + rowPrizeState + "<span>";
                    }
                    else
                    {
                        Item["PrizeState"] = "<span class='errcss'>" + rowPrizeState + "<span>";
                    }


                    string btnstr = "<a class=\"btn btn-xs btn-primary\" onclick=\"AView('" + Item["ActivityId"] + "')\" >查看</a> ";

                    if (rowState == OneTaoState.进行中 || rowState == OneTaoState.未开始)
                    {
                        btnstr += "<a class=\"btn btn-xs btn-primary\" onclick=\"AEdit('" + Item["ActivityId"] + "')\"  >编辑</a> ";
                    }


                    if (rowState == OneTaoState.未开始)
                    {
                        btnstr += "<a class=\"btn btn-xs btn-success\" onclick=\"AStart('" + Item["ActivityId"] + "')\"  >开启</a> ";
                    }

                    if (rowState == OneTaoState.进行中)
                    {
                        btnstr += "<a class=\"btn btn-xs btn-danger\" onclick=\"AEnd('" + Item["ActivityId"] + "','" + Item["FinishedNum"] + "','" + Item["ReachType"] + "','" + Item["ReachNum"] + "')\"  >结束</a> ";
                    }


                    if ((rowState == OneTaoState.已结束 && (int)Item["FinishedNum"] == 0) || rowState == OneTaoState.未开始)
                    {
                        //可删除的活动,1未开始,2已结束且没有人参与的活动

                        btnstr        += "<a class=\"btn btn-xs btn-danger\" onclick=\"ADel('" + Item["ActivityId"] + "')\" >删除</a> ";
                        Item["CanDel"] = 1;
                    }


                    if (rowState == OneTaoState.开奖失败)
                    {
                        btnstr += "<a class=\"btn btn-xs btn-danger\" onclick=\"BatchRefund('" + Item["ActivityId"] + "')\" >批量退款</a> ";
                    }

                    Item["ActionBtn"] = btnstr;
                }


                Datalist.DataSource = dt;
                Datalist.DataBind();
                pager.TotalRecords = ListData.TotalRecords;

                int hasStart  = 0;
                int waitStart = 0;
                int Total     = 0;
                int hasEnd    = 0;

                Total = OneyuanTaoHelp.GetOneyuanTaoTotalNum(out hasStart, out waitStart, out hasEnd);

                ListTotal.Text = "所有夺宝(" + Total.ToString() + ")";
                ListStart.Text = "进行中(" + hasStart.ToString() + ")";
                ListWait.Text  = "未开始(" + waitStart.ToString() + ")";
                Listend.Text   = "已结束(" + hasEnd.ToString() + ")";
            }



            //DataTable dt = (DataTable)productSet.Data;
            //dt.Columns.Add("setStatus");

            pager.TotalRecords = ListData.TotalRecords;
        }
Beispiel #3
0
        protected void Page_Load(object sender, System.EventArgs e)
        {
            string text = base.Request.QueryString.Get("orderId");

            if (string.IsNullOrEmpty(text))
            {
                this.pay_json = "{\"msg\":\"订单参数错误!\"}";
                return;
            }
            OneyuanTaoParticipantInfo addParticipant = OneyuanTaoHelp.GetAddParticipant(0, text, "");

            if (addParticipant == null)
            {
                this.pay_json = "{\"msg\":\"订单不存在了!\"}";
                return;
            }
            OneyuanTaoInfo oneyuanTaoInfoById = OneyuanTaoHelp.GetOneyuanTaoInfoById(addParticipant.ActivityId);

            if (oneyuanTaoInfoById == null)
            {
                this.pay_json = "{\"msg\":\"活动已取消,禁止参与!\"}";
                return;
            }
            OneTaoState oneTaoState = OneyuanTaoHelp.getOneTaoState(oneyuanTaoInfoById);

            if (oneTaoState != OneTaoState.进行中)
            {
                this.pay_json = "{\"msg\":\"您来晚了,活动已结束!\"}";
                return;
            }
            if (oneTaoState != OneTaoState.进行中)
            {
                this.pay_json = "{\"msg\":\"您来晚了,活动已结束!\"}";
                return;
            }
            if (oneyuanTaoInfoById.ReachType == 1 && oneyuanTaoInfoById.FinishedNum + addParticipant.BuyNum > oneyuanTaoInfoById.ReachNum)
            {
                this.pay_json = "{\"msg\":\"活动已满员,您来晚了!\"}";
                return;
            }
            decimal     totalPrice  = addParticipant.TotalPrice;
            PackageInfo packageInfo = new PackageInfo();

            packageInfo.Body       = "一元夺宝。当前活动编号:" + addParticipant.ActivityId;
            packageInfo.NotifyUrl  = string.Format("http://{0}/pay/wx_Pay.aspx", base.Request.Url.Host);
            packageInfo.OutTradeNo = text;
            packageInfo.TotalFee   = (int)(totalPrice * 100m);
            if (packageInfo.TotalFee < 1m)
            {
                packageInfo.TotalFee = 1m;
            }
            string     openId        = "";
            MemberInfo currentMember = MemberProcessor.GetCurrentMember();

            if (currentMember != null)
            {
                openId = currentMember.OpenId;
            }
            else
            {
                this.pay_json = "{\"msg\":\"用户OPENID不存在,无法支付!\"}";
            }
            packageInfo.OpenId = openId;
            SiteSettings masterSettings = SettingsManager.GetMasterSettings(true);
            PayClient    payClient;

            if (masterSettings.EnableSP)
            {
                payClient = new PayClient(masterSettings.Main_AppId, masterSettings.WeixinAppSecret, masterSettings.Main_Mch_ID, masterSettings.Main_PayKey, true, masterSettings.WeixinAppId, masterSettings.WeixinPartnerID);
            }
            else
            {
                payClient = new PayClient(masterSettings.WeixinAppId, masterSettings.WeixinAppSecret, masterSettings.WeixinPartnerID, masterSettings.WeixinPartnerKey, false, "", "");
            }
            if (!payClient.checkSetParams(out this.CheckValue))
            {
                return;
            }
            if (!payClient.checkPackage(packageInfo, out this.CheckValue))
            {
                return;
            }
            PayRequestInfo payRequestInfo = payClient.BuildPayRequest(packageInfo);

            this.pay_json = this.ConvertPayJson(payRequestInfo);
            if (!payRequestInfo.package.ToLower().StartsWith("prepay_id=wx"))
            {
                this.CheckValue = payRequestInfo.package;
            }
        }
Beispiel #4
0
        protected void Page_Load(object sender, EventArgs e)
        {
            string str = base.Request.QueryString.Get("orderId");

            if (string.IsNullOrEmpty(str))
            {
                this.pay_json = "{\"msg\":\"订单参数错误!\"}";
            }
            else
            {
                OneyuanTaoParticipantInfo info = OneyuanTaoHelp.GetAddParticipant(0, str, "");
                if (info == null)
                {
                    this.pay_json = "{\"msg\":\"订单不存在了!\"}";
                }
                else
                {
                    OneyuanTaoInfo oneyuanTaoInfoById = OneyuanTaoHelp.GetOneyuanTaoInfoById(info.ActivityId);
                    if (oneyuanTaoInfoById == null)
                    {
                        this.pay_json = "{\"msg\":\"活动已取消,禁止参与!\"}";
                    }
                    else
                    {
                        OneTaoState state = OneyuanTaoHelp.getOneTaoState(oneyuanTaoInfoById);
                        if (state != OneTaoState.进行中)
                        {
                            this.pay_json = "{\"msg\":\"您来晚了,活动已结束!\"}";
                        }
                        else if (state != OneTaoState.进行中)
                        {
                            this.pay_json = "{\"msg\":\"您来晚了,活动已结束!\"}";
                        }
                        else if ((oneyuanTaoInfoById.ReachType == 1) && ((oneyuanTaoInfoById.FinishedNum + info.BuyNum) > oneyuanTaoInfoById.ReachNum))
                        {
                            this.pay_json = "{\"msg\":\"活动已满员,您来晚了!\"}";
                        }
                        else
                        {
                            PayClient   client;
                            decimal     totalPrice = info.TotalPrice;
                            PackageInfo package    = new PackageInfo
                            {
                                Body       = Globals.SubStr(oneyuanTaoInfoById.ProductTitle, 0x24, "...") + "。活动编号:" + info.ActivityId,
                                NotifyUrl  = string.Format("http://{0}/pay/wx_Pay.aspx", base.Request.Url.Host),
                                OutTradeNo = str,
                                TotalFee   = (int)(totalPrice * 100M)
                            };
                            if (package.TotalFee < 1M)
                            {
                                package.TotalFee = 1M;
                            }
                            string     openId        = "";
                            MemberInfo currentMember = MemberProcessor.GetCurrentMember();
                            if (currentMember != null)
                            {
                                openId = currentMember.OpenId;
                            }
                            else
                            {
                                this.pay_json = "{\"msg\":\"用户OPENID不存在,无法支付!\"}";
                            }
                            package.OpenId = openId;
                            SiteSettings masterSettings = SettingsManager.GetMasterSettings(true);
                            if (masterSettings.EnableSP)
                            {
                                client = new PayClient(masterSettings.Main_AppId, masterSettings.WeixinAppSecret, masterSettings.Main_Mch_ID, masterSettings.Main_PayKey, true, masterSettings.WeixinAppId, masterSettings.WeixinPartnerID);
                            }
                            else
                            {
                                client = new PayClient(masterSettings.WeixinAppId, masterSettings.WeixinAppSecret, masterSettings.WeixinPartnerID, masterSettings.WeixinPartnerKey, false, "", "");
                            }
                            if (client.checkSetParams(out this.CheckValue) && client.checkPackage(package, out this.CheckValue))
                            {
                                PayRequestInfo req = client.BuildPayRequest(package);
                                this.pay_json = this.ConvertPayJson(req);
                                if (!req.package.ToLower().StartsWith("prepay_id=wx"))
                                {
                                    this.CheckValue = req.package;
                                }
                            }
                        }
                    }
                }
            }
        }
        private void DoOneTaoPay(string Pid)
        {
            if (string.IsNullOrEmpty(Pid))
            {
                base.Response.Write("支付参数不正确!<a href='javascript:history.go(-1);'>返回上一页</a>");
                base.Response.End();
            }
            OneyuanTaoParticipantInfo info = OneyuanTaoHelp.GetAddParticipant(0, Pid, "");

            if (info == null)
            {
                base.Response.Write("您的夺宝信息已被删除!<a href='javascript:history.go(-1);'>返回上一页</a>");
                base.Response.End();
            }
            OneyuanTaoInfo oneyuanTaoInfoById = OneyuanTaoHelp.GetOneyuanTaoInfoById(info.ActivityId);

            if (oneyuanTaoInfoById == null)
            {
                base.Response.Write("夺宝活动已被删除,你无法完成支付!<a href='javascript:history.go(-1);'>返回上一页</a>");
                base.Response.End();
            }
            OneTaoState state = OneyuanTaoHelp.getOneTaoState(oneyuanTaoInfoById);

            if (state != OneTaoState.进行中)
            {
                base.Response.Write("当前活动" + state.ToString() + ",无法支付!<a href='javascript:history.go(-1);'>返回上一页</a>");
                base.Response.End();
            }
            if ((oneyuanTaoInfoById.FinishedNum + info.BuyNum) > oneyuanTaoInfoById.ReachNum)
            {
                base.Response.Write("活动已满员,您可以试下其它活动!<a href='/Vshop/OneyuanList.aspx'>夺宝活动中心</a>");
                base.Response.End();
            }
            SiteSettings masterSettings = SettingsManager.GetMasterSettings(true);
            string       partner        = masterSettings.Alipay_Pid;
            string       str3           = masterSettings.Alipay_Key;
            string       str4           = "utf-8";

            Core.setConfig(partner, "MD5", str3, str4);
            string  str5       = "1";
            string  str6       = Globals.FullPath("/Vshop/OneTaoPaySuccess.aspx");
            string  str7       = Globals.FullPath("/Pay/wap_alipay_notify_url.aspx");
            string  str8       = Pid;
            string  str9       = "订单支付";
            decimal totalPrice = info.TotalPrice;
            string  str10      = Globals.FullPath("/Vshop/OneTaoPayView.aspx?Pid=") + Pid;
            string  str11      = "一元夺宝支付,当前支付编号-" + Pid + " ...";
            string  str12      = "1m";
            string  str13      = "";
            SortedDictionary <string, string> sParaTemp = new SortedDictionary <string, string>();

            sParaTemp.Add("partner", partner);
            sParaTemp.Add("seller_id", partner);
            sParaTemp.Add("_input_charset", str4);
            sParaTemp.Add("service", "alipay.wap.create.direct.pay.by.user");
            sParaTemp.Add("payment_type", str5);
            sParaTemp.Add("notify_url", str7);
            sParaTemp.Add("return_url", str6);
            sParaTemp.Add("out_trade_no", str8);
            sParaTemp.Add("subject", str9);
            sParaTemp.Add("total_fee", totalPrice.ToString("F"));
            sParaTemp.Add("show_url", str10);
            sParaTemp.Add("body", str11);
            sParaTemp.Add("it_b_pay", str12);
            sParaTemp.Add("extern_token", str13);
            string s = Core.BuildRequest(sParaTemp, "get", "确认");

            base.Response.Write(s);
        }
Beispiel #6
0
        protected override void AttachChildControls()
        {
            this.Vaid = Globals.RequestQueryStr("vaid");
            if (string.IsNullOrEmpty(this.Vaid))
            {
                base.GotoResourceNotFound("");
            }
            OneyuanTaoInfo oneyuanTaoInfoById = OneyuanTaoHelp.GetOneyuanTaoInfoById(this.Vaid);

            if (oneyuanTaoInfoById == null)
            {
                base.GotoResourceNotFound("");
            }
            this.productId = oneyuanTaoInfoById.ProductId;
            ProductInfo product = ProductBrowser.GetProduct(MemberProcessor.GetCurrentMember(), this.productId);

            if (product == null)
            {
                base.GotoResourceNotFound("");
            }
            OneTaoState oneTaoState = OneyuanTaoHelp.getOneTaoState(oneyuanTaoInfoById);

            this.rptProductImages      = (VshopTemplatedRepeater)this.FindControl("rptProductImages");
            this.litItemParams         = (System.Web.UI.WebControls.Literal) this.FindControl("litItemParams");
            this.litProdcutName        = (System.Web.UI.WebControls.Literal) this.FindControl("litProdcutName");
            this.litProdcutTag         = (System.Web.UI.WebControls.Literal) this.FindControl("litProdcutTag");
            this.litSalePrice          = (System.Web.UI.WebControls.Literal) this.FindControl("litSalePrice");
            this.litMarketPrice        = (System.Web.UI.WebControls.Literal) this.FindControl("litMarketPrice");
            this.litShortDescription   = (System.Web.UI.WebControls.Literal) this.FindControl("litShortDescription");
            this.litDescription        = (System.Web.UI.WebControls.Literal) this.FindControl("litDescription");
            this.litStock              = (System.Web.UI.WebControls.Literal) this.FindControl("litStock");
            this.litSoldCount          = (System.Web.UI.WebControls.Literal) this.FindControl("litSoldCount");
            this.litConsultationsCount = (System.Web.UI.WebControls.Literal) this.FindControl("litConsultationsCount");
            this.litReviewsCount       = (System.Web.UI.WebControls.Literal) this.FindControl("litReviewsCount");
            this.litActivityId         = (System.Web.UI.WebControls.Literal) this.FindControl("litActivityId");
            this.litState              = (System.Web.UI.WebControls.Literal) this.FindControl("litState");
            this.PrizeTime             = (System.Web.UI.HtmlControls.HtmlControl) this.FindControl("PrizeTime");
            this.buyNum           = (System.Web.UI.HtmlControls.HtmlControl) this.FindControl("buyNum");
            this.SaveBtn          = (System.Web.UI.HtmlControls.HtmlControl) this.FindControl("SaveBtn");
            this.ViewtReview      = (System.Web.UI.HtmlControls.HtmlControl) this.FindControl("ViewtReview");
            this.litMaxtxt        = (System.Web.UI.WebControls.Literal) this.FindControl("litMaxtxt");
            this.expandAttr       = (Common_ExpandAttributes)this.FindControl("ExpandAttributes");
            this.skuSelector      = (Common_SKUSelector)this.FindControl("skuSelector");
            this.NomachMember     = (System.Web.UI.HtmlControls.HtmlContainerControl) this.FindControl("NomachMember");
            this.litMinNum        = (System.Web.UI.WebControls.Literal) this.FindControl("litMinNum");
            this.litPrizeNum      = (System.Web.UI.WebControls.Literal) this.FindControl("litPrizeNum");
            this.litFinished      = (System.Web.UI.WebControls.Literal) this.FindControl("litFinished");
            this.Prizeprogress    = (System.Web.UI.HtmlControls.HtmlControl) this.FindControl("Prizeprogress");
            this.litBuytxt        = (System.Web.UI.WebControls.Literal) this.FindControl("litBuytxt");
            this.litPrizeNum.Text = oneyuanTaoInfoById.ReachNum.ToString();
            this.litFinished.Text = oneyuanTaoInfoById.FinishedNum.ToString();
            int num = oneyuanTaoInfoById.ReachNum - oneyuanTaoInfoById.FinishedNum;

            if (num < 0)
            {
                num = 0;
            }
            this.litMinNum.Text = num.ToString();
            float num2 = (float)(100 * oneyuanTaoInfoById.FinishedNum / oneyuanTaoInfoById.ReachNum);

            this.Prizeprogress.Attributes.Add("style", "width:" + num2.ToString("F0") + "%");
            this.ViewtReview.Attributes.Add("href", "ProductReview.aspx?ProductId=" + oneyuanTaoInfoById.ProductId.ToString());
            if (this.expandAttr != null)
            {
                this.expandAttr.ProductId = this.productId;
            }
            this.skuSelector.ProductId = this.productId;
            if (product != null)
            {
                if (this.rptProductImages != null)
                {
                    string       locationUrl = "javascript:;";
                    SlideImage[] source      = new SlideImage[]
                    {
                        new SlideImage(product.ImageUrl1, locationUrl),
                        new SlideImage(product.ImageUrl2, locationUrl),
                        new SlideImage(product.ImageUrl3, locationUrl),
                        new SlideImage(product.ImageUrl4, locationUrl),
                        new SlideImage(product.ImageUrl5, locationUrl)
                    };
                    this.rptProductImages.DataSource = from item in source
                                                       where !string.IsNullOrWhiteSpace(item.ImageUrl)
                                                       select item;
                    this.rptProductImages.DataBind();
                }
                this.litShortDescription.Text = product.ShortDescription;
            }
            int num3 = OneyuanTaoHelp.MermberCanbuyNum(oneyuanTaoInfoById.ActivityId, Globals.GetCurrentMemberUserId());

            this.buyNum.Attributes.Add("max", num3.ToString());
            this.litBuytxt.Text = string.Concat(new object[]
            {
                "限购",
                oneyuanTaoInfoById.EachCanBuyNum,
                "份,每份价格¥",
                oneyuanTaoInfoById.EachPrice.ToString("F2")
            });
            this.litMaxtxt.Text = "您已订购<di>" + (oneyuanTaoInfoById.EachCanBuyNum - num3).ToString() + "</di>份";
            if (num3 == 0 || oneTaoState != OneTaoState.进行中 || !MemberHelper.CheckCurrentMemberIsInRange(oneyuanTaoInfoById.FitMember, oneyuanTaoInfoById.DefualtGroup, oneyuanTaoInfoById.CustomGroup, this.CurrentMemberInfo.UserId))
            {
                this.buyNum.Attributes.Add("disabled", "disabled");
                this.SaveBtn.Visible = false;
            }
            string text;

            if (oneyuanTaoInfoById.FitMember == "0" || oneyuanTaoInfoById.CustomGroup == "0")
            {
                text = "全部会员";
            }
            else
            {
                text = "部分会员";
            }
            text = "适用会员:" + text;
            if (oneyuanTaoInfoById.FitMember != "0" && !MemberHelper.CheckCurrentMemberIsInRange(oneyuanTaoInfoById.FitMember, oneyuanTaoInfoById.DefualtGroup, oneyuanTaoInfoById.CustomGroup, this.CurrentMemberInfo.UserId))
            {
                text = "会员等级不符合活动要求";
                this.NomachMember.Attributes.Add("CanBuy", "false");
            }
            this.NomachMember.InnerHtml = text;
            string productName = product.ProductName;
            string text2       = product.Description;

            if (!string.IsNullOrEmpty(text2))
            {
                text2 = System.Text.RegularExpressions.Regex.Replace(text2, "<img[^>]*\\bsrc=('|\")([^'\">]*)\\1[^>]*>", "<img alt='" + System.Web.HttpContext.Current.Server.HtmlEncode(productName) + "' src='$2' />", System.Text.RegularExpressions.RegexOptions.IgnoreCase);
            }
            if (this.litDescription != null)
            {
                this.litDescription.Text = text2;
            }
            this.litProdcutName.Text = productName;
            this.litSalePrice.Text   = product.MinSalePrice.ToString("F2");
            this.litActivityId.Text  = oneyuanTaoInfoById.ActivityId;
            if (oneyuanTaoInfoById.ReachType == 1)
            {
                this.litActivityId.Text = "活动结束前满足总需份数,自动开出" + oneyuanTaoInfoById.PrizeNumber + "个奖品";
            }
            else if (oneyuanTaoInfoById.ReachType == 2)
            {
                this.litActivityId.Text = "活动到期自动开出" + oneyuanTaoInfoById.PrizeNumber + "个奖品";
            }
            else if (oneyuanTaoInfoById.ReachType == 3)
            {
                this.litActivityId.Text = "到开奖时间并满足总需份数,自动开出" + oneyuanTaoInfoById.PrizeNumber + "个奖品";
            }
            this.PrizeTime.Attributes.Add("PrizeTime", oneyuanTaoInfoById.EndTime.ToString("G"));
            this.litState.Text = oneTaoState.ToString();
            if (oneTaoState == OneTaoState.已开奖)
            {
                IsoDateTimeConverter isoDateTimeConverter = new IsoDateTimeConverter();
                isoDateTimeConverter.DateTimeFormat = "yyyy-MM-dd HH:mm:ss";
                System.Web.UI.WebControls.Literal           literal            = (System.Web.UI.WebControls.Literal) this.FindControl("LitDataJson");
                System.Collections.Generic.IList <LuckInfo> winnerLuckInfoList = OneyuanTaoHelp.getWinnerLuckInfoList(oneyuanTaoInfoById.ActivityId, "");
                if (winnerLuckInfoList != null)
                {
                    literal.Text = "var LitDataJson=" + JsonConvert.SerializeObject(winnerLuckInfoList, new JsonConverter[]
                    {
                        isoDateTimeConverter
                    });
                }
                else
                {
                    literal.Text = "var LitDataJson=null";
                }
            }
            System.Web.UI.WebControls.Literal literal2 = (System.Web.UI.WebControls.Literal) this.FindControl("litJs");
            string title       = oneyuanTaoInfoById.Title;
            string activityDec = oneyuanTaoInfoById.ActivityDec;

            System.Uri url   = this.Context.Request.Url;
            string     text3 = url.Scheme + "://" + url.Host + ((url.Port == 80) ? "" : (":" + url.Port.ToString()));
            string     text4 = oneyuanTaoInfoById.ProductImg;

            if (text4 == "/utility/pics/none.gif")
            {
                text4 = oneyuanTaoInfoById.HeadImgage;
            }
            literal2.Text = string.Concat(new string[]
            {
                "<script>wxinshare_title=\"",
                this.Context.Server.HtmlEncode(title.Replace("\n", " ").Replace("\r", "")),
                "\";wxinshare_desc=\"",
                this.Context.Server.HtmlEncode(activityDec.Replace("\n", " ").Replace("\r", "")),
                "\";wxinshare_link=location.href;wxinshare_imgurl=\"",
                text3,
                text4,
                "\"</script>"
            });
            PageTitle.AddSiteNameTitle("一元夺宝商品详情");
        }
Beispiel #7
0
        private void BindData()
        {
            OneyuanTaoQuery query = new OneyuanTaoQuery {
                PageIndex = this.pager.PageIndex,
                PageSize  = this.pager.PageSize,
                title     = this.atitle,
                state     = this.state,
                ReachType = this.ReachType
            };
            DbQueryResult oneyuanTao = OneyuanTaoHelp.GetOneyuanTao(query);

            if (oneyuanTao.Data != null)
            {
                DataTable data = (DataTable)oneyuanTao.Data;
                data.Columns.Add("ActionBtn");
                data.Columns.Add("ASate");
                data.Columns.Add("PrizeState");
                data.Columns.Add("CanDel");
                foreach (DataRow row in data.Rows)
                {
                    OneyuanTaoInfo   info  = OneyuanTaoHelp.DataRowToOneyuanTaoInfo(row);
                    OneTaoPrizeState state = OneyuanTaoHelp.getPrizeState(info);
                    row["PrizeState"] = state;
                    row["CanDel"]     = 0;
                    switch (state)
                    {
                    case OneTaoPrizeState.成功开奖:
                        row["PrizeState"] = "<span class='success'>" + state + "<span>";
                        break;

                    case OneTaoPrizeState.已关闭:
                        row["PrizeState"] = "<span class='normal'>" + state + "<span>";
                        break;

                    case OneTaoPrizeState.待退款:
                        if (OneyuanTaoHelp.CheckIsAll(row["ActivityId"].ToString()))
                        {
                            info.IsAllRefund  = true;
                            row["PrizeState"] = "<span class='errcss'>已退款<span>";
                        }
                        else
                        {
                            row["PrizeState"] = "<span class='green'>" + state + "<span>";
                        }
                        break;

                    default:
                        row["PrizeState"] = "<span class='errcss'>" + state + "<span>";
                        break;
                    }
                    OneTaoState state2 = OneyuanTaoHelp.getOneTaoState(info);
                    row["ASate"] = state2;
                    string str2 = "<a class=\"btn btn-xs btn-primary\" onclick=\"AView('" + row["ActivityId"] + "')\" >查看</a> ";
                    switch (state2)
                    {
                    case OneTaoState.进行中:
                    case OneTaoState.未开始:
                    {
                        object obj2 = str2;
                        str2 = string.Concat(new object[] { obj2, "<a class=\"btn btn-xs btn-primary\" onclick=\"AEdit('", row["ActivityId"], "')\"  >编辑</a> " });
                        break;
                    }
                    }
                    switch (state2)
                    {
                    case OneTaoState.未开始:
                    {
                        object obj3 = str2;
                        str2 = string.Concat(new object[] { obj3, "<a class=\"btn btn-xs btn-success\" onclick=\"AStart('", row["ActivityId"], "')\"  >开启</a> " });
                        break;
                    }

                    case OneTaoState.进行中:
                    {
                        object obj4 = str2;
                        str2 = string.Concat(new object[] { obj4, "<a class=\"btn btn-xs btn-danger\" onclick=\"AEnd('", row["ActivityId"], "','", row["FinishedNum"], "','", row["ReachType"], "','", row["ReachNum"], "')\"  >结束</a> " });
                        break;
                    }
                    }
                    if (((state2 == OneTaoState.已结束) && (((int)row["FinishedNum"]) == 0)) || ((state2 == OneTaoState.未开始) || (state2 == OneTaoState.退款完成)))
                    {
                        object obj5 = str2;
                        str2          = string.Concat(new object[] { obj5, "<a class=\"btn btn-xs btn-danger\" onclick=\"ADel('", row["ActivityId"], "')\" >删除</a> " });
                        row["CanDel"] = 1;
                    }
                    if (state2 == OneTaoState.开奖失败)
                    {
                        object obj6 = str2;
                        str2 = string.Concat(new object[] { obj6, "<a class=\"btn btn-xs btn-danger\" onclick=\"BatchRefund('", row["ActivityId"], "')\" >批量退款</a> " });
                    }
                    row["ActionBtn"] = str2;
                }
                this.Datalist.DataSource = data;
                this.Datalist.DataBind();
                this.pager.TotalRecords = oneyuanTao.TotalRecords;
                int hasStart  = 0;
                int waitStart = 0;
                int hasEnd    = 0;
                this.ListTotal.Text = "所有夺宝(" + OneyuanTaoHelp.GetOneyuanTaoTotalNum(out hasStart, out waitStart, out hasEnd).ToString() + ")";
                this.ListStart.Text = "进行中(" + hasStart.ToString() + ")";
                this.ListWait.Text  = "未开始(" + waitStart.ToString() + ")";
                this.Listend.Text   = "已结束(" + hasEnd.ToString() + ")";
            }
            this.pager.TotalRecords = oneyuanTao.TotalRecords;
        }
Beispiel #8
0
        private void AjaxAction(string action)
        {
            string s = "{\"state\":false,\"msg\":\"未定义操作\"}";

            System.Collections.Specialized.NameValueCollection form = base.Request.Form;
            switch (action)
            {
            case "Del":
            {
                s = "{\"state\":false,\"msg\":\"活动信息未找到失败\"}";
                string text = form["Aid"];
                if (!string.IsNullOrEmpty(text))
                {
                    OneyuanTaoInfo oneyuanTaoInfoById = OneyuanTaoHelp.GetOneyuanTaoInfoById(text);
                    if (oneyuanTaoInfoById != null)
                    {
                        if (OneyuanTaoHelp.DeleteOneyuanTao(text))
                        {
                            s = "{\"state\":true,\"msg\":\"删除成功\"}";
                            OneyuanTaoHelp.DelParticipantMember(text, true);
                        }
                        else
                        {
                            s = "{\"state\":false,\"msg\":\"该活动已有人参与,不能删除!\"}";
                        }
                    }
                }
                break;
            }

            case "BatchDel":
            {
                s = "{\"state\":false,\"msg\":\"批量删除失败\"}";
                string text = form["Aids"];
                if (!string.IsNullOrEmpty(text))
                {
                    string[] array = text.Split(new char[]
                        {
                            ','
                        });
                    int num2 = OneyuanTaoHelp.BatchDeleteOneyuanTao(array);
                    if (num2 > 0)
                    {
                        s = string.Concat(new string[]
                            {
                                "{\"state\":true,\"msg\":\"成功删除",
                                num2.ToString(),
                                "条数据,失败",
                                (array.Length - num2).ToString(),
                                "条!\"}"
                            });
                        string[] array2 = array;
                        for (int i = 0; i < array2.Length; i++)
                        {
                            string activityId = array2[i];
                            OneyuanTaoHelp.DelParticipantMember(activityId, true);
                        }
                    }
                    else
                    {
                        s = "{\"state\":false,\"msg\":\"没有找到可删除的数据!\"}";
                    }
                }
                break;
            }

            case "EndII":
            {
                string text  = form["Aid"];
                string text2 = form["CanDraw"];
                if (string.IsNullOrEmpty(text) || string.IsNullOrEmpty(text2))
                {
                    s = "{\"state\":false,\"msg\":\"参数错误\"}";
                }
                else if (text2.Trim() == "1")
                {
                    string text3 = OneyuanTaoHelp.CalculateWinner(text);
                    if (text3 == "success")
                    {
                        s = "{\"state\":true,\"msg\":\"手动开奖成功!\"}";
                    }
                    else
                    {
                        s = "{\"state\":false,\"msg\":\"" + text3 + "\"}";
                    }
                }
                else if (OneyuanTaoHelp.SetOneyuanTaoIsOn(text, false))
                {
                    s = "{\"state\":true,\"msg\":\"提前终止活动成功!!\"}";
                    OneyuanTaoHelp.DelParticipantMember(text, true);
                }
                else
                {
                    s = "{\"state\":false,\"msg\":\"提前终止活动失败!\"}";
                }
                break;
            }

            case "End":
            {
                s = "{\"state\":false,\"msg\":\"结束失败\"}";
                string text = form["Aid"];
                if (!string.IsNullOrEmpty(text))
                {
                    OneyuanTaoInfo oneyuanTaoInfoById = OneyuanTaoHelp.GetOneyuanTaoInfoById(text);
                    if (oneyuanTaoInfoById != null)
                    {
                        OneTaoState oneTaoState = this.getOneTaoState(oneyuanTaoInfoById);
                        if (oneTaoState == OneTaoState.进行中)
                        {
                            if (OneyuanTaoHelp.SetOneyuanTaoIsOn(text, false))
                            {
                                s = "{\"state\":true,\"msg\":\"提前终止活动成功!!\"}";
                                OneyuanTaoHelp.DelParticipantMember(text, true);
                            }
                            else
                            {
                                s = "{\"state\":false,\"msg\":\"提前终止活动失败!\"}";
                            }
                        }
                        else
                        {
                            s = "{\"state\":false,\"msg\":\"提前终止活动失败!\"}";
                        }
                    }
                }
                break;
            }

            case "Start":
            {
                s = "{\"state\":false,\"msg\":\"操作开始失败\"}";
                string text = form["Aid"];
                if (!string.IsNullOrEmpty(text))
                {
                    OneyuanTaoInfo oneyuanTaoInfoById = OneyuanTaoHelp.GetOneyuanTaoInfoById(text);
                    if (oneyuanTaoInfoById != null)
                    {
                        if (this.getOneTaoState(oneyuanTaoInfoById) == OneTaoState.未开始)
                        {
                            if (OneyuanTaoHelp.SetOneyuanTaoIsOn(text, true))
                            {
                                s = "{\"state\":true,\"msg\":\"提前开启活动成功!!\"}";
                            }
                            else
                            {
                                s = "{\"state\":false,\"msg\":\"当前状态不能结束!\"}";
                            }
                        }
                        else
                        {
                            s = "{\"state\":false,\"msg\":\"当前状态开启活动!\"}";
                        }
                    }
                }
                break;
            }

            case "BatchStart":
            {
                s = "{\"state\":false,\"msg\":\"批量操作开始失败\"}";
                string text = form["Aids"];
                if (!string.IsNullOrEmpty(text))
                {
                    string[] array = text.Split(new char[]
                        {
                            ','
                        });
                    int num3 = OneyuanTaoHelp.BatchSetOneyuanTaoIsOn(array, true);
                    if (num3 > 0)
                    {
                        s = string.Concat(new string[]
                            {
                                "{\"state\":true,\"msg\":\"成功开启",
                                num3.ToString(),
                                "条活动,失败",
                                (array.Length - num3).ToString(),
                                "条!\"}"
                            });
                    }
                    else
                    {
                        s = "{\"state\":false,\"msg\":\"没有找到可开启的活动数据!\"}";
                    }
                }
                break;
            }
            }
            base.Response.ClearContent();
            base.Response.ContentType = "application/json";
            base.Response.Write(s);
            base.Response.End();
        }
Beispiel #9
0
        private void BindData()
        {
            DbQueryResult oneyuanTao = OneyuanTaoHelp.GetOneyuanTao(new OneyuanTaoQuery
            {
                PageIndex = this.pager.PageIndex,
                PageSize  = this.pager.PageSize,
                title     = this.atitle,
                state     = this.state,
                ReachType = this.ReachType
            });

            if (oneyuanTao.Data != null)
            {
                System.Data.DataTable dataTable = (System.Data.DataTable)oneyuanTao.Data;
                dataTable.Columns.Add("ActionBtn");
                dataTable.Columns.Add("ASate");
                dataTable.Columns.Add("PrizeState");
                dataTable.Columns.Add("CanDel");
                foreach (System.Data.DataRow dataRow in dataTable.Rows)
                {
                    OneyuanTaoInfo   info        = OneyuanTaoHelp.DataRowToOneyuanTaoInfo(dataRow);
                    OneTaoState      oneTaoState = OneyuanTaoHelp.getOneTaoState(info);
                    OneTaoPrizeState prizeState  = OneyuanTaoHelp.getPrizeState(info);
                    dataRow["ASate"]      = oneTaoState;
                    dataRow["PrizeState"] = prizeState;
                    dataRow["CanDel"]     = 0;
                    if (prizeState == OneTaoPrizeState.成功开奖)
                    {
                        dataRow["PrizeState"] = "<span class='success'>" + prizeState + "<span>";
                    }
                    else if (prizeState == OneTaoPrizeState.已关闭)
                    {
                        dataRow["PrizeState"] = "<span class='normal'>" + prizeState + "<span>";
                    }
                    else if (prizeState == OneTaoPrizeState.待退款)
                    {
                        dataRow["PrizeState"] = "<span class='green'>" + prizeState + "<span>";
                    }
                    else
                    {
                        dataRow["PrizeState"] = "<span class='errcss'>" + prizeState + "<span>";
                    }
                    string text = "<a class=\"btn btn-xs btn-primary\" onclick=\"AView('" + dataRow["ActivityId"] + "')\" >查看</a> ";
                    if (oneTaoState == OneTaoState.进行中 || oneTaoState == OneTaoState.未开始)
                    {
                        object obj = text;
                        text = string.Concat(new object[]
                        {
                            obj,
                            "<a class=\"btn btn-xs btn-primary\" onclick=\"AEdit('",
                            dataRow["ActivityId"],
                            "')\"  >编辑</a> "
                        });
                    }
                    if (oneTaoState == OneTaoState.未开始)
                    {
                        object obj2 = text;
                        text = string.Concat(new object[]
                        {
                            obj2,
                            "<a class=\"btn btn-xs btn-success\" onclick=\"AStart('",
                            dataRow["ActivityId"],
                            "')\"  >开启</a> "
                        });
                    }
                    if (oneTaoState == OneTaoState.进行中)
                    {
                        object obj3 = text;
                        text = string.Concat(new object[]
                        {
                            obj3,
                            "<a class=\"btn btn-xs btn-danger\" onclick=\"AEnd('",
                            dataRow["ActivityId"],
                            "','",
                            dataRow["FinishedNum"],
                            "','",
                            dataRow["ReachType"],
                            "','",
                            dataRow["ReachNum"],
                            "')\"  >结束</a> "
                        });
                    }
                    if ((oneTaoState == OneTaoState.已结束 && (int)dataRow["FinishedNum"] == 0) || oneTaoState == OneTaoState.未开始)
                    {
                        object obj4 = text;
                        text = string.Concat(new object[]
                        {
                            obj4,
                            "<a class=\"btn btn-xs btn-danger\" onclick=\"ADel('",
                            dataRow["ActivityId"],
                            "')\" >删除</a> "
                        });
                        dataRow["CanDel"] = 1;
                    }
                    if (oneTaoState == OneTaoState.开奖失败)
                    {
                        object obj5 = text;
                        text = string.Concat(new object[]
                        {
                            obj5,
                            "<a class=\"btn btn-xs btn-danger\" onclick=\"BatchRefund('",
                            dataRow["ActivityId"],
                            "')\" >批量退款</a> "
                        });
                    }
                    dataRow["ActionBtn"] = text;
                }
                this.Datalist.DataSource = dataTable;
                this.Datalist.DataBind();
                this.pager.TotalRecords = oneyuanTao.TotalRecords;
                int num  = 0;
                int num2 = 0;
                int num3 = 0;
                int oneyuanTaoTotalNum = OneyuanTaoHelp.GetOneyuanTaoTotalNum(out num, out num2, out num3);
                this.ListTotal.Text = "所有夺宝(" + oneyuanTaoTotalNum.ToString() + ")";
                this.ListStart.Text = "进行中(" + num.ToString() + ")";
                this.ListWait.Text  = "未开始(" + num2.ToString() + ")";
                this.Listend.Text   = "已结束(" + num3.ToString() + ")";
            }
            this.pager.TotalRecords = oneyuanTao.TotalRecords;
        }
Beispiel #10
0
        private void DoOneTaoPay(string Pid)
        {
            if (string.IsNullOrEmpty(Pid))
            {
                base.Response.Write("支付参数不正确!<a href='javascript:history.go(-1);'>返回上一页</a>");
                base.Response.End();
            }
            OneyuanTaoParticipantInfo addParticipant = OneyuanTaoHelp.GetAddParticipant(0, Pid, "");

            if (addParticipant == null)
            {
                base.Response.Write("您的夺宝信息已被删除!<a href='javascript:history.go(-1);'>返回上一页</a>");
                base.Response.End();
            }
            string         activityId         = addParticipant.ActivityId;
            OneyuanTaoInfo oneyuanTaoInfoById = OneyuanTaoHelp.GetOneyuanTaoInfoById(activityId);

            if (oneyuanTaoInfoById == null)
            {
                base.Response.Write("夺宝活动已被删除,你无法完成支付!<a href='javascript:history.go(-1);'>返回上一页</a>");
                base.Response.End();
            }
            OneTaoState oneTaoState = OneyuanTaoHelp.getOneTaoState(oneyuanTaoInfoById);

            if (oneTaoState != OneTaoState.进行中)
            {
                base.Response.Write("当前活动" + oneTaoState.ToString() + ",无法支付!<a href='javascript:history.go(-1);'>返回上一页</a>");
                base.Response.End();
            }
            if (oneyuanTaoInfoById.FinishedNum + addParticipant.BuyNum > oneyuanTaoInfoById.ReachNum)
            {
                base.Response.Write("活动已满员,您可以试下其它活动!<a href='/Vshop/OneyuanList.aspx'>夺宝活动中心</a>");
                base.Response.End();
            }
            SiteSettings masterSettings = SettingsManager.GetMasterSettings(true);
            string       alipay_Pid     = masterSettings.Alipay_Pid;
            string       alipay_Key     = masterSettings.Alipay_Key;
            string       text           = "utf-8";

            Hidistro.ControlPanel.OutPay.App.Core.setConfig(alipay_Pid, "MD5", alipay_Key, text);
            string       value           = "1";
            string       value2          = Globals.FullPath("/Vshop/OneTaoPaySuccess.aspx");
            string       value3          = Globals.FullPath("/Pay/wap_alipay_notify_url.aspx");
            string       value4          = "订单支付";
            decimal      totalPrice      = addParticipant.TotalPrice;
            string       value5          = Globals.FullPath("/Vshop/OneTaoPayView.aspx?Pid=") + Pid;
            SiteSettings masterSettings2 = SettingsManager.GetMasterSettings(false);
            string       value6          = masterSettings2.SiteName + "支付,当前支付编号-" + Pid + " ...";
            string       value7          = "1m";
            string       value8          = "";
            string       s = Hidistro.ControlPanel.OutPay.App.Core.BuildRequest(new System.Collections.Generic.SortedDictionary <string, string>
            {
                {
                    "partner",
                    alipay_Pid
                },
                {
                    "seller_id",
                    alipay_Pid
                },
                {
                    "_input_charset",
                    text
                },
                {
                    "service",
                    "alipay.wap.create.direct.pay.by.user"
                },
                {
                    "payment_type",
                    value
                },
                {
                    "notify_url",
                    value3
                },
                {
                    "return_url",
                    value2
                },
                {
                    "out_trade_no",
                    Pid
                },
                {
                    "subject",
                    value4
                },
                {
                    "total_fee",
                    totalPrice.ToString("F")
                },
                {
                    "show_url",
                    value5
                },
                {
                    "body",
                    value6
                },
                {
                    "it_b_pay",
                    value7
                },
                {
                    "extern_token",
                    value8
                }
            }, "get", "确认");

            base.Response.Write(s);
        }
Beispiel #11
0
        private void AjaxAction(string action)
        {
            string s = "{\"state\":false,\"msg\":\"未定义操作\"}";

            System.Collections.Specialized.NameValueCollection form = base.Request.Form;
            if (action != null)
            {
                if (!(action == "edit"))
                {
                    if (!(action == "save"))
                    {
                        if (!(action == "read"))
                        {
                            goto IL_417;
                        }
                    }
                    else
                    {
                        try
                        {
                            OneyuanTaoInfo oneyuanTaoInfo = new OneyuanTaoInfo();
                            oneyuanTaoInfo.IsOn          = true;
                            oneyuanTaoInfo.IsEnd         = false;
                            oneyuanTaoInfo.PrizeNumber   = int.Parse(form["PrizeNumber"]);
                            oneyuanTaoInfo.ActivityDec   = form["ActivityDec"];
                            oneyuanTaoInfo.Title         = form["Title"];
                            oneyuanTaoInfo.StartTime     = System.DateTime.Parse(form["StartTime"]);
                            oneyuanTaoInfo.EndTime       = System.DateTime.Parse(form["EndTime"]);
                            oneyuanTaoInfo.EachPrice     = decimal.Parse(form["EachPrice"]);
                            oneyuanTaoInfo.ReachNum      = int.Parse(form["ReachNum"]);
                            oneyuanTaoInfo.EachCanBuyNum = int.Parse(form["EachCanBuyNum"]);
                            oneyuanTaoInfo.FitMember     = form["FitMember"];
                            oneyuanTaoInfo.DefualtGroup  = form["DefualtGroup"];
                            oneyuanTaoInfo.CustomGroup   = form["CustomGroup"];
                            oneyuanTaoInfo.FinishedNum   = 0;
                            oneyuanTaoInfo.SkuId         = "N";
                            oneyuanTaoInfo.ProductImg    = form["ProductImg"];
                            oneyuanTaoInfo.ProductId     = int.Parse(form["ProductId"]);
                            oneyuanTaoInfo.HeadImgage    = form["HeadImgage"];
                            oneyuanTaoInfo.ReachType     = int.Parse(form["ReachType"]);
                            oneyuanTaoInfo.ProductPrice  = decimal.Parse(form["ProductPrice"]);
                            oneyuanTaoInfo.ProductTitle  = form["ProductTitle"];
                            if (oneyuanTaoInfo.ActivityDec.Length > 100)
                            {
                                s = "{\"state\":false,\"msg\":\"活动描述信息太长!\"}";
                            }
                            else if (OneyuanTaoHelp.AddOneyuanTao(oneyuanTaoInfo))
                            {
                                s = "{\"state\":true,\"msg\":\"保存活动成功\"}";
                            }
                            else
                            {
                                s = "{\"state\":false,\"msg\":\"保存活动失败\"}";
                            }
                            goto IL_417;
                        }
                        catch (System.Exception ex)
                        {
                            s = "{\"state\":false,\"msg\":\"" + ex.Message.Replace("'", " ").Replace("\r\n", " ") + "\"}";
                            goto IL_417;
                        }
                    }
                    s = "{\"state\":false,\"msg\":\"读取数据\"}";
                }
                else
                {
                    OneyuanTaoInfo oneyuanTaoInfoById = OneyuanTaoHelp.GetOneyuanTaoInfoById(form["ActivityId"]);
                    if (oneyuanTaoInfoById != null)
                    {
                        this.OneTaoState = OneyuanTaoHelp.getOneTaoState(oneyuanTaoInfoById);
                        if (this.OneTaoState == OneTaoState.已结束)
                        {
                            s = "{\"state\":false,\"msg\":\"当前活动已结束,不能再修改!\"}";
                        }
                        else
                        {
                            oneyuanTaoInfoById.ActivityDec  = form["ActivityDec"];
                            oneyuanTaoInfoById.Title        = form["Title"];
                            oneyuanTaoInfoById.FitMember    = form["FitMember"];
                            oneyuanTaoInfoById.DefualtGroup = form["DefualtGroup"];
                            oneyuanTaoInfoById.CustomGroup  = form["CustomGroup"];
                            oneyuanTaoInfoById.HeadImgage   = form["HeadImgage"];
                            if (this.OneTaoState == OneTaoState.未开始)
                            {
                                oneyuanTaoInfoById.ProductId     = int.Parse(form["ProductId"]);
                                oneyuanTaoInfoById.StartTime     = System.DateTime.Parse(form["StartTime"]);
                                oneyuanTaoInfoById.EndTime       = System.DateTime.Parse(form["EndTime"]);
                                oneyuanTaoInfoById.EachPrice     = decimal.Parse(form["EachPrice"]);
                                oneyuanTaoInfoById.ReachNum      = int.Parse(form["ReachNum"]);
                                oneyuanTaoInfoById.EachCanBuyNum = int.Parse(form["EachCanBuyNum"]);
                                oneyuanTaoInfoById.PrizeNumber   = int.Parse(form["PrizeNumber"]);
                                oneyuanTaoInfoById.ReachType     = int.Parse(form["ReachType"]);
                                oneyuanTaoInfoById.ProductPrice  = decimal.Parse(form["ProductPrice"]);
                                oneyuanTaoInfoById.ProductTitle  = form["ProductTitle"];
                                oneyuanTaoInfoById.FinishedNum   = 0;
                                oneyuanTaoInfoById.SkuId         = "N";
                                oneyuanTaoInfoById.ProductImg    = form["ProductImg"];
                            }
                            if (oneyuanTaoInfoById.ActivityDec.Length > 100)
                            {
                                s = "{\"state\":false,\"msg\":\"活动描述信息太长!\"}";
                            }
                            else if (OneyuanTaoHelp.UpdateOneyuanTao(oneyuanTaoInfoById))
                            {
                                s = "{\"state\":true,\"msg\":\"活动修改成功!\"}";
                            }
                            else
                            {
                                s = "{\"state\":false,\"msg\":\"修改失败!\"}";
                            }
                        }
                    }
                    else
                    {
                        s = "{\"state\":false,\"msg\":\"活动信息不存在,可能已删除!\"}";
                    }
                }
            }
IL_417:
            base.Response.ClearContent();
            base.Response.ContentType = "application/json";
            base.Response.Write(s);
            base.Response.End();
        }