Пример #1
0
        protected override void AttachChildControls()
        {
            PageTitle.AddSiteNameTitle("砍价活动");
            this.rpMyMemberList = (VshopTemplatedRepeater)this.FindControl("rpBargainList");
            this.hiddTotal      = (System.Web.UI.HtmlControls.HtmlInputHidden) this.FindControl("hiddTotal");
            this.hiddPageIndex  = (System.Web.UI.HtmlControls.HtmlInputHidden) this.FindControl("hiddPageIndex");
            int pageIndex;

            if (!int.TryParse(this.Page.Request.QueryString["page"], out pageIndex))
            {
                pageIndex = 1;
            }
            int pageSize;

            if (!int.TryParse(this.Page.Request.QueryString["size"], out pageSize))
            {
                pageSize = 10;
            }
            int          num          = Globals.RequestQueryNum("status");
            BargainQuery bargainQuery = new BargainQuery();

            bargainQuery.Type      = num.ToString();
            bargainQuery.PageSize  = pageSize;
            bargainQuery.PageIndex = pageIndex;
            int           total       = BargainHelper.GetTotal(bargainQuery);
            DbQueryResult bargainList = BargainHelper.GetBargainList(bargainQuery);

            this.hiddTotal.Value           = ((DataTable)bargainList.Data).Rows.Count.ToString();
            this.hiddPageIndex.Value       = pageIndex.ToString();
            this.rpMyMemberList.DataSource = bargainList.Data;
            this.rpMyMemberList.DataBind();
        }
Пример #2
0
        protected override void AttachChildControls()
        {
            int num;
            int num2;

            PageTitle.AddSiteNameTitle("砍价活动");
            this.rpMyMemberList = (VshopTemplatedRepeater)this.FindControl("rpBargainList");
            this.hiddTotal      = (HtmlInputHidden)this.FindControl("hiddTotal");
            this.hiddPageIndex  = (HtmlInputHidden)this.FindControl("hiddPageIndex");
            if (!int.TryParse(this.Page.Request.QueryString["page"], out num))
            {
                num = 1;
            }
            if (!int.TryParse(this.Page.Request.QueryString["size"], out num2))
            {
                num2 = 10;
            }
            int          num3  = Globals.RequestQueryNum("status");
            BargainQuery query = new BargainQuery {
                Type      = num3.ToString(),
                PageSize  = num2,
                PageIndex = num
            };
            int           total       = BargainHelper.GetTotal(query);
            DbQueryResult bargainList = BargainHelper.GetBargainList(query);

            this.hiddTotal.Value           = ((DataTable)bargainList.Data).Rows.Count.ToString();
            this.hiddPageIndex.Value       = num.ToString();
            this.rpMyMemberList.DataSource = bargainList.Data;
            this.rpMyMemberList.DataBind();
        }
        private void grdBargainList_ItemCommand(object source, RepeaterCommandEventArgs e)
        {
            string commandName = e.CommandName;
            string str2        = e.CommandArgument.ToString();

            if (((commandName == "Delete") && !string.IsNullOrEmpty(str2)) && BargainHelper.DeleteBargainById(str2))
            {
                this.ShowMsg("删除成功", true);
                this.BindData();
            }
        }
Пример #4
0
        private void BindData()
        {
            BargainQuery bargainQuery = new BargainQuery();

            bargainQuery.ProductName = this.productName;
            bargainQuery.Title       = this.title;
            bargainQuery.Type        = this.type;
            bargainQuery.PageSize    = this.pager.PageSize;
            bargainQuery.PageIndex   = this.pager.PageIndex;
            this.pager.TotalRecords  = BargainHelper.GetTotal(bargainQuery);
            DbQueryResult bargainList = BargainHelper.GetBargainList(bargainQuery);

            this.grdBargainList.DataSource = bargainList.Data;
            this.grdBargainList.DataBind();
        }
Пример #5
0
        private void grdBargainList_ItemCommand(object source, System.Web.UI.WebControls.RepeaterCommandEventArgs e)
        {
            string commandName = e.CommandName;
            string text        = e.CommandArgument.ToString();

            if (commandName == "Delete" && !string.IsNullOrEmpty(text))
            {
                bool flag = BargainHelper.DeleteBargainById(text);
                if (flag)
                {
                    this.ShowMsg("删除成功", true);
                    this.BindData();
                }
            }
        }
Пример #6
0
        private void BindData()
        {
            BargainQuery query = new BargainQuery {
                ProductName = this.productName,
                Title       = this.title,
                Type        = this.type,
                PageSize    = this.pager.PageSize,
                PageIndex   = this.pager.PageIndex
            };

            this.pager.TotalRecords = BargainHelper.GetTotal(query);
            DbQueryResult bargainList = BargainHelper.GetBargainList(query);

            this.grdBargainList.DataSource = bargainList.Data;
            this.grdBargainList.DataBind();
        }
Пример #7
0
        private void LoadData()
        {
            int result = 0;

            if (int.TryParse(this.Page.Request.QueryString["Id"], out result))
            {
                BargainInfo bargainInfo = BargainHelper.GetBargainInfo(result);
                if (bargainInfo != null)
                {
                    if (bargainInfo.ProductId > 0)
                    {
                        ProductInfo productDetails = ProductHelper.GetProductDetails(bargainInfo.ProductId);
                        this.productImage.ImageUrl = string.IsNullOrEmpty(productDetails.ImageUrl1) ? "/utility/pics/none.gif" : productDetails.ImageUrl1;
                        this.lbProductName.Text    = productDetails.ProductName;
                        this.lbtitle.Text          = bargainInfo.Title;
                        this.productInfoHtml       = this.GetProductInfoHtml(productDetails);
                    }
                    this.txtTitle.Text          = bargainInfo.Title;
                    this.calendarStartDate.Text = bargainInfo.BeginDate.ToString();
                    this.calendarEndDate.Text   = bargainInfo.EndDate.ToString();
                    this.hidpic.Value           = bargainInfo.ActivityCover;
                    this.hiddProductId.Value    = bargainInfo.ProductId.ToString();
                    this.txtRemarks.Text        = bargainInfo.Remarks;
                    this.txtActivityStock.Text  = bargainInfo.ActivityStock.ToString();
                    this.txtPurchaseNumber.Text = bargainInfo.PurchaseNumber.ToString();
                    this.txtInitialPrice.Text   = bargainInfo.InitialPrice.ToString("f2");
                    this.txtFloorPrice.Text     = bargainInfo.FloorPrice.ToString("f2");
                    this.ckIsCommission.Checked = bargainInfo.IsCommission;
                    this.discount.Text          = (((double)bargainInfo.CommissionDiscount) / 10.0).ToString();
                    if (bargainInfo.BargainType == 0)
                    {
                        this.rbtBargainTypeOne.Checked   = true;
                        this.rbtBargainTypeTwo.Checked   = false;
                        this.txtBargainTypeOneValue.Text = bargainInfo.BargainTypeMinVlue.ToString("f2");
                    }
                    else
                    {
                        this.rbtBargainTypeOne.Checked    = false;
                        this.rbtBargainTypeTwo.Checked    = true;
                        this.txtBargainTypeTwoValue1.Text = bargainInfo.BargainTypeMinVlue.ToString("f2");
                        this.txtBargainTypeTwoValue2.Text = bargainInfo.BargainTypeMaxVlue.ToString("f2");
                    }
                }
            }
        }
