Example #1
0
        protected void btnAction_Command(object sender, CommandEventArgs e)
        {
            if (e.CommandName == "Save")
            {
                if (Page.IsValid)
                {
                    DateTime ExpireDate;
                    if (dateControlStart.ValueLocal.HasValue)
                    {
                        ExpireDate = Convert.ToDateTime(dateControlStart.ValueLocal.ToString());
                    }
                    else
                    {
                        ExpireDate = Convert.ToDateTime("1/1/2079");
                    }
                    string currency = CommonHelper.fixquotesAccents(tblCurrency.Text);

                    int days = (txtDays.Text.Length > 0) ? Convert.ToInt32(txtDays.Text) : 0;

                    CSFactory.SavePreference(ExpireDate, currency, CbShippingOption.Checked, Convert.ToInt32(ddlOrderProcessList.SelectedValue), cbGeoTarget.Checked, cbPaymentGateway.Checked, cbFulfillmentHouse.Checked, txtTitle.Text, txtImagePath.Text, days, txtSiteName.Text, txtSiteUrl.Text);

                    SitePreference sitePreference = CSFactory.GetCacheSitePref();

                    ucAttributes.SaveAllEnteredAttributeValues(sitePreference.ObjectName, sitePreference.ItemId);
                }
            }

            Response.Redirect("Main.aspx");
        }
        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);
            }
        }
        public void BindControls(bool cartCompute)
        {
            if (CartContext.CartInfo.CartItems.Count > 0)
            {
                dlShoppingCart.DataSource = CartContext.CartInfo.CartItems.FindAll(x => x.Visible == true);
                dlShoppingCart.DataBind();

                if (cartCompute)
                {
                    CartContext.CartInfo.Compute();
                }

                lblSubtotal.Text     = String.Format("${0:0.00}", CartContext.CartInfo.SubTotal);
                lblTax.Text          = String.Format("${0:0.00}", CartContext.CartInfo.TaxCost);
                lblShipping.Text     = String.Format("${0:0.00}", CartContext.CartInfo.ShippingCost);
                lblRushShipping.Text = String.Format("${0:0.00}", CartContext.CartInfo.RushShippingCost);
                lblOrderTotal.Text   = String.Format("${0:0.00}", CartContext.CartInfo.Total);


                SitePreference shippingGetShippingPref = CSFactory.GetCacheSitePref();
                holderRushShippingTotal.Visible = shippingGetShippingPref.IncludeRushShipping ?? false;
            }
            else
            {
                dlShoppingCart.Visible = false;
            }
        }
Example #4
0
        private decimal GetSurchargeAmt(Order orderItem)
        {
            SitePreference sitePreference = CSFactory.GetCartPrefrence();

            List <SkuShipping> shippingCosts = ShippingDAL.GetSkuShipping();

            decimal surcharge = 0;

            foreach (Sku sku in orderItem.SkuItems)
            {
                if (!sku.AttributeValuesLoaded)
                {
                    sku.LoadAttributeValues();
                }

                if (!sku.SkuCode.ToUpper().Contains("SURCHARGE"))
                {
                    continue;
                }

                CSData.SkuShipping skuShipping = shippingCosts.FirstOrDefault(x =>
                {
                    return(x.PrefId == sitePreference.ShippingPrefID &&
                           x.SkuId == sku.SkuId);
                });

                if (skuShipping != null)
                {
                    surcharge += (skuShipping.Cost * sku.Quantity);
                }
            }

            return(surcharge);
        }
        protected void Application_BeginRequest(object sender, EventArgs e)
        {
            //Ignore if a file is requsted.
            Regex regex = new Regex(@".(txt|gif|pdf|doc|docx|jpg|pdf|js|png|mp4|aspx|asp|html|htm|css|scss|less|eot|svg|ttf|woff|otf|xml)$");

            if (regex.IsMatch(Request.Url.AbsoluteUri))
            {
                return;
            }
            if (Request.Url.AbsoluteUri.ToLower().Contains("/rem_a2"))
            {
                return;
            }

            //Continue with redirection
            SitePreference sitePref = CSFactory.GetCacheSitePref();

            //if (!sitePref.AttributeValuesLoaded)
            sitePref.LoadAttributeValues();
            if (sitePref.ContainsAttribute("redirecturls"))
            {
                string redirectUrl = RedirectToUrls(sitePref.AttributeValues["redirecturls"].Value);
                if (redirectUrl.Length > 0)
                {
                    Response.Redirect(redirectUrl);
                }
            }
        }
