Exemplo n.º 1
0
        public void AddFightGroupActivitie(FightGroupActivityInfo fightGroupActivitie, IList <FightGroupSkuInfo> fightGroupSkus)
        {
            long fightGroupActivityId = this.Add(fightGroupActivitie, null);

            fightGroupSkus.ForEach(delegate(FightGroupSkuInfo x)
            {
                x.FightGroupActivityId = fightGroupActivityId;
                this.Add(x, null);
            });
        }
        protected override void AttachChildControls()
        {
            this.litRule = (Literal)this.FindControl("litRule");
            FightGroupActivityInfo fightGroupActivitieInfo = VShopHelper.GetFightGroupActivitieInfo(this.FightGroupActivityId);

            if (fightGroupActivitieInfo != null)
            {
                this.litRule.Text = $"邀请{fightGroupActivitieInfo.JoinNumber}人即可成团,人数不足自动退款";
            }
        }
Exemplo n.º 3
0
        public void EditFightGroupActivitie(FightGroupActivityInfo fightGroupActivitie)
        {
            FightGroupActivityInfo fightGroupActivityInfo = this.Get <FightGroupActivityInfo>(fightGroupActivitie.FightGroupActivityId);

            if (fightGroupActivityInfo != null)
            {
                fightGroupActivityInfo.Icon            = fightGroupActivitie.Icon;
                fightGroupActivityInfo.EndDate         = fightGroupActivitie.EndDate;
                fightGroupActivityInfo.MaxCount        = fightGroupActivitie.MaxCount;
                fightGroupActivityInfo.ShareContent    = fightGroupActivitie.ShareContent;
                fightGroupActivityInfo.ShareTitle      = fightGroupActivitie.ShareTitle;
                fightGroupActivityInfo.DisplaySequence = fightGroupActivitie.DisplaySequence;
            }
            this.Update(fightGroupActivityInfo, null);
        }
Exemplo n.º 4
0
        private void SetWXShare(FightGroupInfo fightGroup, ProductInfo product)
        {
            SiteSettings masterSettings = SettingsManager.GetMasterSettings();
            string       jsApiTicket    = base.GetJsApiTicket(true);
            string       text           = WAPTemplatedWebControl.GenerateNonceStr();
            string       text2          = WAPTemplatedWebControl.GenerateTimeStamp();
            string       absoluteUri    = this.Page.Request.Url.AbsoluteUri;

            this.hdAppId.Value     = base.site.WeixinAppId;
            this.hdTimestamp.Value = text2;
            this.hdNonceStr.Value  = text;
            this.hdSignature.Value = base.GetSignature(jsApiTicket, text, text2, absoluteUri);
            FightGroupActivityInfo fightGroupActivitieInfo = TradeHelper.GetFightGroupActivitieInfo(fightGroup.FightGroupActivityId);

            if (fightGroupActivitieInfo == null)
            {
                base.GotoResourceNotFound("活动已结束或者已删除");
            }
            else
            {
                string icon = fightGroupActivitieInfo.Icon;
                this.hdImgUrl.Value = Globals.FullPath(string.IsNullOrEmpty(icon) ? masterSettings.DefaultProductThumbnail8 : icon);
                if (string.IsNullOrEmpty(fightGroupActivitieInfo.ShareTitle))
                {
                    this.hdTitle.Value = (string.IsNullOrEmpty(product.Title) ? product.ProductName : product.Title);
                }
                else
                {
                    this.hdTitle.Value = fightGroupActivitieInfo.ShareTitle.Trim();
                }
                if (string.IsNullOrEmpty(fightGroupActivitieInfo.ShareContent.Trim()))
                {
                    this.hdDesc.Value = product.Meta_Description;
                }
                else
                {
                    this.hdDesc.Value = fightGroupActivitieInfo.ShareContent.Trim();
                }
                if (HiContext.Current.User.IsReferral())
                {
                    this.hdLink.Value = Globals.FullPath(string.Format("/vshop/FightGroupDetails.aspx?fightGroupId={0}&ReferralUserId=" + HiContext.Current.User.UserId, fightGroup.FightGroupId));
                }
                else
                {
                    this.hdLink.Value = Globals.FullPath($"/vshop/FightGroupDetails.aspx?fightGroupId={fightGroup.FightGroupId}");
                }
            }
        }
        private void BindProduct()
        {
            FightGroupActivityInfo fightGroupActivitieInfo = VShopHelper.GetFightGroupActivitieInfo(this.fightGroupActivityId);

            this.productId = ((this.productId == 0) ? fightGroupActivitieInfo.ProductId : this.productId);
            this.rptProductSkus.DataSource = VShopHelper.GetFightGroupSkus(this.fightGroupActivityId, this.productId);
            this.rptProductSkus.DataBind();
            IList <int> list = null;
            Dictionary <int, IList <int> > dictionary = default(Dictionary <int, IList <int> >);
            ProductInfo productDetails = ProductHelper.GetProductDetails(this.productId, out dictionary, out list);

            if (productDetails != null)
            {
                this.ltProductName.Text = productDetails.ProductName;
                this.ltStock.Text       = productDetails.Stock.ToString();
                this.lblPrice.Text      = productDetails.MinSalePrice.F2ToString("f2");
            }
        }
        private void BindFightGroupActivitiy()
        {
            FightGroupActivityInfo    fightGroupActivitieInfo = VShopHelper.GetFightGroupActivitieInfo(this.fightGroupActivityId);
            IList <FightGroupSkuInfo> fightGroupSkus          = VShopHelper.GetFightGroupSkus(this.fightGroupActivityId);
            int num = 0;

            if (fightGroupSkus.Count() == 1)
            {
                this.ltPrice.Text      = fightGroupSkus[0].SalePrice.F2ToString("f2");
                this.ltTotalCount.Text = fightGroupSkus[0].TotalCount.ToNullString();
                num = fightGroupSkus[0].BoughtCount;
            }
            else
            {
                for (int i = 0; i < fightGroupSkus.Count(); i++)
                {
                    num += fightGroupSkus[i].BoughtCount;
                }
            }
            Literal literal = this.ltMaxCount;
            int     num2    = fightGroupActivitieInfo.MaxCount;

            literal.Text            = num2.ToString();
            this.ltBoughtCount.Text = num.ToString();
            Literal  literal2 = this.ltEndDate;
            DateTime dateTime = fightGroupActivitieInfo.EndDate;

            literal2.Text = dateTime.ToString("yyyy-MM-dd HH:mm:ss");
            Literal literal3 = this.ltStartTime;

            dateTime              = fightGroupActivitieInfo.StartDate;
            literal3.Text         = dateTime.ToString("yyyy-MM-dd HH:mm:ss");
            this.imgIcon.ImageUrl = fightGroupActivitieInfo.Icon;
            Literal literal4 = this.ltJoinNumber;

            num2          = fightGroupActivitieInfo.JoinNumber;
            literal4.Text = num2.ToString();
            Literal literal5 = this.ltLimitedHour;

            num2          = fightGroupActivitieInfo.LimitedHour;
            literal5.Text = num2.ToString();
        }
Exemplo n.º 7
0
 private void FightGrouptBusiness()
 {
     if (this.FightGroupActivityId > 0)
     {
         FightGroupActivityInfo fightGroupActivitieInfo = VShopHelper.GetFightGroupActivitieInfo(this.FightGroupActivityId);
         int num;
         if (fightGroupActivitieInfo != null)
         {
             Literal literal = this.litMaxCount;
             num          = fightGroupActivitieInfo.MaxCount;
             literal.Text = num.ToString();
         }
         if (fightGroupActivitieInfo == null)
         {
             FightGroupInfo fightGroup = VShopHelper.GetFightGroup(this.FightGroupId);
             if (fightGroup != null)
             {
                 fightGroupActivitieInfo = VShopHelper.GetFightGroupActivitieInfo(fightGroup.FightGroupActivityId);
                 Literal literal2 = this.litMaxCount;
                 num           = fightGroupActivitieInfo.MaxCount;
                 literal2.Text = num.ToString();
             }
         }
         HtmlInputHidden htmlInputHidden = this.hidden_SKUSubmitOrderFightGroupActivityId;
         num = this.FightGroupActivityId;
         htmlInputHidden.Value = num.ToString();
         HtmlInputHidden htmlInputHidden2 = this.hidden_SKUSubmitOrderFightGroupId;
         num = this.FightGroupId;
         htmlInputHidden2.Value = num.ToString();
         IList <FightGroupSkuInfo> fightGroupSkus = VShopHelper.GetFightGroupSkus(this.FightGroupActivityId);
         this.hidden_SKUSubmitOrderFightGroupActivityMinPrice.Value = fightGroupSkus.Min((FightGroupSkuInfo c) => c.SalePrice).F2ToString("f2");
         int num2 = fightGroupSkus.Sum(delegate(FightGroupSkuInfo c)
         {
             if (c.Stock >= c.TotalCount - c.BoughtCount)
             {
                 return(c.TotalCount - c.BoughtCount);
             }
             return(c.Stock);
         });
         this.hidden_SKUSubmitOrderFightGroupActivityStock.Value = ((num2 > 0) ? num2.ToString() : "0");
     }
 }
        public void Delete(HttpContext context)
        {
            int value = base.GetIntParam(context, "id", false).Value;

            if (value <= 0)
            {
                throw new HidistroAshxException("错误的活动编号");
            }
            DateTime now = DateTime.Now;
            FightGroupActivityInfo fightGroupActivitieInfo = VShopHelper.GetFightGroupActivitieInfo(value);

            if (fightGroupActivitieInfo.StartDate > now)
            {
                VShopHelper.DeleteFightGroupActivitie(value);
                base.ReturnSuccessResult(context, "拼团活动删除成功", 0, true);
            }
            else
            {
                if (fightGroupActivitieInfo.StartDate <= now && fightGroupActivitieInfo.EndDate >= now)
                {
                    throw new HidistroAshxException("拼团活动正在进行中,不能删除");
                }
                if (fightGroupActivitieInfo.EndDate < now)
                {
                    if (VShopHelper.isEndFightCannotDel(value))
                    {
                        throw new HidistroAshxException("此活动已经开团,不能删除");
                    }
                    try
                    {
                        VShopHelper.DeleteFightGroupActivitie(value);
                        base.ReturnSuccessResult(context, "拼团活动删除成功", 0, true);
                    }
                    catch (Exception)
                    {
                        throw new HidistroAshxException("活动已产生了订单(含待付款)不能删除");
                    }
                }
            }
        }
Exemplo n.º 9
0
        public static bool ManageFightGroupOrder(OrderInfo orderInfo, DbTransaction dbTran)
        {
            FightGroupDao fightGroupDao = new FightGroupDao();

            if (orderInfo.FightGroupId == 0)
            {
                FightGroupActivityInfo fightGroupActivityInfo = fightGroupDao.Get <FightGroupActivityInfo>(orderInfo.FightGroupActivityId);
                if (fightGroupActivityInfo == null)
                {
                    return(false);
                }
                DateTime endTime = DateTime.Now.AddHours((double)fightGroupActivityInfo.LimitedHour);
                int      num     = fightGroupDao.CreateFightGroup(orderInfo.FightGroupActivityId, orderInfo.OrderId, endTime, dbTran);
                if (num == 0)
                {
                    return(false);
                }
                orderInfo.FightGroupId     = num;
                orderInfo.IsFightGroupHead = true;
            }
            else
            {
                orderInfo.IsFightGroupHead = false;
            }
            foreach (LineItemInfo value in orderInfo.LineItems.Values)
            {
                FightGroupSkuInfo groupSkuInfoByActivityIdSkuId = fightGroupDao.GetGroupSkuInfoByActivityIdSkuId(orderInfo.FightGroupActivityId, value.SkuId);
                if (groupSkuInfoByActivityIdSkuId != null)
                {
                    groupSkuInfoByActivityIdSkuId.BoughtCount += value.Quantity;
                    if (!fightGroupDao.Update(groupSkuInfoByActivityIdSkuId, dbTran))
                    {
                        return(false);
                    }
                }
            }
            return(true);
        }
Exemplo n.º 10
0
        private void SetWXShare(FightGroupInfo fightGroup, ProductInfo product)
        {
            SiteSettings           masterSettings          = SettingsManager.GetMasterSettings();
            string                 absoluteUri             = this.Page.Request.Url.AbsoluteUri;
            FightGroupActivityInfo fightGroupActivitieInfo = TradeHelper.GetFightGroupActivitieInfo(fightGroup.FightGroupActivityId);

            if (fightGroupActivitieInfo != null)
            {
                string jsApiTicket = base.GetJsApiTicket(true);
                string text        = WAPTemplatedWebControl.GenerateNonceStr();
                string text2       = WAPTemplatedWebControl.GenerateTimeStamp();
                this.hdAppId.Value     = base.site.WeixinAppId;
                this.hdTimestamp.Value = text2;
                this.hdNonceStr.Value  = text;
                this.hdSignature.Value = base.GetSignature(jsApiTicket, text, text2, absoluteUri);
                string icon = fightGroupActivitieInfo.Icon;
                this.hdImgUrl.Value = Globals.FullPath(string.IsNullOrEmpty(icon) ? masterSettings.DefaultProductThumbnail8 : icon);
                this.hdTitle.Value  = fightGroupActivitieInfo.ShareTitle;
                HtmlInputHidden htmlInputHidden  = this.hdDesc;
                HtmlInputHidden htmlInputHidden2 = this.hdLink;
                string          text5            = htmlInputHidden.Value = (htmlInputHidden2.Value = Globals.FullPath($"/vshop/FightGroupDetails.aspx?fightGroupId={fightGroup.FightGroupId}"));
            }
        }
Exemplo n.º 11
0
        private void BindFightGroupActivitiy()
        {
            FightGroupActivityInfo fightGroupActivitieInfo = VShopHelper.GetFightGroupActivitieInfo(this.fightGroupActivityId);

            if (fightGroupActivitieInfo != null)
            {
                IList <FightGroupSkuInfo> fightGroupSkus = VShopHelper.GetFightGroupSkus(this.fightGroupActivityId);
                int num = 0;
                if (fightGroupSkus.Count() == 1)
                {
                    this.txtPrice.Text      = fightGroupSkus[0].SalePrice.F2ToString("f2");
                    this.txtTotalCount.Text = fightGroupSkus[0].TotalCount.ToNullString();
                    num = fightGroupSkus[0].BoughtCount;
                }
                else
                {
                    for (int i = 0; i < fightGroupSkus.Count(); i++)
                    {
                        num += fightGroupSkus[i].BoughtCount;
                    }
                }
                this.rbtlTitle.SelectedIndex        = ((!string.IsNullOrEmpty(fightGroupActivitieInfo.ShareTitle)) ? 1 : 0);
                this.txtFightGroupShareTitle.Text   = fightGroupActivitieInfo.ShareTitle;
                this.txtFightGroupShareDetails.Text = fightGroupActivitieInfo.ShareContent;
                this.txtMaxCount.Text         = Convert.ToString(fightGroupActivitieInfo.MaxCount);
                this.ltBoughtCount.Text       = num.ToString();
                this.CPEndDate.SelectedDate   = fightGroupActivitieInfo.EndDate;
                this.CPStartTime.SelectedDate = fightGroupActivitieInfo.StartDate;
                this.hidUploadLogo.Value      = fightGroupActivitieInfo.Icon;
                TextBox textBox = this.txtJoinNumber;
                int     num2    = fightGroupActivitieInfo.JoinNumber;
                textBox.Text = num2.ToString();
                TextBox textBox2 = this.txtLimitedHour;
                num2          = fightGroupActivitieInfo.LimitedHour;
                textBox2.Text = num2.ToString();
            }
        }
