Example #1
0
        protected void Page_Load(object sender, System.EventArgs e)
        {
            string    orderId   = this.Page.Request.QueryString["orderId"];
            OrderInfo orderInfo = TradeHelper.GetOrderInfo(orderId);

            if (orderInfo == null)
            {
                base.Response.Write("<div><font color='red'>您要付款的订单已经不存在,请联系管理员确定</font></div>");
                return;
            }
            if (orderInfo.OrderStatus != OrderStatus.WaitBuyerPay)
            {
                this.Page.Response.Write("订单当前状态不能支付");
                return;
            }
            if (orderInfo.CountDownBuyId > 0)
            {
                CountDownInfo countDownInfoByCountDownId = ProductBrowser.GetCountDownInfoByCountDownId(orderInfo.CountDownBuyId);
                if (countDownInfoByCountDownId == null || countDownInfoByCountDownId.EndDate < System.DateTime.Now)
                {
                    this.Page.Response.Write("此订单属于限时抢购类型订单,但限时抢购活动已经结束或不存在");
                    return;
                }
            }
            PaymentModeInfo paymentMode = TradeHelper.GetPaymentMode(orderInfo.PaymentTypeId);

            if (paymentMode == null)
            {
                base.Response.Write("<div><font color='red'>您之前选择的支付方式已经不存在,请联系管理员修改支付方式</font></div>");
                return;
            }
            System.Collections.Generic.Dictionary <string, LineItemInfo> lineItems = orderInfo.LineItems;
            foreach (LineItemInfo current in lineItems.Values)
            {
                int productId = current.ProductId;
                ProductBrowseInfo productBrowseInfo = ProductBrowser.GetProductBrowseInfo(productId, new int?(6), new int?(6));
                if (productBrowseInfo.Product == null || productBrowseInfo.Product.SaleStatus == ProductSaleStatus.Delete)
                {
                    base.Response.Redirect(Globals.ApplicationPath + "/ResourceNotFound.aspx?errorMsg=" + Globals.UrlEncode("订单内商品已经被管理员删除"));
                    return;
                }
                if (productBrowseInfo.Product.SaleStatus == ProductSaleStatus.OnStock)
                {
                    base.Response.Redirect(Globals.ApplicationPath + "/ResourceNotFound.aspx?errorMsg=" + Globals.UrlEncode("订单内商品已入库"));
                    return;
                }
                ProductInfo product          = productBrowseInfo.Product;
                int         stock            = product.Stock;
                int         shipmentQuantity = current.ShipmentQuantity;
                if (shipmentQuantity > stock)
                {
                    base.Response.Redirect(Globals.ApplicationPath + "/ResourceNotFound.aspx?errorMsg=" + Globals.UrlEncode("订单内商品库存不足"));
                    return;
                }
            }
            string showUrl = Globals.GetSiteUrls().UrlData.FormatUrl("user_UserOrders");

            if (paymentMode.Gateway.ToLower() != "hishop.plugins.payment.podrequest")
            {
                showUrl = base.Server.UrlEncode(string.Format("http://{0}/user/OrderDetails.aspx?OrderId={1}", base.Request.Url.Host, orderInfo.OrderId));
            }
            if (string.Compare(paymentMode.Gateway, "Hishop.Plugins.Payment.BankRequest", true) == 0)
            {
                showUrl = Globals.FullPath(Globals.GetSiteUrls().UrlData.FormatUrl("bank_pay", new object[]
                {
                    orderInfo.OrderId
                }));
            }
            if (string.Compare(paymentMode.Gateway, "Hishop.Plugins.Payment.AdvanceRequest", true) == 0)
            {
                showUrl = Globals.FullPath(Globals.GetSiteUrls().UrlData.FormatUrl("advance_pay", new object[]
                {
                    orderInfo.OrderId
                }));
            }
            string attach = "";

            System.Web.HttpCookie httpCookie = Hidistro.Membership.Context.HiContext.Current.Context.Request.Cookies["Token_" + Hidistro.Membership.Context.HiContext.Current.User.UserId.ToString()];
            if (httpCookie != null && !string.IsNullOrEmpty(httpCookie.Value))
            {
                attach = httpCookie.Value;
            }
            PaymentRequest paymentRequest = PaymentRequest.CreateInstance(paymentMode.Gateway, HiCryptographer.Decrypt(paymentMode.Settings), orderInfo.OrderId, orderInfo.GetTotal(), "订单支付", "订单号-" + orderInfo.OrderId, orderInfo.EmailAddress, orderInfo.OrderDate, showUrl, Globals.FullPath(Globals.GetSiteUrls().UrlData.FormatUrl("PaymentReturn_url", new object[]
            {
                paymentMode.Gateway
            })), Globals.FullPath(Globals.GetSiteUrls().UrlData.FormatUrl("PaymentNotify_url", new object[]
            {
                paymentMode.Gateway
            })), attach);

            paymentRequest.SendRequest();
        }
