Beispiel #1
0
        private void BindData()
        {
            if (orderId > 0)
            {
                Order orderData = CSWebBase.CustomOrderManager.GetOrderDetails(orderId);

                List <Sku> skus = orderData.SkuItems.FindAll(x => !CSWebBase.SiteBasePage.IsKitBundleItem(x.SkuId));

                foreach (Sku sku in skus)
                {
                    if (CSWebBase.SiteBasePage.IsMainSku(sku.SkuId))
                    {
                        decimal totalPrice = sku.TotalPrice;

                        // add up all initial prices of all kit bundle items
                        foreach (Sku bundleSku in orderData.SkuItems.FindAll(x => CSWebBase.SiteBasePage.IsKitBundleItem(x.SkuId)))
                        {
                            totalPrice += bundleSku.TotalPrice;
                        }

                        sku.TotalPrice = totalPrice;
                    }
                }

                skus.Sort(new CSWebBase.SkuSortComparer());

                dlordersList.DataSource = skus;
                dlordersList.DataBind();
                LiteralSubTotal.Text = Math.Round(orderData.SubTotal, 2).ToString();
                LiteralShipping.Text = Math.Round(CSWebBase.SiteBasePage.GetShippingCost(orderData), 2).ToString();
                LiteralTax.Text      = Math.Round(orderData.Tax, 2).ToString();
                LiteralTotal.Text    = Math.Round(orderData.Total, 2).ToString();
                if (orderData.RushShippingCost > 0)
                {
                    pnlRushLabel.Visible     = true;
                    pnlRush.Visible          = true;
                    LiteralRushShipping.Text = Math.Round(orderData.RushShippingCost, 2).ToString();
                }


                if (orderData.DiscountCode.Length > 0 && (CSWebBase.SiteBasePage.FreeShipDiscountCodeMainSku ?? string.Empty).ToUpper() != orderData.DiscountCode.ToUpper())
                {
                    if (orderData.DiscountAmount > 0)
                    {
                        pnlPromotionLabel.Visible    = true;
                        pnlPromotionalAmount.Visible = true;

                        lblPromotionPrice.Text = String.Format("(${0:0.00})", orderData.DiscountAmount);
                    }
                }



                LiteralName.Text     = String.Format("{0} {1}", orderData.CustomerInfo.ShippingAddress.FirstName, orderData.CustomerInfo.ShippingAddress.LastName);
                LiteralEmail.Text    = orderData.CustomerInfo.Email;
                LiteralAddress.Text  = orderData.CustomerInfo.ShippingAddress.Address1;
                LiteralAddress2.Text = orderData.CustomerInfo.ShippingAddress.Address2;
                LiteralCity.Text     = orderData.CustomerInfo.ShippingAddress.City;
                LiteralZip.Text      = orderData.CustomerInfo.ShippingAddress.ZipPostalCode;
                LiteralState.Text    = StateManager.GetStateName(orderData.CustomerInfo.ShippingAddress.StateProvinceId);
                LiteralCountry.Text  = CountryManager.CountryName(orderData.CustomerInfo.ShippingAddress.CountryId);

                LiteralName_b.Text     = String.Format("{0} {1}", orderData.CustomerInfo.BillingAddress.FirstName, orderData.CustomerInfo.BillingAddress.LastName);
                LiteralAddress_b.Text  = orderData.CustomerInfo.BillingAddress.Address1;
                LiteralAddress2_b.Text = orderData.CustomerInfo.BillingAddress.Address2;
                LiteralCity_b.Text     = orderData.CustomerInfo.BillingAddress.City;
                LiteralZip_b.Text      = orderData.CustomerInfo.BillingAddress.ZipPostalCode;
                LiteralState_b.Text    = StateManager.GetStateName(orderData.CustomerInfo.BillingAddress.StateProvinceId);
                LiteralCountry_b.Text  = CountryManager.CountryName(orderData.CustomerInfo.BillingAddress.CountryId);

                //Google Analutics E-Commerce Pixel
                //LoadGoogleAnalytics(orderData);
            }
        }