Exemplo n.º 12
0
        private void toFightGroupSuccess()
        {
            int            num            = 1;
            int            num2           = 0;
            SiteSettings   masterSettings = SettingsManager.GetMasterSettings();
            FightGroupInfo fightGroup     = VShopHelper.GetFightGroup(this.Order.FightGroupId);

            if (fightGroup != null)
            {
                IList <FightGroupUserModel> fightGroupUsers = VShopHelper.GetFightGroupUsers(this.Order.FightGroupId);
                num = (this.Order.IsFightGroupHead ? 1 : ((fightGroupUsers == null || fightGroupUsers.Count >= fightGroup.JoinNumber) ? 3 : 2));
                if (num != 3)
                {
                    num2 = fightGroup.JoinNumber - fightGroupUsers.Count;
                }
                FightGroupActivityInfo fightGroupActivitieInfo = TradeHelper.GetFightGroupActivitieInfo(fightGroup.FightGroupActivityId);
                if (fightGroupActivitieInfo != null)
                {
                    ProductInfo productSimpleInfo = ProductBrowser.GetProductSimpleInfo(fightGroupActivitieInfo.ProductId);
                    if (productSimpleInfo != null)
                    {
                        string arg = (masterSettings.SiteUrl.ToNullString().ToLower().StartsWith("http://") ? masterSettings.SiteUrl : ("http://" + masterSettings.SiteUrl)).TrimEnd('/');
                        string str = "{Result\":{";
                        str += string.Format("\"ShareImage\":\"{0}\",", fightGroupActivitieInfo.Icon.Contains("http://") ? fightGroupActivitieInfo.Icon : $"{arg}/{fightGroupActivitieInfo.Icon}");
                        str += $"\"ShareTitle\":\"{(string.IsNullOrEmpty(fightGroupActivitieInfo.ShareTitle) ? productSimpleInfo.Title : fightGroupActivitieInfo.ShareTitle)}\",";
                        str += $"\"ShareContent\":\"{(string.IsNullOrEmpty(fightGroupActivitieInfo.ShareContent) ? productSimpleInfo.ProductName : fightGroupActivitieInfo.ShareContent)}\",";
                        str += $"\"ShareLink\":\"{$"{arg}/vshop/FightGroupDetails.aspx?fightGroupId={fightGroup.FightGroupId}"}\"";
                        str += "}}";
                        base.Response.Write("<script type=\"text/javascript\" src=\"/Templates/appshop/script/jquery-1.11.0.min.js\"></script>");
                        base.Response.Write("<script type=\"text/javascript\" src=\"/Utility/globals.js\"></script>");
                        base.Response.Write("<script type=\"text/javascript\" src=\"/Templates/appshop/script/main.js\"></script>");
                        base.Response.Write("<script type=\"text/javascript\">$(function () {goFightGroupSuccess(" + num + "," + num2 + "," + str + ");});</script>");
                        base.Response.End();
                    }
                }
            }
        }
Exemplo n.º 13
0
        private void GotoPay()
        {
            SiteSettings masterSettings = SettingsManager.GetMasterSettings();
            string       text           = "";
            string       text2          = HttpContext.Current.Request.UserAgent;

            if (string.IsNullOrEmpty(text2))
            {
                text2 = "";
            }
            text2 = text2.ToLower();
            string str = "";

            if (this.order == null)
            {
                this.litErrorMsg.Text = "订单数据错误";
            }
            else
            {
                DateTime dateTime;
                if (this.order.PreSaleId > 0)
                {
                    ProductPreSaleInfo productPreSaleInfo = ProductPreSaleHelper.GetProductPreSaleInfo(this.order.PreSaleId);
                    if (productPreSaleInfo == null)
                    {
                        this.litErrorMsg.Text = "预售活动不存在不能支付";
                        return;
                    }
                    if (!this.order.DepositDate.HasValue)
                    {
                        if (productPreSaleInfo.PreSaleEndDate < DateTime.Now)
                        {
                            this.litErrorMsg.Text = "您支付晚了,预售活动已经结束";
                            return;
                        }
                        if (!TradeHelper.CheckOrderStockBeforePay(this.order, out str))
                        {
                            this.litErrorMsg.Text = str + ",库存不足,不能进行支付";
                            return;
                        }
                    }
                    if (this.order.DepositDate.HasValue && this.order.OrderStatus == OrderStatus.WaitBuyerPay)
                    {
                        if (productPreSaleInfo.PaymentStartDate > DateTime.Now)
                        {
                            this.litErrorMsg.Text = "尾款支付尚未开始";
                            return;
                        }
                        dateTime = productPreSaleInfo.PaymentEndDate;
                        DateTime t = dateTime.AddDays(1.0);
                        if (t <= DateTime.Now)
                        {
                            this.litErrorMsg.Text = "尾款支付已结束,不能支付!";
                            return;
                        }
                    }
                }
                else if (!TradeHelper.CheckOrderStockBeforePay(this.order, out str))
                {
                    this.litErrorMsg.Text = str + ",库存不足,不能进行支付";
                    return;
                }
                string getClientPath = HiContext.Current.GetClientPath;
                this.litErrorMsg.Text = "";
                PaymentModeInfo paymentMode = ShoppingProcessor.GetPaymentMode(this.order.Gateway);
                if (string.IsNullOrEmpty(text))
                {
                    text = this.order.Gateway;
                }
                if (this.order.CountDownBuyId > 0)
                {
                    string empty = string.Empty;
                    foreach (KeyValuePair <string, LineItemInfo> lineItem in this.order.LineItems)
                    {
                        CountDownInfo countDownInfo = TradeHelper.CheckUserCountDown(lineItem.Value.ProductId, this.order.CountDownBuyId, lineItem.Value.SkuId, HiContext.Current.UserId, this.order.GetAllQuantity(true), this.order.OrderId, out empty, this.order.StoreId);
                        if (countDownInfo == null)
                        {
                            this.litErrorMsg.Text = empty;
                            return;
                        }
                    }
                }
                if (this.order.FightGroupId > 0)
                {
                    string empty2 = string.Empty;
                    foreach (KeyValuePair <string, LineItemInfo> lineItem2 in this.order.LineItems)
                    {
                        FightGroupActivityInfo fightGroupActivityInfo = VShopHelper.CheckUserFightGroup(lineItem2.Value.ProductId, this.order.FightGroupActivityId, this.order.FightGroupId, lineItem2.Value.SkuId, HiContext.Current.UserId, this.order.GetAllQuantity(true), this.order.OrderId, lineItem2.Value.Quantity, out empty2);
                        if (fightGroupActivityInfo == null)
                        {
                            this.litErrorMsg.Text = empty2;
                            return;
                        }
                    }
                }
                if (!string.IsNullOrEmpty(text))
                {
                    text = text.ToLower();
                }
                string  text3 = this.order.OrderId;
                decimal num   = this.order.GetTotal(true);
                text3 = this.order.PayOrderId;
                if (this.order.PreSaleId > 0)
                {
                    if (!this.order.DepositDate.HasValue && this.order.OrderStatus == OrderStatus.WaitBuyerPay)
                    {
                        num = this.order.Deposit - this.order.BalanceAmount;
                    }
                    if (this.order.DepositDate.HasValue && this.order.OrderStatus == OrderStatus.WaitBuyerPay)
                    {
                        num = this.order.FinalPayment;
                    }
                }
                if (this.order.Gateway == "hishop.plugins.payment.advancerequest")
                {
                    this.Page.Response.Redirect("TransactionPwd?orderId=" + this.Page.Request.QueryString["orderId"] + "&totalAmount=" + num.F2ToString("f2"));
                }
                if (text == "hishop.plugins.payment.shengpaymobile.shengpaymobilerequest")
                {
                    if (!masterSettings.EnableWapShengPay)
                    {
                        this.litErrorMsg.Text = "未开启盛付通手机网页支付";
                    }
                    else
                    {
                        string     text4  = "\"outMemberId\":\"{0}\",\"outMemberRegisterTime\":\"{1}\",\"outMemberRegisterIP\":\"{2}\",\"outMemberVerifyStatus\":{3},\"outMemberName\":\"{4}\",\"outMemberMobile\":\"{5}\",\"attach\":\"{6}\"";
                        MemberInfo user   = HiContext.Current.User;
                        string     format = text4;
                        object[]   obj    = new object[7]
                        {
                            user.UserId,
                            null,
                            null,
                            null,
                            null,
                            null,
                            null
                        };
                        dateTime = user.CreateDate;
                        obj[1]   = dateTime.ToString("yyyyMMddHHmmss");
                        obj[2]   = "";
                        obj[3]   = 0;
                        obj[4]   = (string.IsNullOrEmpty(user.NickName) ? user.UserName : user.NickName);
                        obj[5]   = (string.IsNullOrEmpty(user.CellPhone) ? "13566778899" : user.CellPhone);
                        obj[6]   = "";
                        string         attach         = "{" + string.Format(format, obj) + "}";
                        string         text5          = $"http://{HttpContext.Current.Request.Url.Host}/{getClientPath}/default";
                        PaymentRequest paymentRequest = PaymentRequest.CreateInstance(paymentMode.Gateway, HiCryptographer.Decrypt(paymentMode.Settings), text3, num, "订单支付", "订单号-" + this.order.OrderId, this.order.EmailAddress, this.order.OrderDate, text5, text5, Globals.FullPath("/pay/wap_sheng_return_url"), attach);
                        paymentRequest.SendRequest();
                    }
                }
                else if (text == "hishop.plugins.payment.ws_wappay.wswappayrequest")
                {
                    if ((!masterSettings.EnableWeixinWapAliPay && base.ClientType == ClientType.VShop) || (!masterSettings.EnableWapAliPay && (base.ClientType == ClientType.WAP || base.ClientType == ClientType.AliOH)))
                    {
                        this.litErrorMsg.Text = "未开启支付宝网页支付";
                    }
                    else if (text2.IndexOf("micromessenger") > -1)
                    {
                        this.loadPanel.Visible  = false;
                        this.sharePanel.Visible = true;
                    }
                    else
                    {
                        this.loadPanel.Visible  = true;
                        this.sharePanel.Visible = false;
                        string         attach2         = "";
                        string         showUrl         = $"http://{HttpContext.Current.Request.Url.Host}/{getClientPath}/";
                        PaymentRequest paymentRequest2 = PaymentRequest.CreateInstance(paymentMode.Gateway, HiCryptographer.Decrypt(paymentMode.Settings), text3, num, "订单支付", "订单号-" + this.order.OrderId, this.order.EmailAddress, this.order.OrderDate, showUrl, Globals.FullPath("/pay/wap_alipay_return_url"), Globals.FullPath("/pay/wap_alipay_notify_url"), attach2);
                        paymentRequest2.SendRequest();
                    }
                }
                else if (this.order.Gateway == "hishop.plugins.payment.alipaycrossbordermobilepayment.alipaycrossbordermobilepaymentrequest")
                {
                    if (!masterSettings.EnableWapAliPayCrossBorder || base.ClientType != ClientType.WAP)
                    {
                        this.litErrorMsg.Text = "未开启支付宝跨境网页支付";
                    }
                    else
                    {
                        string attach3  = "";
                        string showUrl2 = $"http://{HttpContext.Current.Request.Url.Host}/{getClientPath}/";
                        text3 = this.order.OrderId;
                        text3 = this.order.PayOrderId;
                        PaymentRequest paymentRequest3 = PaymentRequest.CreateInstance(paymentMode.Gateway, HiCryptographer.Decrypt(paymentMode.Settings), text3, num, "OrderPay", "Order_No-" + this.order.OrderId, this.order.EmailAddress, this.order.OrderDate, showUrl2, Globals.FullPath("/pay/wap_alipay_cross_border_return_url"), Globals.FullPath("/pay/wap_alipay_cross_border_notify_url"), attach3);
                        paymentRequest3.SendRequest();
                    }
                }
                else if (base.ClientType == ClientType.VShop)
                {
                    if (text == "hishop.plugins.payment.weixinrequest")
                    {
                        if (!masterSettings.EnableWeiXinRequest && this.order.OrderType == OrderType.ServiceOrder && !masterSettings.OpenWxAppletWxPay)
                        {
                            this.litErrorMsg.Text = "未开启支微信支付";
                            return;
                        }
                        HttpContext.Current.Response.Redirect("~/pay/wx_Submit?orderId=" + this.order.OrderId);
                    }
                    if (text == "hishop.plugins.payment.bankuniongateway.bankuniongetwayrequest")
                    {
                        if (!masterSettings.EnableBankUnionPay)
                        {
                            this.litErrorMsg.Text = "未开启银联全渠道支付";
                        }
                        else
                        {
                            string         attach4         = "";
                            string         showUrl3        = $"http://{HttpContext.Current.Request.Url.Host}/vshop/";
                            PaymentRequest paymentRequest4 = PaymentRequest.CreateInstance(paymentMode.Gateway, HiCryptographer.Decrypt(paymentMode.Settings), text3, num, "订单支付", "订单号-" + this.order.OrderId, this.order.EmailAddress, this.order.OrderDate, showUrl3, Globals.FullPath("/pay/wap_bankunion_return_url"), Globals.FullPath("/pay/wap_bankunion_notify_url"), attach4);
                            paymentRequest4.SendRequest();
                        }
                    }
                    else
                    {
                        if (text == "hishop.plugins.payment.alipaywx.alipaywxrequest")
                        {
                            if (!masterSettings.EnableWeixinWapAliPay)
                            {
                                this.litErrorMsg.Text = "未开启微信端支付宝支付";
                                return;
                            }
                            HttpContext.Current.Response.Redirect("~/vshop/WXAliPay?orderId=" + this.order.OrderId);
                        }
                        if (paymentMode == null)
                        {
                            this.litErrorMsg.Text = "错误的支付方式";
                        }
                        else
                        {
                            this.litErrorMsg.Text = "微信商城不支持使用" + paymentMode.Name + "进行支付";
                        }
                    }
                }
                else if (base.ClientType == ClientType.AliOH)
                {
                    if (text == "hishop.plugins.payment.bankuniongateway.bankuniongetwayrequest")
                    {
                        this.litErrorMsg.Text = "生活号不支持银联全渠道支付";
                    }
                    else
                    {
                        if (text == "hishop.plugins.payment.weixinrequest")
                        {
                            if (!masterSettings.EnableWapWeiXinPay)
                            {
                                this.litErrorMsg.Text = "未开启支微信支付";
                                return;
                            }
                            HttpContext.Current.Response.Redirect("~/pay/H5WxPay_Submit.aspx?orderId=" + this.order.OrderId);
                        }
                        if (paymentMode == null)
                        {
                            this.litErrorMsg.Text = "错误的支付方式";
                        }
                        else
                        {
                            this.litErrorMsg.Text = "生活号不支持使用" + paymentMode.Name + "进行支付";
                        }
                    }
                }
                else if (text == "hishop.plugins.payment.bankuniongateway.bankuniongetwayrequest")
                {
                    if (!masterSettings.EnableBankUnionPay)
                    {
                        this.litErrorMsg.Text = "未开启银联全渠道支付";
                    }
                    else
                    {
                        string         attach5         = "";
                        string         showUrl4        = $"http://{HttpContext.Current.Request.Url.Host}/{getClientPath}/";
                        PaymentRequest paymentRequest5 = PaymentRequest.CreateInstance(paymentMode.Gateway, HiCryptographer.Decrypt(paymentMode.Settings), text3, num, "订单支付", "订单号-" + this.order.OrderId, this.order.EmailAddress, this.order.OrderDate, showUrl4, Globals.FullPath("/pay/wap_bankunion_return_url"), Globals.FullPath("/pay/wap_bankunion_notify_url"), attach5);
                        paymentRequest5.SendRequest();
                    }
                }
                else
                {
                    if (text == "hishop.plugins.payment.weixinrequest")
                    {
                        if (!masterSettings.EnableWapWeiXinPay)
                        {
                            this.litErrorMsg.Text = "未开启支微信支付";
                            return;
                        }
                        HttpContext.Current.Response.Redirect("~/pay/H5WxPay_Submit.aspx?orderId=" + this.order.OrderId);
                    }
                    if (paymentMode == null)
                    {
                        this.litErrorMsg.Text = "错误的支付方式";
                    }
                    else
                    {
                        this.litErrorMsg.Text = "触屏版不支持使用" + paymentMode.Name + "进行支付";
                    }
                }
            }
        }