Example #6
0
        protected override void Page_Load(object sender, EventArgs e)
        {
            string redirectPage = string.Empty;

            if (NavigationControl.CheckOrderFlow(Session["OrderStatus"], Request.RawUrl, out redirectPage))
            {
                Response.Redirect(redirectPage);
            }

            if (!IsPostBack)
            {
                NavigationControl.DisableClientPageCache();
            }

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

            base.Page_Load(sender, e);
        }
        public void BindControls()
        {
            if (CartContext.CartInfo.CartItems.Count > 0)
            {
                rptShoppingCart.DataSource = CartContext.CartInfo.CartItems.FindAll(x => x.Visible == true);
                rptShoppingCart.DataBind();

                pnlTotal.Visible = true;

                lblSubtotal.Text     = String.Format("${0:0.00}", CartContext.CartInfo.SubTotal);
                lblTax.Text          = String.Format("${0:0.00}", CartContext.CartInfo.TaxCost);
                lblShipping.Text     = String.Format("${0:0.00}", CartContext.CartInfo.ShippingCost);
                lblRushShipping.Text = String.Format("${0:0.00}", CartContext.CartInfo.RushShippingCost);
                lblOrderTotal.Text   = String.Format("${0:0.00}", CartContext.CartInfo.Total);
                LoadOfferTerms(CartContext.CartInfo.CartItems[0]);
                //Sri Comments on 11/15: Need to Plug-in to Custom Shipping option Model
                SitePreference shippingGetShippingPref = CSFactory.GetCacheSitePref();
                holderRushShipping.Visible      = shippingGetShippingPref.IncludeRushShipping ?? false;
                holderRushShippingTotal.Visible = chkIncludeRushShipping.Checked = (CartContext.CartInfo.ShippingMethod == UserShippingMethodType.Rush);
            }
            else
            {
                pnlTotal.Visible        = false;
                rptShoppingCart.Visible = false;
            }
        }
        protected override void Page_Load(object sender, EventArgs e)
        {
            if (!Page.IsPostBack)
            {
                base.Page_Load(sender, e);
                SitePreference sitePrefCache = CSFactory.GetCacheSitePref();

                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", "")));
                        }
                    }
                }
                if (OrderHelper.IsMobileBrowser() && (Request.QueryString["mobile"] == null || (Request.QueryString["mobile"] != null && Request.QueryString["mobile"] != "false")))
                {
                    Response.Redirect("/mobile/?" + Request.QueryString.ToString());
                }
            }
        }
Example #9
0
        protected override void Page_Load(object sender, EventArgs e)
        {
            if (!Page.IsPostBack)
            {
                SitePreference sitePrefCache = CSFactory.GetCacheSitePref();

                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", "")));
                        }
                    }
                }
                if (OrderHelper.IsMobileBrowser() && (Request.QueryString["mobile"] == null || (Request.QueryString["mobile"] != null && Request.QueryString["mobile"] != "false")))
                {
                    Response.Redirect("/mobile/?" + Request.QueryString.ToString().Replace("SID=DISPLAY", "SID=DISPLAY_MOB"));
                }

                if (CSBasePage.GetClientDeviceType() == CSBusiness.Enum.DeviceType.Tablet) // device mobile but version not mobile
                {
                    Response.Redirect("/tablet_big3/" + ((Request.QueryString.ToString().Length > 0) ? "?" : "") + Request.QueryString.ToString().Replace("SID=DISPLAY", "SID=DISPLAY_TAB"));
                }

                NavigationControl.RouteTo("big1");

                base.Page_Load(sender, e);
            }
        }