Beispiel #2
0
        public void LoadGoogleAnalytics(Order Order)
        {
            try
            {
                StringBuilder sb = new StringBuilder();
                sb.AppendLine("<script>");
                sb.AppendLine("var pageTracker = _gat._getTracker('UA-10581943-59');");
                sb.AppendLine("pageTracker._trackPageview();");
                sb.AppendFormat("pageTracker._addTrans('{0}','{1}','{2}','{3}','{4}','{5}','{6}','{7}' );\n", Order.OrderId, "", Order.Total, Math.Round(Order.Tax, 2), Math.Round(Order.ShippingCost, 2), Order.CustomerInfo.BillingAddress.City, Order.CustomerInfo.BillingAddress.StateProvinceId, CountryManager.CountryName(Order.CustomerInfo.BillingAddress.CountryId));


                foreach (Sku sku in Order.SkuItems)
                {
                    sb.AppendFormat("pageTracker._addItem('{0}','{1}','{2}','{3}','{4}','{5}');\n", Order.OrderId, sku.SkuCode, sku.Title, "", Math.Round(Convert.ToDouble(sku.InitialPrice), 2), sku.Quantity);
                }
                sb.AppendLine("pageTracker._trackTrans();");
                sb.AppendLine("</script>");
                LiteralGoogleAnalytics.Text = sb.ToString();
            }
            catch (Exception) { }
        }