Exemplo n.º 14
0
        public void ConfirmPay(HttpContext context)
        {
            string text = context.Request["id"];

            if (string.IsNullOrWhiteSpace(text))
            {
                throw new HidistroAshxException("错误的编号");
            }
            OrderInfo orderInfo = new OrderDao().GetOrderInfo(text);

            if (orderInfo == null)
            {
                throw new HidistroAshxException("错误的编号");
            }
            if (!orderInfo.CheckAction(OrderActions.SELLER_CONFIRM_PAY))
            {
                throw new HidistroAshxException("权限不足");
            }
            PaymentModeInfo paymentMode = SalesHelper.GetPaymentMode("hishop.plugins.payment.bankrequest");

            if (paymentMode != null)
            {
                orderInfo.Gateway       = paymentMode.Gateway;
                orderInfo.PaymentType   = paymentMode.Name;
                orderInfo.PaymentTypeId = paymentMode.ModeId;
            }
            else
            {
                orderInfo.Gateway       = "hishop.plugins.payment.bankrequest";
                orderInfo.PaymentType   = "线下支付";
                orderInfo.PaymentTypeId = 0;
            }
            int num  = 0;
            int num2 = 0;
            int num3 = 0;

            if (orderInfo.CountDownBuyId > 0)
            {
                string empty = string.Empty;
                foreach (KeyValuePair <string, LineItemInfo> lineItem in orderInfo.LineItems)
                {
                    CountDownInfo countDownInfo = TradeHelper.CheckUserCountDown(lineItem.Value.ProductId, orderInfo.CountDownBuyId, lineItem.Value.SkuId, orderInfo.UserId, orderInfo.GetAllQuantity(true), orderInfo.OrderId, out empty, orderInfo.StoreId);
                    if (countDownInfo == null)
                    {
                        throw new HidistroAshxException(empty);
                    }
                }
            }
            if (orderInfo.FightGroupId > 0)
            {
                string empty2 = string.Empty;
                foreach (KeyValuePair <string, LineItemInfo> lineItem2 in orderInfo.LineItems)
                {
                    FightGroupActivityInfo fightGroupActivityInfo = VShopHelper.CheckUserFightGroup(lineItem2.Value.ProductId, orderInfo.FightGroupActivityId, orderInfo.FightGroupId, lineItem2.Value.SkuId, orderInfo.UserId, orderInfo.GetAllQuantity(true), orderInfo.OrderId, lineItem2.Value.Quantity, out empty2);
                    if (fightGroupActivityInfo == null)
                    {
                        throw new HidistroAshxException(empty2);
                    }
                }
            }
            if (orderInfo.GroupBuyId > 0)
            {
                GroupBuyInfo groupBuy = PromoteHelper.GetGroupBuy(orderInfo.GroupBuyId);
                if (groupBuy == null || groupBuy.Status != GroupBuyStatus.UnderWay)
                {
                    throw new HidistroAshxException("当前的订单为团购订单,此团购活动已结束,所以不能支付");
                }
                num2 = PromoteHelper.GetOrderCount(orderInfo.GroupBuyId);
                num  = groupBuy.MaxCount;
                num3 = orderInfo.GetGroupBuyOerderNumber();
                if (num < num2 + num3)
                {
                    throw new HidistroAshxException("当前的订单为团购订单,订购数量已超过订购总数,所以不能支付");
                }
            }
            if (orderInfo.PreSaleId > 0)
            {
                ProductPreSaleInfo productPreSaleInfo = ProductPreSaleHelper.GetProductPreSaleInfo(orderInfo.PreSaleId);
                if (productPreSaleInfo == null)
                {
                    throw new HidistroAshxException("预售活动不存在");
                }
                if (!orderInfo.DepositDate.HasValue && productPreSaleInfo.PreSaleEndDate < DateTime.Now)
                {
                    throw new HidistroAshxException("预售活动已结束不能支付定金,所以不能确认收款");
                }
            }
            string empty3 = string.Empty;

            switch (TradeHelper.CheckOrderBeforePay(orderInfo, out empty3))
            {
            case 1:
                throw new HidistroAshxException($"当前有商品{empty3}下架或者被删除,不能确认收款");

            case 2:
                if ((orderInfo.PreSaleId <= 0 || orderInfo.DepositDate.HasValue) && orderInfo.PreSaleId > 0)
                {
                    break;
                }
                throw new HidistroAshxException($"当前有商品{empty3}库存不足,不能确认收款");
            }
            if (OrderHelper.ConfirmPay(orderInfo))
            {
                if (orderInfo.GroupBuyId > 0 && num == num2 + num3)
                {
                    PromoteHelper.SetGroupBuyEndUntreated(orderInfo.GroupBuyId);
                }
                if (orderInfo.ParentOrderId == "-1")
                {
                    OrderQuery orderQuery = new OrderQuery();
                    orderQuery.ParentOrderId = orderInfo.OrderId;
                    IList <OrderInfo> listUserOrder = MemberProcessor.GetListUserOrder(orderInfo.UserId, orderQuery);
                    foreach (OrderInfo item in listUserOrder)
                    {
                        OrderHelper.OrderConfirmPaySendMessage(item);
                    }
                }
                else
                {
                    OrderHelper.OrderConfirmPaySendMessage(orderInfo);
                }
                base.ReturnSuccessResult(context, "成功的确认了订单收款", 0, true);
                return;
            }
            throw new HidistroAshxException("确认订单收款失败");
        }
Exemplo n.º 15
0
        protected override void AttachChildControls()
        {
            this.divConsultationEmpty    = (HtmlGenericControl)this.FindControl("divConsultationEmpty");
            this.rptProductConsultations = (WapTemplatedRepeater)this.FindControl("rptProductConsultations");
            this.fightGroupRule          = (Common_FightGroupRule)this.FindControl("fightGroupRule");
            this.rptProductImages        = (WapTemplatedRepeater)this.FindControl("rptProductImages");
            this.divFightGroupsHead      = (HtmlControl)this.FindControl("divFightGroupsHead");
            this.skuSubmitOrder          = (Common_SKUSubmitOrder)this.FindControl("skuSubmitOrder");
            this.fightGroupActivityId    = this.Page.Request["fightGroupActivityId"].ToInt(0);
            this.litDescription          = (Literal)this.FindControl("litDescription");
            this.litConsultationsCount   = (Literal)this.FindControl("litConsultationsCount");
            this.litJoinNumber           = (Literal)this.FindControl("litJoinNumber");
            this.litStartDate            = (Literal)this.FindControl("litStartDate");
            this.litProductName          = (Literal)this.FindControl("litProductName");
            this.litFGAPrice             = (Literal)this.FindControl("litFGAPrice");
            this.litPPrice             = (Literal)this.FindControl("litPPrice");
            this.litProductReviewCount = (Literal)this.FindControl("litProductReviewCount");
            this.imgEnd          = (Image)this.FindControl("imgEnd");
            this.hlProductReview = (HyperLink)this.FindControl("hlProductReview");
            this.rptFightGroups  = (WapTemplatedRepeater)this.FindControl("rptFightGroups");
            this.litProductPrice = (Literal)this.FindControl("litProductPrice");
            this.lblStock        = (StockLabel)this.FindControl("lblStock");
            this.litUnit         = (Literal)this.FindControl("litUnit");
            this.divGetBySelf    = (HtmlControl)this.FindControl("divGetBySelf");
            FightGroupActivityInfo fightGroupActivitieInfo = TradeHelper.GetFightGroupActivitieInfo(this.fightGroupActivityId);

            if (fightGroupActivitieInfo != null)
            {
                if (fightGroupActivitieInfo.StartDate <= DateTime.Now)
                {
                    HiContext.Current.Context.Response.Redirect("FightGroupActivityDetails?fightGroupActivityId=" + fightGroupActivitieInfo.FightGroupActivityId);
                }
                this.fightGroupRule.FightGroupActivityId = fightGroupActivitieInfo.FightGroupActivityId;
                SiteSettings masterSettings = SettingsManager.GetMasterSettings();
                if (masterSettings.OpenMultStore && StoresHelper.ProductHasStores(fightGroupActivitieInfo.ProductId))
                {
                    this.divGetBySelf.Visible = true;
                }
                IList <FightGroupSkuInfo> fightGroupSkus = VShopHelper.GetFightGroupSkus(this.fightGroupActivityId);
                this.hlProductReview.NavigateUrl = $"/vshop/ProductReview.aspx?ProductId={fightGroupActivitieInfo.ProductId}";
                this.imgEnd.Visible = (fightGroupActivitieInfo.EndDate < DateTime.Now);
                Literal literal = this.litJoinNumber;
                int     num     = fightGroupActivitieInfo.JoinNumber;
                literal.Text             = num.ToString();
                this.litStartDate.Text   = fightGroupActivitieInfo.StartDate.ToString("yyyy-MM-dd HH:mm:ss");
                this.litProductName.Text = fightGroupActivitieInfo.ProductName;
                decimal num2 = fightGroupSkus.Min((FightGroupSkuInfo c) => c.SalePrice);
                this.litFGAPrice.Text = num2.F2ToString("f2");
                if (fightGroupSkus.Count() > 1)
                {
                    decimal num3 = fightGroupSkus.Max((FightGroupSkuInfo c) => c.SalePrice);
                    if (num3 > num2)
                    {
                        this.litFGAPrice.Text = num2.F2ToString("f2") + "~" + num3.F2ToString("f2");
                    }
                }
                IList <int> list = null;
                Dictionary <int, IList <int> > dictionary = default(Dictionary <int, IList <int> >);
                ProductInfo productDetails = ProductHelper.GetProductDetails(fightGroupActivitieInfo.ProductId, out dictionary, out list);
                if (productDetails != null)
                {
                    this.litPPrice.Text             = productDetails.MaxSalePrice.F2ToString("f2");
                    this.litProductPrice.Text       = this.litPPrice.Text;
                    this.skuSubmitOrder.ProductInfo = productDetails;
                }
                this.skuSubmitOrder.FightGroupActivityId = fightGroupActivitieInfo.FightGroupActivityId;
                Literal literal2 = this.litProductReviewCount;
                num = ProductBrowser.GetProductReviews(new ProductReviewQuery
                {
                    PageIndex = 1,
                    PageSize  = 2147483647,
                    ProductId = fightGroupActivitieInfo.ProductId
                }).TotalRecords;
                literal2.Text = num.ToString();
                DataTable fightGroups = VShopHelper.GetFightGroups(this.fightGroupActivityId);
                for (int i = 0; i < fightGroups.Rows.Count; i++)
                {
                    fightGroups.Rows[i]["Name"] = DataHelper.GetHiddenUsername(fightGroups.Rows[i]["Name"].ToString());
                }
                this.divFightGroupsHead.Visible = (fightGroups.Rows.Count > 0);
                this.rptFightGroups.DataSource  = fightGroups;
                this.rptFightGroups.DataBind();
                if (this.rptProductImages != null)
                {
                    string locationUrl = "javascript:;";
                    if (string.IsNullOrEmpty(productDetails.ImageUrl1) && string.IsNullOrEmpty(productDetails.ImageUrl2) && string.IsNullOrEmpty(productDetails.ImageUrl3) && string.IsNullOrEmpty(productDetails.ImageUrl4) && string.IsNullOrEmpty(productDetails.ImageUrl5))
                    {
                        productDetails.ImageUrl1 = masterSettings.DefaultProductImage;
                    }
                    DataTable         skus  = ProductBrowser.GetSkus(fightGroupActivitieInfo.ProductId);
                    List <SlideImage> list2 = new List <SlideImage>();
                    foreach (DataRow row in skus.Rows)
                    {
                        List <SlideImage> list3 = (from s in list2
                                                   where s.ImageUrl == row["ThumbnailUrl410"].ToString()
                                                   select s).ToList();
                        if (list3.Count <= 0)
                        {
                            list2.Add(new SlideImage(row["ThumbnailUrl410"].ToString(), locationUrl));
                        }
                    }
                    list2.Add(new SlideImage(productDetails.ImageUrl1, locationUrl));
                    list2.Add(new SlideImage(productDetails.ImageUrl2, locationUrl));
                    list2.Add(new SlideImage(productDetails.ImageUrl3, locationUrl));
                    list2.Add(new SlideImage(productDetails.ImageUrl4, locationUrl));
                    list2.Add(new SlideImage(productDetails.ImageUrl5, locationUrl));
                    this.rptProductImages.DataSource = from item in list2
                                                       where !string.IsNullOrWhiteSpace(item.ImageUrl)
                                                       select item;
                    this.rptProductImages.DataBind();
                    Literal control = this.litConsultationsCount;
                    num = ProductBrowser.GetProductConsultationsCount(productDetails.ProductId, true);
                    control.SetWhenIsNotNull(num.ToString());
                    if (this.litDescription != null)
                    {
                        string text  = "";
                        Regex  regex = new Regex("<script[^>]*?>.*?</script>", RegexOptions.IgnoreCase);
                        if (!string.IsNullOrWhiteSpace(productDetails.MobbileDescription))
                        {
                            text = regex.Replace(productDetails.MobbileDescription, "");
                        }
                        else if (!string.IsNullOrWhiteSpace(productDetails.Description))
                        {
                            text = regex.Replace(productDetails.Description, "");
                        }
                        text = text.Replace("src", "data-url");
                        this.litDescription.Text = text;
                    }
                }
                DataTable data = ProductBrowser.GetProductConsultations(new ProductConsultationAndReplyQuery
                {
                    ProductId = productDetails.ProductId,
                    PageIndex = 1,
                    PageSize  = 2147483647,
                    SortOrder = SortAction.Desc,
                    SortBy    = "ConsultationId"
                }).Data;
                for (int j = 0; j < data.Rows.Count; j++)
                {
                    data.Rows[j]["UserName"] = DataHelper.GetHiddenUsername(data.Rows[j]["UserName"].ToNullString());
                }
                this.rptProductConsultations.DataSource = data;
                this.rptProductConsultations.DataBind();
                this.divConsultationEmpty.Visible = data.IsNullOrEmpty();
            }
            else
            {
                base.GotoResourceNotFound("活动不存在");
            }
        }