Example #10
0
        public void BindControls()
        {
            if (CartContext.CartInfo.CartItems.Count > 0)
            {
                rptShoppingCart.DataSource = CartContext.CartInfo.CartItems.FindAll(x => x.Visible == true &&
                                                                                    !CSWebBase.SiteBasePage.IsKitBundleItem(x.SkuId) &&
                                                                                    !CSWebBase.SiteBasePage.IsShippingSku(x)); // dont show kit bundle and shipping items
                rptShoppingCart.DataBind();

                pnlTotal.Visible = true;

                lblSubtotal.Text     = String.Format("${0:0.00}", CartContext.CartInfo.SubTotal);
                lblTax.Text          = String.Format("${0:0.00}", CartContext.CartInfo.TaxCost);
                lblShipping.Text     = String.Format("${0:0.00}", CSWebBase.SiteBasePage.GetShippingCost(CartContext.CartInfo));
                lblRushShipping.Text = String.Format("${0:0.00}", CartContext.CartInfo.RushShippingCost);
                lblOrderTotal.Text   = String.Format("${0:0.00}", CartContext.CartInfo.Total);

                //Sri Comments on 11/15: Need to Plug-in to Custom Shipping option Model
                SitePreference shippingGetShippingPref = CSFactory.GetCacheSitePref();
                //holderRushShipping.Visible = shippingGetShippingPref.IncludeRushShipping ?? false;
                holderRushShippingTotal.Visible = chkIncludeRushShipping.Checked = (CartContext.CartInfo.ShippingMethod == UserShippingMethodType.Rush);
            }
            else
            {
                pnlTotal.Visible        = false;
                rptShoppingCart.Visible = false;
            }
        }
Example #11
0
        protected override void Page_Load(object sender, EventArgs e)
        {
            base.Page_Load(sender, e);

            if (!Page.IsPostBack)
            {
                SitePreference sitePrefCache = CSFactory.GetCacheSitePref();

                if (!sitePrefCache.GeoLocationService)
                {
                    string GeoCoountry = "";
                    GeoCoountry = CommonHelper.GetGeoTargetLocation(CommonHelper.IpAddress(HttpContext.Current));
                    if (GeoCoountry.Equals("canada") || GeoCoountry.Equals("ca"))
                    {
                        Response.Redirect("https://www.bettabasket.ca?" + Request.QueryString);
                    }
                }

                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", "")));
                        }
                    }
                }
            }
        }
Example #12
0
        private decimal GetMerchandiseSubtotal(Order orderItem)
        {
            SitePreference sitePreference = CSFactory.GetCartPrefrence();

            List <SkuShipping> shippingCosts = ShippingDAL.GetSkuShipping();

            decimal rushCharge = 0;

            foreach (Sku sku in orderItem.SkuItems)
            {
                if (!sku.AttributeValuesLoaded)
                {
                    sku.LoadAttributeValues();
                }

                if (!sku.GetAttributeValue("RushSku", false))
                {
                    continue;
                }

                CSData.SkuShipping skuShipping = shippingCosts.FirstOrDefault(x =>
                {
                    return(x.PrefId == sitePreference.ShippingPrefID &&
                           x.SkuId == sku.SkuId);
                });

                if (skuShipping != null)
                {
                    rushCharge += (skuShipping.Cost * sku.Quantity);
                }
            }

            return(rushCharge);
        }