Пример #8
0
 private void LoadData()
 {
     if (this.Page.Request.QueryString["Id"] != null)
     {
         int         id          = int.Parse(this.Page.Request.QueryString["Id"]);
         BargainInfo bargainInfo = BargainHelper.GetBargainInfo(id);
         if (bargainInfo != null)
         {
             if (bargainInfo.ProductId > 0)
             {
                 ProductInfo productDetails = ProductHelper.GetProductDetails(bargainInfo.ProductId);
                 this.productImage.ImageUrl = (string.IsNullOrEmpty(productDetails.ImageUrl1) ? "/utility/pics/none.gif" : productDetails.ImageUrl1);
                 this.lbproductName.Text    = productDetails.ProductName;
                 this.lbtitle.Text          = bargainInfo.Title;
                 this.productInfoHtml       = this.GetProductInfoHtml(productDetails);
             }
             this.txtTitle.Text            = bargainInfo.Title;
             this.calendarStartDate.Text   = bargainInfo.BeginDate.ToString();
             this.calendarEndDate.Text     = bargainInfo.EndDate.ToString();
             this.imgeProductName.ImageUrl = (string.IsNullOrEmpty(bargainInfo.ActivityCover) ? "/utility/pics/none.gif" : bargainInfo.ActivityCover);
             this.txtRemarks.Text          = bargainInfo.Remarks;
             this.txtTranNumber.Text       = bargainInfo.ActivityStock.ToString();
             this.txtPurchaseNumber.Text   = bargainInfo.PurchaseNumber.ToString();
             this.txtFloorPrice.Text       = bargainInfo.FloorPrice.ToString("f2");
             this.txtInitialPrice.Text     = bargainInfo.InitialPrice.ToString("f2");
             this.ckIsCommission.Checked   = bargainInfo.IsCommission;
             if (bargainInfo.BargainType == 0)
             {
                 this.rbtBargainTypeOne.Checked   = true;
                 this.rbtBargainTypeTwo.Checked   = false;
                 this.txtBargainTypeOneValue.Text = bargainInfo.BargainTypeMinVlue.ToString("f2");
                 return;
             }
             this.rbtBargainTypeOne.Checked    = false;
             this.rbtBargainTypeTwo.Checked    = true;
             this.txtBargainTypeTwoValue1.Text = bargainInfo.BargainTypeMinVlue.ToString("f2");
             this.txtBargainTypeTwoValue2.Text = bargainInfo.BargainTypeMaxVlue.ToString("f2");
         }
     }
 }
Пример #9
0
        protected override void AttachChildControls()
        {
            PageTitle.AddSiteNameTitle("我的砍价");
            MemberInfo currentMember = MemberProcessor.GetCurrentMember();

            if (currentMember != null)
            {
                int num;
                int num2;
                this.rpMyBargainList = (VshopTemplatedRepeater)this.FindControl("rpMyBargainList");
                this.hiddTotal       = (HtmlInputHidden)this.FindControl("hiddTotal");
                this.hiddPageIndex   = (HtmlInputHidden)this.FindControl("hiddPageIndex");
                if (!int.TryParse(this.Page.Request.QueryString["page"], out num))
                {
                    num = 1;
                }
                if (!int.TryParse(this.Page.Request.QueryString["size"], out num2))
                {
                    num2 = 10;
                }
                int num3 = 0;
                if (!int.TryParse(this.Page.Request.QueryString["status"], out num3))
                {
                    num3 = 0;
                }
                BargainQuery query = new BargainQuery {
                    PageSize  = num2,
                    PageIndex = num,
                    UserId    = currentMember.UserId,
                    Status    = num3
                };
                DbQueryResult myBargainList = BargainHelper.GetMyBargainList(query);
                this.hiddTotal.Value            = ((DataTable)myBargainList.Data).Rows.Count.ToString();
                this.hiddPageIndex.Value        = num.ToString();
                this.rpMyBargainList.DataSource = myBargainList.Data;
                this.rpMyBargainList.DataBind();
            }
        }
Пример #10
0
        protected override void AttachChildControls()
        {
            PageTitle.AddSiteNameTitle("我的砍价");
            MemberInfo currentMember = MemberProcessor.GetCurrentMember();

            if (currentMember != null)
            {
                this.rpMyBargainList = (VshopTemplatedRepeater)this.FindControl("rpMyBargainList");
                this.hiddTotal       = (System.Web.UI.HtmlControls.HtmlInputHidden) this.FindControl("hiddTotal");
                this.hiddPageIndex   = (System.Web.UI.HtmlControls.HtmlInputHidden) this.FindControl("hiddPageIndex");
                int pageIndex;
                if (!int.TryParse(this.Page.Request.QueryString["page"], out pageIndex))
                {
                    pageIndex = 1;
                }
                int pageSize;
                if (!int.TryParse(this.Page.Request.QueryString["size"], out pageSize))
                {
                    pageSize = 10;
                }
                int status = 0;
                if (!int.TryParse(this.Page.Request.QueryString["status"], out status))
                {
                    status = 0;
                }
                DbQueryResult myBargainList = BargainHelper.GetMyBargainList(new BargainQuery
                {
                    PageSize  = pageSize,
                    PageIndex = pageIndex,
                    UserId    = currentMember.UserId,
                    Status    = status
                });
                this.hiddTotal.Value            = ((DataTable)myBargainList.Data).Rows.Count.ToString();
                this.hiddPageIndex.Value        = pageIndex.ToString();
                this.rpMyBargainList.DataSource = myBargainList.Data;
                this.rpMyBargainList.DataBind();
            }
        }