Exemplo n.º 16
0
        protected override void AttachChildControls()
        {
            this.orderId = base.GetParameter("orderId", false);
            if (base.GetParameter("isCallback", false).ToBool())
            {
                HiContext.Current.Context.Response.Clear();
                HiContext.Current.Context.Response.ContentType = "application/json";
                string parameter = base.GetParameter("action", false);
                if (parameter.Equals("ToPay"))
                {
                    string    empty     = string.Empty;
                    OrderInfo orderInfo = ShoppingProcessor.GetOrderInfo(this.orderId);
                    if (orderInfo != null || orderInfo.UserId != HiContext.Current.UserId)
                    {
                        if (orderInfo.OrderStatus != OrderStatus.WaitBuyerPay)
                        {
                            HiContext.Current.Context.Response.Write("{\"Status\":0,\"Msg\":\"当前订单不是等待付款状态\"}");
                            return;
                        }
                        if (orderInfo.CountDownBuyId > 0)
                        {
                            foreach (KeyValuePair <string, LineItemInfo> lineItem in orderInfo.LineItems)
                            {
                                CountDownInfo countDownInfo = TradeHelper.CheckUserCountDown(lineItem.Value.ProductId, orderInfo.CountDownBuyId, lineItem.Value.SkuId, HiContext.Current.UserId, orderInfo.GetAllQuantity(true), orderInfo.OrderId, out empty, orderInfo.StoreId);
                                if (countDownInfo == null)
                                {
                                    HiContext.Current.Context.Response.Write("{\"Status\":0,\"Msg\":\"" + empty + "\"}");
                                    return;
                                }
                            }
                        }
                        if (orderInfo.FightGroupId > 0)
                        {
                            foreach (KeyValuePair <string, LineItemInfo> lineItem2 in orderInfo.LineItems)
                            {
                                FightGroupActivityInfo fightGroupActivityInfo = VShopHelper.CheckUserFightGroup(lineItem2.Value.ProductId, orderInfo.FightGroupActivityId, orderInfo.FightGroupId, lineItem2.Value.SkuId, HiContext.Current.UserId, orderInfo.GetAllQuantity(true), orderInfo.OrderId, lineItem2.Value.Quantity, out empty);
                                if (fightGroupActivityInfo == null)
                                {
                                    HiContext.Current.Context.Response.Write("{\"Status\":0,\"Msg\":\"" + empty + "\"}");
                                    return;
                                }
                            }
                        }
                        if (orderInfo.PreSaleId > 0)
                        {
                            ProductPreSaleInfo productPreSaleInfo = ProductPreSaleHelper.GetProductPreSaleInfo(orderInfo.PreSaleId);
                            if (productPreSaleInfo == null)
                            {
                                HiContext.Current.Context.Response.Write("{\"Status\":0,\"Msg\":\"预售活动不存在不能支付\"}");
                                return;
                            }
                            if (!orderInfo.DepositDate.HasValue && orderInfo.OrderStatus == OrderStatus.WaitBuyerPay && productPreSaleInfo.PreSaleEndDate < DateTime.Now)
                            {
                                HiContext.Current.Context.Response.Write("{\"Status\":0,\"Msg\":\"您支付晚了,预售活动已经结束\"}");
                                return;
                            }
                            if (orderInfo.DepositDate.HasValue && orderInfo.OrderStatus == OrderStatus.WaitBuyerPay)
                            {
                                if (productPreSaleInfo.PaymentStartDate > DateTime.Now)
                                {
                                    HiContext.Current.Context.Response.Write("{\"Status\":0,\"Msg\":\"尾款支付尚未开始\"}");
                                    return;
                                }
                                DateTime dateTime = productPreSaleInfo.PaymentEndDate;
                                DateTime date     = dateTime.Date;
                                dateTime = DateTime.Now;
                                if (date < dateTime.Date)
                                {
                                    HiContext.Current.Context.Response.Write("{\"Status\":0,\"Msg\":\"尾款支付已结束\"}");
                                    return;
                                }
                            }
                        }
                        int             modeId      = base.GetParameter("paymentModeId", false).ToInt(0);
                        PaymentModeInfo paymentMode = ShoppingProcessor.GetPaymentMode(modeId);
                        if (paymentMode == null)
                        {
                            HiContext.Current.Context.Response.Write("{\"Status\":0,\"Msg\":\"请选择支付方式\"}");
                            return;
                        }
                        orderInfo.PaymentTypeId = paymentMode.ModeId;
                        orderInfo.Gateway       = paymentMode.Gateway;
                        orderInfo.PaymentType   = paymentMode.Name;
                        if (TradeHelper.UpdateOrderPaymentType(orderInfo))
                        {
                            string empty2 = string.Empty;
                            empty2 = ((!(orderInfo.Gateway.ToLower() != "hishop.plugins.payment.advancerequest")) ? ("{\"Status\":1,\"Msg\":\"" + $"/user/pay.aspx?OrderId={this.orderId}" + "\"}") : ((!(orderInfo.Gateway.ToLower() == "hishop.plugins.payment.bankrequest")) ? ("{\"Status\":1,\"Msg\":\"" + base.GetRouteUrl("sendPayment", new
                            {
                                this.orderId
                            }) + "\"}") : ("{\"Status\":1,\"Msg\":\"" + Globals.FullPath(base.GetRouteUrl("bank_pay", new
                            {
                                orderInfo.OrderId
                            })) + "\"}")));
                            HttpContext.Current.Response.Write(empty2);
                            HttpContext.Current.Response.End();
                            return;
                        }
                        goto IL_058f;
                    }
                    HiContext.Current.Context.Response.Write("{\"Status\":0,\"Msg\":\"错误的订单信息\"}");
                    HttpContext.Current.Response.End();
                    return;
                }
            }
            goto IL_058f;
IL_058f:
            if (string.IsNullOrEmpty(this.orderId))
            {
                base.GotoResourceNotFound();
            }
            this.litOrderId           = (Literal)this.FindControl("litOrderId");
            this.litOrderPrice        = (FormatedMoneyLabel)this.FindControl("litOrderPrice");
            this.promptMsg            = (HtmlGenericControl)this.FindControl("promptMsg");
            this.onlinePayPanel       = (HtmlGenericControl)this.FindControl("onlinePayPanel");
            this.btnOrderPay          = ButtonManager.Create(this.FindControl("btnOrderPay"));
            this.paymentModeList      = (Common_PaymentModeList)this.FindControl("grd_Common_PaymentModeList");
            this.paymentModeId        = (HtmlInputHidden)this.FindControl("paymentModeId");
            this.AdvanceId            = (HtmlInputHidden)this.FindControl("AdvanceId");
            this.hidOrderid           = (HtmlInputHidden)this.FindControl("hidOrderid");
            this.msgTitle             = (HtmlGenericControl)this.FindControl("msgTitle");
            this.hidIspop             = (HiddenField)this.FindControl("hidIspop");
            this.userLink             = (HtmlAnchor)this.FindControl("userLink");
            this.orderLink            = (HtmlAnchor)this.FindControl("orderLink");
            this.divfinish            = (HtmlGenericControl)this.FindControl("divfinish");
            this.userLink.HRef        = "/User/UserDefault";
            this.divOrderPayInfo      = (HtmlGenericControl)this.FindControl("divOrderPayInfo");
            this.imgPayResult         = (HtmlImage)this.FindControl("imgPayResult");
            this.hidIsPreSale         = (HiddenField)this.FindControl("hidIsPreSale");
            this.litDeposit           = (FormatedMoneyLabel)this.FindControl("litDeposit");
            this.litDeposittxt        = (Literal)this.FindControl("litDeposittxt");
            this.demodiv              = (HtmlGenericControl)this.FindControl("demodiv");
            this.demodiv.Visible      = SettingsManager.GetMasterSettings().IsDemoSite;
            this.hidHasTradePassword  = (HtmlInputHidden)this.FindControl("hidHasTradePassword");
            this.litOfflinePayContent = (Literal)this.FindControl("litOfflinePayContent");
            this.offlinePayPanel      = (HtmlGenericControl)this.FindControl("offlinePayPanel");
            if (!this.Page.IsPostBack)
            {
                this.LoadOrderInfo();
            }
        }