Example #2
0
        private void SetControlsValue(int countDownId)
        {
            CountDownInfo     countDownInfoByCountDownId = ProductBrowser.GetCountDownInfoByCountDownId(countDownId);
            ProductBrowseInfo productBrowseInfo          = ProductBrowser.GetProductBrowseInfo(countDownInfoByCountDownId.ProductId, null, null);

            if (productBrowseInfo == null)
            {
                base.GotoResourceNotFound("此商品已不存在");
            }
            if (productBrowseInfo.Product.SaleStatus != ProductSaleStatus.OnSale)
            {
                base.GotoResourceNotFound("此商品已下架");
            }
            if (this.rptProductImages != null)
            {
                string       locationUrl = "javascript:;";
                SlideImage[] source      = new SlideImage[]
                {
                    new SlideImage(productBrowseInfo.Product.ImageUrl1, locationUrl),
                    new SlideImage(productBrowseInfo.Product.ImageUrl2, locationUrl),
                    new SlideImage(productBrowseInfo.Product.ImageUrl3, locationUrl),
                    new SlideImage(productBrowseInfo.Product.ImageUrl4, locationUrl),
                    new SlideImage(productBrowseInfo.Product.ImageUrl5, locationUrl)
                };
                this.rptProductImages.DataSource =
                    from item in source
                    where !string.IsNullOrWhiteSpace(item.ImageUrl)
                    select item;
                this.rptProductImages.DataBind();
            }
            this.litProdcutName.SetWhenIsNotNull(productBrowseInfo.Product.ProductName);
            this.litminCount.SetWhenIsNotNull(countDownInfoByCountDownId.MaxCount.ToString());
            this.litShortDescription.SetWhenIsNotNull(productBrowseInfo.Product.ShortDescription);
            if (this.litDescription != null && !string.IsNullOrWhiteSpace(productBrowseInfo.Product.Description))
            {
                System.Text.RegularExpressions.Regex regex = new System.Text.RegularExpressions.Regex("<script[^>]*?>.*?</script>", System.Text.RegularExpressions.RegexOptions.IgnoreCase);
                if (!string.IsNullOrEmpty(productBrowseInfo.Product.MobblieDescription))
                {
                    this.litDescription.Text = regex.Replace(productBrowseInfo.Product.MobblieDescription, "");
                }
                else
                {
                    this.litDescription.Text = regex.Replace(productBrowseInfo.Product.Description, "");
                }
            }
            this.litprice.SetWhenIsNotNull(countDownInfoByCountDownId.CountDownPrice.ToString("F2"));
            this.litLeftSeconds.SetWhenIsNotNull(System.Math.Ceiling((countDownInfoByCountDownId.EndDate - System.DateTime.Now).TotalSeconds).ToString());
            this.litcontent.SetWhenIsNotNull(countDownInfoByCountDownId.Content);
            this.litGroupBuyId.SetWhenIsNotNull(countDownInfoByCountDownId.CountDownId.ToString());
            this.skuSelector.ProductId = countDownInfoByCountDownId.ProductId;
            this.expandAttr.ProductId  = countDownInfoByCountDownId.ProductId;
            this.salePrice.SetWhenIsNotNull(productBrowseInfo.Product.MaxSalePrice.ToString("F2"));
            this.linkDescription.SetWhenIsNotNull("/Vshop/ProductDescription.aspx?productId=" + countDownInfoByCountDownId.ProductId);
            this.txtProductId.SetWhenIsNotNull(countDownInfoByCountDownId.ProductId.ToString());
            this.litConsultationsCount.SetWhenIsNotNull(productBrowseInfo.ConsultationCount.ToString());
            this.litReviewsCount.SetWhenIsNotNull(productBrowseInfo.ReviewCount.ToString());
            this.litGroupbuyDescription.SetWhenIsNotNull(countDownInfoByCountDownId.Content);
            this.litMaxCount.SetWhenIsNotNull(countDownInfoByCountDownId.MaxCount.ToString());
            this.nowTime = (System.Web.UI.HtmlControls.HtmlInputHidden) this.FindControl("nowTime");
            this.nowTime.SetWhenIsNotNull(System.DateTime.Now.ToString("yyyy/MM/dd HH:mm:ss", System.Globalization.DateTimeFormatInfo.InvariantInfo));
            this.startTime.SetWhenIsNotNull(countDownInfoByCountDownId.StartDate.ToString("yyyy/MM/dd HH:mm:ss"));
            this.endTime.SetWhenIsNotNull(countDownInfoByCountDownId.EndDate.ToString("yyyy/MM/dd HH:mm:ss"));
            this.groupBuyMaxCount.SetWhenIsNotNull(countDownInfoByCountDownId.MaxCount.ToString());
        }
