protected override void AttachChildControls()
        {
            this.litItemParams = (Literal)this.FindControl("litItemParams");
            string str    = HttpContext.Current.Request.QueryString.Get("shareid");
            int    result = 0;

            if (!string.IsNullOrEmpty(str))
            {
                if (int.TryParse(str, out result))
                {
                    DataView defaultView = ShareActHelper.GetShareActivity().DefaultView;
                    defaultView.RowFilter = " id=" + result;
                    if (defaultView.Count > 0)
                    {
                        ShareActivityInfo act = ShareActHelper.GetAct(result);
                        if (act != null)
                        {
                            MemberInfo currentMember = MemberProcessor.GetCurrentMember();
                            if (act.ShareTitle.Contains("{{微信昵称}}"))
                            {
                                act.ShareTitle = act.ShareTitle.Replace("{{微信昵称}}", currentMember.UserName);
                            }
                            if (act.Description.Contains("{{店铺名称}}"))
                            {
                                HttpCookie cookie = new HttpCookie("Vshop-ReferralId");
                                if ((cookie != null) && (cookie.Value != null))
                                {
                                    DistributorsInfo userIdDistributors = new DistributorsInfo();
                                    userIdDistributors = DistributorsBrower.GetUserIdDistributors(int.Parse(cookie.Value));
                                    act.Description    = act.Description.Replace("{{店铺名称}}", userIdDistributors.StoreName);
                                }
                                else
                                {
                                    SiteSettings masterSettings = SettingsManager.GetMasterSettings(true, wid);
                                    act.Description = act.Description.Replace("{{店铺名称}}", masterSettings.SiteName);
                                }
                            }
                            if (currentMember == null)
                            {
                                base.GotoResourceNotFound("用户信息获取错误!");
                            }
                            this.litItemParams.Text = string.Concat(new object[] { Globals.HostPath(HttpContext.Current.Request.Url), act.ImgUrl, "|", act.ShareTitle, "|", Globals.HostPath(HttpContext.Current.Request.Url), "/Vshop/getredpager.aspx?id=", result, "&userid=", currentMember.UserId, "|", act.Description });
                        }
                    }
                    else
                    {
                        HttpContext.Current.Response.Redirect("/vshop/MemberCenter.aspx");
                    }
                }
                else
                {
                    base.GotoResourceNotFound("输入的参数不正确!");
                }
            }
            PageTitle.AddSiteNameTitle("分享助力");
        }
Exemple #2
0
        protected void Page_Load(object sender, System.EventArgs e)
        {
            string text = base.Request.QueryString.Get("orderId");

            if (string.IsNullOrEmpty(text))
            {
                return;
            }
            System.Collections.Generic.List <OrderInfo> orderMarkingOrderInfo = ShoppingProcessor.GetOrderMarkingOrderInfo(text);
            if (orderMarkingOrderInfo.Count == 0)
            {
                return;
            }
            decimal d = 0m;

            foreach (OrderInfo current in orderMarkingOrderInfo)
            {
                if (current.BargainDetialId > 0)
                {
                    string text2 = BargainHelper.IsCanBuyByBarginDetailId(current.BargainDetialId);
                    if (text2 != "1")
                    {
                        current.OrderStatus = OrderStatus.Closed;
                        current.CloseReason = text2;
                        OrderHelper.UpdateOrder(current);
                        base.Response.Write("<script>alert('" + text2 + ",订单自动关闭!');location.href='/Vshop/MemberOrders.aspx'</script>");
                        base.Response.End();
                        return;
                    }
                }
                else
                {
                    foreach (LineItemInfo current2 in current.LineItems.Values)
                    {
                        if (!ProductHelper.GetProductHasSku(current2.SkuId, current2.Quantity))
                        {
                            current.OrderStatus = OrderStatus.Closed;
                            current.CloseReason = "库存不足";
                            OrderHelper.UpdateOrder(current);
                            base.Response.Write("<script>alert('库存不足,订单自动关闭!');location.href='/Vshop/MemberOrders.aspx'</script>");
                            base.Response.End();
                            return;
                        }
                    }
                }
                d += current.GetTotal();
            }
            PackageInfo packageInfo = new PackageInfo();

            packageInfo.Body       = text;
            packageInfo.NotifyUrl  = string.Format("http://{0}/pay/wx_Pay.aspx", base.Request.Url.Host);
            packageInfo.OutTradeNo = text;
            packageInfo.TotalFee   = (int)(d * 100m);
            if (packageInfo.TotalFee < 1m)
            {
                packageInfo.TotalFee = 1m;
            }
            string     openId        = "";
            MemberInfo currentMember = MemberProcessor.GetCurrentMember();

            if (currentMember != null)
            {
                openId = currentMember.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))
            {
                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;
                }
                System.Data.DataTable shareActivity = ShareActHelper.GetShareActivity();
                int     num = 0;
                decimal d2  = 0m;
                if (shareActivity.Rows.Count > 0)
                {
                    for (int i = 0; i < shareActivity.Rows.Count; i++)
                    {
                        if (d != 0m && d >= decimal.Parse(shareActivity.Rows[shareActivity.Rows.Count - 1]["MeetValue"].ToString()))
                        {
                            num = int.Parse(shareActivity.Rows[shareActivity.Rows.Count - 1]["Id"].ToString());
                            d2  = decimal.Parse(shareActivity.Rows[shareActivity.Rows.Count - 1]["MeetValue"].ToString());
                            break;
                        }
                        if (d != 0m && d <= decimal.Parse(shareActivity.Rows[0]["MeetValue"].ToString()))
                        {
                            num = int.Parse(shareActivity.Rows[0]["Id"].ToString());
                            d2  = decimal.Parse(shareActivity.Rows[0]["MeetValue"].ToString());
                            break;
                        }
                        if (d != 0m && d >= decimal.Parse(shareActivity.Rows[i]["MeetValue"].ToString()))
                        {
                            num = int.Parse(shareActivity.Rows[i]["Id"].ToString());
                            d2  = decimal.Parse(shareActivity.Rows[i]["MeetValue"].ToString());
                        }
                    }
                    if (d >= d2)
                    {
                        this.shareid = num;
                    }
                }
                return;
            }
        }