Exemplo n.º 17
0
        protected override void AttachChildControls()
        {
            this.divConsultationEmpty    = (HtmlGenericControl)this.FindControl("divConsultationEmpty");
            this.rptProductConsultations = (WapTemplatedRepeater)this.FindControl("rptProductConsultations");
            this.fightGroupRule          = (Common_FightGroupRule)this.FindControl("fightGroupRule");
            this.fightGroupId            = this.Page.Request["fightGroupId"].ToInt(0);
            this.skuSubmitOrder          = (Common_SKUSubmitOrder)this.FindControl("skuSubmitOrder");
            this.litDescription          = (Literal)this.FindControl("litDescription");
            this.litConsultationsCount   = (Literal)this.FindControl("litConsultationsCount");
            this.litJoinNumber           = (Literal)this.FindControl("litJoinNumber");
            this.litLimitedHour          = (Literal)this.FindControl("litLimitedHour");
            this.litEndDate                  = (Literal)this.FindControl("litEndDate");
            this.litProductName              = (Literal)this.FindControl("litProductName");
            this.litFGAPrice                 = (Literal)this.FindControl("litFGAPrice");
            this.litPPrice                   = (Literal)this.FindControl("litPPrice");
            this.rptProductImages            = (WapTemplatedRepeater)this.FindControl("rptProductImages");
            this.litProductReviewCount       = (Literal)this.FindControl("litProductReviewCount");
            this.imgStatus                   = (Image)this.FindControl("imgStatus");
            this.hlProductReview             = (HyperLink)this.FindControl("hlProductReview");
            this.rptMemberGroupDetailsStatus = (WapTemplatedRepeater)this.FindControl("rptMemberGroupDetailsStatus");
            FightGroupInfo fightGroup = VShopHelper.GetFightGroup(this.fightGroupId);

            if (fightGroup != null)
            {
                if (fightGroup.EndTime <= DateTime.Now && fightGroup.Status == FightGroupStatus.FightGroupIn)
                {
                    VShopHelper.DealFightGroupFail(fightGroup.FightGroupId);
                    fightGroup.Status = FightGroupStatus.FightGroupFail;
                }
                FightGroupActivityInfo fightGroupActivitieInfo = TradeHelper.GetFightGroupActivitieInfo(fightGroup.FightGroupActivityId);
                this.fightGroupRule.FightGroupActivityId = fightGroup.FightGroupActivityId;
                FightGroupStatus status = fightGroup.Status;
                if (status.Equals(FightGroupStatus.FightGroupFail))
                {
                    this.imgStatus.ImageUrl = "/Templates/common/images/fg_fail.png";
                    this.imgStatus.Attributes.Add("class", "fg_fail");
                }
                else
                {
                    status = fightGroup.Status;
                    if (status.Equals(FightGroupStatus.FightGroupSuccess))
                    {
                        this.imgStatus.ImageUrl = "/Templates/common/images/fg_ok.png";
                        this.imgStatus.Attributes.Add("class", "fg_ok");
                    }
                }
                SiteSettings masterSettings = SettingsManager.GetMasterSettings();
                IList <FightGroupSkuInfo> fightGroupSkus = VShopHelper.GetFightGroupSkus(fightGroup.FightGroupActivityId);
                this.hlProductReview.NavigateUrl = $"/vshop/ProductReview.aspx?ProductId={fightGroup.ProductId}";
                Literal literal = this.litJoinNumber;
                int     num     = fightGroup.JoinNumber;
                literal.Text = num.ToString();
                Literal literal2 = this.litLimitedHour;
                num                      = fightGroupActivitieInfo.LimitedHour;
                literal2.Text            = num.ToString();
                this.litEndDate.Text     = fightGroup.EndTime.ToString("yy.MM.dd");
                this.litProductName.Text = fightGroup.ProductName;
                this.litFGAPrice.Text    = fightGroupSkus.Min((FightGroupSkuInfo c) => c.SalePrice).F2ToString("f2");
                IList <int> list = null;
                Dictionary <int, IList <int> > dictionary = default(Dictionary <int, IList <int> >);
                ProductInfo productDetails = ProductHelper.GetProductDetails(fightGroup.ProductId, out dictionary, out list);
                if (productDetails != null)
                {
                    this.litPPrice.Text             = productDetails.MaxSalePrice.F2ToString("f2");
                    this.skuSubmitOrder.ProductInfo = productDetails;
                }
                Literal literal3 = this.litProductReviewCount;
                num = ProductBrowser.GetProductReviews(new ProductReviewQuery
                {
                    PageIndex = 1,
                    PageSize  = 2147483647,
                    ProductId = fightGroup.ProductId
                }).TotalRecords;
                literal3.Text = num.ToString();
                IList <FightGroupUserModel> fightGroupUsers = VShopHelper.GetFightGroupUsers(fightGroup.FightGroupId);
                int num2 = fightGroupUsers.Count();
                if (fightGroupUsers.Count < fightGroup.JoinNumber)
                {
                    for (int i = 0; i < fightGroup.JoinNumber - num2; i++)
                    {
                        FightGroupUserModel item2 = new FightGroupUserModel();
                        fightGroupUsers.Add(item2);
                    }
                }
                this.rptMemberGroupDetailsStatus.DataSource = fightGroupUsers;
                this.rptMemberGroupDetailsStatus.DataBind();
                Literal control = this.litConsultationsCount;
                num = ProductBrowser.GetProductConsultationsCount(productDetails.ProductId, false);
                control.SetWhenIsNotNull(num.ToString());
                if (this.litDescription != null)
                {
                    Regex regex = new Regex("<script[^>]*?>.*?</script>", RegexOptions.IgnoreCase);
                    if (!string.IsNullOrWhiteSpace(productDetails.MobbileDescription))
                    {
                        this.litDescription.Text = regex.Replace(productDetails.MobbileDescription, "");
                    }
                    else if (!string.IsNullOrWhiteSpace(productDetails.Description))
                    {
                        this.litDescription.Text = regex.Replace(productDetails.Description, "");
                    }
                }
                this.skuSubmitOrder.FightGroupActivityId = fightGroupActivitieInfo.FightGroupActivityId;
                if (this.rptProductImages != null)
                {
                    string locationUrl = "javascript:;";
                    if (string.IsNullOrEmpty(productDetails.ImageUrl1) && string.IsNullOrEmpty(productDetails.ImageUrl2) && string.IsNullOrEmpty(productDetails.ImageUrl3) && string.IsNullOrEmpty(productDetails.ImageUrl4) && string.IsNullOrEmpty(productDetails.ImageUrl5))
                    {
                        productDetails.ImageUrl1 = masterSettings.DefaultProductImage;
                    }
                    DataTable         skus  = ProductBrowser.GetSkus(fightGroupActivitieInfo.ProductId);
                    List <SlideImage> list2 = new List <SlideImage>();
                    foreach (DataRow row in skus.Rows)
                    {
                        List <SlideImage> list3 = (from s in list2
                                                   where s.ImageUrl == row["ThumbnailUrl410"].ToString()
                                                   select s).ToList();
                        if (list3.Count <= 0)
                        {
                            list2.Add(new SlideImage(row["ThumbnailUrl410"].ToString(), locationUrl));
                        }
                    }
                    list2.Add(new SlideImage(productDetails.ImageUrl1, locationUrl));
                    list2.Add(new SlideImage(productDetails.ImageUrl2, locationUrl));
                    list2.Add(new SlideImage(productDetails.ImageUrl3, locationUrl));
                    list2.Add(new SlideImage(productDetails.ImageUrl4, locationUrl));
                    list2.Add(new SlideImage(productDetails.ImageUrl5, locationUrl));
                    this.rptProductImages.DataSource = from item in list2
                                                       where !string.IsNullOrWhiteSpace(item.ImageUrl)
                                                       select item;
                    this.rptProductImages.DataBind();
                    Literal control2 = this.litConsultationsCount;
                    num = ProductBrowser.GetProductConsultationsCount(productDetails.ProductId, false);
                    control2.SetWhenIsNotNull(num.ToString());
                    if (this.litDescription != null)
                    {
                        string text   = "";
                        Regex  regex2 = new Regex("<script[^>]*?>.*?</script>", RegexOptions.IgnoreCase);
                        if (!string.IsNullOrWhiteSpace(productDetails.MobbileDescription))
                        {
                            text = regex2.Replace(productDetails.MobbileDescription, "");
                        }
                        else if (!string.IsNullOrWhiteSpace(productDetails.Description))
                        {
                            text = regex2.Replace(productDetails.Description, "");
                        }
                        text = text.Replace("src", "data-url");
                        this.litDescription.Text = text;
                    }
                }
                DataTable data = ProductBrowser.GetProductConsultations(new ProductConsultationAndReplyQuery
                {
                    ProductId = productDetails.ProductId,
                    PageIndex = 1,
                    PageSize  = 2147483647,
                    SortOrder = SortAction.Desc,
                    SortBy    = "ConsultationId",
                    Type      = ConsultationReplyType.Replyed
                }).Data;
                for (int j = 0; j < data.Rows.Count; j++)
                {
                    data.Rows[j]["UserName"] = DataHelper.GetHiddenUsername(data.Rows[j]["UserName"].ToNullString());
                }
                this.rptProductConsultations.DataSource = data;
                this.rptProductConsultations.DataBind();
                this.divConsultationEmpty.Visible = data.IsNullOrEmpty();
            }
        }
        private void btnSaveFightGroupActivitiy_Click(object sender, EventArgs e)
        {
            FightGroupActivityInfo   fightGroupActivitieInfo = VShopHelper.GetFightGroupActivitieInfo(this.fightGroupActivityId);
            List <FightGroupSkuInfo> list = new List <FightGroupSkuInfo>();

            if (fightGroupActivitieInfo == null)
            {
                this.ShowMsg("火拼团不存在", false, "FightGroupActivitiyList.aspx");
                return;
            }
            if (this.productId > 0)
            {
                fightGroupActivitieInfo.ProductId = this.productId;
            }
            else
            {
                this.productId = fightGroupActivitieInfo.ProductId;
            }
            string text  = Globals.StripAllTags(this.txtFightGroupShareTitle.Text.Trim());
            string text2 = Globals.StripAllTags(this.txtFightGroupShareDetails.Text.Trim());
            int    num;

            if ((this.rbtlTitle.SelectedIndex != 1 || (!string.IsNullOrEmpty(text) && text.Length <= 60)) && !string.IsNullOrEmpty(text2))
            {
                num = ((text2.Length > 60) ? 1 : 0);
                goto IL_00c4;
            }
            num = 1;
            goto IL_00c4;
IL_00c4:
            if (num != 0)
            {
                this.ShowMsg("请按要求输入分享标题和详情", false);
            }
            else
            {
                if (this.rbtlTitle.SelectedIndex == 0)
                {
                    fightGroupActivitieInfo.ShareTitle = "";
                }
                else
                {
                    fightGroupActivitieInfo.ShareTitle = text;
                }
                fightGroupActivitieInfo.ShareContent = text2;
                if (this.rptProductSkus.Items.Count > 0)
                {
                    for (int i = 0; i < this.rptProductSkus.Items.Count; i++)
                    {
                        RepeaterItem      repeaterItem = this.rptProductSkus.Items[i];
                        HiddenField       hiddenField  = repeaterItem.FindControl("hfSkuId") as HiddenField;
                        TextBox           textBox      = repeaterItem.FindControl("txtActivityStock") as TextBox;
                        HiddenField       hiddenField2 = repeaterItem.FindControl("hidSalePrice") as HiddenField;
                        FightGroupSkuInfo item         = new FightGroupSkuInfo
                        {
                            SalePrice            = hiddenField2.Value.Trim().ToDecimal(0),
                            TotalCount           = textBox.Text.Trim().ToInt(0),
                            SkuId                = hiddenField.Value,
                            FightGroupActivityId = fightGroupActivitieInfo.FightGroupActivityId
                        };
                        list.Add(item);
                    }
                    if (this.rptProductSkus.Items.Count == 0 && this.txtTotalCount.Text.Trim().ToInt(0) == 0)
                    {
                        this.ShowMsg("请填写活动库存", false);
                        return;
                    }
                }
                if (!this.CPEndDate.SelectedDate.HasValue)
                {
                    this.ShowMsg(Formatter.FormatErrorMessage("请填写结束时间"), false);
                }
                else
                {
                    fightGroupActivitieInfo.EndDate = this.CPEndDate.SelectedDate.Value;
                    if (fightGroupActivitieInfo.StartDate >= fightGroupActivitieInfo.EndDate)
                    {
                        this.ShowMsg(Formatter.FormatErrorMessage("结束时间要大于开始时间"), false);
                    }
                    else if (this.txtMaxCount.Text.Trim().ToInt(0) == 0)
                    {
                        this.ShowMsg("请填写每人限购数量", false);
                    }
                    else
                    {
                        fightGroupActivitieInfo.MaxCount = this.txtMaxCount.Text.ToInt(0);
                        int num2 = 0;
                        num2 = ((this.rptProductSkus.Items.Count == 0) ? this.txtTotalCount.Text.Trim().ToInt(0) : list.Sum((FightGroupSkuInfo c) => c.TotalCount));
                        if (fightGroupActivitieInfo.MaxCount > num2)
                        {
                            this.ShowMsg(Formatter.FormatErrorMessage("每人限购数量不能大于活动库存"), false);
                        }
                        else if (list.Count > 0 && fightGroupActivitieInfo.MaxCount > (from c in list
                                                                                       where c.TotalCount > 0
                                                                                       select c).Min((FightGroupSkuInfo c) => c.TotalCount))
                        {
                            this.ShowMsg(Formatter.FormatErrorMessage("每人限购数量不能大于规格的最小活动库存"), false);
                        }
                        else
                        {
                            fightGroupActivitieInfo.Icon = Globals.SaveFile("GroupActivitie", this.hidUploadLogo.Value, "/Storage/master/", true, false, "");
                            this.hidUploadLogo.Value     = fightGroupActivitieInfo.Icon;
                            IList <int> list2 = null;
                            Dictionary <int, IList <int> > dictionary = default(Dictionary <int, IList <int> >);
                            ProductInfo productDetails = ProductHelper.GetProductDetails(fightGroupActivitieInfo.ProductId, out dictionary, out list2);
                            if (productDetails != null)
                            {
                                fightGroupActivitieInfo.ProductName = productDetails.ProductName;
                                if (productDetails.Stock < fightGroupActivitieInfo.MaxCount)
                                {
                                    this.ShowMsg("库存小于每人限购数量", false);
                                    return;
                                }
                                if (productDetails.Stock < num2)
                                {
                                    this.ShowMsg($"当前活动库存为 {num2},商品库存小于活动库存", false);
                                    return;
                                }
                                if (list.Count > 0)
                                {
                                    foreach (KeyValuePair <string, SKUItem> sku in productDetails.Skus)
                                    {
                                        FightGroupSkuInfo fightGroupSkuInfo = (from s in list
                                                                               where s.SkuId == sku.Value.SkuId
                                                                               select s).FirstOrDefault();
                                        if (fightGroupSkuInfo == null)
                                        {
                                            this.ShowMsg("规格不存在,请重新刷新页面", false);
                                            return;
                                        }
                                        if (fightGroupSkuInfo.TotalCount > sku.Value.Stock)
                                        {
                                            this.ShowMsg($"当前规格活动库存为 {fightGroupSkuInfo.TotalCount},商品库存小于活动库存", false);
                                            return;
                                        }
                                    }
                                }
                            }
                            if (list.Count == 0)
                            {
                                DataTable skusByProductId = ProductHelper.GetSkusByProductId(this.productId);
                                if (skusByProductId.Rows.Count > 0)
                                {
                                    DataRow           dataRow = skusByProductId.Rows[0];
                                    FightGroupSkuInfo item2   = new FightGroupSkuInfo
                                    {
                                        SalePrice            = this.ltPrice.Text.Trim().ToDecimal(0),
                                        TotalCount           = num2,
                                        SkuId                = dataRow["SkuId"].ToNullString(),
                                        FightGroupActivityId = fightGroupActivitieInfo.FightGroupActivityId
                                    };
                                    list.Add(item2);
                                }
                            }
                            if (VShopHelper.CanAddFightGroupActivitiy(fightGroupActivitieInfo.ProductId, productDetails.ProductName, fightGroupActivitieInfo.FightGroupActivityId))
                            {
                                VShopHelper.EditFightGroupActivitie(fightGroupActivitieInfo, list);
                                this.ShowMsg("保存火拼团活动成功", true, "FightGroupActivitiyList.aspx");
                            }
                            else
                            {
                                this.ShowMsg("该商品正在参加其他活动,无法同时参加拼团活动", false);
                            }
                        }
                    }
                }
            }
        }
        protected override void AttachChildControls()
        {
            this.hidSupplier             = (HtmlInputHidden)this.FindControl("hidSupplier");
            this.litSupplierName         = (Literal)this.FindControl("litSupplierName");
            this.divConsultationEmpty    = (HtmlGenericControl)this.FindControl("divConsultationEmpty");
            this.rptProductConsultations = (WapTemplatedRepeater)this.FindControl("rptProductConsultations");
            this.fightGroupRule          = (Common_FightGroupRule)this.FindControl("fightGroupRule");
            this.litDescription          = (Literal)this.FindControl("litDescription");
            this.litConsultationsCount   = (Literal)this.FindControl("litConsultationsCount");
            this.rptProductImages        = (WapTemplatedRepeater)this.FindControl("rptProductImages");
            this.divFightGroupsHead      = (HtmlControl)this.FindControl("divFightGroupsHead");
            this.skuSubmitOrder          = (Common_SKUSubmitOrder)this.FindControl("skuSubmitOrder");
            this.fightGroupActivityId    = this.Page.Request["fightGroupActivityId"].ToInt(0);
            this.litJoinNumber           = (Literal)this.FindControl("litJoinNumber");
            this.litLimitedHour          = (Literal)this.FindControl("litLimitedHour");
            this.litEndDate            = (Literal)this.FindControl("litEndDate");
            this.litProductName        = (Literal)this.FindControl("litProductName");
            this.litFGAPrice           = (Literal)this.FindControl("litFGAPrice");
            this.litPPrice             = (Literal)this.FindControl("litPPrice");
            this.litProductReviewCount = (Literal)this.FindControl("litProductReviewCount");
            this.imgEnd          = (Image)this.FindControl("imgEnd");
            this.hlProductReview = (HyperLink)this.FindControl("hlProductReview");
            this.rptFightGroups  = (WapTemplatedRepeater)this.FindControl("rptFightGroups");
            this.litMinPrice     = (Literal)this.FindControl("litMinPrice");
            this.litProductPrice = (Literal)this.FindControl("litProductPrice");
            this.lblStock        = (StockLabel)this.FindControl("lblStock");
            this.litUnit         = (Literal)this.FindControl("litUnit");
            this.divGetBySelf    = (HtmlControl)this.FindControl("divGetBySelf");
            this.hiddenProductId = (HtmlInputText)this.FindControl("hiddenProductId");
            this.hdAppId         = (HtmlInputHidden)this.FindControl("hdAppId");
            this.hdTitle         = (HtmlInputHidden)this.FindControl("hdTitle");
            this.hdDesc          = (HtmlInputHidden)this.FindControl("hdDesc");
            this.hdImgUrl        = (HtmlInputHidden)this.FindControl("hdImgUrl");
            this.hdLink          = (HtmlInputHidden)this.FindControl("hdLink");
            FightGroupActivityInfo fightGroupActivitieInfo = TradeHelper.GetFightGroupActivitieInfo(this.fightGroupActivityId);

            if (fightGroupActivitieInfo != null)
            {
                HtmlInputText htmlInputText = this.hiddenProductId;
                int           num           = fightGroupActivitieInfo.ProductId;
                htmlInputText.Value = num.ToString();
                this.fightGroupRule.FightGroupActivityId = fightGroupActivitieInfo.FightGroupActivityId;
                if (fightGroupActivitieInfo.StartDate > DateTime.Now)
                {
                    this.Page.Response.Redirect("FightGroupActivityDetailsSoon.aspx?fightGroupActivityId=" + this.fightGroupActivityId);
                }
                SiteSettings masterSettings = SettingsManager.GetMasterSettings();
                if (masterSettings.OpenMultStore && StoresHelper.ProductHasStores(fightGroupActivitieInfo.ProductId))
                {
                    this.divGetBySelf.Visible = true;
                }
                this.skuSubmitOrder.FightGroupActivityId = fightGroupActivitieInfo.FightGroupActivityId;
                IList <FightGroupSkuInfo> fightGroupSkus = VShopHelper.GetFightGroupSkus(this.fightGroupActivityId);
                this.hlProductReview.NavigateUrl = $"/vshop/ProductReview.aspx?ProductId={fightGroupActivitieInfo.ProductId}";
                this.imgEnd.Visible = (fightGroupActivitieInfo.EndDate < DateTime.Now);
                Literal literal = this.litJoinNumber;
                num          = fightGroupActivitieInfo.JoinNumber;
                literal.Text = num.ToString();
                Literal literal2 = this.litLimitedHour;
                num                      = fightGroupActivitieInfo.LimitedHour;
                literal2.Text            = num.ToString();
                this.litEndDate.Text     = fightGroupActivitieInfo.EndDate.ToString("yy.MM.dd");
                this.litProductName.Text = fightGroupActivitieInfo.ProductName;
                decimal num2 = fightGroupSkus.Min((FightGroupSkuInfo c) => c.SalePrice);
                this.litFGAPrice.Text = num2.F2ToString("f2");
                if (fightGroupSkus.Count() > 1)
                {
                    decimal num3 = fightGroupSkus.Max((FightGroupSkuInfo c) => c.SalePrice);
                    if (num3 > num2)
                    {
                        this.litFGAPrice.Text = num2.F2ToString("f2") + "~" + num3.F2ToString("f2");
                    }
                }
                this.litMinPrice.Text = num2.F2ToString("f2");
                IList <int> list = null;
                Dictionary <int, IList <int> > dictionary = default(Dictionary <int, IList <int> >);
                ProductInfo productDetails = ProductHelper.GetProductDetails(fightGroupActivitieInfo.ProductId, out dictionary, out list);
                if (productDetails != null)
                {
                    this.skuSubmitOrder.ProductInfo = productDetails;
                    this.litPPrice.Text             = MemberProcessor.GetMemberPrice(productDetails).F2ToString("f2");
                    this.litProductPrice.Text       = this.litPPrice.Text;
                }
                int supplierId = productDetails.SupplierId;
                if (supplierId > 0)
                {
                    SupplierInfo supplierById = SupplierHelper.GetSupplierById(supplierId);
                    if (supplierById != null)
                    {
                        this.hidSupplier.Value    = "true";
                        this.litSupplierName.Text = supplierById.SupplierName;
                    }
                }
                else
                {
                    this.hidSupplier.Value = "false";
                }
                Literal literal3 = this.litProductReviewCount;
                num = ProductBrowser.GetProductReviews(new ProductReviewQuery
                {
                    PageIndex = 1,
                    PageSize  = 2147483647,
                    ProductId = fightGroupActivitieInfo.ProductId
                }).TotalRecords;
                literal3.Text = num.ToString();
                DataTable fightGroups = VShopHelper.GetFightGroups(this.fightGroupActivityId);
                for (int i = 0; i < fightGroups.Rows.Count; i++)
                {
                    fightGroups.Rows[i]["Name"] = DataHelper.GetHiddenUsername(fightGroups.Rows[i]["Name"].ToString());
                }
                this.divFightGroupsHead.Visible = (fightGroups.Rows.Count > 0);
                this.rptFightGroups.DataSource  = fightGroups;
                this.rptFightGroups.DataBind();
                this.hdAppId.Value = base.site.WeixinAppId;
                if (string.IsNullOrEmpty(fightGroupActivitieInfo.ShareTitle))
                {
                    this.hdTitle.Value = (string.IsNullOrEmpty(productDetails.Title) ? productDetails.ProductName : productDetails.Title);
                }
                else
                {
                    this.hdTitle.Value = fightGroupActivitieInfo.ShareTitle.Trim();
                }
                if (string.IsNullOrEmpty(fightGroupActivitieInfo.ShareContent.Trim()))
                {
                    this.hdDesc.Value = productDetails.Meta_Description;
                }
                else
                {
                    this.hdDesc.Value = fightGroupActivitieInfo.ShareContent.Trim();
                }
                string local = string.IsNullOrEmpty(fightGroupActivitieInfo.Icon) ? SettingsManager.GetMasterSettings().DefaultProductImage : fightGroupActivitieInfo.Icon;
                this.hdImgUrl.Value = Globals.FullPath(local);
                this.hdLink.Value   = Globals.FullPath(this.Page.Request.Url.ToString());
                if (this.rptProductImages != null)
                {
                    string locationUrl = "javascript:;";
                    if (string.IsNullOrEmpty(productDetails.ImageUrl1) && string.IsNullOrEmpty(productDetails.ImageUrl2) && string.IsNullOrEmpty(productDetails.ImageUrl3) && string.IsNullOrEmpty(productDetails.ImageUrl4) && string.IsNullOrEmpty(productDetails.ImageUrl5))
                    {
                        productDetails.ImageUrl1 = masterSettings.DefaultProductImage;
                    }
                    DataTable         skus  = ProductBrowser.GetSkus(fightGroupActivitieInfo.ProductId);
                    List <SlideImage> list2 = new List <SlideImage>();
                    list2.Add(new SlideImage(productDetails.ImageUrl1, locationUrl));
                    list2.Add(new SlideImage(productDetails.ImageUrl2, locationUrl));
                    list2.Add(new SlideImage(productDetails.ImageUrl3, locationUrl));
                    list2.Add(new SlideImage(productDetails.ImageUrl4, locationUrl));
                    list2.Add(new SlideImage(productDetails.ImageUrl5, locationUrl));
                    this.rptProductImages.DataSource = from item in list2
                                                       where !string.IsNullOrWhiteSpace(item.ImageUrl)
                                                       select item;
                    this.rptProductImages.DataBind();
                    Literal control = this.litConsultationsCount;
                    num = ProductBrowser.GetProductConsultationsCount(productDetails.ProductId, false);
                    control.SetWhenIsNotNull(num.ToString());
                    if (this.litDescription != null)
                    {
                        string text  = "";
                        Regex  regex = new Regex("<script[^>]*?>.*?</script>", RegexOptions.IgnoreCase);
                        if (!string.IsNullOrWhiteSpace(productDetails.MobbileDescription))
                        {
                            text = regex.Replace(productDetails.MobbileDescription, "");
                        }
                        else if (!string.IsNullOrWhiteSpace(productDetails.Description))
                        {
                            text = regex.Replace(productDetails.Description, "");
                        }
                        text = text.Replace("src", "data-url");
                        this.litDescription.Text = text;
                    }
                    DataTable data = ProductBrowser.GetProductConsultations(new ProductConsultationAndReplyQuery
                    {
                        ProductId  = productDetails.ProductId,
                        PageIndex  = 1,
                        PageSize   = 2147483647,
                        SortOrder  = SortAction.Desc,
                        SortBy     = "ConsultationId",
                        HasReplied = true
                    }).Data;
                    for (int j = 0; j < data.Rows.Count; j++)
                    {
                        data.Rows[j]["UserName"] = DataHelper.GetHiddenUsername(data.Rows[j]["UserName"].ToNullString());
                    }
                    this.rptProductConsultations.DataSource = data;
                    this.rptProductConsultations.DataBind();
                    this.divConsultationEmpty.Visible = data.IsNullOrEmpty();
                }
            }
            else
            {
                base.GotoResourceNotFound("活动不存在");
            }
        }
