Beispiel #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;
            }
        }
        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);
                }
            }
        }
        protected void Page_Load(object sender, EventArgs e)
        {
            lblSuccess.Text = ResourceHelper.GetResoureValue("LabelSuccess");
            lblCancel.Text  = ResourceHelper.GetResoureValue("LabelCancel");

            if (!Page.IsPostBack)
            {
                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());
            }
        }
        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);
            }
        }
        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;
            }
        }
        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());
                }
            }
        }
        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;
            }
        }
        //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"];
        }
Beispiel #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", "")));
                        }
                    }
                }
            }
        }
Beispiel #12
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);
        }
Beispiel #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());
        }
Beispiel #14
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;
            }
        }
Beispiel #15
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);
            }
        }
        protected void Page_Load(object sender, EventArgs e)
        {
            versionName = CSWeb.OrderHelper.GetVersionName();
            if (versionName == "")
            {
                versionName = "control";
                List <CSBusiness.Version> list = (CSFactory.GetCacheSitePref()).VersionItems;
                CSBusiness.Version        item = list.Find(x => x.Title.ToLower() == versionName.ToLower());
                if (item != null)
                {
                    versionName = item.Title.ToUpper();
                }
            }
            //versionNameReferrer = CSWeb.OrderHelper.GetVersionNameByReferrer(CartContext);
            SetHomePagePnl();
            SetHomeAndSubPagesPnl();
            SetCartPagePnl();
            SetAllPagesPnl();
            SetReceiptPagePnl();
            BindGoogleTagManager();
            SetGtmParameters();
            if (Request.Url.ToString().ToLower().Contains("getvolaire"))
            {
                pnlVolaire.Visible    = false;
                pnlGetVolaire.Visible = true;
            }
            else
            {
                pnlVolaire.Visible    = true;
                pnlGetVolaire.Visible = false;
            }

            string cookieString = OrderHelper.getCookieString();
        }
        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", "")));
                        }
                    }
                }
            }
        }
 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");
        }
Beispiel #21
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);
        }
        protected override void Page_Load(object sender, EventArgs e)
        {
            base.Page_Load(sender, e);

            List <CSBusiness.Version> list = (CSFactory.GetCacheSitePref()).VersionItems;

            CSBusiness.Version item = list.Find(x => x.Title.ToUpper() == "A1");

            if (item != null)
            {
                ClientOrderData.VersionId = item.VersionId;
            }
        }
        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);
            }
        }
Beispiel #29
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);
        }
        private void DoDeviceRedirect(int currentVersionId)
        {
            if (!Page.IsPostBack)
            {
                //ignore redirection for rem_a2 version
                if (Request.Url.AbsoluteUri.ToLower().Contains("/rem_a2"))
                {
                    return;
                }

                if (ClientDeviceType == CSBusiness.Enum.DeviceType.Mobile)
                {
                    CSBusiness.Version currentVersion = (CSFactory.GetCacheSitePref()).VersionItems.FirstOrDefault(x => { return(x.VersionId == currentVersionId); });

                    if (currentVersion != null && !currentVersion.Title.ToUpper().Contains("MOBILE")) // mobile device not viewing the mobile version
                    {
                        if (currentVersion.Title.ToUpper().Contains("NATIVE") && currentVersion.Title.ToUpper().Equals("MOBILE_NATIVE") == false)
                        {
                            if (Request.QueryString.Count > 0)
                            {
                                Response.Redirect("/mobile_native?" + Request.QueryString, true);
                            }
                            else
                            {
                                Response.Redirect("/mobile_native", true);
                            }
                        }
                        else
                        {
                            if (Request.QueryString.Count > 0)
                            {
                                Response.Redirect("/mobile_b2?" + Request.QueryString, true);
                            }
                            else
                            {
                                Response.Redirect("/mobile_b2", true);
                            }
                        }
                    }
                    else if (currentVersion == null)
                    {
                        CSCore.CSLogger.Instance.LogException("No version found given current version Id. DoDeviceRedirect of sitebasepage.", new Exception("Currentversion null"));
                    }
                }
            }
        }