Beispiel #3
0
        public static bool SendOrderCompletedEmail(int orderId)
        {
            //pull Specific Email Template
            int emailId = ConfigHelper.EmailAppSetting("EmailId");

            EmailSetting emailTemplate = EmailManager.GetEmail(emailId);
            OrderManager orderMgr      = new OrderManager();
            Order        orderData     = orderMgr.GetOrderDetails(orderId);


            if (emailTemplate.Body != null)
            {
                //Subject Translation
                emailTemplate.Subject = emailTemplate.Subject.Replace("{ORDER_NUMBER}", orderData.OrderId.ToString());

                //Body Translation
                String BodyTemplate = emailTemplate.Body.Replace("&", "&amp;");

                BodyTemplate = BodyTemplate.Replace("{SUBTOTAL}", orderData.SubTotal.ToString("N2"));
                BodyTemplate = BodyTemplate.Replace("{SHIPPING_HANDLING}", orderData.ShippingCost.ToString("N2"));
                BodyTemplate = BodyTemplate.Replace("{TAX}", orderData.Tax.ToString("N2"));
                BodyTemplate = BodyTemplate.Replace("{TOTAL}", orderData.Total.ToString("N2"));
                BodyTemplate = BodyTemplate.Replace("{ORDER_ID}", orderData.OrderId.ToString());
                BodyTemplate = BodyTemplate.Replace("{ORDER_NUMBER}", orderData.OrderId.ToString());
                BodyTemplate = BodyTemplate.Replace("{ORDER_DATE}", orderData.CreatedDate.ToString("dd MMM yyyy hh:mm:ss"));

                CSBusiness.CustomerManagement.Address billing = orderData.CustomerInfo.BillingAddress;
                if (billing != null)
                {
                    BodyTemplate = BodyTemplate.Replace("{BILLING_COMPANY}", CommonHelper.EnsureNotNull(billing.Company));
                    BodyTemplate = BodyTemplate.Replace("{BILLING_ADDRESS2}", CommonHelper.EnsureNotNull(billing.Address2));
                    BodyTemplate = BodyTemplate.Replace("{BILLING_NAME}", billing.FirstName + " " + billing.LastName);
                    BodyTemplate = BodyTemplate.Replace("{BILLING_ADDRESS}", billing.Address1);
                    BodyTemplate = BodyTemplate.Replace("{BILLING_CITY}", billing.City);
                    BodyTemplate = BodyTemplate.Replace("{BILLING_STATE}", StateManager.GetStateName(billing.StateProvinceId)); //pull from Cache
                    BodyTemplate = BodyTemplate.Replace("{BILLING_ZIP}", billing.ZipPostalCode);
                    BodyTemplate = BodyTemplate.Replace("{BILLING_EMAIL}", orderData.Email);
                    BodyTemplate = BodyTemplate.Replace("{BILLING_COUNTRY}", CountryManager.CountryName(billing.CountryId)); //pull from Cache
                }



                CSBusiness.CustomerManagement.Address shippingAddress = orderData.CustomerInfo.ShippingAddress;
                if (shippingAddress != null)
                {
                    BodyTemplate = BodyTemplate.Replace("{SHIPPING_COMPANY}", CommonHelper.EnsureNotNull(shippingAddress.Company));
                    BodyTemplate = BodyTemplate.Replace("{SHIPPING_NAME}", shippingAddress.FirstName + " " + shippingAddress.LastName);
                    BodyTemplate = BodyTemplate.Replace("{SHIPPING_ADDRESS}", shippingAddress.Address1);
                    BodyTemplate = BodyTemplate.Replace("{SHIPPING_ADDRESS2}", CommonHelper.EnsureNotNull(shippingAddress.Address2));
                    BodyTemplate = BodyTemplate.Replace("{SHIPPING_CITY}", shippingAddress.City);
                    BodyTemplate = BodyTemplate.Replace("{SHIPPING_STATE}", StateManager.GetStateName(shippingAddress.StateProvinceId)); //pull from Cache
                    BodyTemplate = BodyTemplate.Replace("{SHIPPING_ZIP}", shippingAddress.ZipPostalCode);
                    BodyTemplate = BodyTemplate.Replace("{SHIPPING_COUNTRY}", CountryManager.CountryName(shippingAddress.CountryId));    //pull from Cache
                    BodyTemplate = BodyTemplate.Replace("{SHIPPING_PHONE}", CommonHelper.EnsureNotNull(shippingAddress.PhoneNumber));
                }

                XElement elem  = XElement.Parse("<root>" + BodyTemplate + "</root>", LoadOptions.PreserveWhitespace);
                var      nodes = from XElement e in elem.Descendants()
                                 where e.Attribute("cart") != null
                                 select e;

                StringBuilder sb = new StringBuilder();
                foreach (XElement node in nodes)
                {
                    string originalString = node.ToString();

                    int totalSkuItems = orderData.SkuItems.Count;
                    for (int i = 0; i < totalSkuItems; i++)
                    {
                        Sku    sku          = orderData.SkuItems[i];
                        string resultString = originalString;
                        resultString = resultString
                                       .Replace("{SKU}", sku.ImagePath)
                                       .Replace("{SKU_QTY}", sku.Quantity.ToString())
                                       .Replace("{SKU_DESCR}", sku.LongDescription)
                                       .Replace("{SKU_PRICE}", sku.FullPrice.ToString("N2"));

                        sb.Append(resultString);
                    }
                    BodyTemplate = BodyTemplate.Replace(originalString, sb.ToString());
                    sb.Clear();
                    BodyTemplate = BodyTemplate.Replace("&amp;", "&");
                }


                try
                {
                    //Prepare Mail Message
                    MailMessage _oMailMessage = new MailMessage(emailTemplate.FromAddress, orderData.Email, emailTemplate.Subject, BodyTemplate);
                    _oMailMessage.IsBodyHtml = true;
                    SendMail(_oMailMessage);
                    //Fire OrderConfirmation Log
                    orderMgr.FireEmailLog(orderData.OrderId, orderData.Email, emailTemplate.Subject, BodyTemplate, DateTime.Now);
                    return(true);
                }
                catch (Exception)
                {
                    return(false);
                }
            }
            else
            {
                return(false);
            }
        }
        private void BindData()
        {
            if (orderId > 0)
            {
                Order orderData = CSWebBase.CustomOrderManager.GetOrderDetails(orderId);

                dlordersList.DataSource = orderData.SkuItems;
                dlordersList.DataBind();
                LiteralSubTotal.Text = Math.Round(orderData.SubTotal, 2).ToString();
                LiteralShipping.Text = Math.Round(orderData.ShippingCost, 2).ToString();
                LiteralTax.Text      = Math.Round(orderData.Tax, 2).ToString();
                LiteralTotal.Text    = Math.Round(orderData.Total, 2).ToString();
                if (orderData.RushShippingCost > 0)
                {
                    pnlRushLabel.Visible     = true;
                    pnlRush.Visible          = true;
                    LiteralRushShipping.Text = Math.Round(orderData.RushShippingCost, 2).ToString();
                }


                if (orderData.DiscountCode.Length > 0)
                {
                    pnlPromotionLabel.Visible    = true;
                    pnlPromotionalAmount.Visible = true;

                    lblPromotionPrice.Text = String.Format("(${0:0.00})", orderData.DiscountAmount);
                }



                LiteralName.Text     = String.Format("{0} {1}", orderData.CustomerInfo.ShippingAddress.FirstName, orderData.CustomerInfo.ShippingAddress.LastName);
                LiteralEmail.Text    = orderData.CustomerInfo.Email;
                LiteralAddress.Text  = orderData.CustomerInfo.ShippingAddress.Address1;
                LiteralAddress2.Text = orderData.CustomerInfo.ShippingAddress.Address2;
                if (LiteralAddress2.Text.Equals(""))
                {
                    pnlSAddress2.Visible = false;
                }
                else
                {
                    pnlSAddress2.Visible = true;
                }
                LiteralCity.Text    = orderData.CustomerInfo.ShippingAddress.City;
                LiteralZip.Text     = orderData.CustomerInfo.ShippingAddress.ZipPostalCode;
                LiteralState.Text   = StateManager.GetStateName(orderData.CustomerInfo.ShippingAddress.StateProvinceId);
                LiteralCountry.Text = CountryManager.CountryName(orderData.CustomerInfo.ShippingAddress.CountryId);

                LiteralName_b.Text     = String.Format("{0} {1}", orderData.CustomerInfo.BillingAddress.FirstName, orderData.CustomerInfo.BillingAddress.LastName);
                LiteralAddress_b.Text  = orderData.CustomerInfo.BillingAddress.Address1;
                LiteralAddress2_b.Text = orderData.CustomerInfo.BillingAddress.Address2;
                if (LiteralAddress2_b.Text.Equals(""))
                {
                    pnlBAddress2.Visible = false;
                }
                else
                {
                    pnlBAddress2.Visible = true;
                }
                LiteralCity_b.Text    = orderData.CustomerInfo.BillingAddress.City;
                LiteralZip_b.Text     = orderData.CustomerInfo.BillingAddress.ZipPostalCode;
                LiteralState_b.Text   = StateManager.GetStateName(orderData.CustomerInfo.BillingAddress.StateProvinceId);
                LiteralCountry_b.Text = CountryManager.CountryName(orderData.CustomerInfo.BillingAddress.CountryId);
                LiteralPhone.Text     = orderData.CustomerInfo.BillingAddress.PhoneNumber;
                //Google Analutics E-Commerce Pixel
                //LoadGoogleAnalytics(orderData);
            }
        }
