Exemple #1
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("一元夺宝商品详情");
        }
        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);
        }
Exemple #3
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);
        }