Пример #11
0
        private void btnDeleteCheck_Click(object sender, System.EventArgs e)
        {
            string text = base.Request.Form["CheckBoxGroup"];

            if (string.IsNullOrEmpty(text))
            {
                this.ShowMsg("请先选择要删除的砍价活动!", false);
                return;
            }
            text = text.TrimEnd(new char[]
            {
                ','
            });
            System.Data.DataTable bargainById = BargainHelper.GetBargainById(text);
            if (bargainById.Rows.Count > 0)
            {
                this.ShowMsg("删除的砍价活动中有正在进行的,不能删除", false);
                return;
            }
            BargainHelper.DeleteBargainById(text);
            this.ShowMsg("删除成功", true);
            this.BindData();
        }
        private void btnDeleteCheck_Click(object sender, EventArgs e)
        {
            string str = base.Request.Form["CheckBoxGroup"];

            if (string.IsNullOrEmpty(str))
            {
                this.ShowMsg("请先选择要删除的砍价活动!", false);
            }
            else
            {
                str = str.TrimEnd(new char[] { ',' });
                if (BargainHelper.GetBargainById(str).Rows.Count > 0)
                {
                    this.ShowMsg("删除的砍价活动中有正在进行的,不能删除", false);
                }
                else
                {
                    BargainHelper.DeleteBargainById(str);
                    this.ShowMsg("删除成功", true);
                    this.BindData();
                }
            }
        }
Пример #13
0
        protected void Page_Load(object sender, EventArgs e)
        {
            string str  = base.Request.QueryString.Get("orderId");
            string str2 = base.Request.QueryString.Get("Ptype");

            if (string.IsNullOrEmpty(str))
            {
                this.infos.InnerText = "订单号为空,请返回";
            }
            else
            {
                if (!string.IsNullOrEmpty(str2) && (str2 == "OneTao"))
                {
                    this.DoOneTaoPay(str);
                    base.Response.End();
                }
                List <OrderInfo> orderMarkingOrderInfo = ShoppingProcessor.GetOrderMarkingOrderInfo(str);
                if (orderMarkingOrderInfo.Count == 0)
                {
                    this.infos.InnerText = "订单信息未找到!";
                }
                else
                {
                    decimal num = 0M;
                    foreach (OrderInfo info in orderMarkingOrderInfo)
                    {
                        if (info.BargainDetialId > 0)
                        {
                            string str3 = BargainHelper.IsCanBuyByBarginDetailId(info.BargainDetialId);
                            if (str3 != "1")
                            {
                                info.OrderStatus = OrderStatus.Closed;
                                info.CloseReason = str3;
                                OrderHelper.UpdateOrder(info);
                                base.Response.Write("<script>alert('" + str3 + ",订单自动关闭!');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.GetTotal();
                    }
                    SiteSettings masterSettings = SettingsManager.GetMasterSettings(false);
                    string       partner        = masterSettings.Alipay_Pid;
                    string       str5           = masterSettings.Alipay_Key;
                    string       str6           = "utf-8";
                    Core.setConfig(partner, "MD5", str5, str6);
                    string  str7  = "1";
                    string  str8  = Globals.FullPath("/Pay/wap_alipay_return_url.aspx");
                    string  str9  = Globals.FullPath("/Pay/wap_alipay_notify_url.aspx");
                    string  str10 = str;
                    string  str11 = "订单支付";
                    decimal num2  = num;
                    string  str12 = Globals.FullPath("/Vshop/MemberOrderDetails.aspx?orderId=") + orderMarkingOrderInfo[0].OrderId;
                    string  str13 = "订单号-" + orderMarkingOrderInfo[0].OrderId + " ...";
                    string  str14 = "1m";
                    string  str15 = "";
                    SortedDictionary <string, string> sParaTemp = new SortedDictionary <string, string>();
                    sParaTemp.Add("partner", partner);
                    sParaTemp.Add("seller_id", partner);
                    sParaTemp.Add("_input_charset", str6);
                    sParaTemp.Add("service", "alipay.wap.create.direct.pay.by.user");
                    sParaTemp.Add("payment_type", str7);
                    sParaTemp.Add("notify_url", str9);
                    sParaTemp.Add("return_url", str8);
                    sParaTemp.Add("out_trade_no", str10);
                    sParaTemp.Add("subject", str11);
                    sParaTemp.Add("total_fee", num2.ToString("F"));
                    sParaTemp.Add("show_url", str12);
                    sParaTemp.Add("body", str13);
                    sParaTemp.Add("it_b_pay", str14);
                    sParaTemp.Add("extern_token", str15);
                    string s = Core.BuildRequest(sParaTemp, "get", "确认");
                    base.Response.Write(s);
                }
            }
        }
Пример #14
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;
                            }
                        }
                    }
                }
            }
        }