Example #3
0
        protected void Page_Load(object sender, EventArgs e)
        {
            string    orderId   = this.Page.Request.QueryString["orderId"];
            OrderInfo orderInfo = Hidistro.SaleSystem.Vshop.TradeHelper.GetOrderInfo(orderId);

            if (orderInfo == null)
            {
                base.Response.Write("<div><font color='red'>您要付款的订单已经不存在,请联系管理员确定</font></div>");
            }
            else if (orderInfo.OrderStatus != OrderStatus.WaitBuyerPay)
            {
                this.Page.Response.Write("订单当前状态不能支付");
            }
            else
            {
                if (orderInfo.CountDownBuyId > 0)
                {
                    CountDownInfo countDownInfoByCountDownId = ProductBrowser.GetCountDownInfoByCountDownId(orderInfo.CountDownBuyId);
                    if ((countDownInfoByCountDownId == null) || (countDownInfoByCountDownId.EndDate < DateTime.Now))
                    {
                        this.Page.Response.Write("此订单属于限时抢购类型订单,但限时抢购活动已经结束或不存在");
                        return;
                    }
                }
                PaymentModeInfo paymentMode = ShoppingProcessor.GetPaymentMode(orderInfo.PaymentTypeId);
                //PaymentModeInfo paymentMode = Hidistro.SaleSystem.Vshop.TradeHelper.GetPaymentMode(orderInfo.PaymentTypeId);
                if (paymentMode == null)
                {
                    base.Response.Write("<div><font color='red'>您之前选择的支付方式已经不存在,请联系管理员修改支付方式</font></div>");
                }
                else
                {
                    /*
                     * foreach (LineItemInfo info4 in orderInfo.LineItems.Values)
                     * {
                     *  int productId = info4.ProductId;
                     *  SiteSettings masterSettings = SettingsManager.GetMasterSettings(true);
                     *  ProductBrowseInfo info5 = ProductBrowser.GetProductBrowseInfo(productId, 6, 6, 0,false);
                     *  //ProductBrowseInfo info5 = ProductBrowser.GetProducts
                     *  if ((info5.Product == null) || (info5.Product.SaleStatus == ProductSaleStatus.Delete))
                     *  {
                     *      base.Response.Redirect(Globals.ApplicationPath + "/ResourceNotFound.aspx?errorMsg=" + Globals.UrlEncode("订单内商品已经被管理员删除"));
                     *      return;
                     *  }
                     *  if (info5.Product.SaleStatus == ProductSaleStatus.OnStock)
                     *  {
                     *      base.Response.Redirect(Globals.ApplicationPath + "/ResourceNotFound.aspx?errorMsg=" + Globals.UrlEncode("订单内商品已入库"));
                     *      return;
                     *  }
                     *  int stock = info5.Product.Stock;
                     *  if (info4.ShipmentQuantity > stock)
                     *  {
                     *      base.Response.Redirect(Globals.ApplicationPath + "/ResourceNotFound.aspx?errorMsg=" + Globals.UrlEncode("订单内商品库存不足"));
                     *      return;
                     *  }
                     * }
                     */
                    string showUrl = Globals.GetSiteUrls().UrlData.FormatUrl("user_UserOrders");
                    if (paymentMode.Gateway.ToLower() != "hishop.plugins.payment.podrequest")
                    {
                        showUrl = base.Server.UrlEncode(string.Format("http://{0}/user/OrderDetails.aspx?OrderId={1}", base.Request.Url.Host, orderInfo.OrderId));
                    }
                    if (string.Compare(paymentMode.Gateway, "Hishop.Plugins.Payment.BankRequest", true) == 0)
                    {
                        showUrl = Globals.FullPath(Globals.GetSiteUrls().UrlData.FormatUrl("bank_pay", new object[] { orderInfo.OrderId }));
                    }
                    if (string.Compare(paymentMode.Gateway, "Hishop.Plugins.Payment.AdvanceRequest", true) == 0)
                    {
                        showUrl = Globals.FullPath(Globals.GetSiteUrls().UrlData.FormatUrl("advance_pay", new object[] { orderInfo.OrderId }));
                    }
                    string attach = "";
                    //HttpCookie cookie = HiContext.Current.Context.Request.Cookies["Token_" + HiContext.Current.User.UserId.ToString()];
                    //if ((cookie != null) && !string.IsNullOrEmpty(cookie.Value))
                    //{
                    //    attach = cookie.Value;
                    //}
                    PaymentRequest.CreateInstance(paymentMode.Gateway, HiCryptographer.Decrypt(paymentMode.Settings), orderInfo.OrderId, orderInfo.GetTotal(), "订单支付", "订单号-" + orderInfo.OrderId, orderInfo.EmailAddress, orderInfo.OrderDate, showUrl, Globals.FullPath(Globals.GetSiteUrls().UrlData.FormatUrl("PaymentReturn_url", new object[] { paymentMode.Gateway })), Globals.FullPath(Globals.GetSiteUrls().UrlData.FormatUrl("PaymentNotify_url", new object[] { paymentMode.Gateway })), attach).SendRequest();
                }
            }
        }