Exemplo n.º 20
0
        protected override void AttachChildControls()
        {
            this.divConsultationEmpty    = (HtmlGenericControl)this.FindControl("divConsultationEmpty");
            this.rptProductConsultations = (WapTemplatedRepeater)this.FindControl("rptProductConsultations");
            this.fightGroupRule          = (Common_FightGroupRule)this.FindControl("fightGroupRule");
            this.rptProductImages        = (WapTemplatedRepeater)this.FindControl("rptProductImages");
            int fightGroupId = this.Page.Request["fightGroupId"].ToInt(0);

            this.litDescription           = (Literal)this.FindControl("litDescription");
            this.litConsultationsCount    = (Literal)this.FindControl("litConsultationsCount");
            this.hfStartTime              = (HtmlInputHidden)this.FindControl("hfStartTime");
            this.hiddenJoinedUser         = (HtmlInputText)this.FindControl("hiddenJoinedUser");
            this.hfEndTime                = (HtmlInputHidden)this.FindControl("hfEndTime");
            this.hfNowTime                = (HtmlInputHidden)this.FindControl("hfNowTime");
            this.rptFightGroupDetails     = (WapTemplatedRepeater)this.FindControl("rptFightGroupDetails");
            this.rptFightGroupDetailsNeed = (WapTemplatedRepeater)this.FindControl("rptFightGroupDetailsNeed");
            this.litNeedPerson            = (Literal)this.FindControl("litNeedPerson");
            this.divIn                       = (HtmlControl)this.FindControl("divIn");
            this.divOver                     = (HtmlControl)this.FindControl("divOver");
            this.skuSubmitOrder              = (Common_SKUSubmitOrder)this.FindControl("skuSubmitOrder");
            this.litProductReviewCount       = (Literal)this.FindControl("litProductReviewCount");
            this.litJoinNumber               = (Literal)this.FindControl("litJoinNumber");
            this.litLimitedHour              = (Literal)this.FindControl("litLimitedHour");
            this.litProductName              = (Literal)this.FindControl("litProductName");
            this.litFGAPrice                 = (Literal)this.FindControl("litFGAPrice");
            this.litPPrice                   = (Literal)this.FindControl("litPPrice");
            this.imgStatus                   = (Image)this.FindControl("imgStatus");
            this.litRemainTimeHtml           = (HtmlGenericControl)this.FindControl("litRemainTimeHtml");
            this.spanTime                    = (HtmlGenericControl)this.FindControl("spanTime");
            this.hiddenProductId             = (HtmlInputText)this.FindControl("hiddenProductId");
            this.hlProductReview             = (HyperLink)this.FindControl("hlProductReview");
            this.hidFightGroupActivityStatus = (HtmlInputHidden)this.FindControl("hidFightGroupActivityStatus");
            this.divGetBySelf                = (HtmlControl)this.FindControl("divGetBySelf");
            this.hdAppId                     = (HtmlInputHidden)this.FindControl("hdAppId");
            this.hdTitle                     = (HtmlInputHidden)this.FindControl("hdTitle");
            this.hdDesc                      = (HtmlInputHidden)this.FindControl("hdDesc");
            this.hdImgUrl                    = (HtmlInputHidden)this.FindControl("hdImgUrl");
            this.hdLink                      = (HtmlInputHidden)this.FindControl("hdLink");
            this.hdAppId.Value               = base.site.WeixinAppId;
            FightGroupInfo fightGroup = VShopHelper.GetFightGroup(fightGroupId);

            if (fightGroup != null)
            {
                SiteSettings masterSettings = SettingsManager.GetMasterSettings();
                if (masterSettings.OpenMultStore && StoresHelper.ProductHasStores(fightGroup.ProductId))
                {
                    this.divGetBySelf.Visible = true;
                }
                if (fightGroup.EndTime <= DateTime.Now && fightGroup.Status == FightGroupStatus.FightGroupIn)
                {
                    VShopHelper.DealFightGroupFail(fightGroupId);
                    fightGroup.Status = FightGroupStatus.FightGroupFail;
                }
                this.fightGroupRule.FightGroupActivityId = fightGroup.FightGroupActivityId;
                FightGroupActivityInfo fightGroupActivitieInfo = TradeHelper.GetFightGroupActivitieInfo(fightGroup.FightGroupActivityId);
                HtmlInputText          htmlInputText           = this.hiddenProductId;
                int num = fightGroup.ProductId;
                htmlInputText.Value = num.ToString();
                this.hidFightGroupActivityStatus.Value = ((fightGroupActivitieInfo.EndDate > DateTime.Now) ? "1" : "0");
                HtmlInputHidden htmlInputHidden = this.hfNowTime;
                DateTime        dateTime        = DateTime.Now;
                htmlInputHidden.Value = dateTime.ToString("yyyy-MM-dd HH:mm:ss");
                HtmlInputHidden htmlInputHidden2 = this.hfEndTime;
                dateTime = fightGroup.EndTime;
                htmlInputHidden2.Value = dateTime.ToString("yyyy-MM-dd HH:mm:ss");
                HtmlInputHidden htmlInputHidden3 = this.hfStartTime;
                dateTime = fightGroup.StartTime;
                htmlInputHidden3.Value           = dateTime.ToString("yyyy-MM-dd HH:mm:ss");
                this.hlProductReview.NavigateUrl = $"/vshop/ProductReview.aspx?ProductId={fightGroup.ProductId}";
                IList <FightGroupSkuInfo> fightGroupSkus = VShopHelper.GetFightGroupSkus(fightGroup.FightGroupActivityId);
                Literal literal = this.litJoinNumber;
                num          = fightGroup.JoinNumber;
                literal.Text = num.ToString();
                Literal literal2 = this.litLimitedHour;
                num                      = fightGroupActivitieInfo.LimitedHour;
                literal2.Text            = num.ToString();
                this.litProductName.Text = fightGroup.ProductName;
                this.litFGAPrice.Text    = fightGroupSkus.Min((FightGroupSkuInfo c) => c.SalePrice).F2ToString("f2");
                IList <int> list = null;
                Dictionary <int, IList <int> > dictionary = default(Dictionary <int, IList <int> >);
                ProductInfo productDetails = ProductHelper.GetProductDetails(fightGroup.ProductId, out dictionary, out list);
                if (productDetails != null)
                {
                    this.litPPrice.Text                      = productDetails.MaxSalePrice.F2ToString("f2");
                    this.skuSubmitOrder.ProductInfo          = productDetails;
                    this.skuSubmitOrder.OrderBusiness        = 1;
                    this.skuSubmitOrder.FightGroupActivityId = fightGroup.FightGroupActivityId;
                    this.skuSubmitOrder.FightGroupId         = fightGroup.FightGroupId;
                }
                Literal literal3 = this.litProductReviewCount;
                num = ProductBrowser.GetProductReviews(new ProductReviewQuery
                {
                    PageIndex = 1,
                    PageSize  = 2147483647,
                    ProductId = fightGroupActivitieInfo.ProductId
                }).TotalRecords;
                literal3.Text = num.ToString();
                FightGroupStatus status = fightGroup.Status;
                if (status.Equals(FightGroupStatus.FightGroupFail))
                {
                    this.imgStatus.ImageUrl = "/Templates/common/images/fg_fail.png";
                    this.imgStatus.Attributes.Add("class", "fg_fail");
                    this.spanTime.Style.Add("text-align", "center");
                    this.litRemainTimeHtml.Style.Add("display", "none");
                }
                else
                {
                    status = fightGroup.Status;
                    if (status.Equals(FightGroupStatus.FightGroupSuccess))
                    {
                        this.imgStatus.ImageUrl = "/Templates/common/images/fg_ok.png";
                        this.imgStatus.Attributes.Add("class", "fg_ok");
                    }
                }
                Image image = this.imgStatus;
                status        = fightGroup.Status;
                image.Visible = !status.Equals(FightGroupStatus.FightGroupIn);
                int fightGroupActiveNumber = VShopHelper.GetFightGroupActiveNumber(fightGroup.FightGroupId);
                int num2 = fightGroup.JoinNumber - fightGroupActiveNumber;
                num2 = ((num2 >= 0) ? num2 : 0);
                this.litNeedPerson.Text = num2.ToString();
                HtmlControl htmlControl = this.divIn;
                status = fightGroup.Status;
                htmlControl.Visible = status.Equals(FightGroupStatus.FightGroupIn);
                HtmlControl htmlControl2 = this.divOver;
                status = fightGroup.Status;
                htmlControl2.Visible = !status.Equals(FightGroupStatus.FightGroupIn);
                IList <FightGroupUserModel> fightGroupUsers = VShopHelper.GetFightGroupUsers(fightGroup.FightGroupId);
                foreach (FightGroupUserModel item in fightGroupUsers)
                {
                    item.Name = DataHelper.GetHiddenUsername(item.Name);
                    if (HiContext.Current.UserId == item.UserId)
                    {
                        this.hiddenJoinedUser.Value = "true";
                    }
                }
                this.rptFightGroupDetails.DataSource = fightGroupUsers;
                this.rptFightGroupDetails.DataBind();
                List <int> list2 = new List <int>();
                for (int i = 0; i < num2; i++)
                {
                    list2.Add(i);
                }
                this.rptFightGroupDetailsNeed.DataSource = list2;
                this.rptFightGroupDetailsNeed.DataBind();
                Literal control = this.litConsultationsCount;
                num = ProductBrowser.GetProductConsultationsCount(productDetails.ProductId, true);
                control.SetWhenIsNotNull(num.ToString());
                if (this.litDescription != null)
                {
                    string text  = "";
                    Regex  regex = new Regex("<script[^>]*?>.*?</script>", RegexOptions.IgnoreCase);
                    if (!string.IsNullOrWhiteSpace(productDetails.MobbileDescription))
                    {
                        text = regex.Replace(productDetails.MobbileDescription, "");
                    }
                    else if (!string.IsNullOrWhiteSpace(productDetails.Description))
                    {
                        text = regex.Replace(productDetails.Description, "");
                    }
                    text = text.Replace("src", "data-url");
                    this.litDescription.Text = text;
                }
                if (this.rptProductImages != null)
                {
                    string locationUrl = "javascript:;";
                    if (string.IsNullOrEmpty(productDetails.ImageUrl1) && string.IsNullOrEmpty(productDetails.ImageUrl2) && string.IsNullOrEmpty(productDetails.ImageUrl3) && string.IsNullOrEmpty(productDetails.ImageUrl4) && string.IsNullOrEmpty(productDetails.ImageUrl5))
                    {
                        productDetails.ImageUrl1 = masterSettings.DefaultProductImage;
                    }
                    DataTable         skus  = ProductBrowser.GetSkus(fightGroupActivitieInfo.ProductId);
                    List <SlideImage> list3 = new List <SlideImage>();
                    foreach (DataRow row in skus.Rows)
                    {
                        List <SlideImage> list4 = (from s in list3
                                                   where s.ImageUrl == row["ThumbnailUrl410"].ToString()
                                                   select s).ToList();
                        if (list4.Count <= 0)
                        {
                            list3.Add(new SlideImage(row["ThumbnailUrl410"].ToString(), locationUrl));
                        }
                    }
                    list3.Add(new SlideImage(productDetails.ImageUrl1, locationUrl));
                    list3.Add(new SlideImage(productDetails.ImageUrl2, locationUrl));
                    list3.Add(new SlideImage(productDetails.ImageUrl3, locationUrl));
                    list3.Add(new SlideImage(productDetails.ImageUrl4, locationUrl));
                    list3.Add(new SlideImage(productDetails.ImageUrl5, locationUrl));
                    this.rptProductImages.DataSource = from item in list3
                                                       where !string.IsNullOrWhiteSpace(item.ImageUrl)
                                                       select item;
                    this.rptProductImages.DataBind();
                }
                if (string.IsNullOrEmpty(fightGroupActivitieInfo.ShareTitle))
                {
                    this.hdTitle.Value = (string.IsNullOrEmpty(productDetails.Title) ? productDetails.ProductName : productDetails.Title);
                }
                else
                {
                    this.hdTitle.Value = fightGroupActivitieInfo.ShareTitle.Trim();
                }
                if (string.IsNullOrEmpty(fightGroupActivitieInfo.ShareContent.Trim()))
                {
                    this.hdDesc.Value = productDetails.Meta_Description;
                }
                else
                {
                    this.hdDesc.Value = fightGroupActivitieInfo.ShareContent.Trim();
                }
                string icon = fightGroupActivitieInfo.Icon;
                this.hdImgUrl.Value = Globals.FullPath(string.IsNullOrEmpty(icon) ? base.site.DefaultProductThumbnail8 : icon);
                this.hdLink.Value   = Globals.FullPath(this.Page.Request.Url.ToString());
                DataTable data = ProductBrowser.GetProductConsultations(new ProductConsultationAndReplyQuery
                {
                    ProductId = productDetails.ProductId,
                    PageIndex = 1,
                    PageSize  = 2147483647,
                    SortOrder = SortAction.Desc,
                    SortBy    = "ConsultationId"
                }).Data;
                for (int j = 0; j < data.Rows.Count; j++)
                {
                    data.Rows[j]["UserName"] = DataHelper.GetHiddenUsername(data.Rows[j]["UserName"].ToNullString());
                }
                this.rptProductConsultations.DataSource = data;
                this.rptProductConsultations.DataBind();
                this.divConsultationEmpty.Visible = data.IsNullOrEmpty();
            }
            else
            {
                base.GotoResourceNotFound("活动不存在");
            }
        }
