コード例 #1
0
        protected void Page_Load(object sender, EventArgs e)
        {
            try
            {
                hyperLinkInvoice.Visible = false;

                if (ShoppingCart != null && !string.IsNullOrWhiteSpace(OrderProvider.GetForeignPPVCountryCode(ShoppingCart.DistributorID, ShoppingCart.CountryCode)))
                {
                    if (ShoppingCart.CartItems.Count > 0 &&
                        ShoppingCart.OrderCategory == ServiceProvider.CatalogSvc.OrderCategoryType.RSO)
                    {
                        if (OrderProvider.IsEligibleReceiptModelSkus(ShoppingCart).Any())
                        {
                            ForeignPPVPopupExtender.Show();
                            var receiptModel = OrderProvider.GetReceiptModel(ShoppingCart);
                            HttpContext.Current.Session["ReceiptModel"] = receiptModel;
                        }
                    }
                }

                //if (HLConfigManager.Configurations.DOConfiguration.InvoiceInOrderConfrimation &&
                //    (null != ShoppingCart && ShoppingCart.OrderCategory != ServiceProvider.CatalogSvc.OrderCategoryType.ETO))
                //{
                //    hyperLinkInvoice.Visible = true;
                //}
                //else
                //{
                //    hyperLinkInvoice.Visible = false;
                //}
                //if (!(OrderProvider.IsEligibleReceiptModelSkus(ShoppingCart).Count() > 0))
                //{
                //    hyperLinkInvoice.Visible = false;
                //}
                if (HLConfigManager.Configurations.DOConfiguration.InvoiceInOrderConfrimation && ShoppingCart != null && string.IsNullOrWhiteSpace(OrderProvider.GetForeignPPVCountryCode(ShoppingCart.DistributorID, ShoppingCart.CountryCode)) &&
                    OrderProvider.IsEligibleReceiptModelSkus(ShoppingCart).Any() &&
                    ShoppingCart.OrderCategory == ServiceProvider.CatalogSvc.OrderCategoryType.RSO)
                {
                    hyperLinkInvoice.Visible = true;
                }
                ClearShoppingCartModuleCache();
                if (IsChina)
                {
                    var ordNumQS = string.Empty;
                    if (ShouldLoadOrderFromSerializedData)
                    {
                        ordNumQS = Request.QueryString["OrderNumber"];
                    }
                    else
                    {
                        ordNumQS = Request.QueryString["OrderId"];
                    }
                    if (!string.IsNullOrEmpty(ordNumQS))
                    {
                        SessionLessInfoManager.Instance.LoadOrderAcknowledgement(SessionInfo, ordNumQS, this.Locale, this.DistributorID);
                    }
                }

                if (!IsPostBack && ShoppingCart != null && ShoppingCart.Totals == null)
                {
                    SessionInfo.UseHMSCalc = HLConfigManager.Configurations.CheckoutConfiguration.UseHMSCalc;
                    ShoppingCart.Calculate();
                }
                (Master as OrderingMaster).SetPageHeader(GetLocalResourceObject("PageHeaderProducts").ToString());
                ContinueShopping.Text = GetLocalResourceObject("ProductCatalogReturn").ToString();
                if (null != ShoppingCart && !string.IsNullOrEmpty(ShoppingCart.EmailAddress))
                {
                    PrimaryEmail = ShoppingCart.EmailAddress;
                }
                if (null != ShoppingCart && ShoppingCart.OrderCategory == ServiceProvider.CatalogSvc.OrderCategoryType.ETO)
                {
                    (Master as OrderingMaster).SetPageHeader(GetLocalResourceObject("PageHeaderEvents").ToString());
                    hdnOrderType.Value       = "ETO";
                    ContinueShopping.Text    = GetLocalResourceObject("EventTicketsReturn").ToString();
                    lnkCreateInvoice.Visible = false;
                }

                //SessionInfo currentSession = SessionInfo.GetSessionInfo(DistributorID, Locale);

                if (SessionInfo != null)
                {
                    var ordernumber = string.Empty;
                    if (!String.IsNullOrEmpty(SessionInfo.OrderNumber))
                    {
                        ordernumber = SessionInfo.OrderNumber;
                    }
                    else if (SessionInfo.SessionLessInfo != null)
                    {
                        ordernumber = SessionInfo.SessionLessInfo.OrderNumber;
                    }

                    if (!string.IsNullOrEmpty(ordernumber))
                    {
                        if (HLConfigManager.Configurations.CheckoutConfiguration.DisplayTransactionTime)
                        {
                            lblTransactiontime.Text = DateUtils.GetCurrentLocalTime(CountryCode).ToString();
                        }
                        lblOrderNumber.Text = getOrderNumber(ordernumber, CountryCode);
                        OrderNumber         = lblOrderNumber.Text;
                        if (ShoppingCart.CustomerOrderDetail != null)
                        {
                            ContinueShopping.Text = GetLocalResourceObject("ReturnToCustomerOrders").ToString();
                            hdnOrderType.Value    = "CustomerOrder";
                            var CountryCO2DO = Settings.GetRequiredAppSetting("CountryCO2DO", string.Empty).Split(',');
                            if (CountryCO2DO.Contains(ShoppingCart.CountryCode))
                            {
                                DisplayInvoiceOptions = false;
                            }
                        }
                        else
                        {
                            DisplayInvoiceOptions = true;
                        }
                    }
                }

                if (HLConfigManager.Configurations.CheckoutConfiguration.FraudControlEnabled && SessionInfo.OrderStatus == SubmitOrderStatus.OrderSubmittedPending)
                {
                    trFControl.Visible = true;
                }

                if (SessionInfo.OrderStatus == SubmitOrderStatus.OrderSubmittedInReview)
                {
                    trFControl.Visible      = true;
                    lblFControlMessage.Text = PlatformResources.GetGlobalResourceString("ErrorMessage", "KountReviewOrder");
                }

                if (ShoppingCart.HoldCheckoutOrder &&
                    ShoppingCart.DeliveryInfo != null && ShoppingCart.DeliveryInfo.Option == ServiceProvider.ShippingSvc.DeliveryOptionType.Pickup)
                {
                    trMPCFraud.Visible = true;
                }

                if (SessionInfo.OrderStatus == SubmitOrderStatus.OrderSubmittedProcessing)
                {
                    trPendingOrder.Visible = true;
                    if (HLConfigManager.Configurations.PaymentsConfiguration.PendingOrderhascontent)
                    {
                        PendingNotification.Visible = true;
                        lblPendingOrder.Visible     = false;
                    }
                    else
                    {
                        PendingNotification.Visible = false;
                        lblPendingOrder.Visible     = true;
                    }
                    trPendingOrderLink.Visible = true;
                    trConfirm.Visible          = false;
                }
                if (HLConfigManager.Configurations.DOConfiguration.IsChina)
                {
                    //if (SessionInfo.OrderStatus == SubmitOrderStatus.OrderSubmitted)
                    //{
                    bool QRCodeDisable = Settings.GetRequiredAppSetting("QRCodeDisable", true);
                    if (!QRCodeDisable)
                    {
                        var cartitems = SessionInfo.ShoppingCart.CartItems;
                        if (cartitems.Count == 0 || string.IsNullOrEmpty(SessionInfo.OrderNumber))
                        {
                            cartitems = SessionInfo.SessionLessInfo.ShoppingCart.CartItems;
                        }
                        foreach (var sku in cartitems)
                        {
                            var skU = Providers.CatalogProvider.GetCatalogItem(sku.SKU, "CN");
                            if (skU.ProductCategory == "ETO")
                            {
                                var Tickets = new MyHerbalife3.Ordering.Providers.MyHLShoppingCart.Ticket
                                {
                                    quantity  = sku.Quantity,
                                    ticketSKU = sku.SKU,
                                };
                                TicketDetails.Add(Tickets);
                            }
                            else
                            {
                                btnQrCodeDownload.Visible = false;
                            }
                        }
                        if (TicketDetails.Count > 0)
                        {
                            string QRCodeUrl = MyHerbalife3.Ordering.Providers.China.OrderProvider.DownloadQRCode(DistributorID, SessionInfo.OrderNumber, DateTime.Now.ToString(), Locale, TicketDetails);

                            if (!string.IsNullOrEmpty(QRCodeUrl))
                            {
                                ViewState["QrCode"] = QRCodeUrl;
                            }
                            else
                            {
                                btnQrCodeDownload.Visible = false;
                            }
                        }
                        else
                        {
                            btnQrCodeDownload.Visible = false;
                        }
                    }
                    else
                    {
                        btnQrCodeDownload.Visible = false;
                    }
                }
                else
                {
                    btnQrCodeDownload.Visible = false;
                }
                //}
                //else
                //{
                //  btnQrCodeDownload.Visible = false;
                //}

                LoadControls();
                if (HLConfigManager.Configurations.DOConfiguration.IsChina && !String.IsNullOrEmpty(SessionInfo.OrderNumber))
                {
                    var response = Providers.China.OrderProvider.GetPBPPaymentServiceDetail(DistributorID, SessionInfo.OrderNumber);
                    if (response != null && response.Status == ServiceProvider.OrderChinaSvc.ServiceResponseStatusType.Success)
                    {
                        if (response.PaymentStatus == "CNPending")
                        {
                            lblPBPMessageTitle.Text  = GetLocalResourceObject("lblPBPMessageTitle").ToString();
                            lblPBPOrderMessage.Text  = string.Format(GetLocalResourceObject("PBPOrderSubmittedResource").ToString(), SessionInfo.OrderNumber);
                            PBPDynamicButtonYes.Text = GetLocalResourceString("OK.Text");
                            PBPOrderPopupExtender.Show();
                        }
                    }
                }
            }
            catch (Exception ex)
            {
                LoggerHelper.Error(string.Format("Error in Confirm.aspx.cs : Page_Load {0} \n StackTrace {1}", ex.Message, ex.StackTrace));
                closeCart();
            }
            if (string.IsNullOrEmpty(lblOrderNumber.Text))
            {
                OrderNumber             =
                    lblOrderNumber.Text =
                        string.IsNullOrEmpty(Request.QueryString["OrderNumber"])
                        ? string.Empty
                        : Request.QueryString["OrderNumber"];
            }

            if (HLConfigManager.Configurations.CheckoutConfiguration.DisplayTellYourStory)
            {
                (Master as OrderingMaster).gdoNavMidCSS("gdo-nav-mid col-md-12 gdo-nav-mid-confirm-tellstory");
            }
            else
            {
                (Master as OrderingMaster).gdoNavMidCSS("gdo-nav-mid col-md-12 gdo-nav-mid-confirm");
            }

            if (HLConfigManager.Configurations.CheckoutConfiguration.DisplayTellYourStory)
            {
                (Master as OrderingMaster).gdoNavRightCSS("gdo-nav-right col-sm-3 confirm");
            }

            var invoiceEnabledLocales = Settings.GetRequiredAppSetting("InvoiceEnabledLocales", string.Empty);

            if (!string.IsNullOrEmpty(invoiceEnabledLocales) && invoiceEnabledLocales.Contains(Locale))
            {
                dvCreateInvoice.Visible = true;
            }

            if (HLConfigManager.Configurations.PaymentsConfiguration.SendConfirmationEmail)
            {
                try
                {
                    var cmmSVCP = new CommunicationSvcProvider();
                    cmmSVCP.SendEmailConfirmation(OrderNumber, "OrderSubmitted");
                }
                catch (Exception ex)
                {
                    LoggerHelper.Error(string.Format("Error sending confirmation email, order:{0} : {1}", OrderNumber, ex.Message));
                }
            }

            // HAP Updates
            if (HLConfigManager.Configurations.DOConfiguration.AllowDO && SessionInfo.IsHAPMode)
            {
                trSalesConfirm.Visible  = false;
                lblSuccess.Text         = GetLocalResourceObject("lblHapOrderPlacedSuccessResource.Text").ToString();
                lblOrderStatus.Text     = GetLocalResourceObject("lblOrderStatusResource2.Text").ToString();
                dvCreateInvoice.Visible = false;
                dvHapOrderPage.Visible  = true;
                (Master as OrderingMaster).SetRightPanelStyle("display", "none");
            }

            if (HLConfigManager.Configurations.DOConfiguration.IsResponsive && (Master as OrderingMaster).IsMobile())
            {
                (Master as OrderingMaster).divLeftVisibility = true;
            }
            else
            {
                (Master as OrderingMaster).divLeftVisibility = false;
            }

            if (!IsPostBack && HLConfigManager.Configurations.DOConfiguration.AddScriptsForRecommendations && SessionInfo != null &&
                SessionInfo.ShoppingCart != null && ShoppingCart != null && ShoppingCart.Totals != null)
            {
                // Adobe Target - Confirmation Page
                OrderTotals_V01 totals = ShoppingCart.Totals as OrderTotals_V01;
                totalOrder  = totals.ItemsTotal;
                orderNumber = lblOrderNumber.Text;
                skuList     = AdobeTarget_ConvertCartItemsToString(SessionInfo.ShoppingCart.ShoppingCartItems);

                // Salesforce - Confirmation Page
                cartItems = Salesforce_ConvertCartItemsToString(SessionInfo.ShoppingCart.ShoppingCartItems);
            }
        }