Example #4
0
        private Literal litEndtime;//抢购结束时间

        protected override void AttachChildControls()
        {
            if (!int.TryParse(this.Page.Request.QueryString["countDownId"], out this.countDownId))
            {
                base.GotoResourceNotFound("");
            }
            this.rptProductImages      = (VshopTemplatedRepeater)this.FindControl("rptProductImages");
            this.litItemParams         = (Literal)this.FindControl("litItemParams");
            this.litProdcutName        = (Literal)this.FindControl("litProdcutName");
            this.litActivities         = (Literal)this.FindControl("litActivities");
            this.litSalePrice          = (Literal)this.FindControl("litSalePrice");
            this.litMarketPrice        = (Literal)this.FindControl("litMarketPrice");
            this.litShortDescription   = (Literal)this.FindControl("litShortDescription");
            this.litDescription        = (Literal)this.FindControl("litDescription");
            this.litStock              = (Literal)this.FindControl("litStock");
            this.skuSelector           = (Common_SKUSelector)this.FindControl("skuSelector");
            this.linkDescription       = (HyperLink)this.FindControl("linkDescription");
            this.expandAttr            = (Common_ExpandAttributes)this.FindControl("ExpandAttributes");
            this.litSoldCount          = (Literal)this.FindControl("litSoldCount");
            this.litConsultationsCount = (Literal)this.FindControl("litConsultationsCount");
            this.litReviewsCount       = (Literal)this.FindControl("litReviewsCount");
            this.litHasCollected       = (HtmlInputHidden)this.FindControl("litHasCollected");
            this.litCategoryId         = (HtmlInputHidden)this.FindControl("litCategoryId");
            this.litproductid          = (HtmlInputHidden)this.FindControl("litproductid");
            this.litGroupbuyId         = (HtmlInputControl)this.FindControl("litGroupbuyId");
            this.litEndtime            = (Literal)this.FindControl("litEndtime");//抢购结束时间
            //ProductInfo product = ProductBrowser.GetProduct(MemberProcessor.GetCurrentMember(), this.productId);
            CountDownInfo countDownInfoByCountDownId = ProductBrowser.GetCountDownInfoByCountDownId(countDownId);
            SiteSettings  masterSettings             = SettingsManager.GetMasterSettings(true);
            //ProductBrowseInfo info2 = ProductBrowser.GetProductBrowseInfo(countDownInfoByCountDownId.ProductId, null, null, masterSettings.StoreStockValidateType, masterSettings.OpenMultStore);
            ProductInfo product = ProductBrowser.GetProduct(MemberProcessor.GetCurrentMember(), countDownInfoByCountDownId.ProductId);

            this.litproductid.Value = this.countDownId.ToString();

            if (!string.IsNullOrEmpty(this.litActivities.Text) && (product == null))
            {
                base.GotoResourceNotFound("此商品已不存在");
            }
            if (product.SaleStatus != ProductSaleStatus.OnSale)
            {
                base.GotoResourceNotFound("此商品已下架");
            }
            if (this.rptProductImages != null)
            {
                string       locationUrl = "javascript:;";
                SlideImage[] imageArray  = new SlideImage[] { new SlideImage(product.ImageUrl1, locationUrl), new SlideImage(product.ImageUrl2, locationUrl), new SlideImage(product.ImageUrl3, locationUrl), new SlideImage(product.ImageUrl4, locationUrl), new SlideImage(product.ImageUrl5, locationUrl) };
                this.rptProductImages.DataSource = from item in imageArray
                                                   where !string.IsNullOrWhiteSpace(item.ImageUrl)
                                                   select item;
                this.rptProductImages.DataBind();
            }
            string mainCategoryPath = product.MainCategoryPath;

            if (!string.IsNullOrEmpty(mainCategoryPath))
            {
                this.litCategoryId.Value = mainCategoryPath.Split(new char[] { '|' })[0];
            }
            else
            {
                this.litCategoryId.Value = "0";
            }
            this.litProdcutName.Text = product.ProductName;
            this.litSalePrice.Text   = countDownInfoByCountDownId.CountDownPrice.ToString("F2");//现价是该商品的抢购价
            if (product.MarketPrice.HasValue)
            {
                this.litMarketPrice.SetWhenIsNotNull(product.MinSalePrice.ToString("F2"));//原价是该商品的一口价
            }
            this.litShortDescription.Text = product.ShortDescription;
            if (this.litDescription != null)
            {
                this.litDescription.Text = product.Description;
            }
            this.litSoldCount.SetWhenIsNotNull(product.ShowSaleCounts.ToString());
            this.litStock.Text         = countDownInfoByCountDownId.MaxCount.ToString(); //库存为限购数量
            this.skuSelector.ProductId = countDownInfoByCountDownId.ProductId;           //为型号选择器绑定productid
            if (this.litEndtime != null)                                                 //倒计时
            {
                this.litEndtime.Text = Convert.ToDateTime(countDownInfoByCountDownId.EndDate).ToString();
            }
            this.skuSelector.ProductId = countDownInfoByCountDownId.ProductId;
            if (this.expandAttr != null)
            {
                this.expandAttr.ProductId = countDownInfoByCountDownId.ProductId;
            }
            if (this.linkDescription != null)
            {
                this.linkDescription.NavigateUrl = "/Vshop/ProductDescription.aspx?productId=" + countDownInfoByCountDownId.ProductId;
            }
            this.litConsultationsCount.SetWhenIsNotNull(ProductBrowser.GetProductConsultationsCount(countDownInfoByCountDownId.ProductId, false).ToString());
            this.litReviewsCount.SetWhenIsNotNull(ProductBrowser.GetProductReviewsCount(countDownInfoByCountDownId.ProductId).ToString());
            MemberInfo currentMember = MemberProcessor.GetCurrentMember();
            bool       flag          = false;

            if (currentMember != null)
            {
                flag = ProductBrowser.CheckHasCollect(currentMember.UserId, countDownInfoByCountDownId.ProductId);
            }
            this.litHasCollected.SetWhenIsNotNull(flag ? "1" : "0");
            ProductBrowser.UpdateVisitCounts(countDownInfoByCountDownId.ProductId);
            PageTitle.AddSiteNameTitle("商品详情");
            string str3 = "";

            if (!string.IsNullOrEmpty(masterSettings.GoodsPic))
            {
                str3 = Globals.HostPath(HttpContext.Current.Request.Url) + masterSettings.GoodsPic;
            }
            string           str4 = "";
            DistributorsInfo userIdDistributors = new DistributorsInfo();

            userIdDistributors = DistributorsBrower.GetUserIdDistributors(base.referralId);
            if ((userIdDistributors != null) && (userIdDistributors.UserId > 0))
            {
                PageTitle.AddSiteNameTitle(userIdDistributors.StoreName);
            }
            string str5 = (userIdDistributors == null) ? masterSettings.SiteName : userIdDistributors.StoreName;

            if (!string.IsNullOrEmpty(masterSettings.DistributorBackgroundPic))
            {
                str4 = Globals.HostPath(HttpContext.Current.Request.Url) + masterSettings.DistributorBackgroundPic.Split(new char[] { '|' })[0];
            }
            string strDes = masterSettings.ShopHomeDescription;

            if (Hidistro.ControlPanel.Config.CustomConfigHelper.Instance.BrandShow)
            {
                strDes = "低价抢正品,马上有优惠,就在考拉萌购!";
            }

            this.litItemParams.Text = str3 + "|" + masterSettings.ShopHomeName + "|" + strDes + "$";
            this.litItemParams.Text = string.Concat(new object[] { this.litItemParams.Text, str4, "|好店推荐之", str5, "商城|" + strDes + "|", HttpContext.Current.Request.Url });
            this.litGroupbuyId.SetWhenIsNotNull(countDownInfoByCountDownId.CountDownId.ToString());
        }