Example #13
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());
        }
        protected void subButton_Click(object sender, EventArgs e)
        {
            lblmsg.Text = "";
            if (!String.IsNullOrEmpty(this.txtEmail.Text))
            {
                bool isEmail = Regex.IsMatch(this.txtEmail.Text, @"\A(?:[a-z0-9!#$%&'*+/=?^_`{|}~-]+(?:\.[a-z0-9!#$%&'*+/=?^_`{|}~-]+)*@(?:[a-z0-9](?:[a-z0-9-]*[a-z0-9])?\.)+[a-z0-9](?:[a-z0-9-]*[a-z0-9])?)\Z", RegexOptions.IgnoreCase);

                if (isEmail)
                {
                    RestClient     _client;
                    SitePreference sitePreference = CSFactory.GetCacheSitePref();


                    _client = new RestClient(sitePreference.GetAttributeValue <string>("Url_Klaviyo", ""));
                    _client.AddDefaultHeader("Content-Type", "application/json");
                    var request = new RestRequest("api/v1/list/" + sitePreference.GetAttributeValue <string>("Key_EmailPopSignups", "") + "/members?api_key=" + sitePreference.GetAttributeValue <string>("APIKey_Klaviyo", "") + "&email=" + this.txtEmail.Text, Method.POST);
                    request.AddParameter("email", this.txtEmail.Text);


                    /* If this paramter is set to true we dont get the person id and
                     * email is not added into Klaviyo list until the person confirms his subscription */
                    request.AddParameter("confirm_optin", false);

                    IRestResponse response = _client.Execute(request);
                    dynamic       obj      = JsonConvert.DeserializeObject(response.Content);

                    if (response.StatusCode == HttpStatusCode.OK && obj != null)
                    {
                        if (obj["already_member"].Value == false)
                        {
                            lblmsg.Text      = "Thank you for signing up!";
                            lblmsg.ForeColor = System.Drawing.ColorTranslator.FromHtml("#039029");

                            SaveContact(this.txtEmail.Text);
                            this.txtEmail.Text = "";
                            lblmsg.Visible     = true;
                        }
                        else
                        {
                            this.txtEmail.Text = "";
                            lblmsg.Visible     = true;
                            lblmsg.ForeColor   = System.Drawing.Color.Red;
                            lblmsg.Text        = "Email address entered is already registered";
                        }
                    }
                }
                else
                {
                    lblmsg.Visible   = true;
                    lblmsg.ForeColor = System.Drawing.Color.Red;
                    lblmsg.Text      = "Please enter a valid email address";
                }
            }
            else
            {
                lblmsg.Visible   = true;
                lblmsg.Text      = "Please enter an email address";
                lblmsg.ForeColor = System.Drawing.Color.Red;
            }
        }
        //Setting up required values for each call
        public TokenexProcessor()
        {
            //Load gateway settings from database
            SitePreference sitePreference = CSFactory.GetCacheSitePref();

            sitePreference.LoadAttributeValues();
            if (sitePreference.AttributeValues["gatewayname"] != null)
            {
                GatewayName = sitePreference.AttributeValues["gatewayname"].Value;
            }
            if (sitePreference.AttributeValues["gatewaylogin"] != null)
            {
                GatewayLogin = sitePreference.AttributeValues["gatewaylogin"].Value;
            }
            if (sitePreference.AttributeValues["gatewaypassword"] != null)
            {
                GatewayPassword = sitePreference.AttributeValues["gatewaypassword"].Value;
            }
            //Load Tokenex credentials from web.config
            APIKey    = BCEncryptor.Decrypt(ConfigurationManager.AppSettings["APIKey"]);
            TokenExID = BCEncryptor.Decrypt(ConfigurationManager.AppSettings["TokenExID"]);
            //if (sitePreference.AttributeValues["tokenxapikey"] != null)
            //    APIKey = sitePreference.AttributeValues["tokenxapikey"].Value;
            //if (sitePreference.AttributeValues["tokenexid"] != null)
            //    TokenExID = ConfigurationManager.AppSettings["tokenexid"];
        }
        protected override void Page_Load(object sender, EventArgs e)
        {
            NavigationControl.RouteTo("big1");
            base.Page_Load(sender, e);

            if (!Page.IsPostBack)
            {
                SitePreference sitePrefCache = CSFactory.GetCacheSitePref();

                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", "")));
                        }
                    }
                }
            }
        }
        public static decimal GetMainSkuShippingCost(Cart cart)
        {
            decimal            shippingCost    = 0;
            List <SkuShipping> skuShippingList = ShippingDAL.GetSkuShipping();

            SitePreference sitePreference = CSFactory.GetCartPrefrence(cart);

            if (sitePreference != null)
            {
                foreach (Sku sku in cart.CartItems)
                {
                    if (SiteBasePage.IsMainSku(sku.SkuId))
                    {
                        CSData.SkuShipping skuShipping = skuShippingList.FirstOrDefault(x =>
                        {
                            return(x.PrefId == sitePreference.ShippingPrefID &&
                                   x.SkuId == sku.SkuId);
                        });

                        if (skuShipping != null)
                        {
                            shippingCost += (skuShipping.Cost * sku.Quantity);
                        }
                    }
                }
            }

            return(shippingCost);
            // TODO: add rush sku cost support
        }
        protected override void Page_Load(object sender, EventArgs e)
        {
            if (!Page.IsPostBack)
            {
                base.Page_Load(sender, e);
                SitePreference sitePrefCache = CSFactory.GetCacheSitePref();

                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", "")));
                        }
                    }
                }
                //if (OrderHelper.IsMobileBrowser() && (Request.QueryString["mobile"] == null ||(Request.QueryString["mobile"] != null && Request.QueryString["mobile"] != "false")))
                //    Response.Redirect("/mobile/?" + Request.QueryString.ToString());

                //if (CSBasePage.GetClientDeviceType() == CSBusiness.Enum.DeviceType.Tablet) // device mobile but version not mobile
                //    Response.Redirect("/tablet/?" + Request.QueryString, true);
            }
        }