Beispiel #5
0
        protected void LoadOrderDetails()
        {
            Order orderData = CSResolve.Resolve <IOrderService>().GetOrderDetails(orderId, true);

            dlordersList.DataSource = orderData.SkuItems;
            dlordersList.DataBind();

            LiteralSubTotal.Text = Math.Round(orderData.SubTotal, 2).ToString();
            LiteralShipping.Text = Math.Round(orderData.ShippingCost, 2).ToString();
            LiteralTax.Text      = Math.Round(orderData.Tax, 2).ToString();
            LiteralTotal.Text    = Math.Round(orderData.Total, 2).ToString();

            // shipping literals
            LiteralName.Text     = String.Format("{0} {1}", orderData.CustomerInfo.ShippingAddress.FirstName, orderData.CustomerInfo.ShippingAddress.LastName);
            LiteralEmail.Text    = orderData.CustomerInfo.Email;
            LiteralAddress.Text  = orderData.CustomerInfo.ShippingAddress.Address1;
            LiteralAddress2.Text = orderData.CustomerInfo.ShippingAddress.Address2;
            LiteralCity.Text     = orderData.CustomerInfo.ShippingAddress.City;
            LiteralZip.Text      = orderData.CustomerInfo.ShippingAddress.ZipPostalCode;
            LiteralState.Text    = StateManager.GetStateName(orderData.CustomerInfo.ShippingAddress.StateProvinceId);
            LiteralCountry.Text  = CountryManager.CountryName(orderData.CustomerInfo.ShippingAddress.CountryId);
            LiteralPhone.Text    = orderData.CustomerInfo.ShippingAddress.PhoneNumber;
            // shipping edit controls
            txtShippingFirstName.Text = orderData.CustomerInfo.ShippingAddress.FirstName;
            txtShippingLastName.Text  = orderData.CustomerInfo.ShippingAddress.LastName;
            txtShippingAddress.Text   = orderData.CustomerInfo.ShippingAddress.Address1;
            txtShippingAddress2.Text  = orderData.CustomerInfo.ShippingAddress.Address2;
            txtShippingCity.Text      = orderData.CustomerInfo.ShippingAddress.City;
            txtShippingZipCode.Text   = orderData.CustomerInfo.ShippingAddress.ZipPostalCode;
            SetCountryAndStateDropDown(ddlShippingCountry, ddlShippingState, orderData.CustomerInfo.ShippingAddress.CountryId, Convert.ToString(orderData.CustomerInfo.ShippingAddress.StateProvinceId));

            // billing literals
            LiteralName_b.Text      = String.Format("{0} {1}", orderData.CustomerInfo.BillingAddress.FirstName, orderData.CustomerInfo.BillingAddress.LastName);
            LiteralAddress_b.Text   = orderData.CustomerInfo.BillingAddress.Address1;
            LiteralAddress2_b.Text  = orderData.CustomerInfo.BillingAddress.Address2;
            LiteralCity_b.Text      = orderData.CustomerInfo.BillingAddress.City;
            LiteralZip_b.Text       = orderData.CustomerInfo.BillingAddress.ZipPostalCode;
            LiteralState_b.Text     = StateManager.GetStateName(orderData.CustomerInfo.BillingAddress.StateProvinceId);
            LiteralCountry_b.Text   = CountryManager.CountryName(orderData.CustomerInfo.BillingAddress.CountryId);
            LiteralOrderDate.Text   = orderData.CreatedDate.ToString();
            LiteralOrderStatus.Text = orderData.OrderStatus;
            // billing edit controls
            txtBillingFirstName.Text = orderData.CustomerInfo.BillingAddress.FirstName;
            txtBillingLastName.Text  = orderData.CustomerInfo.BillingAddress.LastName;
            txtBillingAddress.Text   = orderData.CustomerInfo.BillingAddress.Address1;
            txtBillingAddress2.Text  = orderData.CustomerInfo.BillingAddress.Address2;
            txtBillingCity.Text      = orderData.CustomerInfo.BillingAddress.City;
            txtBillingZipCode.Text   = orderData.CustomerInfo.BillingAddress.ZipPostalCode;
            SetCountryAndStateDropDown(ddlBillingCountry, ddlBillingState, orderData.CustomerInfo.BillingAddress.CountryId, Convert.ToString(orderData.CustomerInfo.BillingAddress.StateProvinceId));

            txtEmail.Text = orderData.CustomerInfo.Email;

            // payment info
            AuthorizationCode    = orderData.CreditInfo.AuthorizationCode;
            TransactionCode      = orderData.CreditInfo.TransactionCode;
            Version              = orderData.VersionName;
            CreditCardName       = orderData.CreditInfo.CreditCardName;
            CreditCardExpireDate = orderData.CreditInfo.CreditCardExpired.ToString("MM/yyyy");
            CreditCardCSC        = orderData.CreditInfo.CreditCardCSC;
            CreditCardLast4      = orderData.CreditInfo.CreditCardNumber.Length > 4 ? orderData.CreditInfo.CreditCardNumber.Substring(orderData.CreditInfo.CreditCardNumber.Length - 4, 4)
                : orderData.CreditInfo.CreditCardNumber;

            ucAttributes.Populate(orderData);
        }
