protected override void Page_Load(object sender, EventArgs e)
        {
            base.Page_Load(sender, e);
            ClientCartContext clientData = (ClientCartContext)Session["ClientOrderData"];

            if (!Page.IsPostBack)
            {
                SitePreference sitePrefCache = CSFactory.GetCacheSitePref();
                if (!sitePrefCache.GeoLocationService)
                {
                    string GeoCoountry = "";
                    GeoCoountry = CommonHelper.GetGeoTargetLocation(CommonHelper.IpAddress(HttpContext.Current));
                }

                if (Request["versionlp"] != null)
                {
                    Version = Request["versionlp"].ToString();
                    if (clientData.OrderAttributeValues != null)
                    {
                        if (clientData.OrderAttributeValues.ContainsKey("DynamicVerionName"))
                        {
                            Version = clientData.OrderAttributeValues["DynamicVerionName"].Value;
                        }
                        else
                        {
                            clientData.OrderAttributeValues.Add("DynamicVerionName", new AttributeValue(Version));
                        }
                    }
                }
                OrderHelper.SetDynamicLandingPageVersion(Version, clientData);
            }
        }
Exemple #2
0
        //protected void ibOnePay_OnClick(object sender, ImageClickEventArgs e)
        //{
        //    ImageButton btn = (ImageButton)(sender);
        //    string btnArgs = btn.CommandArgument;

        //    if (btnArgs.Equals("Additional"))
        //    {
        //        btnArgs = rblAdditionalKits.SelectedValue;
        //    }

        //    OrderHelper.ChangeCart(btnArgs);

        //    btn.Enabled = false;
        //    btn.ImageUrl = "//d39hwjxo88pg52.cloudfront.net/wonderflex/images/btn_added.png";

        //    BindControls();
        //    if (UpdateCart != null)
        //        UpdateCart(sender, e);
        //}

        protected void ddlQty_SelectedIndexChanged1(object sender, EventArgs e)
        {
            DropDownList ddl = sender as DropDownList;
            RepeaterItem ri  = ddl.NamingContainer as RepeaterItem;

            if (ri != null)
            {
                int skuid = -1;
                int qty   = 1;

                TextBox tb = ri.FindControl("txtQuantity") as TextBox;
                if (tb != null)
                {
                    tb.Text = ddl.SelectedValue;
                    qty     = Convert.ToInt32(ddl.SelectedValue);
                }

                HiddenField hidSkuId = ri.FindControl("hidSkuId") as HiddenField;
                if (hidSkuId != null)
                {
                    skuid = int.Parse(CSCore.Utils.CommonHelper.Decrypt(hidSkuId.Value));
                }

                if (skuid > 0)
                {
                    ClientCartContext cartContext = ClientOrderData;
                    cartContext.CartInfo.AddOrUpdate(skuid, qty, true, false, false);
                    cartContext.CartInfo.Compute();
                    ClientOrderData = cartContext;
                }
            }
            BindControls();
        }
Exemple #3
0
        public static string GetVersionNameByReferrer(ClientCartContext CartContext)
        {
            string versionName = "";

            try
            {
                versionName = HttpContext.Current.Request.Url.Host.ToUpper().Replace("WWW.", "");
                if (CartContext.OrderAttributeValues != null)
                {
                    Uri uri = new Uri(CartContext.OrderAttributeValues["ref_url"].Value);
                    versionName = uri.Host.ToUpper().Replace("WWW.", "");
                    SitePreference sitePrefCache = CSFactory.GetCacheSitePref();
                    if (!sitePrefCache.AttributeValuesLoaded)
                    {
                        sitePrefCache.LoadAttributeValues();
                    }
                    string[] strRedirectDomains = sitePrefCache.AttributeValues["redirectdomainnames"].Value.ToLower().Split(';');
                    if (strRedirectDomains.Any(versionName.ToLower().Contains))
                    {
                        versionName += "-" + GetDynamicVersionName();
                    }
                    else if (versionName.StartsWith("TRYKYRO.COM"))
                    {
                        versionName = "Direct" + "-" + GetDynamicVersionName();
                    }
                    else
                    {
                        versionName = "Referral-" + GetDynamicVersionName();
                    }
                }
            }
            catch { versionName = "Direct" + "-" + GetDynamicVersionName(); }
            return(versionName.ToUpper());
        }