Example #19
0
 protected override void Page_Load(object sender, EventArgs e)
 {
     if (!Page.IsPostBack)
     {
         base.Page_Load(sender, e);
         SitePreference sitePrefCache = CSFactory.GetCacheSitePref();
     }
 }
        protected override void Page_Load(object sender, EventArgs e)
        {
            base.Page_Load(sender, e);

            //Hashtable htAdditinalInfo = new Hashtable();
            //Hashtable htAdditinalInfoResponse = new Hashtable();

            //htAdditinalInfo.Add("TRANSACTIONID", "36088288TD269925W");
            //htAdditinalInfo.Add("REFUNDTYPE", "Full");
            //htAdditinalInfo.Add("Method", "RefundTransaction");
            ////If you comment below 3 credentials then default payments will be used from config. So for testing we can comment it.
            //htAdditinalInfo.Add("APIUser", "aparma_1340123768_biz_api1.conversionsystems.com");
            //htAdditinalInfo.Add("APIPassword", "1340123791");
            //htAdditinalInfo.Add("APISignature", "AFcWxV21C7fd0v3bYYYRCpSSRl31ARlSk0Kjb6YYjKlJqWd0UyNZ.rt5");
            //if (OrderHelper.RefundOrderWithPayPalExpressCheckout(234223,htAdditinalInfo, out htAdditinalInfoResponse))
            if (!Page.IsPostBack)
            {
                SitePreference sitePrefCache = CSFactory.GetCacheSitePref();

                if (!sitePrefCache.GeoLocationService)
                {
                    string GeoCoountry = "";
                    GeoCoountry = CommonHelper.GetGeoTargetLocation(CommonHelper.IpAddress(HttpContext.Current));
                    if (GeoCoountry.Equals("canada"))
                    {
                        //Response.Redirect("https://www.plugnsafe.com/canada/?" + Request.QueryString);
                    }
                }

                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", "")));
                        }
                    }
                }

                if (CSWeb.OrderHelper.GetVersionName().ToLower().Equals("o3"))  //  || CSWeb.OrderHelper.GetVersionName().ToLower().Equals("k2"))
                {
                    //if (Request.QueryString != null && Request.QueryString.ToString().Length > 1)
                    //{
                    Response.Redirect("/o2/index?" + Request.QueryString);
                    //Response.Redirect("/j2/index?" + Request.QueryString + "&referrer=" + Request.Url);
                    //}
                    //else
                    //{
                    //    Response.Redirect("/j2/?referrer=" + Request.Url);
                    //}
                }
            }
        }
        protected void btnAction_Command(object sender, CommandEventArgs e)
        {
            if (e.CommandName == "Save")
            {
                if (Page.IsValid)
                {
                    DateTime ExpireDate;
                    if (dateControlStart.ValueLocal.HasValue)
                    {
                        ExpireDate = Convert.ToDateTime(dateControlStart.ValueLocal.ToString());
                    }
                    else
                    {
                        ExpireDate = Convert.ToDateTime("1/1/2079");
                    }
                    string currency = CommonHelper.fixquotesAccents(tblCurrency.Text);

                    int days = (txtDays.Text.Length > 0) ? Convert.ToInt32(txtDays.Text) : 0;

                    CSFactory.SavePreference(ExpireDate, currency, CbShippingOption.Checked,
                                             Convert.ToInt32(ddlOrderProcessList.SelectedValue), cbGeoTarget.Checked,
                                             cbPaymentGateway.Checked, cbFulfillmentHouse.Checked, txtTitle.Text,
                                             txtImagePath.Text, days, txtSiteName.Text, txtSiteUrl.Text);

                    SitePreference sitePreference = CSFactory.GetCacheSitePref();

                    ucAttributes.SaveAllEnteredAttributeValues(sitePreference.ObjectName, sitePreference.ItemId);
                }
                lblSuccess.Visible = true;
                lblCancel.Visible  = false;
            }
            else
            {
                SitePref item = CSFactory.GetSitePreference();
                if (item.PathOrderDate.Value.Year != 2079)
                {
                    dateControlStart.ValueLocal = item.PathOrderDate;
                }
                tblCurrency.Text           = item.Currency;
                CbShippingOption.Checked   = item.OrderTotalShipping;
                cbGeoTarget.Checked        = item.GeoTargetService;
                txtDays.Text               = item.ArchiveData.ToString();
                txtTitle.Text              = item.SiteHeader;
                txtImagePath.Text          = item.LogoPath;
                txtSiteName.Text           = item.SiteName;
                txtSiteUrl.Text            = item.SiteUrl;
                cbPaymentGateway.Checked   = item.PaymentGatewayService;
                cbFulfillmentHouse.Checked = item.FulfillmentHouseService;
                BindOrderProcess(item.OrderProcessType);
                ucAttributes.Populate(CSFactory.GetCacheSitePref());
                lblCancel.Visible  = true;
                lblSuccess.Visible = false;
            }



            //Response.Redirect("Main.aspx");
        }
        public decimal CalculateFullPrice(CSBusiness.ShoppingManagement.Cart cart)
        {
            decimal        taxToReturn   = 0;
            SitePreference list          = CSFactory.GetCartPrefrence();
            decimal        taxableAmount = cart.SubTotalFullPrice;

            if (list.IncludeShippingCostInTaxCalculation)
            {
                decimal shippingCostDiscount = 0;
                if (CSWebBase.SiteBasePage.IsFreeShipOrderMainSku(cart))
                {
                    shippingCostDiscount = SiteBasePage.GetMainSkuShippingCost(cart);
                }

                taxableAmount += cart.ShippingCost;
                if (cart.ShippingMethod == CSBusiness.Shipping.UserShippingMethodType.Rush)
                {
                    taxableAmount += cart.RushShippingCost;
                }

                taxableAmount -= shippingCostDiscount; // don't count shipping cost amount in tax calcultor
            }

            //If this returns a value, it means country has states and we need to
            //find tax for states
            if (cart.ShippingAddress.CountryId > 0)
            {
                //CodeReview By Sri on 09/15: Need to change TaxRegionCache Object
                TaxRegion countryRegion = null, stateRegion = null, zipRegion = null;

                //Comments on 11/2: pulling data from Cache object
                TaxregionCache   cache      = new TaxregionCache(HttpContext.Current);
                List <TaxRegion> taxRegions = (List <TaxRegion>)cache.Value;

                countryRegion = taxRegions.FirstOrDefault(t => t.CountryId == cart.ShippingAddress.CountryId && t.StateId == 0 && string.IsNullOrEmpty(t.ZipCode));
                stateRegion   = taxRegions.FirstOrDefault(t => t.CountryId == cart.ShippingAddress.CountryId && t.StateId == cart.ShippingAddress.StateProvinceId && string.IsNullOrEmpty(t.ZipCode));
                zipRegion     = taxRegions.FirstOrDefault(t => t.CountryId == cart.ShippingAddress.CountryId && t.StateId == cart.ShippingAddress.StateProvinceId &&
                                                          t.ZipCode == cart.ShippingAddress.ZipPostalCode);

                //Tax regions are always returned by country
                //taxRegions = CSFactory.GetTaxByCountry(cart.ShippingAddress.CountryId);
                if (zipRegion != null)
                {
                    taxToReturn = taxableAmount * zipRegion.Value / 100;
                }
                else if (stateRegion != null)
                {
                    taxToReturn = taxableAmount * stateRegion.Value / 100;
                }
                else if (countryRegion != null)
                {
                    taxToReturn = taxableAmount * countryRegion.Value / 100;
                }
            }
            return(Math.Round(taxToReturn, 2));
        }