Пример #15
0
        protected override void AttachChildControls()
        {
            if (!int.TryParse(this.Page.Request.QueryString["id"], out this.bargainId))
            {
                base.GotoResourceNotFound("");
            }
            MemberInfo currentMember = MemberProcessor.GetCurrentMember();

            if (currentMember != null)
            {
                BargainDetialInfo bargainDetialInfo = BargainHelper.GetBargainDetialInfo(this.bargainId, currentMember.UserId);
                if (bargainDetialInfo != null)
                {
                    this.Page.Response.Redirect(string.Concat(new object[] { "InviteBargainDetial.aspx?bargainId=", this.bargainId, "&bargainDetialId=", bargainDetialInfo.Id, "&ReferralId=", this.Page.Request.QueryString["ReferralId"] }));
                }
            }
            this.litProdcutName              = (Literal)this.FindControl("litProdcutName");
            this.litShortDescription         = (Literal)this.FindControl("litShortDescription");
            this.litSalePrice                = (Literal)this.FindControl("litSalePrice");
            this.litFloorPrice               = (Literal)this.FindControl("litFloorPrice");
            this.litFloorPrice1              = (Literal)this.FindControl("litFloorPrice1");
            this.litPurchaseNumber           = (Literal)this.FindControl("litPurchaseNumber");
            this.litParticipantNumber        = (Literal)this.FindControl("litParticipantNumber");
            this.litProductDesc              = (Literal)this.FindControl("litProductDesc");
            this.litProductConsultationTotal = (Literal)this.FindControl("litProductConsultationTotal");
            this.litProductCommentTotal      = (Literal)this.FindControl("litProductCommentTotal");
            this.litStock           = (Literal)this.FindControl("litStock");
            this.hiddHasCollected   = (HtmlInputHidden)this.FindControl("hiddHasCollected");
            this.hiddProductId      = (HtmlInputHidden)this.FindControl("hiddProductId");
            this.hiddEndDate        = (HtmlInputHidden)this.FindControl("hiddEndDate");
            this.hiddPurchaseNumber = (HtmlInputHidden)this.FindControl("hiddPurchaseNumber");
            this.skuSelector        = (Common_SKUSelector)this.FindControl("skuSelector");
            this.rptProductImages   = (VshopTemplatedRepeater)this.FindControl("rptProductImages");
            this.hideTitle          = (HtmlInputHidden)this.FindControl("hideTitle");
            this.hideImgUrl         = (HtmlInputHidden)this.FindControl("hideImgUrl");
            this.hideDesc           = (HtmlInputHidden)this.FindControl("hideDesc");
            bool        flag        = false;
            BargainInfo bargainInfo = BargainHelper.GetBargainInfo(this.bargainId);

            if (bargainInfo != null)
            {
                PageTitle.AddSiteNameTitle(bargainInfo.Title);
                this.litFloorPrice.Text        = bargainInfo.FloorPrice.ToString("F2");
                this.litFloorPrice1.Text       = bargainInfo.FloorPrice.ToString("F2");
                this.litSalePrice.Text         = bargainInfo.InitialPrice.ToString("f2");
                this.litPurchaseNumber.Text    = (bargainInfo.ActivityStock - bargainInfo.TranNumber).ToString();
                this.litParticipantNumber.Text = BargainHelper.HelpBargainCount(this.bargainId).ToString();
                this.hiddEndDate.Value         = bargainInfo.EndDate.ToString("yyyy:MM:dd:HH:mm:ss");
                this.hiddPurchaseNumber.Value  = bargainInfo.PurchaseNumber.ToString();
                this.litStock.Text             = bargainInfo.PurchaseNumber.ToString();
                this.hideTitle.Value           = bargainInfo.Title;
                this.hideDesc.Value            = bargainInfo.Remarks.Replace("\n", " ").Replace("\r", "");
                string activityCover = bargainInfo.ActivityCover;
                string str2          = string.Empty;
                Uri    url           = HttpContext.Current.Request.Url;
                if (!activityCover.StartsWith("http"))
                {
                    str2 = url.Scheme + "://" + url.Host + ((url.Port == 80) ? "" : (":" + url.Port.ToString()));
                }
                if (bargainInfo.ProductId > 0)
                {
                    this.skuSelector.ProductId = bargainInfo.ProductId;
                    if (currentMember != null)
                    {
                        flag = ProductBrowser.CheckHasCollect(currentMember.UserId, bargainInfo.ProductId);
                    }
                    this.hiddHasCollected.SetWhenIsNotNull(flag ? "1" : "0");
                    ProductInfo productDetails = ProductHelper.GetProductDetails(bargainInfo.ProductId);
                    if (productDetails == null)
                    {
                        this.Context.Response.Write("<script>alert('该商品不存在!');location.href='/default.aspx';</script>");
                        this.Context.Response.End();
                    }
                    else
                    {
                        this.hiddProductId.Value      = bargainInfo.ProductId.ToString();
                        this.litProdcutName.Text      = productDetails.ProductName;
                        this.litShortDescription.Text = productDetails.ProductShortName;
                        this.hideImgUrl.Value         = string.IsNullOrEmpty(productDetails.ThumbnailUrl60) ? (str2 + activityCover) : (str2 + productDetails.ThumbnailUrl60);
                        this.litProductDesc.Text      = productDetails.Description;
                        //if (this.rptProductImages != null)
                        //{
                        //    string locationUrl = "javascript:;";
                        //    SlideImage[] imageArray = new SlideImage[] { new SlideImage(productDetails.ImageUrl1, locationUrl), new SlideImage(productDetails.ImageUrl2, locationUrl), new SlideImage(productDetails.ImageUrl3, locationUrl), new SlideImage(productDetails.ImageUrl4, locationUrl), new SlideImage(productDetails.ImageUrl5, locationUrl) };
                        //    if (CS$<>9__CachedAnonymousMethodDelegate1 == null)
                        //    {
                        //        CS$<>9__CachedAnonymousMethodDelegate1 = new Func<SlideImage, bool>(null, (IntPtr) <AttachChildControls>b__0);
                        //    }
                        //    this.rptProductImages.DataSource = Enumerable.Where<SlideImage>(imageArray, CS$<>9__CachedAnonymousMethodDelegate1);
                        //    this.rptProductImages.DataBind();
                        //}
                        if (this.rptProductImages != null)
                        {
                            string       locationUrl = "javascript:;";
                            SlideImage[] imageArray  = new SlideImage[] { new SlideImage(productDetails.ImageUrl1, locationUrl), new SlideImage(productDetails.ImageUrl2, locationUrl), new SlideImage(productDetails.ImageUrl3, locationUrl), new SlideImage(productDetails.ImageUrl4, locationUrl), new SlideImage(productDetails.ImageUrl5, locationUrl) };
                            this.rptProductImages.DataSource = from item in imageArray
                                                               where !string.IsNullOrWhiteSpace(item.ImageUrl)
                                                               select item;
                            this.rptProductImages.DataBind();
                        }
                        int productConsultationsCount = ProductBrowser.GetProductConsultationsCount(bargainInfo.ProductId, false);
                        this.litProductConsultationTotal.SetWhenIsNotNull(productConsultationsCount.ToString());
                        this.litProductCommentTotal.SetWhenIsNotNull(ProductBrowser.GetProductReviewsCount(bargainInfo.ProductId).ToString());
                    }
                }
            }
        }