コード例 #2
0
        private void OrderDetail(string orderId, DateTime orderDate)
        {
            DistributorOrderingProfile distributorOrderingProfile = null;
            var membershipUser = (MembershipUser <DistributorProfileModel>)Membership.GetUser();

            if (membershipUser != null && membershipUser.Value != null)
            {
                distributorOrderingProfile = MyHerbalife3.Ordering.Providers.DistributorOrderingProfileProvider.GetProfile(DistributorID, "CN");
            }

            var obj          = new MyHerbalife3.Ordering.Providers.MyHLShoppingCartView();
            var orderDetails = obj.GetOrdersWithDetail(DistributorID, distributorOrderingProfile.CNCustomorProfileID, "zh-CN", orderDate.AddDays(-1), orderDate.AddDays(1), MyHerbalife3.Ordering.Providers.China.OrderStatusFilterType.All, "", "", false, false, orderId);

            if (orderDetails != null && orderDetails.Any() && orderDetails.FirstOrDefault().DonationAmount > 0)
            {
                Donation.Visible       = true;
                DonationGrd.DataSource = orderDetails;
                DonationGrd.DataBind();
            }
            if (orderDetails != null)
            {
                view = orderDetails.FirstOrDefault();
            }
            if (view != null && membershipUser != null && distributorOrderingProfile != null)
            {
                lblOrdernumber.Text     = view.OrderNumber ?? string.Empty;
                lblOrderMonth.Text      = view.OrderMonth ?? string.Empty;
                lblOrderStatus.Text     = view.OrderStatus ?? string.Empty;
                lblShipStore.Text       = view.StoreInfo ?? string.Empty;
                lblCustomerName.Text    = membershipUser.Value.FirstNameLocal ?? string.Empty;
                lblCustomerNumber.Text  = membershipUser.UserName ?? string.Empty;
                lblSalesChannels.Text   = view.ChannelInfo ?? string.Empty;
                lblShippingAddress.Text = view.Address ?? String.Empty;
                DateTime Recivedate = view.DateTimeForOrder;
                lbldeliverydate.Text = Recivedate.ToString("yyyy-MM-dd");

                if (membershipUser.IsOnline == true)
                {
                    lblProcessingStore.Text = "在线订购";
                    lblReceivingMode.Text   = "送货上门";
                }


                var modifiedcartItems = new List <MyHerbalife3.Ordering.Providers.MyHLProductItemView>();
                foreach (var cartitem in view.CartItems)
                {
                    var sku = Providers.CatalogProvider.GetCatalogItem(cartitem.SKU, "CN");
                    if (sku.ProductCategory == "ETO" && view.OrderHeaderId != 0)
                    {
                        var Tickets = new MyHerbalife3.Ordering.Providers.MyHLShoppingCart.Ticket
                        {
                            quantity  = cartitem.Quantity,
                            ticketSKU = cartitem.SKU
                        };
                        TicketDetails.Add(Tickets);
                    }
                    if (sku != null)
                    {
                        cartitem.RetailPrice = sku.ListPrice * cartitem.Quantity;
                        modifiedcartItems.Add(cartitem);
                    }
                }

                view.CartItems         = modifiedcartItems;
                ProductList.DataSource = view.CartItems;
                ProductList.DataBind();
                if (view.OrderStatus == "取消订单")
                {
                    btnQRcodeDownload.Visible = false;
                }
                if (view.OrderHeaderId != 0)
                {
                    var orderHeaderList = new List <int>();
                    orderHeaderList.Add(view.OrderHeaderId);

                    var paymentDetails = MyHerbalife3.Ordering.Providers.China.OrderProvider.GetPaymentDetails(orderHeaderList);

                    if (paymentDetails != null)
                    {
                        paymentDetails.PaymentDetails.ForEach(c =>
                        {
                            c.PaymentDate = c.PaymentDate.AddHours(8);
                            c.Amount      = c.Amount + view.DonationAmount;
                        });


                        DateTime ChinaTime = Convert.ToDateTime(paymentDetails.PaymentDetails[0].PaymentDate);
                        lblNTSdate.Text          = ChinaTime.ToString("yyyy-MM-dd");
                        lblPaymentTime.Text      = ChinaTime.ToString("yyyy-MM-dd HH:mm:ss");
                        PaymentDetail.DataSource = paymentDetails.PaymentDetails;
                        PaymentDetail.DataBind();
                    }
                    else
                    {
                        btnQRcodeDownload.Visible = false;
                    }
                }
                else
                {
                    btnQRcodeDownload.Visible = false;
                }
            }
        }