Example #23
0
        public void Calculate(Cart cart, int prefID)
        {
            List <ShippingOrderValue> shippingSettings = ShippingDAL.GetShippingOrderValue(ShippingOptionType.Weight, _isRushShipping, prefID).OrderBy(s => s.OrderTotal).ToList();

            bool           withQuantity = false;
            decimal        cartWeight;
            SitePreference sp = CSFactory.GetCacheSitePref();

            if (!sp.AttributeValuesLoaded)
            {
                sp.LoadAttributeValues();
            }
            if (sp.AttributeValues.ContainsKey("qtyinweightbasedshipping"))
            {
                if (sp.AttributeValues["qtyinweightbasedshipping"].BooleanValue)
                {
                    withQuantity = true;
                }
            }
            if (withQuantity)
            {
                cartWeight = cart.CartItems.Sum(c => c.Weight * c.Quantity);
            }
            else
            {
                cartWeight = cart.CartItems.Sum(c => c.Weight);
            }

            int totalShippingSettings = shippingSettings.Count;

            for (int i = 0; i < totalShippingSettings; i++)
            {
                ShippingOrderValue currentSetting = shippingSettings[i];
                if (cartWeight <= currentSetting.OrderTotal ||
                    i == totalShippingSettings - 1)
                {
                    // add additional shipping charge by specified key
                    ShippingCharge shippingCharge = ShippingDAL.GetShippingCharge(prefID, cart.ShippingChargeKey);
                    if (shippingCharge != null)
                    {
                        cart.AdditionalShippingCharge = shippingCharge.Cost;
                    }

                    if (_isRushShipping)
                    {
                        cart.RushShippingCost = currentSetting.Cost;
                    }
                    else
                    {
                        cart.ShippingCost = currentSetting.Cost;
                    }

                    break;
                }
            }
        }
        public static void CallCartCompute(Cart cart)
        {
            try
            {
                /*
                 * // Use for logging
                 * if (CSFactory.GetCacheSitePref().GetAttributeValue("EnableFreeShipMainSku", false))
                 * {
                 * }
                 * else
                 * {
                 *  CSCore.CSLogger.Instance.LogException("EnableFreeShipMainSku is not set", new Exception("custom error"));
                 *
                 *  CSCore.CSLogger.Instance.LogException("CSFactory.GetCacheSitePref().VersionItems: " + (CSFactory.GetCacheSitePref().VersionItems == null).ToString(), new Exception("custom error"));
                 *
                 *  if (CSFactory.GetCacheSitePref().VersionItems == null)
                 *  {
                 *      CSCore.CSLogger.Instance.LogException("CSFactory.GetCacheSitePref().VersionItems.Count: " + (CSFactory.GetCacheSitePref().VersionItems.Count).ToString(), new Exception("custom error"));
                 *  }
                 *
                 *  CSCore.CSLogger.Instance.LogException("CSFactory.GetCacheSitePref().AttributeValues: " + (CSFactory.GetCacheSitePref().AttributeValues == null).ToString(), new Exception("custom error"));
                 *
                 *  CSCore.CSLogger.Instance.LogException("CSFactory.GetCacheSitePref().AttributeValuesLoaded: " + (CSFactory.GetCacheSitePref().AttributeValuesLoaded).ToString(), new Exception("custom error"));
                 *
                 *  if (CSFactory.GetCacheSitePref().AttributeValues != null)
                 *  {
                 *      CSCore.CSLogger.Instance.LogException("CSFactory.GetCacheSitePref().AttributeValues.Count: " + (CSFactory.GetCacheSitePref().AttributeValues.Count).ToString(), new Exception("custom error"));
                 *  }
                 * }
                 */
                SitePreference sitePreference = CSFactory.GetCacheSitePref();



                sitePreference.LoadAttributeValues();
                if (sitePreference.AttributeValuesLoaded && sitePreference.ContainsAttribute("AutoDiscountCode"))
                {
                    if (sitePreference.GetAttributeValue("AutoDiscountCode") != null)



                    {
                        cart.DiscountCode = sitePreference.GetAttributeValue("AutoDiscountCode");
                        cart.Compute();
                    }
                }
            }



            catch (Exception ex)
            {
                CSCore.CSLogger.Instance.LogException("Error logging tests", ex);
            }
        }
        public static string GetPrivacyPolicy()
        {
            SitePreference sitePref = CSFactory.GetCacheSitePref();

            if (!sitePref.AttributeValuesLoaded)
            {
                sitePref.LoadAttributeValues();
            }

            return(sitePref.GetAttributeValue <string>("privacypolicy", string.Empty));
        }
        public static string GetRequest(Request request)
        {
            SitePreference sitePreference = CSFactory.GetCacheSitePref();

            sitePreference.LoadAttributeValues();
            string GatewayName     = sitePreference.GetAttributeValue <string>("gatewayname", string.Empty, string.Empty);
            string GatewayLogin    = sitePreference.GetAttributeValue <string>("gatewaylogin", string.Empty, string.Empty);
            string GatewayPassword = sitePreference.GetAttributeValue <string>("gatewaypassword", string.Empty, string.Empty);
            string apiKey          = ConfigurationManager.AppSettings["APIKey"];
            string tokenExID       = ConfigurationManager.AppSettings["TokenExID"];
            var    o = new RootObject
            {
                APIKey             = apiKey,
                TokenExID          = tokenExID,
                TransactionType    = 1,
                TransactionRequest = new TransactionRequest()
                {
                    gateway = new Gateway()
                    {
                        login = GatewayLogin,
                        name  = GatewayName
                    },
                    credit_card = new CreditCard()
                    {
                        number             = request.CardNumber,
                        month              = request.ExpireDate.Month.ToString(),
                        first_name         = request.FirstName,
                        last_name          = request.LastName,
                        verification_value = request.CardCvv,
                        year = request.ExpireDate.Year.ToString()
                    },
                    transaction = new Transaction()
                    {
                        amount          = (request.Amount).ToString().Replace(".0", ""),
                        order_id        = request.InvoiceNumber,
                        billing_address = new BillingAddress()
                        {
                            address1 = request.Address1,
                            city     = request.City,
                            state    = request.State,
                            zip      = request.ZipCode
                        },
                    },
                },
            };

            var jsonConf = new JsonSerializerSettings();

            var json = JsonConvert.SerializeObject(o, jsonConf);

            return(json);
        }