Пример #16
0
        private void btnSave_Click(object sender, EventArgs e)
        {
            int    num  = Globals.RequestQueryNum("id");
            string text = this.txtTitle.Text;

            if (string.IsNullOrWhiteSpace(text))
            {
                this.ShowMsg("分享标题不能为空!", false);
            }
            else
            {
                string str2 = this.calendarStartDate.Text;
                string str3 = this.calendarEndDate.Text;
                if (string.IsNullOrWhiteSpace(str2) || string.IsNullOrWhiteSpace(str3))
                {
                    this.ShowMsg("活动时间不能为空!", false);
                }
                else if (DateTime.Parse(str2) >= DateTime.Parse(str3))
                {
                    this.ShowMsg("结束时间必须大于开始时间!", false);
                }
                else
                {
                    string str4 = this.hidpic.Value;
                    if (string.IsNullOrWhiteSpace(str4))
                    {
                        this.ShowMsg("请先上传活动封面!", false);
                    }
                    else
                    {
                        string str5 = this.txtRemarks.Text;
                        if (str5.Length > 200)
                        {
                            this.ShowMsg("活动说明不能超过200个字节!", false);
                        }
                        else
                        {
                            int productId = Globals.ToNum(this.hiddProductId.Value);
                            if (productId <= 0)
                            {
                                this.ShowMsg("请先选择参加活动的产品!", false);
                            }
                            else
                            {
                                int num3 = Globals.ToNum(this.txtActivityStock.Text.Trim());
                                if (num3 <= 0)
                                {
                                    this.ShowMsg("活动库存必须为大于0的正整数!", false);
                                }
                                else
                                {
                                    int num4 = Globals.ToNum(this.txtPurchaseNumber.Text.Trim());
                                    if (num4 <= 0)
                                    {
                                        this.ShowMsg("限购数量必须为大于0的正整数!", false);
                                    }
                                    else
                                    {
                                        float result = 0f;
                                        if (!float.TryParse(this.txtInitialPrice.Text, out result))
                                        {
                                            this.ShowMsg("初始价格输入不正确!", false);
                                        }
                                        else
                                        {
                                            float num6 = 0f;
                                            if (!float.TryParse(this.txtFloorPrice.Text, out num6))
                                            {
                                                this.ShowMsg("活动底价输入不正确!", false);
                                            }
                                            else if ((num6 <= 0f) || (result <= 0f))
                                            {
                                                this.ShowMsg("活动底价必须或初始价格必须大于0!", false);
                                            }
                                            else if (result < num6)
                                            {
                                                this.ShowMsg("初始价格不能小于活动底价!", false);
                                            }
                                            else
                                            {
                                                long productSumStock = ProductHelper.GetProductSumStock(productId);
                                                if (num3 > productSumStock)
                                                {
                                                    this.ShowMsg("活动库存不能大于商品库存!", false);
                                                }
                                                else if (num4 > num3)
                                                {
                                                    this.ShowMsg("限购数量不能大于活动库存!", false);
                                                }
                                                else
                                                {
                                                    bool   flag = this.ckIsCommission.Checked;
                                                    string str6 = this.discount.Text;
                                                    if (flag && string.IsNullOrEmpty(str6))
                                                    {
                                                        this.ShowMsg("请填写佣金折扣值!", false);
                                                    }
                                                    else if (flag && (str6 == "0"))
                                                    {
                                                        this.ShowMsg("佣金折扣值必须大于0!", false);
                                                    }
                                                    else
                                                    {
                                                        int         num8    = this.rbtBargainTypeOne.Checked ? 0 : 1;
                                                        BargainInfo bargain = new BargainInfo {
                                                            Title              = text,
                                                            BeginDate          = DateTime.Parse(str2),
                                                            EndDate            = DateTime.Parse(str3),
                                                            ActivityCover      = str4,
                                                            Remarks            = str5,
                                                            ProductId          = productId,
                                                            ActivityStock      = num3,
                                                            PurchaseNumber     = num4,
                                                            TranNumber         = 0,
                                                            InitialPrice       = (decimal)result,
                                                            FloorPrice         = (decimal)num6,
                                                            BargainType        = num8,
                                                            CreateDate         = DateTime.Now,
                                                            IsCommission       = this.ckIsCommission.Checked,
                                                            CommissionDiscount = flag ? ((int)(float.Parse(str6) * 10f)) : 0
                                                        };
                                                        if (num8 == 0)
                                                        {
                                                            string str7 = this.txtBargainTypeOneValue.Text;
                                                            if (string.IsNullOrWhiteSpace(str7))
                                                            {
                                                                this.ShowMsg("每次砍掉价格不能为空!", false);
                                                                return;
                                                            }
                                                            bargain.BargainTypeMinVlue = float.Parse(str7);
                                                        }
                                                        else
                                                        {
                                                            string str8 = this.txtBargainTypeTwoValue1.Text;
                                                            string str9 = this.txtBargainTypeTwoValue2.Text;
                                                            if (string.IsNullOrWhiteSpace(str8) || string.IsNullOrWhiteSpace(str9))
                                                            {
                                                                this.ShowMsg("随机砍价最小值或最大值不能为空!", false);
                                                                return;
                                                            }
                                                            float num9  = 0f;
                                                            float num10 = 0f;
                                                            if (!float.TryParse(str8, out num9))
                                                            {
                                                                this.ShowMsg("随机砍价最小值必须为数值!", false);
                                                                return;
                                                            }
                                                            if (!float.TryParse(str9, out num10))
                                                            {
                                                                this.ShowMsg("随机砍价最大值必须为数值!", false);
                                                                return;
                                                            }
                                                            if (num9 > num10)
                                                            {
                                                                this.ShowMsg("随机砍价最大值必须大于最小值!", false);
                                                                return;
                                                            }
                                                            if ((num9 < 0f) || (num10 < 0f))
                                                            {
                                                                this.ShowMsg("随机砍价最大值,最小值都必须大于零!", false);
                                                                return;
                                                            }
                                                            bargain.BargainTypeMinVlue = num9;
                                                            bargain.BargainTypeMaxVlue = num10;
                                                        }
                                                        if (num > 0)
                                                        {
                                                            bargain.Id = num;
                                                            if (BargainHelper.UpdateBargain(bargain))
                                                            {
                                                                this.ShowMsgAndReUrl("修改成功", true, "ManagerBargain.aspx?Type=0");
                                                            }
                                                        }
                                                        else if (BargainHelper.InsertBargain(bargain))
                                                        {
                                                            this.ShowMsgAndReUrl("添加成功", true, "ManagerBargain.aspx?Type=0");
                                                        }
                                                    }
                                                }
                                            }
                                        }
                                    }
                                }
                            }
                        }
                    }
                }
            }
        }