Exemplo n.º 21
0
        private void GotoPay()
        {
            SiteSettings masterSettings = SettingsManager.GetMasterSettings();
            OrderInfo    orderInfo      = ShoppingProcessor.GetOrderInfo(this.orderId);
            string       str            = "";

            if (orderInfo == null)
            {
                this.litErrorMsg.Text = "数据错误!";
            }
            else
            {
                if (orderInfo.PreSaleId > 0)
                {
                    ProductPreSaleInfo productPreSaleInfo = ProductPreSaleHelper.GetProductPreSaleInfo(orderInfo.PreSaleId);
                    if (productPreSaleInfo == null)
                    {
                        this.litErrorMsg.Text = "预售活动不存在不能支付";
                        return;
                    }
                    if (!orderInfo.DepositDate.HasValue)
                    {
                        if (productPreSaleInfo.PreSaleEndDate < DateTime.Now)
                        {
                            this.litErrorMsg.Text = "您支付晚了,预售活动已经结束";
                            return;
                        }
                        if (!TradeHelper.CheckOrderStockBeforePay(orderInfo, out str))
                        {
                            this.litErrorMsg.Text = str + ",库存不足,不能进行支付";
                            return;
                        }
                    }
                    if (orderInfo.DepositDate.HasValue && orderInfo.OrderStatus == OrderStatus.WaitBuyerPay)
                    {
                        if (productPreSaleInfo.PaymentStartDate > DateTime.Now)
                        {
                            this.litErrorMsg.Text = "尾款支付尚未开始";
                            return;
                        }
                        DateTime t = productPreSaleInfo.PaymentEndDate.AddDays(1.0);
                        if (t <= DateTime.Now)
                        {
                            this.litErrorMsg.Text = "尾款支付已结束,不能支付!";
                            return;
                        }
                    }
                }
                else if (!TradeHelper.CheckOrderStockBeforePay(orderInfo, out str))
                {
                    this.litErrorMsg.Text = str + ",库存不足,不能进行支付";
                    return;
                }
                if (orderInfo.CountDownBuyId > 0)
                {
                    string empty = string.Empty;
                    foreach (KeyValuePair <string, LineItemInfo> lineItem in orderInfo.LineItems)
                    {
                        CountDownInfo countDownInfo = TradeHelper.CheckUserCountDown(lineItem.Value.ProductId, orderInfo.CountDownBuyId, lineItem.Value.SkuId, HiContext.Current.UserId, orderInfo.GetAllQuantity(true), orderInfo.OrderId, out empty, orderInfo.StoreId);
                        if (countDownInfo == null)
                        {
                            this.litErrorMsg.Text = empty;
                            return;
                        }
                    }
                }
                if (orderInfo.FightGroupId > 0)
                {
                    string empty2 = string.Empty;
                    foreach (KeyValuePair <string, LineItemInfo> lineItem2 in orderInfo.LineItems)
                    {
                        FightGroupActivityInfo fightGroupActivityInfo = VShopHelper.CheckUserFightGroup(lineItem2.Value.ProductId, orderInfo.FightGroupActivityId, orderInfo.FightGroupId, lineItem2.Value.SkuId, HiContext.Current.UserId, orderInfo.GetAllQuantity(true), orderInfo.OrderId, lineItem2.Value.Quantity, out empty2);
                        if (fightGroupActivityInfo == null)
                        {
                            this.litErrorMsg.Text = empty2;
                            return;
                        }
                    }
                }
                string  text   = orderInfo.OrderId;
                decimal amount = orderInfo.GetTotal(true);
                text = orderInfo.PayOrderId;
                if (orderInfo.PreSaleId > 0)
                {
                    if (!orderInfo.DepositDate.HasValue && orderInfo.OrderStatus == OrderStatus.WaitBuyerPay)
                    {
                        amount = orderInfo.Deposit;
                    }
                    if (orderInfo.DepositDate.HasValue && orderInfo.OrderStatus == OrderStatus.WaitBuyerPay)
                    {
                        amount = orderInfo.FinalPayment;
                    }
                }
                this.litErrorMsg.Text = "";
                if (orderInfo.Gateway == "hishop.plugins.payment.advancerequest")
                {
                    this.Page.Response.Redirect("TransactionPwd?orderId=" + this.Page.Request.QueryString["orderId"] + "&totalAmount=" + orderInfo.GetTotal(false).F2ToString("f2"));
                }
                if (orderInfo.Gateway == "hishop.plugins.payment.ws_apppay.wswappayrequest")
                {
                    HttpContext.Current.Response.Redirect("~/pay/app_alipay_Submit?orderId=" + orderInfo.OrderId);
                }
                PaymentModeInfo paymentMode = ShoppingProcessor.GetPaymentMode(orderInfo.Gateway);
                if (orderInfo.Gateway == "hishop.plugins.payment.ws_wappay.wswappayrequest")
                {
                    if (!masterSettings.EnableAppWapAliPay)
                    {
                        this.litErrorMsg.Text = "未开启支付宝网页支付";
                    }
                    else
                    {
                        string         attach         = "";
                        string         showUrl        = $"http://{HttpContext.Current.Request.Url.Host}/AppShop/MemberOrderDetails?orderId={orderInfo.OrderId}";
                        PaymentRequest paymentRequest = PaymentRequest.CreateInstance(paymentMode.Gateway, HiCryptographer.Decrypt(paymentMode.Settings), text, amount, "订单支付", "订单号-" + orderInfo.OrderId, orderInfo.EmailAddress, orderInfo.OrderDate, showUrl, Globals.FullPath("/pay/wap_alipay_return_url"), Globals.FullPath("/pay/wap_alipay_notify_url"), attach);
                        paymentRequest.SendRequest();
                    }
                }
                else if (orderInfo.Gateway == "Hishop.Plugins.Payment.ShengPayMobile.ShengPayMobileRequest")
                {
                    if (!masterSettings.EnableAppShengPay)
                    {
                        this.litErrorMsg.Text = "未开启盛付通手机网页支付";
                    }
                    else
                    {
                        string         attach2         = "";
                        string         text2           = $"http://{HttpContext.Current.Request.Url.Host}/AppShop/";
                        PaymentRequest paymentRequest2 = PaymentRequest.CreateInstance(paymentMode.Gateway, HiCryptographer.Decrypt(paymentMode.Settings), text, amount, "订单支付", "订单号-" + orderInfo.OrderId, orderInfo.EmailAddress, orderInfo.OrderDate, text2, text2 + "MemberOrderDetails?orderId=" + orderInfo.OrderId, Globals.FullPath("/pay/wap_sheng_return_url"), attach2);
                        paymentRequest2.SendRequest();
                    }
                }
                else if (orderInfo.Gateway == "hishop.plugins.payment.bankuniongateway.bankuniongetwayrequest")
                {
                    if (!masterSettings.EnableAPPBankUnionPay)
                    {
                        this.litErrorMsg.Text = "未开启银联全渠道支付";
                    }
                    else
                    {
                        string         attach3         = "";
                        string         showUrl2        = $"http://{HttpContext.Current.Request.Url.Host}/AppShop/";
                        PaymentRequest paymentRequest3 = PaymentRequest.CreateInstance(paymentMode.Gateway, HiCryptographer.Decrypt(paymentMode.Settings), text, amount, "订单支付", "订单号-" + orderInfo.OrderId, orderInfo.EmailAddress, orderInfo.OrderDate, showUrl2, Globals.FullPath("/pay/wap_bankunion_return_url"), Globals.FullPath("/pay/wap_bankunion_notify_url"), attach3);
                        paymentRequest3.SendRequest();
                    }
                }
                else
                {
                    if (orderInfo.Gateway == "hishop.plugins.payment.weixinrequest" || orderInfo.Gateway == "hishop.plugins.payment.appwxrequest")
                    {
                        if (!masterSettings.OpenAppWxPay || string.IsNullOrEmpty(masterSettings.AppWxAppId) || string.IsNullOrEmpty(masterSettings.AppWxAppSecret) || string.IsNullOrEmpty(masterSettings.AppWxMchId) || string.IsNullOrEmpty(masterSettings.AppWxPartnerKey))
                        {
                            this.litErrorMsg.Text = "APP未开通微信支付";
                            return;
                        }
                        HttpContext.Current.Response.Redirect("~/pay/H5WxPay_Submit?orderId=" + orderInfo.OrderId);
                    }
                    if (paymentMode == null)
                    {
                        this.litErrorMsg.Text = "错误的支付方式";
                    }
                    else
                    {
                        this.litErrorMsg.Text = "APP不支持使用" + paymentMode.Name + "进行支付";
                    }
                }
            }
        }