Exemple #3
0
        protected void Page_Load(object sender, EventArgs e)
        {
            string str = base.Request.QueryString.Get("orderId");

            if (!string.IsNullOrEmpty(str))
            {
                List <OrderInfo> orderMarkingOrderInfo = ShoppingProcessor.GetOrderMarkingOrderInfo(str, true);
                if (orderMarkingOrderInfo.Count != 0)
                {
                    PayClient client;
                    decimal   num = 0M;
                    if (orderMarkingOrderInfo[0].UserId != 0)
                    {
                        foreach (OrderInfo info in orderMarkingOrderInfo)
                        {
                            if (info.BargainDetialId > 0)
                            {
                                string str2 = BargainHelper.IsCanBuyByBarginDetailId(info.BargainDetialId);
                                if (str2 != "1")
                                {
                                    info.OrderStatus = OrderStatus.Closed;
                                    info.CloseReason = str2;
                                    OrderHelper.UpdateOrder(info);
                                    base.Response.Write("<script>alert('" + str2 + ",订单自动关闭!');location.href='/Vshop/MemberOrders.aspx'</script>");
                                    base.Response.End();
                                    return;
                                }
                            }
                            else
                            {
                                foreach (LineItemInfo info2 in info.LineItems.Values)
                                {
                                    if (!ProductHelper.GetProductHasSku(info2.SkuId, info2.Quantity))
                                    {
                                        info.OrderStatus = OrderStatus.Closed;
                                        info.CloseReason = "库存不足";
                                        OrderHelper.UpdateOrder(info);
                                        base.Response.Write("<script>alert('库存不足,订单自动关闭!');location.href='/Vshop/MemberOrders.aspx'</script>");
                                        base.Response.End();
                                        return;
                                    }
                                }
                            }
                            num += info.GetCashPayMoney();
                        }
                    }
                    else
                    {
                        num = orderMarkingOrderInfo[0].Amount;
                    }
                    PackageInfo package = new PackageInfo {
                        Body       = str,
                        NotifyUrl  = string.Format("http://{0}/pay/wx_Pay.aspx", base.Request.Url.Host),
                        OutTradeNo = str,
                        TotalFee   = (int)(num * 100M)
                    };
                    if (package.TotalFee < 1M)
                    {
                        package.TotalFee = 1M;
                    }


                    string     openId        = "";
                    MemberInfo currentMember = MemberProcessor.GetCurrentMember();
                    if (currentMember != null)
                    {
                        openId = currentMember.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;
                        }
                        DataTable shareActivity = ShareActHelper.GetShareActivity();
                        int       num2          = 0;
                        decimal   num3          = 0M;
                        if (shareActivity.Rows.Count > 0)
                        {
                            for (int i = 0; i < shareActivity.Rows.Count; i++)
                            {
                                if ((num != 0M) && (num >= decimal.Parse(shareActivity.Rows[shareActivity.Rows.Count - 1]["MeetValue"].ToString())))
                                {
                                    num2 = int.Parse(shareActivity.Rows[shareActivity.Rows.Count - 1]["Id"].ToString());
                                    num3 = decimal.Parse(shareActivity.Rows[shareActivity.Rows.Count - 1]["MeetValue"].ToString());
                                    break;
                                }
                                if ((num != 0M) && (num <= decimal.Parse(shareActivity.Rows[0]["MeetValue"].ToString())))
                                {
                                    num2 = int.Parse(shareActivity.Rows[0]["Id"].ToString());
                                    num3 = decimal.Parse(shareActivity.Rows[0]["MeetValue"].ToString());
                                    break;
                                }
                                if ((num != 0M) && (num >= decimal.Parse(shareActivity.Rows[i]["MeetValue"].ToString())))
                                {
                                    num2 = int.Parse(shareActivity.Rows[i]["Id"].ToString());
                                    num3 = decimal.Parse(shareActivity.Rows[i]["MeetValue"].ToString());
                                }
                            }
                            if (num >= num3)
                            {
                                this.shareid = num2;
                            }
                        }
                    }
                }
            }
        }