Пример #17
0
        protected override void AttachChildControls()
        {
            if (!int.TryParse(this.Page.Request.QueryString["bargainId"], out this.bargainId))
            {
                base.GotoResourceNotFound("");
            }
            this.litProdcutName              = (Literal)this.FindControl("litProdcutName");
            this.litShortDescription         = (Literal)this.FindControl("litShortDescription");
            this.litSalePrice                = (Literal)this.FindControl("litSalePrice");
            this.litFloorPrice               = (Literal)this.FindControl("litFloorPrice");
            this.litFloorPrice1              = (Literal)this.FindControl("litFloorPrice1");
            this.litPurchaseNumber           = (Literal)this.FindControl("litPurchaseNumber");
            this.litParticipantNumber        = (Literal)this.FindControl("litParticipantNumber");
            this.litProductDesc              = (Literal)this.FindControl("litProductDesc");
            this.litProductConsultationTotal = (Literal)this.FindControl("litProductConsultationTotal");
            this.litProductCommentTotal      = (Literal)this.FindControl("litProductCommentTotal");
            this.litStock           = (Literal)this.FindControl("litStock");
            this.hiddHasCollected   = (HtmlInputHidden)this.FindControl("hiddHasCollected");
            this.hiddProductId      = (HtmlInputHidden)this.FindControl("hiddProductId");
            this.hideTitle          = (HtmlInputHidden)this.FindControl("hideTitle");
            this.hideImgUrl         = (HtmlInputHidden)this.FindControl("hideImgUrl");
            this.hideDesc           = (HtmlInputHidden)this.FindControl("hideDesc");
            this.hiddEndDate        = (HtmlInputHidden)this.FindControl("hiddEndDate");
            this.hiddPurchaseNumber = (HtmlInputHidden)this.FindControl("hiddPurchaseNumber");
            this.skuSelector        = (Common_SKUSelector)this.FindControl("skuSelector");
            this.rptProductImages   = (VshopTemplatedRepeater)this.FindControl("rptProductImages");
            MemberInfo  currentMember = MemberProcessor.GetCurrentMember();
            bool        flag          = false;
            BargainInfo bargainInfo   = BargainHelper.GetBargainInfo(this.bargainId);

            if (bargainInfo != null)
            {
                this.hideTitle.Value = bargainInfo.Title;
                this.hideDesc.Value  = bargainInfo.Remarks;
                Uri    url           = HttpContext.Current.Request.Url;
                string activityCover = bargainInfo.ActivityCover;
                string str2          = string.Empty;
                if (!activityCover.StartsWith("http"))
                {
                    str2 = url.Scheme + "://" + url.Host + ((url.Port == 80) ? "" : (":" + url.Port.ToString()));
                }
                int id = Globals.RequestQueryNum("bargainDetialId");
                if (id > 0)
                {
                    BargainDetialInfo bargainDetialInfo = BargainHelper.GetBargainDetialInfo(id);
                    if ((currentMember == null) || (((currentMember != null) && (bargainDetialInfo != null)) && (bargainDetialInfo.UserId != currentMember.UserId)))
                    {
                        HttpContext.Current.Response.Redirect(string.Concat(new object[] { "HelpBargainDetial.aspx?bargainId=", this.bargainId, "&bargainDetialId=", id }));
                        HttpContext.Current.Response.End();
                    }
                }
                PageTitle.AddSiteNameTitle(bargainInfo.Title);
                this.litFloorPrice.Text        = bargainInfo.FloorPrice.ToString("F2");
                this.litFloorPrice1.Text       = bargainInfo.FloorPrice.ToString("F2");
                this.litPurchaseNumber.Text    = (bargainInfo.ActivityStock - bargainInfo.TranNumber).ToString();
                this.litParticipantNumber.Text = BargainHelper.HelpBargainCount(this.bargainId).ToString();
                this.hiddEndDate.Value         = bargainInfo.EndDate.ToString("yyyy:MM:dd:HH:mm:ss");
                this.hiddPurchaseNumber.Value  = bargainInfo.PurchaseNumber.ToString();
                this.litStock.Text             = bargainInfo.PurchaseNumber.ToString();
                if (bargainInfo.ProductId > 0)
                {
                    this.skuSelector.ProductId = bargainInfo.ProductId;
                    if (currentMember != null)
                    {
                        flag = ProductBrowser.CheckHasCollect(currentMember.UserId, bargainInfo.ProductId);
                    }
                    this.hiddHasCollected.SetWhenIsNotNull(flag ? "1" : "0");
                    ProductInfo productDetails = ProductHelper.GetProductDetails(bargainInfo.ProductId);
                    this.hiddProductId.Value      = bargainInfo.ProductId.ToString();
                    this.litProdcutName.Text      = productDetails.ProductName;
                    this.litShortDescription.Text = productDetails.ShortDescription;
                    this.litSalePrice.Text        = productDetails.MinSalePrice.ToString("f2");
                    this.litProductDesc.Text      = productDetails.Description;
                    this.hideImgUrl.Value         = string.IsNullOrEmpty(productDetails.ThumbnailUrl60) ? (str2 + activityCover) : (str2 + productDetails.ThumbnailUrl60);
                    if (this.rptProductImages != null)
                    {
                        string       locationUrl = "javascript:;";
                        SlideImage[] imageArray  = new SlideImage[] { new SlideImage(productDetails.ImageUrl1, locationUrl), new SlideImage(productDetails.ImageUrl2, locationUrl), new SlideImage(productDetails.ImageUrl3, locationUrl), new SlideImage(productDetails.ImageUrl4, locationUrl), new SlideImage(productDetails.ImageUrl5, locationUrl) };
                        this.rptProductImages.DataSource = from item in imageArray
                                                           where !string.IsNullOrWhiteSpace(item.ImageUrl)
                                                           select item;
                        this.rptProductImages.DataBind();
                    }
                    int productConsultationsCount = ProductBrowser.GetProductConsultationsCount(bargainInfo.ProductId, false);
                    this.litProductConsultationTotal.SetWhenIsNotNull(productConsultationsCount.ToString());
                    this.litProductCommentTotal.SetWhenIsNotNull(ProductBrowser.GetProductReviewsCount(bargainInfo.ProductId).ToString());
                }
            }
            else
            {
                HttpContext.Current.Response.Redirect("/default.aspx");
                HttpContext.Current.Response.End();
            }
        }