Exemple #4
0
 protected void FillShippingInfo()
 {
     try
     {
         ClientCartContext contextData = ClientOrderData;
         if (contextData != null && contextData.CustomerInfo != null)
         {
             if (contextData.CustomerInfo.ShippingAddress != null)
             {
                 txtShippingFirstName.Text        = contextData.CustomerInfo.ShippingAddress.FirstName;
                 txtShippingLastName.Text         = contextData.CustomerInfo.ShippingAddress.LastName;
                 txtShippingAddress1.Text         = contextData.CustomerInfo.ShippingAddress.Address1;
                 txtShippingAddress2.Text         = contextData.CustomerInfo.ShippingAddress.Address2;
                 txtShippingCity.Text             = contextData.CustomerInfo.ShippingAddress.City;
                 txtShippingZipCode.Text          = contextData.CustomerInfo.ShippingAddress.ZipPostalCode;
                 ddlShippingCountry.SelectedValue = contextData.CustomerInfo.ShippingAddress.CountryId.ToString();
                 BindShippingRegions();
                 ddlShippingState.SelectedValue = contextData.CustomerInfo.ShippingAddress.StateProvinceId.ToString();
                 txtEmail.Text        = contextData.CustomerInfo.Email;
                 txtPhoneNumber1.Text = contextData.CustomerInfo.PhoneNumber.Replace(" ", "").Replace("-", "").Replace("(", "").Replace(")", "").Trim().Substring(0, 3);
                 txtPhoneNumber2.Text = contextData.CustomerInfo.PhoneNumber.Replace(" ", "").Replace("-", "").Replace("(", "").Replace(")", "").Trim().Substring(3, 3);
                 txtPhoneNumber3.Text = contextData.CustomerInfo.PhoneNumber.Replace(" ", "").Replace("-", "").Replace("(", "").Replace(")", "").Trim().Substring(6, 4);
             }
         }
     }
     catch
     {
     }
 }
        private void BindData()
        {
            ClientCartContext clientData = (ClientCartContext)Session["ClientOrderData"];

            Order orderData = CSResolve.Resolve <IOrderService>().GetOrderDetails(clientData.OrderId);

            dlordersList.DataSource = orderData.SkuItems.Where <Sku>(x => { return(x.SkuCode != "Shipping"); });
            dlordersList.DataBind();
            LiteralSubTotal.Text = Math.Round(OrderValues.GetSubTotal(orderData), 2).ToString();
            LiteralShipping.Text = Math.Round(OrderValues.GetShippingCharge(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)
            {
                pnlPromotionLabel.Visible    = true;
                pnlPromotionalAmount.Visible = true;

                lblPromotionPrice.Text = String.Format("(${0:0.00})", orderData.DiscountAmount);
            }
        }
        public void CallBindControl()
        {
            MinCrt.Visible  = true;
            ClientOrderData = (ClientCartContext)Session["ClientOrderData"];
            int count = 0;

            foreach (Sku sku in ClientOrderData.CartInfo.CartItems)
            {
                sku.LoadAttributeValues();
                if (sku.Visible)
                {
                    count++;
                }
            }
            subTotal = ClientOrderData.CartInfo.SubTotal;
            if (ClientOrderData.CartInfo.SubTotal < 50)
            {
                remainingAmount       = 50 - ClientOrderData.CartInfo.SubTotal;
                pShipping.Visible     = true;
                pFreeShipping.Visible = false;
            }
            else
            {
                pShipping.Visible     = false;
                pFreeShipping.Visible = true;
            }
            itemCount = count.ToString();
        }
        public void ProcessAmazonOrder()
        {
            ClientCartContext clientData = ClientOrderData;

            if (hOrderRefId.Value.Length > 0)
            {
                Session["OrderRefId"] = hOrderRefId.Value;

                if (ClientOrderData.CartInfo.CartItems.Count == 0)
                {
                    SetMainSku(118);
                }

                ClientOrderData = OrderHelper.SaveAmazonOrder(ClientOrderData, (string)Session["OrderRefId"]);

                if (ClientOrderData.OrderId > 0)
                {
                    OrderProcessor.ProcessOrderAndRedirect(ClientOrderData.OrderId);
                }
                //Response.Redirect("PostSale");
                else
                {
                    lblPrompt.Text = ClientOrderData.OrderId.ToString() + ClientOrderData.CustomerInfo.StateProvinceId +
                                     ClientOrderData.CustomerInfo.CountryId;
                    lblPrompt.Visible = true;
                }
                ClientOrderData = clientData;
                //Response.Redirect("PostSale.aspx");
            }
            else
            {
                lblPrompt.Text    = "There is no amazon order reference id";
                lblPrompt.Visible = true;
            }
        }
        protected void imgContinue_Click(object sender, EventArgs e)
        {
            string skuId = "";

            if (rbClassic.Checked)
            {
                skuId = "110";
            }
            if (rbComplete.Checked)
            {
                skuId = "111";
            }
            if (skuId.Length > 0)
            {
                if (Session["ClientOrderData"] != null)
                {
                    ClientCartContext clientData = (ClientCartContext)Session["ClientOrderData"];
                    if (clientData.CartInfo != null)
                    {
                        clientData.CartInfo.CartItems.Clear();
                    }
                }

                Session["PId"]         = skuId;
                Session["OrderStatus"] = "Cart";
                Response.Redirect("AddProduct.aspx?PId=" + skuId + "&CId=3");
            }
            else
            {
                lblPrompt.Text = ResourceHelper.GetResoureValue("NoSkuSelectedError");
            }
        }
Exemple #9
0
        public decimal GetShippingRate(ClientCartContext cart)
        {
            Decimal result = 0;
            string  req    = new ShipWire().GetShipRateRequest(cart); // Posting order to OMX
            string  res    = CommonHelper.HttpPost(config.Attributes["transactionUrl"].Value, req);
            Dictionary <string, AttributeValue> orderAttributes = new Dictionary <string, AttributeValue>();

            orderAttributes.Add("Request", new CSBusiness.Attributes.AttributeValue(req));
            orderAttributes.Add("Response", new CSBusiness.Attributes.AttributeValue(res));

            XmlDocument doc = new XmlDocument();

            doc.LoadXml(res);
            XmlNode xnResult = doc.SelectSingleNode("/RateResponse/Status");

            if (xnResult.InnerText.ToLower().Equals("ok"))
            {
                XmlNode xnTrans = doc.SelectSingleNode("/RateResponse/Order/Quotes/Quote/Cost");
                result = Convert.ToDecimal(xnTrans.InnerText.ToLower());
                //orderAttributes.Add("ShipWireTransactionId", new CSBusiness.Attributes.AttributeValue(xnTrans.InnerText.ToLower()));
            }
            else
            {
                result = 0;
            }
            return(result);
        }
        public void SaveData()
        {
            if (Page.IsValid)
            {
                //Set Customer Information
                Address billingAddress = new Address();
                billingAddress.FirstName       = CommonHelper.fixquotesAccents(txtFirstName.Text);
                billingAddress.LastName        = CommonHelper.fixquotesAccents(txtLastName.Text);
                billingAddress.Address1        = CommonHelper.fixquotesAccents(txtAddress1.Text);
                billingAddress.Address2        = CommonHelper.fixquotesAccents(txtAddress2.Text);
                billingAddress.City            = CommonHelper.fixquotesAccents(txtCity.Text);
                billingAddress.StateProvinceId = Convert.ToInt32(ddlState.SelectedValue);
                billingAddress.CountryId       = Convert.ToInt32(ddlCountry.SelectedValue);
                billingAddress.ZipPostalCode   = txtZipCode.Text;

                Customer CustData = new Customer();
                CustData.FirstName       = CommonHelper.fixquotesAccents(txtFirstName.Text);
                CustData.LastName        = CommonHelper.fixquotesAccents(txtLastName.Text);
                CustData.PhoneNumber     = txtPhone1.Text + txtPhone2.Text + txtPhone3.Text;
                CustData.Email           = CommonHelper.fixquotesAccents(txtEmail.Text);
                CustData.Username        = CommonHelper.fixquotesAccents(txtEmail.Text);
                CustData.BillingAddress  = billingAddress;
                CustData.ShippingAddress = billingAddress;

                //Set the Client Order objects
                //Set the Client Order objects
                ClientCartContext contextData = (ClientCartContext)Session["ClientOrderData"];
                contextData.CustomerInfo      = CustData;
                contextData.CartAbandonmentId = CSResolve.Resolve <ICustomerService>().InsertCartAbandonment(CustData, contextData);
                Session["ClientOrderData"]    = contextData;
            }
        }
Exemple #11
0
        private void BindCart()
        {
            try
            {
                List <Sku> skus = ((CSWebBase.SiteBasePage)Page).ClientOrderData.CartInfo.CartItems;

                Sku currentSku = skus.FirstOrDefault(x => { return(CSWebBase.SiteBasePage.IsMainSku(x.SkuId)); });

                //if (currentSku == null)
                //Response.Redirect("index.aspx?empcart=true", true);

                txtQuantity.Text = currentSku.Quantity.ToString();

                ClientCartContext clientData = ((CSWebBase.SiteBasePage)Page).ClientOrderData;

                if (clientData.CustomerInfo.ShippingAddress.CountryId == 46 ||
                    (clientData.CustomerInfo.ShippingAddress.CountryId == 231 &&
                     "|AK|HI|PR|GU|VI|".Contains(StateManager.GetCacheStates().First(x =>
                {
                    return(x.StateProvinceId == clientData.CustomerInfo.ShippingAddress.StateProvinceId);
                }).Abbreviation.Trim().ToUpper())))
                {
                    clientData.CartInfo.AddOrUpdate((int)CSWebBase.SiteBasePage.SkuEnum.Surcharge, 1, true, false,
                                                    false);
                    clientData.CartInfo.Compute();
                }

                ((CSWebBase.SiteBasePage)Page).ClientOrderData = clientData;
            }
            catch
            {
            }
        }
Exemple #12
0
        protected void btnAddToCart_Click(object sender, EventArgs e)
        {
            if (Session["ClientOrderData"] == null)
            {
                clientData          = new ClientCartContext();
                clientData.CartInfo = new Cart();
            }
            else
            {
                clientData = (ClientCartContext)Session["ClientOrderData"];
                if (clientData.CartInfo == null)
                {
                    clientData.CartInfo = new CSBusiness.ShoppingManagement.Cart();
                    clientData.CartInfo.ShippingAddress = new CSBusiness.CustomerManagement.Address();
                }
            }
            bool showPopUP = false;

            if (Session["skuID_AddtoCart"] != null && Session["skuID_AddtoCart"].ToString() != "") // adding dynamic product to cart based on selected size of product
            {
                var id = Convert.ToInt32(Session["skuID_AddtoCart"].ToString());
                if (OrderHelper.AutoshipCart() && id == 120)
                {
                    showPopUP = true;
                }
                else
                {
                    clientData.CartInfo.AddItem(id, Convert.ToInt32(ddlQuantity.SelectedValue), true, false);
                }
            }
            else if (SkuId > 0)
            {
                clientData.CartInfo.AddItem(SkuId, Convert.ToInt32(ddlQuantity.SelectedValue), true, false);
            }
            else if (skuID > 0)
            {
                clientData.CartInfo.AddItem(skuID, Convert.ToInt32(ddlQuantity.SelectedValue), true, false);
            }



            //clientData.CartInfo.ShippingMethod = UserShippingMethodType.Rush;
            SiteBasePage.SetCatalogShipping();
            clientData.CartInfo.Compute();
            clientData.CartInfo.ShowQuantity = false;

            Session["ClientOrderData"] = clientData;

            if (showPopUP)
            {
                mpePopup.Show();
            }
            else
            {
                mpeMiniCart.Show();
                ucMiniCart.CallBindControl();
                //Response.Redirect("cart.aspx");
            }
        }
Exemple #13
0
        private void SaveAdditionaInfo()
        {
            ClientCartContext contextData = ClientOrderData;

            //contextData.CartAbandonmentId = CSResolve.Resolve<ICustomerService>().InsertCartAbandonment(contextData.CustomerInfo, contextData);

            ClientOrderData = contextData;
        }
        public void SaveData()
        {
            if (Page.IsValid)
            {
                ClientCartContext clientData = (ClientCartContext)Session["ClientOrderData"];


                Address billingAddress = new Address();
                billingAddress.FirstName       = CommonHelper.fixquotesAccents(txtFirstName.Value);
                billingAddress.LastName        = CommonHelper.fixquotesAccents(txtLastName.Value);
                billingAddress.Address1        = CommonHelper.fixquotesAccents(txtAddress1.Value);
                billingAddress.Address2        = CommonHelper.fixquotesAccents(txtAddress2.Text);
                billingAddress.City            = CommonHelper.fixquotesAccents(txtCity.Value);
                billingAddress.StateProvinceId = Convert.ToInt32(ddlState.SelectedValue);
                billingAddress.CountryId       = Convert.ToInt32(ddlCountry.SelectedValue);
                billingAddress.ZipPostalCode   = txtZipCode.Value;

                Address shippingAddress = new Address();
                shippingAddress.FirstName       = CommonHelper.fixquotesAccents(txtShippingFirstName.Value);
                shippingAddress.LastName        = CommonHelper.fixquotesAccents(txtShippingLastName.Value);
                shippingAddress.Address1        = CommonHelper.fixquotesAccents(txtShippingAddress1.Value);
                shippingAddress.Address2        = CommonHelper.fixquotesAccents(txtShippingAddress2.Text);
                shippingAddress.City            = CommonHelper.fixquotesAccents(txtShippingCity.Value);
                shippingAddress.StateProvinceId = ddlShippingState.SelectedIndex;
                shippingAddress.CountryId       = Convert.ToInt32(ddlShippingCountry.SelectedValue);
                shippingAddress.ZipPostalCode   = txtShippingZipCode.Value;

                clientData.CustomerInfo.FirstName       = CommonHelper.fixquotesAccents(txtFirstName.Value);
                clientData.CustomerInfo.LastName        = CommonHelper.fixquotesAccents(txtLastName.Value);
                clientData.CustomerInfo.PhoneNumber     = txtPhoneNumber.Text;
                clientData.CustomerInfo.Email           = CommonHelper.fixquotesAccents(txtEmail.Value);
                clientData.CustomerInfo.BillingAddress  = billingAddress;
                clientData.CustomerInfo.ShippingAddress = shippingAddress;



                PaymentInformation paymentDataInfo = new PaymentInformation();
                string             CardNumber      = txtCCNumber1.Text + txtCCNumber2.Text + txtCCNumber3.Text + txtCCNumber4.Text;
                paymentDataInfo.CreditCardNumber  = CommonHelper.Encrypt(CardNumber);
                paymentDataInfo.CreditCardType    = Convert.ToInt32(ddlCCType.Items[ddlCCType.SelectedIndex]);
                paymentDataInfo.CreditCardName    = ddlCCType.Items[ddlCCType.SelectedIndex].Text;
                paymentDataInfo.CreditCardExpired = new DateTime(int.Parse(ddlExpYear.Items[ddlExpYear.SelectedIndex].Text), int.Parse(ddlExpMonth.Items[ddlExpMonth.SelectedIndex].Text), 1);
                paymentDataInfo.CreditCardCSC     = txtCvv.Value;

                clientData.PaymentInfo = paymentDataInfo;

                int orderId = clientData.OrderId;
                CSResolve.Resolve <IOrderService>().UpdateOrder(orderId, clientData);
                if (orderId > 1)
                {
                    clientData.OrderId         = orderId;
                    Session["ClientOrderData"] = clientData;
                    OrderProcessor.ProcessOrderAndRedirect(orderId);
                    //Server.Transfer(string.Format("/Shared/ProcessOrder.aspx?oid={0}", CartContext.OrderId),true);
                }
            }
        }
Exemple #15
0
        public static string GetDynamicVersionData(string dataName)
        {
            string            radioVersionData = "";
            ClientCartContext context          = (ClientCartContext)HttpContext.Current.Session["ClientOrderData"];

            if (context.OrderAttributeValues != null && context.OrderAttributeValues.ContainsKey("DynamicVerionData"))
            {
                radioVersionData = context.OrderAttributeValues["DynamicVerionData"].Value;
            }
            XmlDocument doc = new XmlDocument();

            doc.LoadXml(radioVersionData);
            doc.SelectSingleNode("version");

            string returnData = "";

            switch (dataName)
            {
            case "phone":
                returnData = doc.SelectSingleNode("Version")["Phone"].InnerText;
                break;

            case "image1":
                returnData = doc.SelectSingleNode("Version")["Image1"].InnerText;
                break;

            case "MainKitBlack":
                returnData = doc.SelectSingleNode("Version")["MainKitBlack"].InnerText;
                break;

            case "MainKitDarkGray":
                returnData = doc.SelectSingleNode("Version")["MainKitDarkGray"].InnerText;
                break;

            case "MainKitLightGray":
                returnData = doc.SelectSingleNode("Version")["MainKitLightGray"].InnerText;
                break;

            case "imageSelector":
                returnData = doc.SelectSingleNode("Version")["imageSelector"].InnerText;
                break;

            case "homepageimage":
                returnData = doc.SelectSingleNode("Version")["Image1"].InnerText;
                break;

            case "ctaimage":
                returnData = doc.SelectSingleNode("Version")["Image2"].InnerText;
                break;

            case "cartimage":
                returnData = doc.SelectSingleNode("Version")["Image3"].InnerText;
                break;
            }
            return(returnData);
        }
        public void SaveData()
        {
            if (Page.IsValid)
            {
                ClientCartContext clientData = (ClientCartContext)Session["ClientOrderData"];


                Address billingAddress = new Address();
                billingAddress.FirstName       = CommonHelper.fixquotesAccents(txtFirstName.Text);
                billingAddress.LastName        = CommonHelper.fixquotesAccents(txtLastName.Text);
                billingAddress.Address1        = CommonHelper.fixquotesAccents(txtAddress1.Text);
                billingAddress.Address2        = CommonHelper.fixquotesAccents(txtAddress2.Text);
                billingAddress.City            = CommonHelper.fixquotesAccents(txtCity.Text);
                billingAddress.StateProvinceId = Convert.ToInt32(ddlState.SelectedValue);
                billingAddress.CountryId       = Convert.ToInt32(ddlCountry.SelectedValue);
                billingAddress.ZipPostalCode   = txtZipCode.Text;

                Address shippingAddress = new Address();
                shippingAddress.FirstName       = CommonHelper.fixquotesAccents(txtShippingFirstName.Text);
                shippingAddress.LastName        = CommonHelper.fixquotesAccents(txtShippingLastName.Text);
                shippingAddress.Address1        = CommonHelper.fixquotesAccents(txtShippingAddress1.Text);
                shippingAddress.Address2        = CommonHelper.fixquotesAccents(txtShippingAddress2.Text);
                shippingAddress.City            = CommonHelper.fixquotesAccents(txtShippingCity.Text);
                shippingAddress.StateProvinceId = Convert.ToInt32(ddlShippingState.SelectedValue);
                shippingAddress.CountryId       = Convert.ToInt32(ddlShippingCountry.SelectedValue);
                shippingAddress.ZipPostalCode   = txtShippingZipCode.Text;

                clientData.CustomerInfo.FirstName       = CommonHelper.fixquotesAccents(txtFirstName.Text);
                clientData.CustomerInfo.LastName        = CommonHelper.fixquotesAccents(txtLastName.Text);
                clientData.CustomerInfo.PhoneNumber     = txtPhoneNumber.Text;
                clientData.CustomerInfo.Email           = CommonHelper.fixquotesAccents(txtEmail.Text);
                clientData.CustomerInfo.BillingAddress  = billingAddress;
                clientData.CustomerInfo.ShippingAddress = shippingAddress;



                PaymentInformation paymentDataInfo = new PaymentInformation();
                string             CardNumber      = ucTokenex.ReceivedToken;
                paymentDataInfo.CreditCardNumber  = CommonHelper.Encrypt(CardNumber);
                paymentDataInfo.CreditCardType    = Convert.ToInt32(ddlCCType.SelectedValue);
                paymentDataInfo.CreditCardName    = ddlCCType.SelectedItem.Text;
                paymentDataInfo.CreditCardExpired = new DateTime(int.Parse(ddlExpYear.SelectedValue), int.Parse(ddlExpMonth.SelectedValue), 1);
                paymentDataInfo.CreditCardCSC     = CommonHelper.Encrypt(txtCvv.Text);

                clientData.PaymentInfo = paymentDataInfo;

                int orderId = clientData.OrderId;
                CSResolve.Resolve <IOrderService>().UpdateOrder(orderId, clientData);
                if (orderId > 1)
                {
                    clientData.OrderId         = orderId;
                    Session["ClientOrderData"] = clientData;
                    Response.Redirect("AuthorizeOrder.aspx?" + Request.QueryString);
                }
            }
        }
        private void AddSku(string skuId)
        {
            ClientCartContext clientData = (ClientCartContext)Session["ClientOrderData"];

            if (clientData.CartInfo != null)
            {
                clientData.CartInfo.CartItems.Clear();
            }
            Session["PId"] = skuId;
            Response.Redirect("AddProduct.aspx?PId=" + skuId + "&CId=3");
        }
Exemple #18
0
        public void ReloadCartData()
        {
            ClientCartContext clientData = (ClientCartContext)Session["ClientOrderData"];

            ddlShippingCountry.ClearSelection();
            ddlCountry.ClearSelection();
            ddlShippingState.ClearSelection();
            ddlState.ClearSelection();

            ddlShippingCountry.Items.FindByValue(clientData.CustomerInfo.ShippingAddress.CountryId.ToString()).Selected = true;
            ddlCountry.Items.FindByValue(clientData.CustomerInfo.BillingAddress.CountryId.ToString()).Selected          = true;

            ShippingCountry_SelectedIndexChanged(null, null);
            Country_SelectedIndexChanged(null, null);

            ddlShippingState.Items.FindByValue(clientData.CustomerInfo.ShippingAddress.StateProvinceId.ToString()).Selected = true;
            ddlState.Items.FindByValue(clientData.CustomerInfo.BillingAddress.StateProvinceId.ToString()).Selected          = true;

            //Shipping information
            txtShippingFirstName.Text = clientData.CustomerInfo.ShippingAddress.FirstName;
            txtShippingLastName.Text  = clientData.CustomerInfo.ShippingAddress.LastName;
            txtShippingAddress1.Text  = clientData.CustomerInfo.ShippingAddress.Address1;
            txtShippingAddress2.Text  = clientData.CustomerInfo.ShippingAddress.Address2;
            txtShippingCity.Text      = clientData.CustomerInfo.ShippingAddress.City;
            txtShippingZipCode.Text   = clientData.CustomerInfo.ShippingAddress.ZipPostalCode;


            //Payment information
            string ccNumber = CommonHelper.Decrypt(clientData.PaymentInfo.CreditCardNumber);

            txtCCNumber1.Text = ccNumber.Substring(0, 4);
            txtCCNumber2.Text = ccNumber.Substring(4, 4);
            txtCCNumber3.Text = ccNumber.Substring(8, 4);
            txtCCNumber4.Text = ccNumber.Substring(12, ccNumber.Length - 12);

            txtCvv.Text = clientData.PaymentInfo.CreditCardCSC;
            DateTime expireDate = DateTime.MinValue;

            DateTime.TryParse(clientData.PaymentInfo.CreditCardExpired.ToString(), out expireDate);
            ddlExpMonth.Items.FindByValue(expireDate.Month.ToString()).Selected = true;
            ddlExpYear.Items.FindByValue(expireDate.Year.ToString()).Selected   = true;

            //Billing informarion
            txtFirstName.Text   = clientData.CustomerInfo.BillingAddress.FirstName;
            txtLastName.Text    = clientData.CustomerInfo.BillingAddress.LastName;
            txtAddress1.Text    = clientData.CustomerInfo.BillingAddress.Address1;
            txtAddress2.Text    = clientData.CustomerInfo.BillingAddress.Address2;
            txtCity.Text        = clientData.CustomerInfo.BillingAddress.City;
            txtZipCode.Text     = clientData.CustomerInfo.BillingAddress.ZipPostalCode;
            txtEmail.Text       = clientData.CustomerInfo.Email;
            txtPhoneNumber.Text = clientData.CustomerInfo.PhoneNumber;
        }
        protected void rptProducts3_ItemCommand(object sender, RepeaterCommandEventArgs e)
        {
            Sku cartItem = e.Item.DataItem as Sku;

            switch (e.CommandName)
            {
            case "ViewProduct":
            {
                int          skuId          = Convert.ToInt32(e.CommandArgument);
                DropDownList ddlQuantity    = e.Item.FindControl("ddlQuantity") as DropDownList;
                LinkButton   product_anchor = e.Item.FindControl("product_anchor") as LinkButton;
                if (skuId == 161)
                {
                    Response.Redirect(product_anchor.PostBackUrl);
                }
                else
                {
                    if (Session["ClientOrderData"] == null)
                    {
                        clientData          = new ClientCartContext();
                        clientData.CartInfo = new Cart();
                    }
                    else
                    {
                        clientData = (ClientCartContext)Session["ClientOrderData"];
                        if (clientData.CartInfo == null)
                        {
                            clientData.CartInfo = new CSBusiness.ShoppingManagement.Cart();
                            clientData.CartInfo.ShippingAddress = new CSBusiness.CustomerManagement.Address();
                        }
                    }



                    clientData.CartInfo.AddItem(skuId, 1, true, false);
                    //clientData.CartInfo.ShippingMethod = UserShippingMethodType.Rush;
                    SiteBasePage.SetCatalogShipping();
                    clientData.CartInfo.Compute();
                    clientData.CartInfo.ShowQuantity = false;

                    Session["ClientOrderData"] = clientData;
                    //Response.Redirect("Cart.aspx");
                    mpeMiniCart.Show();
                    ucMiniCart.CallBindControl();
                }
            }
            break;

            default:
                break;
            }
        }
Exemple #20
0
        protected void BindPackageOptions()
        {
            ClientCartContext cartContext = CartContext;

            if (cartContext.CartInfo.CartItems.FirstOrDefault(x => { return(x.SkuId == (int)CSWebBase.SiteBasePage.SkuEnum.Enhanced4MultiPay); }) != null)
            {
                rbEnhancedPackage.Checked = true;
            }
            else if (cartContext.CartInfo.CartItems.FirstOrDefault(x => { return(x.SkuId == (int)CSWebBase.SiteBasePage.SkuEnum.Accelerated4MultiPay); }) != null)
            {
                rbAcceleratedPackage.Checked = true;
            }
        }
        protected override ClientCartContext GetSiteInitializedCart(ClientCartContext cart)
        {
            try
            {
                cart.OrderAttributeValues.AddOrUpdateAttributeValue("UserAgent", new AttributeValue(Request.UserAgent));
                cart.OrderAttributeValues.AddOrUpdateAttributeValue("SessionId", new AttributeValue(Session.SessionID));
            }
            catch
            {
            }

            return(cart);
        }
        protected void BindSkus(object sender, EventArgs e)
        {
            if (rblPaymentOption.SelectedValue.Equals("same"))
            {
                Session["showpopup"] = "false";
            }
            else
            {
                ClientCartContext clientData = (ClientCartContext)Session["ClientOrderData"];
                List <string>     skuRemove  = new List <string>();
                List <string>     skuAdd     = new List <string>();
                if (clientData.CartInfo.ItemCount > 0)
                {
                    foreach (Sku s in clientData.CartInfo.CartItems)
                    {
                        if (!s.AttributeValuesLoaded)
                        {
                            s.LoadAttributeValues();
                        }

                        if (s.ContainsAttribute("RelatedOnePay"))
                        {
                            if (!s.GetAttributeValue <string>("RelatedOnePay", "0").Equals("0"))
                            {
                                skuAdd.Add(s.GetAttributeValue <string>("RelatedOnePay", "0"));
                                skuRemove.Add(s.SkuId.ToString());
                            }
                        }
                    }
                }

                foreach (string sku in skuAdd)
                {
                    clientData.CartInfo.AddOrUpdate(int.Parse(sku), 1, true, false, false);
                }

                foreach (string sku in skuRemove)
                {
                    clientData.CartInfo.RemoveSku(int.Parse(sku));
                    if (clientData.CartInfo.SkuExists(59))
                    {
                        clientData.CartInfo.RemoveSku(59);
                    }
                }


                clientData.CartInfo.Compute();
            }

            Page.ClientScript.RegisterStartupScript(this.GetType(), "close", "<script language=javascript>parent.jQuery.fancybox.close();</script>");
        }
        public static decimal GetTax(int orderId, bool UpdateOrderTax, bool CartTax, ClientCartContext clientData)
        {
            decimal taxAmount = 0M;

            try
            {
                XmlNode config = null;
                config = GetTax_AvalaraConfig();
                string accountNumber = config.Attributes["accountNumber"].Value;
                string licenseKey    = config.Attributes["licenseKey"].Value;
                string serviceURL    = config.Attributes["serviceURL"].Value;

                TaxSvc taxSvc = new TaxSvc(accountNumber, licenseKey, serviceURL);

                GetTaxRequest           getTaxRequest = GetTax_Request(orderId, UpdateOrderTax, CartTax, clientData);
                XmlSerializerNamespaces namesp        = new XmlSerializerNamespaces();
                namesp.Add(string.Empty, string.Empty);
                XmlWriterSettings settings = new XmlWriterSettings();
                settings.OmitXmlDeclaration = true;
                XmlSerializer x1 = new XmlSerializer(getTaxRequest.GetType());
                StringBuilder sb = new StringBuilder();
                x1.Serialize(XmlTextWriter.Create(sb, settings), getTaxRequest, namesp);
                string       req          = sb.ToString();
                int          timeout      = getTimeOutTax(); // This is for Request TimeOut
                GetTaxResult getTaxResult = taxSvc.GetTax(getTaxRequest, timeout);

                XmlSerializer x2  = new XmlSerializer(getTaxResult.GetType());
                StringBuilder sb2 = new StringBuilder();
                x2.Serialize(XmlTextWriter.Create(sb2, settings), getTaxResult, namesp);
                string res = sb2.ToString();

                if (getTaxResult.ResultCode.Equals(SeverityLevel.Success))
                {
                    taxAmount = getTaxResult.TotalTax;
                }

                if (UpdateOrderTax && orderId > 0)
                {
                    CSResolve.Resolve <IOrderService>().UpdateOrderTax(orderId, taxAmount);
                    Dictionary <string, AttributeValue> orderAttributes = new Dictionary <string, AttributeValue>();
                    orderAttributes.Add("TaxRequest", new CSBusiness.Attributes.AttributeValue(req));
                    orderAttributes.Add("TaxResponse", new CSBusiness.Attributes.AttributeValue(res));
                    CSResolve.Resolve <IOrderService>().UpdateOrderAttributes(orderId, orderAttributes, null);
                }
            }
            catch
            {
            }
            return(taxAmount);
        }
 public static bool CanUseTemplate(Template template, ClientCartContext cartContext)
 {
     if (template.Items.FirstOrDefault(x => { return(x.TypeId == TemplateItemTypeEnum.ListItems &&
                                                     IsRushSku(CSResolve.Resolve <ISkuService>().GetSkuByID(x.SkuId))); }) != null)
     {
         // Don't show template for PO box shipping address
         return(!IsPOBoxAddress(cartContext.CustomerInfo.ShippingAddress.Address1 + " " + cartContext.CustomerInfo.ShippingAddress.Address2) &&
                template.CanUseTemplate(cartContext));
     }
     else
     {
         return(template.CanUseTemplate(cartContext));
     }
 }
Exemple #25
0
        public static void SetCatalogShipping()
        {
            ClientCartContext CartContext1 = new ClientCartContext();

            CartContext1 = HttpContext.Current.Session["ClientOrderData"] as ClientCartContext;
            bool    withQuantity1 = false;
            decimal cartWeight    = 0;

            if (CartContext1.CartInfo.SkuExists(153))
            {
                CartContext1.CartInfo.RemoveSku(153);
            }
            if (CartContext1.CartInfo.SkuExists(154))
            {
                CartContext1.CartInfo.RemoveSku(154);
            }
            bool    flag     = false;
            decimal subTotal = 0;
            bool    mainKit  = false;

            foreach (Sku sku in CartContext1.CartInfo.CartItems)
            {
                if ((sku.SkuId >= 138 && sku.SkuId <= 152) || sku.SkuId == 161) // g2 individual products
                {
                    flag      = true;
                    subTotal += sku.InitialPrice * sku.Quantity;
                }
                else
                {
                    mainKit = true;
                }
            }
            if (flag == true && mainKit == false)
            {
                //CartContext1.CartInfo.AddItem(153, 1, false, true);
                if (subTotal >= 50)
                {
                    CartContext1.CartInfo.AddItem(154, 1, false, true);
                }
                else
                {
                    CartContext1.CartInfo.AddItem(153, 1, false, true);
                }
            }


            CartContext1.CartInfo.Compute();
            HttpContext.Current.Session["ClientOrderData"] = CartContext1;
        }
Exemple #26
0
        public void SaveData()
        {
            if (Page.IsValid)
            {
                //Set Customer Information
                Address shippingAddress = new Address();
                shippingAddress.FirstName       = CommonHelper.fixquotesAccents(txtShippingFirstName.Text);
                shippingAddress.LastName        = CommonHelper.fixquotesAccents(txtShippingLastName.Text);
                shippingAddress.Address1        = CommonHelper.fixquotesAccents(txtShippingAddress1.Text);
                shippingAddress.Address2        = CommonHelper.fixquotesAccents(txtShippingAddress2.Text);
                shippingAddress.City            = CommonHelper.fixquotesAccents(txtShippingCity.Text);
                shippingAddress.StateProvinceId = Convert.ToInt32(ddlShippingState.SelectedValue);
                shippingAddress.CountryId       = Convert.ToInt32(ddlShippingCountry.SelectedValue);
                shippingAddress.ZipPostalCode   = txtShippingZipCode.Text;

                Customer CustData = new Customer();
                CustData.FirstName       = CommonHelper.fixquotesAccents(txtShippingFirstName.Text);
                CustData.LastName        = CommonHelper.fixquotesAccents(txtShippingLastName.Text);
                CustData.PhoneNumber     = txtPhoneNumber.Text;
                CustData.Email           = CommonHelper.fixquotesAccents(txtEmail.Text);
                CustData.Username        = CommonHelper.fixquotesAccents(txtEmail.Text);
                CustData.BillingAddress  = shippingAddress;
                CustData.ShippingAddress = shippingAddress;

                //Set the Client Order objects
                //Set the Client Order objects
                ClientCartContext contextData = (ClientCartContext)Session["ClientOrderData"];

                if (SiteBasePage.IsPOBoxAddress(shippingAddress.Address1 + " " + shippingAddress.Address2))
                {
                    if (contextData.OrderAttributeValues == null)
                    {
                        contextData.OrderAttributeValues = new Dictionary <string, CSBusiness.Attributes.AttributeValue>();
                    }

                    contextData.OrderAttributeValues.AddOrUpdateAttributeValue("IsPOBoxShipping", new AttributeValue(true));
                }

                if (contextData == null) // indicates session timeout
                {
                    Response.Redirect("CheckoutSessionExpired.aspx?page=index.aspx", true);
                }

                contextData.CustomerInfo      = CustData;
                contextData.CartAbandonmentId = CSResolve.Resolve <ICustomerService>().InsertCartAbandonment(CustData, contextData);
                Session["ClientOrderData"]    = contextData;
            }
        }
        protected override void Page_Load(object sender, EventArgs e)
        {
            if (Request.Headers["X-HTTPS"] != null)
            {
                if (Request.Headers["X-HTTPS"].ToLower().Equals("no"))
                {
                    if (Request.Url.ToString().Contains("www"))
                    {
                        Response.Redirect((Request.Url.ToString().Replace("http:/", "https:/").Replace("index.aspx", "")));
                    }
                    else
                    {
                        Response.Redirect((Request.Url.ToString().Replace("http:/", "https:/").Replace("https://", "https://www.").Replace("index.aspx", "")));
                    }
                }
            }

            base.Page_Load(sender, e);

            ClientCartContext clientData = (ClientCartContext)Session["ClientOrderData"];

            if (!Page.IsPostBack)
            {
                SitePreference sitePrefCache = CSFactory.GetCacheSitePref();
                if (!sitePrefCache.GeoLocationService)
                {
                    string GeoCoountry = "";
                    GeoCoountry = CommonHelper.GetGeoTargetLocation(CommonHelper.IpAddress(HttpContext.Current));
                }

                if (Request["versionlp"] != null)
                {
                    Version = Request["versionlp"].ToString();
                    if (clientData.OrderAttributeValues != null)
                    {
                        if (clientData.OrderAttributeValues.ContainsKey("DynamicVerionName"))
                        {
                            Version = clientData.OrderAttributeValues["DynamicVerionName"].Value;
                        }
                        else
                        {
                            clientData.OrderAttributeValues.Add("DynamicVerionName", new AttributeValue(Version));
                        }
                    }
                }
                OrderHelper.SetDynamicLandingPageVersion(Version, clientData);
            }
        }
        protected void Page_Load(object sender, EventArgs e)
        {
            versionName     = CSWeb.OrderHelper.GetVersionName();
            ClientOrderData = (ClientCartContext)Session["ClientOrderData"];
            int count = 0;

            foreach (Sku sku in ClientOrderData.CartInfo.CartItems)
            {
                sku.LoadAttributeValues();
                if (sku.Visible)
                {
                    count++;
                }
            }
            itemCount = count.ToString();
        }
Exemple #29
0
        public static bool SetDynamicLandingPageVersion(string version, ClientCartContext context)
        {
            string radioVersionData = "";

            if (context.OrderAttributeValues != null && context.OrderAttributeValues.ContainsKey("DynamicVerionData"))
            {
                radioVersionData = context.OrderAttributeValues["DynamicVerionData"].Value;
            }
            else
            {
                radioVersionData = DynamicVersionDAL.GetDynamicVersion(version);
                context.OrderAttributeValues.Add("DynamicVerionData", new AttributeValue(radioVersionData));
                HttpContext.Current.Session["ClientOrderData"] = context;
            }
            return(true);
        }
        private void SetCart(out ClientCartContext cartContext)
        {
            cartContext = new ClientCartContext();
            cartContext.RequestParam         = CommonHelper.GetQueryString(Request.RawUrl);
            cartContext.IpAddress            = CommonHelper.IpAddress(HttpContext.Current);
            cartContext.OrderAttributeValues = new System.Collections.Generic.Dictionary <string, CSBusiness.Attributes.AttributeValue>();
            cartContext.OrderAttributeValues.Add("ref_url", new AttributeValue(ReferrerURL));
            cartContext.OrderAttributeValues.Add("landing_url", new AttributeValue(LandingPageURL));
            cartContext.OrderAttributeValues.Add("servername", new AttributeValue(ServerName));
            cartContext.VersionId = CSBasePage.GetVersion();

            if (cartContext.CartInfo == null)
            {
                cartContext.CartInfo = new CSBusiness.ShoppingManagement.Cart();
                cartContext.CartInfo.ShippingAddress = new CSBusiness.CustomerManagement.Address();
            }
        }