Exemple #4
0
        protected void Page_Load(object sender, EventArgs e)
        {
            string str = base.Request.QueryString.Get("orderId");

            if (!string.IsNullOrEmpty(str))
            {
                List <OrderInfo> orderMarkingOrderInfo = ShoppingProcessor.GetOrderMarkingOrderInfo(str);
                if (orderMarkingOrderInfo.Count != 0)
                {
                    decimal num = 0M;
                    foreach (OrderInfo info in orderMarkingOrderInfo)
                    {
                        num += info.GetTotal();
                    }
                    PackageInfo package = new PackageInfo {
                        Body       = str,
                        NotifyUrl  = string.Format("http://{0}/pay/wx_Pay.aspx", base.Request.Url.Host),
                        OutTradeNo = str,
                        TotalFee   = (int)(num * 100M)
                    };
                    if (package.TotalFee < 1M)
                    {
                        package.TotalFee = 1M;
                    }
                    string     openId        = "";
                    MemberInfo currentMember = MemberProcessor.GetCurrentMember();
                    if (currentMember != null)
                    {
                        openId = currentMember.OpenId;
                    }
                    package.OpenId = openId;
                    wid            = currentMember.wid;
                    //SiteSettings masterSettings = SettingsManager.GetMasterSettings(false);
                    Chenduo.Model.sf_website website = new Chenduo.BLL.sf_website().GetModelByWid(wid);
                    //PayRequestInfo req = new PayClient(masterSettings.WeixinAppId, masterSettings.WeixinAppSecret, masterSettings.WeixinPartnerID, masterSettings.WeixinPartnerKey, masterSettings.WeixinPaySignKey).BuildPayRequest(package);
                    PayRequestInfo req = new PayClient(wid, website.appid, website.appsecret, website.weixin_pay_account, website.account_pay_key, "").BuildPayRequest(package);
                    this.pay_json = this.ConvertPayJson(req);
                    DataTable shareActivity = ShareActHelper.GetShareActivity();
                    int       num2          = 0;
                    decimal   num3          = 0M;
                    if (shareActivity.Rows.Count > 0)
                    {
                        for (int i = 0; i < shareActivity.Rows.Count; i++)
                        {
                            if ((num != 0M) && (num >= decimal.Parse(shareActivity.Rows[shareActivity.Rows.Count - 1]["MeetValue"].ToString())))
                            {
                                num2 = int.Parse(shareActivity.Rows[shareActivity.Rows.Count - 1]["Id"].ToString());
                                num3 = decimal.Parse(shareActivity.Rows[shareActivity.Rows.Count - 1]["MeetValue"].ToString());
                                break;
                            }
                            if ((num != 0M) && (num <= decimal.Parse(shareActivity.Rows[0]["MeetValue"].ToString())))
                            {
                                num2 = int.Parse(shareActivity.Rows[0]["Id"].ToString());
                                num3 = decimal.Parse(shareActivity.Rows[0]["MeetValue"].ToString());
                                break;
                            }
                            if ((num != 0M) && (num >= decimal.Parse(shareActivity.Rows[i]["MeetValue"].ToString())))
                            {
                                num2 = int.Parse(shareActivity.Rows[i]["Id"].ToString());
                                num3 = decimal.Parse(shareActivity.Rows[i]["MeetValue"].ToString());
                            }
                        }
                        if (num >= num3)
                        {
                            this.shareid = num2;
                        }
                    }
                }
            }
        }