Beispiel #6
0
        private void BindData()
        {
            if (orderId > 0)
            {
                Order orderData = CSResolve.Resolve <IOrderService>().GetOrderDetails(orderId, true);

                dlordersList.DataSource = orderData.SkuItems.FindAll(x => x.SkuId != 153);;
                dlordersList.DataBind();
                ltOfferDetails.Text = OrderHelper.GetOfferDatails();
                if (string.IsNullOrEmpty(ltOfferDetails.Text))
                {
                    cart_offer_wrap_m.Visible = false;
                }
                else
                {
                    cart_offer_wrap_m.Visible = true;
                }
                LiteralSubTotal.Text = Math.Round(orderData.SubTotal, 2).ToString();
                LiteralShipping.Text = Math.Round(orderData.ShippingCost, 2).ToString();
                LiteralTax.Text      = Math.Round(orderData.Tax, 2).ToString();
                LiteralTotal.Text    = Math.Round(orderData.Total, 2).ToString();

                ltCardNumber.Text = orderData.CreditInfo.CreditCardNumber.Substring(orderData.CreditInfo.CreditCardNumber.Length - 4, 4);
                ltCardType.Text   = orderData.CreditInfo.CreditCardName;//.Substring(0, 1);
                ltExpDate.Text    = orderData.CreditInfo.CreditCardExpired.ToString("MM/yyyy");

                if (orderData.RushShippingCost > 0)
                {
                    pnlRushLabel.Visible     = true;
                    pnlRush.Visible          = true;
                    LiteralRushShipping.Text = Math.Round(orderData.RushShippingCost, 2).ToString();
                }


                if (orderData.DiscountCode.Length > 0)
                {
                    pnlPromotionLabel.Visible    = true;
                    pnlPromotionalAmount.Visible = true;

                    lblPromotionPrice.Text = String.Format("(${0:0.00})", orderData.DiscountAmount);
                }



                LiteralName.Text     = String.Format("{0} {1}", orderData.CustomerInfo.ShippingAddress.FirstName, orderData.CustomerInfo.ShippingAddress.LastName);
                LiteralEmail.Text    = orderData.CustomerInfo.Email;
                LiteralAddress.Text  = orderData.CustomerInfo.ShippingAddress.Address1;
                LiteralAddress2.Text = orderData.CustomerInfo.ShippingAddress.Address2;
                if (LiteralAddress2.Text.Equals(""))
                {
                    pnlSAddress2.Visible = false;
                }
                else
                {
                    pnlSAddress2.Visible = true;
                }
                LiteralCity.Text    = orderData.CustomerInfo.ShippingAddress.City;
                LiteralZip.Text     = orderData.CustomerInfo.ShippingAddress.ZipPostalCode;
                LiteralState.Text   = StateManager.GetStateName(orderData.CustomerInfo.ShippingAddress.StateProvinceId);
                LiteralCountry.Text = CountryManager.CountryName(orderData.CustomerInfo.ShippingAddress.CountryId);

                LiteralName_b.Text     = String.Format("{0} {1}", orderData.CustomerInfo.BillingAddress.FirstName, orderData.CustomerInfo.BillingAddress.LastName);
                LiteralAddress_b.Text  = orderData.CustomerInfo.BillingAddress.Address1;
                LiteralAddress2_b.Text = orderData.CustomerInfo.BillingAddress.Address2;
                if (LiteralAddress2_b.Text.Equals(""))
                {
                    pnlBAddress2.Visible = false;
                }
                else
                {
                    pnlBAddress2.Visible = true;
                }
                LiteralCity_b.Text    = orderData.CustomerInfo.BillingAddress.City;
                LiteralZip_b.Text     = orderData.CustomerInfo.BillingAddress.ZipPostalCode;
                LiteralState_b.Text   = StateManager.GetStateName(orderData.CustomerInfo.BillingAddress.StateProvinceId);
                LiteralCountry_b.Text = CountryManager.CountryName(orderData.CustomerInfo.BillingAddress.CountryId);
                LiteralPhone.Text     = orderData.CustomerInfo.BillingAddress.PhoneNumber;
                //Google Analutics E-Commerce Pixel
                //LoadGoogleAnalytics(orderData);
            }
        }
 public string GetCountryName(string countryId)
 {
     return(CountryManager.CountryName(Convert.ToInt32(countryId)));
 }