Пример #18
0
        protected override void AttachChildControls()
        {
            if (!int.TryParse(this.Page.Request.QueryString["bargainId"], out this.bargainId))
            {
                base.GotoResourceNotFound("");
            }
            int num = int.Parse(this.Page.Request.QueryString["bargainDetialId"]);

            this.litProdcutName              = (System.Web.UI.WebControls.Literal) this.FindControl("litProdcutName");
            this.litShortDescription         = (System.Web.UI.WebControls.Literal) this.FindControl("litShortDescription");
            this.litSalePrice                = (System.Web.UI.WebControls.Literal) this.FindControl("litSalePrice");
            this.litFloorPrice               = (System.Web.UI.WebControls.Literal) this.FindControl("litFloorPrice");
            this.litPurchaseNumber           = (System.Web.UI.WebControls.Literal) this.FindControl("litPurchaseNumber");
            this.litParticipantNumber        = (System.Web.UI.WebControls.Literal) this.FindControl("litParticipantNumber");
            this.litProductDesc              = (System.Web.UI.WebControls.Literal) this.FindControl("litProductDesc");
            this.litProductConsultationTotal = (System.Web.UI.WebControls.Literal) this.FindControl("litProductConsultationTotal");
            this.litProductCommentTotal      = (System.Web.UI.WebControls.Literal) this.FindControl("litProductCommentTotal");
            this.litStock           = (System.Web.UI.WebControls.Literal) this.FindControl("litStock");
            this.litPurcharseNum    = (System.Web.UI.WebControls.Literal) this.FindControl("litPurcharseNum");
            this.hiddHasCollected   = (System.Web.UI.HtmlControls.HtmlInputHidden) this.FindControl("hiddHasCollected");
            this.hiddProductId      = (System.Web.UI.HtmlControls.HtmlInputHidden) this.FindControl("hiddProductId");
            this.hiddEndDate        = (System.Web.UI.HtmlControls.HtmlInputHidden) this.FindControl("hiddEndDate");
            this.hiddPurchaseNumber = (System.Web.UI.HtmlControls.HtmlInputHidden) this.FindControl("hiddPurchaseNumber");
            this.rptProductImages   = (VshopTemplatedRepeater)this.FindControl("rptProductImages");
            this.skuSelector        = (Common_SKUSelector)this.FindControl("skuSelector");
            this.hideTitle          = (System.Web.UI.HtmlControls.HtmlInputHidden) this.FindControl("hideTitle");
            this.hideImgUrl         = (System.Web.UI.HtmlControls.HtmlInputHidden) this.FindControl("hideImgUrl");
            this.hideDesc           = (System.Web.UI.HtmlControls.HtmlInputHidden) this.FindControl("hideDesc");
            MemberInfo        currentMember     = MemberProcessor.GetCurrentMember();
            bool              flag              = false;
            BargainInfo       bargainInfo       = BargainHelper.GetBargainInfo(this.bargainId);
            BargainDetialInfo bargainDetialInfo = BargainHelper.GetBargainDetialInfo(num);

            if (bargainInfo != null)
            {
                PageTitle.AddSiteNameTitle(bargainInfo.Title);
                this.litFloorPrice.Text        = bargainInfo.FloorPrice.ToString("F2");
                this.litPurchaseNumber.Text    = (bargainInfo.ActivityStock - bargainInfo.TranNumber).ToString();
                this.litParticipantNumber.Text = BargainHelper.GetHelpBargainDetialCount(num).ToString();
                this.hiddEndDate.Value         = bargainInfo.EndDate.ToString("yyyy:MM:dd:HH:mm:ss");
                this.hiddPurchaseNumber.Value  = bargainInfo.PurchaseNumber.ToString();
                this.litStock.Text             = bargainInfo.PurchaseNumber.ToString();
                this.litPurcharseNum.Text      = bargainInfo.PurchaseNumber.ToString();
                this.hideTitle.Value           = bargainInfo.Title;
                this.hideDesc.Value            = bargainInfo.Remarks.Replace("\n", " ").Replace("\r", "");
                string     activityCover = bargainInfo.ActivityCover;
                string     str           = string.Empty;
                System.Uri url           = System.Web.HttpContext.Current.Request.Url;
                if (!activityCover.StartsWith("http"))
                {
                    str = url.Scheme + "://" + url.Host + ((url.Port == 80) ? "" : (":" + url.Port.ToString()));
                }
                if (bargainDetialInfo != null)
                {
                    this.litSalePrice.Text = bargainDetialInfo.Price.ToString("F2");
                }
                if (bargainInfo.ProductId > 0)
                {
                    this.skuSelector.ProductId = bargainInfo.ProductId;
                    if (currentMember != null)
                    {
                        flag = ProductBrowser.CheckHasCollect(currentMember.UserId, bargainInfo.ProductId);
                    }
                    this.hiddHasCollected.SetWhenIsNotNull(flag ? "1" : "0");
                    ProductInfo productDetails = ProductHelper.GetProductDetails(bargainInfo.ProductId);
                    this.hiddProductId.Value      = bargainInfo.ProductId.ToString();
                    this.litProdcutName.Text      = productDetails.ProductName;
                    this.litShortDescription.Text = bargainInfo.Remarks;
                    this.hideImgUrl.Value         = (string.IsNullOrEmpty(productDetails.ThumbnailUrl60) ? (str + activityCover) : (str + productDetails.ThumbnailUrl60));
                    this.litProductDesc.Text      = productDetails.Description;
                    if (this.rptProductImages != null)
                    {
                        string       locationUrl = "javascript:;";
                        SlideImage[] source      = new SlideImage[]
                        {
                            new SlideImage(productDetails.ImageUrl1, locationUrl),
                            new SlideImage(productDetails.ImageUrl2, locationUrl),
                            new SlideImage(productDetails.ImageUrl3, locationUrl),
                            new SlideImage(productDetails.ImageUrl4, locationUrl),
                            new SlideImage(productDetails.ImageUrl5, locationUrl)
                        };
                        this.rptProductImages.DataSource = from item in source
                                                           where !string.IsNullOrWhiteSpace(item.ImageUrl)
                                                           select item;
                        this.rptProductImages.DataBind();
                    }
                    int num2 = ProductBrowser.GetProductConsultationsCount(bargainInfo.ProductId, false);
                    this.litProductConsultationTotal.SetWhenIsNotNull(num2.ToString());
                    num2 = ProductBrowser.GetProductReviewsCount(bargainInfo.ProductId);
                    this.litProductCommentTotal.SetWhenIsNotNull(num2.ToString());
                }
            }
        }
Пример #19
0
        protected void Page_Load(object sender, System.EventArgs e)
        {
            string text  = base.Request.QueryString.Get("orderId");
            string text2 = base.Request.QueryString.Get("Ptype");

            if (string.IsNullOrEmpty(text))
            {
                this.infos.InnerText = "订单号为空,请返回";
                return;
            }
            if (!string.IsNullOrEmpty(text2) && text2 == "OneTao")
            {
                this.DoOneTaoPay(text);
                base.Response.End();
            }
            System.Collections.Generic.List <OrderInfo> orderMarkingOrderInfo = ShoppingProcessor.GetOrderMarkingOrderInfo(text, true);
            if (orderMarkingOrderInfo.Count == 0)
            {
                this.infos.InnerText = "订单信息未找到!";
                return;
            }
            decimal num = 0m;

            foreach (OrderInfo current in orderMarkingOrderInfo)
            {
                if (current.BargainDetialId > 0)
                {
                    string text3 = BargainHelper.IsCanBuyByBarginDetailId(current.BargainDetialId);
                    if (text3 != "1")
                    {
                        current.OrderStatus = OrderStatus.Closed;
                        current.CloseReason = text3;
                        OrderHelper.UpdateOrder(current);
                        base.Response.Write("<script>alert('" + text3 + ",订单自动关闭!');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;
                        }
                    }
                }
                num += current.GetCashPayMoney();
            }
            SiteSettings masterSettings = SettingsManager.GetMasterSettings(false);
            string       alipay_Pid     = masterSettings.Alipay_Pid;
            string       alipay_Key     = masterSettings.Alipay_Key;
            string       text4          = "utf-8";

            Hidistro.ControlPanel.OutPay.App.Core.setConfig(alipay_Pid, "MD5", alipay_Key, text4);
            string  value  = "1";
            string  value2 = Globals.FullPath("/Pay/wap_alipay_return_url.aspx");
            string  value3 = Globals.FullPath("/Pay/wap_alipay_notify_url.aspx");
            string  value4 = text;
            string  value5 = "订单支付";
            decimal num2   = num;
            string  value6 = Globals.FullPath("/Vshop/MemberOrderDetails.aspx?orderId=") + orderMarkingOrderInfo[0].OrderId;
            string  value7 = "订单号-" + orderMarkingOrderInfo[0].OrderId + " ...";
            string  value8 = "1m";
            string  value9 = "";
            string  s      = Hidistro.ControlPanel.OutPay.App.Core.BuildRequest(new System.Collections.Generic.SortedDictionary <string, string>
            {
                {
                    "partner",
                    alipay_Pid
                },
                {
                    "seller_id",
                    alipay_Pid
                },
                {
                    "_input_charset",
                    text4
                },
                {
                    "service",
                    "alipay.wap.create.direct.pay.by.user"
                },
                {
                    "payment_type",
                    value
                },
                {
                    "notify_url",
                    value3
                },
                {
                    "return_url",
                    value2
                },
                {
                    "out_trade_no",
                    value4
                },
                {
                    "subject",
                    value5
                },
                {
                    "total_fee",
                    num2.ToString("F")
                },
                {
                    "show_url",
                    value6
                },
                {
                    "body",
                    value7
                },
                {
                    "it_b_pay",
                    value8
                },
                {
                    "extern_token",
                    value9
                }
            }, "get", "确认");

            base.Response.Write(s);
        }