Exemplo n.º 22
0
        private void btnPay_Click(object sender, EventArgs e)
        {
            string value  = this.hdorderId.Value;
            int    modeId = 0;

            int.TryParse(this.dropPayType.SelectedValue, out modeId);
            PaymentModeInfo paymentMode = TradeHelper.GetPaymentMode(modeId);
            OrderInfo       orderInfo   = TradeHelper.GetOrderInfo(value);
            string          msg         = "";

            if (!TradeHelper.CheckOrderStock(orderInfo, out msg))
            {
                this.ShowMessage(msg, false, "", 1);
            }
            else
            {
                IList <string> list = new List <string>();
                list.Add("hishop.plugins.payment.podrequest");
                list.Add("hishop.plugins.payment.bankrequest");
                if (orderInfo.CountDownBuyId > 0)
                {
                    if (list.Contains(paymentMode.Gateway.ToLower().Trim()))
                    {
                        msg = "限购的订单不支持货到付款和线下支付";
                        this.ShowMessage(msg, false, "", 1);
                        return;
                    }
                    foreach (LineItemInfo value2 in orderInfo.LineItems.Values)
                    {
                        CountDownInfo countDownInfo = TradeHelper.CheckUserCountDown(value2.ProductId, orderInfo.CountDownBuyId, value2.SkuId, HiContext.Current.UserId, orderInfo.GetAllQuantity(true), orderInfo.OrderId, out msg, orderInfo.StoreId);
                        if (countDownInfo == null)
                        {
                            this.ShowMessage(msg, false, "", 1);
                            return;
                        }
                    }
                }
                if (orderInfo.FightGroupId > 0)
                {
                    if (paymentMode == null || (!TradeHelper.GatewayIsCanBackReturn(paymentMode.Gateway) && paymentMode.Gateway != EnumDescription.GetEnumDescription((Enum)(object)EnumPaymentType.AdvancePay, 1)))
                    {
                        this.ShowMessage("火拼团订单不支付该支付方式进行支付", false, "", 1);
                        return;
                    }
                    foreach (KeyValuePair <string, LineItemInfo> lineItem in orderInfo.LineItems)
                    {
                        FightGroupActivityInfo fightGroupActivityInfo = VShopHelper.CheckUserFightGroup(lineItem.Value.ProductId, orderInfo.FightGroupActivityId, orderInfo.FightGroupId, lineItem.Value.SkuId, HiContext.Current.UserId, orderInfo.GetAllQuantity(true), orderInfo.OrderId, lineItem.Value.Quantity, out msg);
                        if (fightGroupActivityInfo == null)
                        {
                            this.ShowMessage(msg, false, "", 1);
                            return;
                        }
                    }
                }
                if (orderInfo.GroupBuyId > 0 && list.Contains(paymentMode.Gateway.ToLower().Trim()))
                {
                    msg = "团购的订单不支持货到付款和线下支付";
                    this.ShowMessage(msg, false, "", 1);
                }
                else
                {
                    if (orderInfo.PreSaleId > 0)
                    {
                        if (paymentMode.Gateway.ToLower().Trim() == "hishop.plugins.payment.podrequest")
                        {
                            this.ShowMessage("预售订单不支持货到付款", false, "", 1);
                            return;
                        }
                        ProductPreSaleInfo productPreSaleInfo = ProductPreSaleHelper.GetProductPreSaleInfo(orderInfo.PreSaleId);
                        if (productPreSaleInfo == null)
                        {
                            this.ShowMessage("预售活动不存在,不能支付", false, "", 1);
                            return;
                        }
                        if (!orderInfo.DepositDate.HasValue && orderInfo.OrderStatus == OrderStatus.WaitBuyerPay && productPreSaleInfo.PreSaleEndDate < DateTime.Now)
                        {
                            this.ShowMessage("您支付晚了,预售活动已经结束", false, "", 1);
                            return;
                        }
                        if (orderInfo.DepositDate.HasValue && orderInfo.OrderStatus == OrderStatus.WaitBuyerPay)
                        {
                            if (productPreSaleInfo.PaymentStartDate > DateTime.Now)
                            {
                                this.ShowMessage("尾款支付尚未开始", false, "", 1);
                                return;
                            }
                            DateTime dateTime = productPreSaleInfo.PaymentEndDate;
                            DateTime date     = dateTime.Date;
                            dateTime = DateTime.Now;
                            if (date < dateTime.Date)
                            {
                                this.ShowMessage("尾款支付已结束", false, "", 1);
                                return;
                            }
                        }
                    }
                    if (paymentMode != null)
                    {
                        orderInfo.PaymentTypeId = paymentMode.ModeId;
                        orderInfo.PaymentType   = paymentMode.Name;
                        orderInfo.Gateway       = paymentMode.Gateway;
                        TradeHelper.UpdateOrderPaymentType(orderInfo);
                    }
                    this.Page.Response.Redirect(base.GetRouteUrl("sendPayment", new
                    {
                        orderId = value
                    }));
                }
            }
        }
Exemplo n.º 23
0
        protected override void OnInit(EventArgs e)
        {
            if (this.SkinName == null)
            {
                this.SkinName = "Skin-ServiceProductSubmitOrder.html";
            }
            base.OnInit(e);
            string urlToEncode = "";

            this.from          = this.Page.Request.QueryString["from"].ToNullString().ToLower();
            this.productSku    = Globals.UrlDecode(this.Page.Request.QueryString["productSku"].ToNullString());
            this.buyAmount     = this.Page.Request.QueryString["buyAmount"].ToInt(0);
            this.storeId       = this.Page.Request.QueryString["StoreId"].ToInt(0);
            this.chooseStoreId = this.Page.Request.QueryString["ChooseStoreId"].ToInt(0);
            if (this.from == "groupbuy")
            {
                this.isGroupBuy = true;
            }
            else if (this.from == "countdown")
            {
                this.isCountDown = true;
            }
            else if (this.from == "fightgroup")
            {
                this.isFightGroup = true;
            }
            else
            {
                if (this.from == "presale")
                {
                    this.PresaleId  = this.Page.Request.QueryString["PresaleId"].ToInt(0);
                    this.productSku = DataHelper.CleanSearchString(this.productSku);
                    if (this.CheckPresaleInfo())
                    {
                        this.isPreSale = true;
                        goto IL_01cd;
                    }
                    return;
                }
                this.from = "serviceproduct";
            }
            goto IL_01cd;
IL_01cd:
            if (this.storeId == 0 && !HiContext.Current.SiteSettings.OpenMultStore)
            {
                this.cart = ShoppingCartProcessor.GetShoppingCart(this.from, this.productSku, this.buyAmount, 0, true, -1, this.Page.Request["fightGroupActivityId"].ToInt(0));
            }
            else
            {
                this.cart = ShoppingCartProcessor.GetShoppingCart(this.from, this.productSku, this.buyAmount, 0, true, this.storeId, this.Page.Request["fightGroupActivityId"].ToInt(0));
            }
            if (this.cart == null)
            {
                string msg = "购物车无任何商品!";
                this.hasError = true;
                this.ShowWapMessage(msg, "default.aspx");
            }
            else
            {
                if (this.isGroupBuy)
                {
                    this.groupbuyInfo = TradeHelper.GetProductGroupBuyInfo(this.cart.LineItems[0].ProductId, this.buyAmount, out urlToEncode);
                    if (this.groupbuyInfo == null)
                    {
                        this.hasError = true;
                        this.ShowWapMessage(Globals.UrlEncode(urlToEncode), "default.aspx");
                        return;
                    }
                }
                if (this.isCountDown)
                {
                    this.countdownInfo = TradeHelper.ProductExistsCountDown(this.cart.LineItems[0].ProductId, "", this.storeId);
                    if (this.countdownInfo == null)
                    {
                        this.hasError = true;
                        this.ShowWapMessage("该商品未进行抢购活动,或者活动已结束", "Default.aspx");
                        return;
                    }
                    if (!StoreActivityHelper.JoinActivity(this.countdownInfo.CountDownId, 2, this.storeId, this.countdownInfo.StoreType))
                    {
                        this.hasError = true;
                        this.ShowWapMessage("该门店未参与此抢购活动", "Default.aspx");
                        return;
                    }
                    this.countdownInfo = TradeHelper.CheckUserCountDown(this.cart.LineItems[0].ProductId, this.countdownInfo.CountDownId, this.cart.LineItems[0].SkuId, HiContext.Current.UserId, this.buyAmount, "", out urlToEncode, this.storeId);
                    if (this.countdownInfo == null)
                    {
                        this.ShowWapMessage(Globals.UrlEncode(urlToEncode), "Default.aspx");
                        return;
                    }
                }
                if (this.isFightGroup)
                {
                    this.fightGroupActivitiyInfo = TradeHelper.GetFightGroupActivitieInfo(this.Page.Request["fightGroupActivityId"].ToInt(0));
                    if (this.fightGroupActivitiyInfo == null)
                    {
                        this.hasError = true;
                        this.ShowWapMessage("拼团活动不存在", "Default.aspx");
                    }
                    else
                    {
                        int num = this.Page.Request["fightGroupId"].ToInt(0);
                        this.fightGroupInfo = VShopHelper.GetFightGroup(num);
                        if (this.fightGroupInfo == null && num != 0)
                        {
                            this.hasError = true;
                            this.ShowWapMessage("拼团活动不存在", "Default.aspx");
                        }
                    }
                }
            }
        }
Exemplo n.º 24
0
        protected void btnPay_Click(object sender, EventArgs e)
        {
            MemberInfo user = HiContext.Current.User;

            if (string.IsNullOrEmpty(user.TradePassword))
            {
                this.Page.Response.Redirect("/user/OpenBalance.aspx");
            }
            string    empty     = string.Empty;
            OrderInfo orderInfo = TradeHelper.GetOrderInfo(this.orderId);
            int       num       = 0;
            int       num2      = 0;
            int       num3      = 0;

            if (orderInfo.CountDownBuyId > 0)
            {
                foreach (KeyValuePair <string, LineItemInfo> lineItem in orderInfo.LineItems)
                {
                    CountDownInfo countDownInfo = TradeHelper.CheckUserCountDown(lineItem.Value.ProductId, orderInfo.CountDownBuyId, lineItem.Value.SkuId, HiContext.Current.UserId, orderInfo.GetAllQuantity(true), orderInfo.OrderId, out empty, orderInfo.StoreId);
                    if (countDownInfo == null)
                    {
                        this.ShowMessage(empty, false, "", 1);
                        return;
                    }
                }
            }
            if (orderInfo.FightGroupId > 0)
            {
                foreach (KeyValuePair <string, LineItemInfo> lineItem2 in orderInfo.LineItems)
                {
                    FightGroupActivityInfo fightGroupActivityInfo = VShopHelper.CheckUserFightGroup(lineItem2.Value.ProductId, orderInfo.FightGroupActivityId, orderInfo.FightGroupId, lineItem2.Value.SkuId, HiContext.Current.UserId, orderInfo.GetAllQuantity(true), orderInfo.OrderId, lineItem2.Value.Quantity, out empty);
                    if (fightGroupActivityInfo == null)
                    {
                        this.ShowMessage(empty, false, "", 1);
                        return;
                    }
                }
            }
            if (orderInfo.GroupBuyId > 0)
            {
                GroupBuyInfo groupBuy = TradeHelper.GetGroupBuy(orderInfo.GroupBuyId);
                if (groupBuy == null || groupBuy.Status != GroupBuyStatus.UnderWay)
                {
                    this.ShowMessage("当前的订单为团购订单,此团购活动已结束,所以不能支付", false, "", 1);
                    return;
                }
                num2 = TradeHelper.GetOrderCount(orderInfo.GroupBuyId);
                num3 = orderInfo.GetGroupBuyOerderNumber();
                num  = groupBuy.MaxCount;
                if (num < num2 + num3)
                {
                    this.ShowMessage("当前的订单为团购订单,订购数量已超过订购总数,所以不能支付", false, "", 1);
                    return;
                }
            }
            if (orderInfo.PreSaleId > 0)
            {
                ProductPreSaleInfo productPreSaleInfo = ProductPreSaleHelper.GetProductPreSaleInfo(orderInfo.PreSaleId);
                if (productPreSaleInfo == null)
                {
                    this.ShowMessage("预售活动不存在不能支付", false, "", 1);
                    return;
                }
                if (!orderInfo.DepositDate.HasValue && orderInfo.OrderStatus == OrderStatus.WaitBuyerPay && productPreSaleInfo.PreSaleEndDate < DateTime.Now)
                {
                    this.ShowMessage("您支付晚了,预售活动已经结束", false, "", 1);
                    return;
                }
                if (orderInfo.DepositDate.HasValue && orderInfo.OrderStatus == OrderStatus.WaitBuyerPay)
                {
                    if (productPreSaleInfo.PaymentStartDate > DateTime.Now)
                    {
                        this.ShowMessage("尾款支付尚未开始", false, "", 1);
                        return;
                    }
                    DateTime dateTime = productPreSaleInfo.PaymentEndDate;
                    DateTime date     = dateTime.Date;
                    dateTime = DateTime.Now;
                    if (date < dateTime.Date)
                    {
                        this.ShowMessage("尾款支付已结束", false, "", 1);
                        return;
                    }
                }
            }
            if (!orderInfo.CheckAction(OrderActions.BUYER_PAY))
            {
                this.ShowMessage("当前的订单订单状态不是等待付款,所以不能支付", false, "", 1);
            }
            else if (HiContext.Current.UserId != orderInfo.UserId)
            {
                this.ShowMessage("预付款只能为自己下的订单付款,查一查该订单是不是你的", false, "", 1);
            }
            else if ((decimal)this.litUseableBalance.Money < orderInfo.GetTotal(false))
            {
                this.ShowMessage("预付款余额不足,支付失败", false, "", 1);
            }
            else if (MemberProcessor.ValidTradePassword(this.txtPassword.Text))
            {
                string str = "";
                if (!TradeHelper.CheckOrderStock(orderInfo, out str))
                {
                    this.ShowMessage("订单中有商品(" + str + ")库存不足", false, "", 1);
                }
                else
                {
                    Dictionary <string, LineItemInfo> lineItems = orderInfo.LineItems;
                    foreach (LineItemInfo value in lineItems.Values)
                    {
                        int skuStock = ShoppingCartProcessor.GetSkuStock(value.SkuId, 0);
                        if (skuStock < value.ShipmentQuantity)
                        {
                            this.ShowMessage("订单中商品库存不足,禁止支付!", false, "", 1);
                            return;
                        }
                    }
                    if (TradeHelper.UserPayOrder(orderInfo, true, false))
                    {
                        if (orderInfo.GroupBuyId > 0 && num == num2 + num3)
                        {
                            TradeHelper.SetGroupBuyEndUntreated(orderInfo.GroupBuyId);
                        }
                        if (orderInfo.ParentOrderId == "-1")
                        {
                            OrderQuery orderQuery = new OrderQuery();
                            orderQuery.ParentOrderId = orderInfo.OrderId;
                            IList <OrderInfo> listUserOrder = MemberProcessor.GetListUserOrder(orderInfo.UserId, orderQuery);
                            foreach (OrderInfo item in listUserOrder)
                            {
                                OrderHelper.OrderConfirmPaySendMessage(item);
                            }
                        }
                        else
                        {
                            OrderHelper.OrderConfirmPaySendMessage(orderInfo);
                        }
                        this.Page.Response.Redirect("/user/PaySucceed.aspx?orderId=" + this.orderId);
                    }
                    else
                    {
                        this.ShowMessage($"对订单{orderInfo.OrderId} 支付失败", false, "", 1);
                    }
                }
            }
            else
            {
                this.ShowMessage("交易密码有误,请重试", false, "", 1);
            }
        }