Example #27
0
        protected override void Page_Load(object sender, EventArgs e)
        {
            base.Page_Load(sender, e);

            if (!Page.IsPostBack)
            {
                SitePreference sitePrefCache = CSFactory.GetCacheSitePref();
                if (!sitePrefCache.GeoLocationService)
                {
                    string GeoCoountry = "";
                    GeoCoountry = CommonHelper.GetGeoTargetLocation(CommonHelper.IpAddress(HttpContext.Current));
                }
            }
        }
 private void TrackPageView()
 {
     try
     {
         SitePreference sitePreference = CSFactory.GetCacheSitePref();
         sitePreference.LoadAttributeValues();
         if (sitePreference.AttributeValues["pageviewinsert"].Value.ToString().Equals("1"))
         {
             PageView.InsertPageEntry(HttpContext.Current);
         }
     }
     catch
     {
     }
 }
        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);
            }
        }
Example #30
0
        public static XmlNode GetTax_AvalaraConfig()
        {
            SitePreference sitePrefCache = CSFactory.GetCacheSitePref();

            sitePrefCache.LoadAttributeValues();
            string TaxAvalaraSetting = sitePrefCache.AttributeValues["taxavalarasetting"].Value;

            if (!TaxAvalaraSetting.Equals(""))
            {
                XmlDocument doc = new XmlDocument();
                List <FulfillmentHouseProviderSetting> allSettings = FulfillmentHouseProviderManger.GetAllProvidersFromDB(true);
                doc.LoadXml(TaxAvalaraSetting);
                return(doc.FirstChild);
            }
            return(null);
        }