Пример #20
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;
            }
        }
Пример #21
0
        private void btnSave_Click(object sender, System.EventArgs e)
        {
            int    num  = Globals.RequestQueryNum("id");
            string text = this.txtTitle.Text;

            if (string.IsNullOrWhiteSpace(text))
            {
                this.ShowMsg("分享标题不能为空!", false);
                return;
            }
            string text2 = this.calendarStartDate.Text;
            string text3 = this.calendarEndDate.Text;

            if (string.IsNullOrWhiteSpace(text2) || string.IsNullOrWhiteSpace(text3))
            {
                this.ShowMsg("活动时间不能为空!", false);
                return;
            }
            if (System.DateTime.Parse(text2) >= System.DateTime.Parse(text3))
            {
                this.ShowMsg("结束时间必须大于开始时间!", false);
                return;
            }
            string value = this.hidpic.Value;

            if (string.IsNullOrWhiteSpace(value))
            {
                this.ShowMsg("请先上传活动封面!", false);
                return;
            }
            string text4 = this.txtRemarks.Text;

            if (text4.Length > 200)
            {
                this.ShowMsg("活动说明不能超过200个字节!", false);
                return;
            }
            int num2 = Globals.ToNum(this.hiddProductId.Value);

            if (num2 <= 0)
            {
                this.ShowMsg("请先选择参加活动的产品!", false);
                return;
            }
            int num3 = Globals.ToNum(this.txtActivityStock.Text.Trim());

            if (num3 <= 0)
            {
                this.ShowMsg("活动库存必须为大于0的正整数!", false);
                return;
            }
            int num4 = Globals.ToNum(this.txtPurchaseNumber.Text.Trim());

            if (num4 <= 0)
            {
                this.ShowMsg("限购数量必须为大于0的正整数!", false);
                return;
            }
            float num5 = 0f;

            if (!float.TryParse(this.txtInitialPrice.Text, out num5))
            {
                this.ShowMsg("初始价格输入不正确!", false);
                return;
            }
            float num6 = 0f;

            if (!float.TryParse(this.txtFloorPrice.Text, out num6))
            {
                this.ShowMsg("活动底价输入不正确!", false);
                return;
            }
            if (num6 <= 0f || num5 <= 0f)
            {
                this.ShowMsg("活动底价必须或初始价格必须大于0!", false);
                return;
            }
            if (num5 < num6)
            {
                this.ShowMsg("初始价格不能小于活动底价!", false);
                return;
            }
            long productSumStock = ProductHelper.GetProductSumStock(num2);

            if ((long)num3 > productSumStock)
            {
                this.ShowMsg("活动库存不能大于商品库存!", false);
                return;
            }
            if (num4 > num3)
            {
                this.ShowMsg("限购数量不能大于活动库存!", false);
                return;
            }
            int         num7        = this.rbtBargainTypeOne.Checked ? 0 : 1;
            BargainInfo bargainInfo = new BargainInfo();

            bargainInfo.Title          = text;
            bargainInfo.BeginDate      = System.DateTime.Parse(text2);
            bargainInfo.EndDate        = System.DateTime.Parse(text3);
            bargainInfo.ActivityCover  = value;
            bargainInfo.Remarks        = text4;
            bargainInfo.ProductId      = num2;
            bargainInfo.ActivityStock  = num3;
            bargainInfo.PurchaseNumber = num4;
            bargainInfo.TranNumber     = 0;
            bargainInfo.InitialPrice   = (decimal)num5;
            bargainInfo.FloorPrice     = (decimal)num6;
            bargainInfo.BargainType    = num7;
            bargainInfo.CreateDate     = System.DateTime.Now;
            bargainInfo.IsCommission   = this.ckIsCommission.Checked;
            if (num7 == 0)
            {
                string text5 = this.txtBargainTypeOneValue.Text;
                if (string.IsNullOrWhiteSpace(text5))
                {
                    this.ShowMsg("每次砍掉价格不能为空!", false);
                    return;
                }
                bargainInfo.BargainTypeMinVlue = float.Parse(text5);
            }
            else
            {
                string text6 = this.txtBargainTypeTwoValue1.Text;
                string text7 = this.txtBargainTypeTwoValue2.Text;
                if (string.IsNullOrWhiteSpace(text6) || string.IsNullOrWhiteSpace(text7))
                {
                    this.ShowMsg("随机砍价最小值或最大值不能为空!", false);
                    return;
                }
                float num8 = 0f;
                float num9 = 0f;
                if (!float.TryParse(text6, out num8))
                {
                    this.ShowMsg("随机砍价最小值必须为数值!", false);
                    return;
                }
                if (!float.TryParse(text7, out num9))
                {
                    this.ShowMsg("随机砍价最大值必须为数值!", false);
                    return;
                }
                if (num8 > num9)
                {
                    this.ShowMsg("随机砍价最大值必须大于最小值!", false);
                    return;
                }
                if (num8 < 0f || num9 < 0f)
                {
                    this.ShowMsg("随机砍价最大值,最小值都必须大于零!", false);
                    return;
                }
                bargainInfo.BargainTypeMinVlue = num8;
                bargainInfo.BargainTypeMaxVlue = num9;
            }
            if (num > 0)
            {
                bargainInfo.Id = num;
                bool flag = BargainHelper.UpdateBargain(bargainInfo);
                if (flag)
                {
                    this.ShowMsgAndReUrl("修改成功", true, "ManagerBargain.aspx?Type=0");
                    return;
                }
            }
            else
            {
                bool flag2 = BargainHelper.InsertBargain(bargainInfo);
                if (flag2)
                {
                    this.ShowMsgAndReUrl("添加成功", true, "ManagerBargain.aspx?Type=0");
                }
            }
        }