Esempio n. 1
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());
        }
        //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 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);
                }
            }
        }
Esempio n. 4
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);
        }
 private void TrackPageView()
 {
     try
     {
         SitePreference sitePreference = CSFactory.GetCacheSitePref();
         sitePreference.LoadAttributeValues();
         if (sitePreference.AttributeValues["pageviewinsert"].Value.ToString().Equals("1"))
         {
             PageView.InsertPageEntry(HttpContext.Current);
         }
     }
     catch
     {
     }
 }
Esempio n. 9
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);
        }
        public bool validateInput()
        {
            if (CommonHelper.EnsureNotNull(txtEmail.Text) == String.Empty)
            {
                lblEmailError.Text    = ResourceHelper.GetResoureValue("EmailErrorMsg");
                lblEmailError.Visible = true;
                _bError = true;
            }
            else
            {
                if (!CommonHelper.IsValidEmail(txtEmail.Text))
                {
                    lblEmailError.Text    = ResourceHelper.GetResoureValue("EmailValidationErrorMsg");
                    lblEmailError.Visible = true;
                    _bError = true;
                }
                else
                {
                    lblEmailError.Visible = false;
                }
            }

            SitePreference sitePrefCache = CSFactory.GetCacheSitePref();

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

            if (sitePrefCache.GetAttributeValue <bool>("DuplicateOrderCheck", true))
            {
                if (DuplicateOrderDAL.IsDuplicateOrder(txtEmail.Text))
                {
                    lblEmailError.Text    = ResourceHelper.GetResoureValue("DuplicateEmailCheck") + "<br /><br />";
                    lblEmailError.Visible = true;
                    _bError = true;
                }
                else
                {
                    lblEmailError.Visible = false;
                }
            }

            return(_bError);
        }
Esempio n. 11
0
 public void BindSettings()
 {
     if (!Page.IsPostBack)
     {
         SitePref PrefObject = CSFactory.GetSitePreference();
         imgLogo.ImageUrl = PrefObject.LogoPath;
         SitePreference sitePreference = CSFactory.GetCacheSitePref();
         sitePreference.LoadAttributeValues();
         if (sitePreference.AttributeValues["hitslinkusername"] != null)
         {
             hitsLinkUserName = sitePreference.AttributeValues["hitslinkusername"].Value;
         }
         if (sitePreference.AttributeValues["hitslinkpassword"] != null)
         {
             hitsLinkPassword = sitePreference.AttributeValues["hitslinkpassword"].Value;
         }
     }
 }
Esempio n. 12
0
        //This will return site level shipping preference
        public static SitePreference GetCartPrefrence()
        {
            SitePreference prefObject = new SitePreference();

            //Site Level Settings
            SitePref item = CSFactory.GetSitePreference();

            prefObject.PrefID = item.PrefId;
            prefObject.IncludeShippingCostInTaxCalculation = item.OrderTotalShipping;
            prefObject.OrderProcessType   = (OrderProcessTypeEnum)item.OrderProcessType;
            prefObject.GeoLocationService = item.GeoTargetService;
            prefObject.VersionItems       = GetAllVersion();
            prefObject.CouponItems        = GetAllCoupon();

            prefObject.LoadAttributeValues();

            //Shipping Preferences
            ShippingPref val = ShippingDAL.GetShippingPref().Where(p => p.PrefId == 1).First();

            prefObject.ShippingPrefID     = val.PrefId;
            prefObject.RushShippingPrefID = val.PrefId;

            prefObject.ShippingOptionId = (ShippingOptionType)val.OptionId;
            if (val.RushOptionId.HasValue)
            {
                prefObject.RushShippingOptionID = (ShippingOptionType)val.RushOptionId.Value;
            }
            else
            {
                prefObject.RushShippingOptionID = prefObject.ShippingOptionId;
            }

            prefObject.IncludeRushShipping = val.InCludeRushShipping;
            prefObject.RushShippingCost    = val.RushShippingCost;
            prefObject.FlatShippingCost    = val.flatShipping;

            //Default Settings
            prefObject.PaymentGatewayService   = item.PaymentGatewayService;
            prefObject.FulfillmentHouseService = item.FulfillmentHouseService;

            return(prefObject);
        }
 public void LoadScripts(Page page)
 {
     //Adding scripts to header
     if (CartContext != null)
     {
         SitePreference sitePref = CSFactory.GetCacheSitePref();
         if (!sitePref.AttributeValuesLoaded)
         {
             sitePref.LoadAttributeValues();
         }
         if (sitePref.AttributeValues != null)
         {
             if (sitePref.ContainsAttribute("scripts") != null)
             {
                 Literal li = new Literal();
                 li.Text = sitePref.AttributeValues["scripts"].Value;
                 if (page.Header != null)
                 {
                     page.Header.Controls.Add(li);
                 }
             }
         }
     }
 }
Esempio n. 14
0
        //protected void rblBillingReview_CheckedChanged(object sender, EventArgs e)
        //{
        //    bool billingVal = Convert.ToBoolean(rbBillingReview.SelectedItem.Value);
        //    if (billingVal)
        //        pnlBilling.Visible = true;
        //    else
        //        pnlBilling.Visible = false;
        //}


        //public void ReloadCartData()
        //{
        //    ClientCartContext clientData = (ClientCartContext)Session["ClientOrderData"];

        //    LabelCreditCardNumberError.Visible=true;
        //    LabelCreditCardNumberError.Text = "Sorry, we were unable to process your Payment Information as entered. Please try placing your order again or call Customer Service at (800) 672-2259.";
        //    rfvFirstName.ErrorMessage = ResourceHelper.GetResoureValue("FirstNameErrorMsg");
        //    rfvLastName.ErrorMessage = ResourceHelper.GetResoureValue("LastNameErrorMsg");
        //    rfvAddress1.ErrorMessage = ResourceHelper.GetResoureValue("BillingAddress1ErrorMsg");
        //    rfvCity.ErrorMessage = ResourceHelper.GetResoureValue("BillingCityErrorMsg");
        //    rfvZipCode.ErrorMessage = ResourceHelper.GetResoureValue("BillingZipCodeErrorMsg");
        //    rfvZipCodeReg.ErrorMessage = ResourceHelper.GetResoureValue("BillingZipCodeValidationErrorMsg");
        //    rfvPhone.ErrorMessage = ResourceHelper.GetResoureValue("PhoneNumErrorMsg");
        //    rfvEmail.ErrorMessage = ResourceHelper.GetResoureValue("EmailErrorMsg");
        //    rfvEmailReg.ErrorMessage = ResourceHelper.GetResoureValue("EmailValidationErrorMsg");

        //    pnlBillingReview.Visible = true;
        //    BindBillingCountries(false);
        //    BindShippingCountries(false);

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

        //    BindBillingRegions();
        //    BindShippingRegions();

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

        //    //Shipping information
        //    TextBoxShippingFirstName.Text = clientData.CustomerInfo.ShippingAddress.FirstName;
        //    TextBoxShippingLastName.Text = clientData.CustomerInfo.ShippingAddress.LastName;
        //    TextBoxShippingAddress1.Text = clientData.CustomerInfo.ShippingAddress.Address1;
        //    TextBoxShippingAddress2.Text = clientData.CustomerInfo.ShippingAddress.Address2;
        //    TextBoxShippingCity.Text = clientData.CustomerInfo.ShippingAddress.City;
        //    TextBoxShippingZip.Text = clientData.CustomerInfo.ShippingAddress.ZipPostalCode;


        //    //Payment information
        //    TextBoxCCNum.Text = CommonHelper.Decrypt(clientData.PaymentInfo.CreditCardNumber);
        //    TextBoxCVV.Text = clientData.PaymentInfo.CreditCardCSC;
        //    DateTime expireDate = DateTime.MinValue;
        //    DateTime.TryParse(clientData.PaymentInfo.CreditCardExpired.ToString(), out expireDate);
        //    DropDownListExpMonth.Items.FindByValue(expireDate.Month.ToString()).Selected = true;
        //    DropDownListExpYear.Items.FindByValue(expireDate.Year.ToString()).Selected = true;

        //    //Billing informarion
        //    TextBoxFirstName.Text = clientData.CustomerInfo.BillingAddress.FirstName;
        //    TextBoxLastName.Text = clientData.CustomerInfo.BillingAddress.LastName;
        //    TextBoxAddress1.Text = clientData.CustomerInfo.BillingAddress.Address1;
        //    TextBoxAddress2.Text = clientData.CustomerInfo.BillingAddress.Address2;
        //    TextBoxCity.Text = clientData.CustomerInfo.BillingAddress.City;
        //    TextBoxZip.Text = clientData.CustomerInfo.BillingAddress.ZipPostalCode;
        //    TextBoxEmail.Text = clientData.CustomerInfo.Email;



        //    //quick fix
        //    TextBoxArea.Text = clientData.CustomerInfo.PhoneNumber.Substring(0, 3);
        //    TextBoxPhoneNum1.Text = clientData.CustomerInfo.PhoneNumber.Substring(3, 3);
        //    TextBoxPhoneNum2.Text = clientData.CustomerInfo.PhoneNumber.Substring(6, 4);
        //}

        public bool validateInput()
        {
            //_bError = false;
            if (cbBillingDifferent.Checked)
            {
                if (CommonHelper.EnsureNotNull(txtFirstName.Text) == String.Empty)
                {
                    lblFirstNameError.Text    = ResourceHelper.GetResoureValue("FirstNameErrorMsg");
                    lblFirstNameError.Visible = true;
                    _bError = true;
                }
                else
                {
                    lblFirstNameError.Visible = false;
                }

                if (CommonHelper.EnsureNotNull(txtLastName.Text) == String.Empty)
                {
                    lblLastNameError.Text    = ResourceHelper.GetResoureValue("LastNameErrorMsg");
                    lblLastNameError.Visible = true;
                    _bError = true;
                }
                else
                {
                    lblLastNameError.Visible = false;
                }

                if (CommonHelper.EnsureNotNull(txtAddress1.Text) == String.Empty)
                {
                    lblAddress1Error.Text    = ResourceHelper.GetResoureValue("Address1ErrorMsg");
                    lblAddress1Error.Visible = true;
                    _bError = true;
                }
                else
                {
                    lblAddress1Error.Visible = false;
                }

                if (CommonHelper.EnsureNotNull(txtCity.Text) == String.Empty)
                {
                    lblCityError.Text    = ResourceHelper.GetResoureValue("CityErrorMsg");
                    lblCityError.Visible = true;
                    _bError = true;
                }
                else
                {
                    lblCityError.Visible = false;
                }


                if (ddlState.SelectedValue.Equals(""))
                {
                    lblStateError.Text    = ResourceHelper.GetResoureValue("StateErrorMsg");
                    lblStateError.Visible = true;
                    _bError = true;
                }
                else
                {
                    lblStateError.Visible = false;
                }


                if (CommonHelper.EnsureNotNull(txtZipCode.Text) == String.Empty)
                {
                    lblZiPError.Text    = ResourceHelper.GetResoureValue("ShippingZipCodeErrorMsg");
                    lblZiPError.Visible = true;
                    _bError             = true;
                }
                else
                {
                    if (ddlCountry.SelectedItem.Text.Contains("United States") || ddlCountry.SelectedValue.Contains("327") || ddlCountry.SelectedValue.Contains("397") || ddlCountry.SelectedValue.Contains("444"))
                    {
                        if (!CommonHelper.IsValidZipCode(txtZipCode.Text))
                        {
                            lblZiPError.Text    = ResourceHelper.GetResoureValue("ShippingZipCodeValidationErrorMsg");
                            lblZiPError.Visible = true;
                            _bError             = true;
                        }
                        else
                        {
                            lblZiPError.Visible = false;
                        }
                    }
                    else
                    {
                        if (!CommonHelper.IsValidZipCodeCanadian(txtZipCode.Text))
                        {
                            lblZiPError.Text    = ResourceHelper.GetResoureValue("ShippingZipCodeValidationErrorMsg");
                            lblZiPError.Visible = true;
                            _bError             = true;
                        }
                        else
                        {
                            lblZiPError.Visible = false;
                        }
                    }
                }



                //if (CommonHelper.EnsureNotNull(txtZipCode.Text) == String.Empty)
                //{
                //    lblZiPError.Text = ResourceHelper.GetResoureValue("ZipCodeErrorMsg");
                //    lblZiPError.Visible = true;
                //    _bError = true;
                //}
                //else
                //{
                //    if (!CommonHelper.IsValidZipCode(txtZipCode.Text))
                //    {
                //        lblZiPError.Text = ResourceHelper.GetResoureValue("ZipCodeValidationErrorMsg");
                //        lblZiPError.Visible = true;
                //        _bError = true;

                //    }
                //    else
                //        lblZiPError.Visible = false;

                //}
            }
            //if (!CheckBoxAgree.Checked)
            //{
            //    lblAgreeError.Text = "Please Agree to the terms and conditions";
            //    lblAgreeError.Visible = true;
            //    _bError = true;

            //}
            //else
            //    lblAgreeError.Visible = false;

            if (ddlCCType.SelectedIndex < 0)
            {
                lblCCType.Text    = ResourceHelper.GetResoureValue("CCTypeErrorMsg");
                lblCCType.Visible = true;
                _bError           = true;
            }
            else
            {
                lblCCType.Visible = false;
            }


            DateTime expire = new DateTime();

            if (ddlExpYear.SelectedIndex > -1 && ddlExpMonth.SelectedIndex > -1)
            {
                expire = new DateTime(int.Parse(ddlExpYear.SelectedValue), int.Parse(ddlExpMonth.SelectedValue), 1);
            }
            DateTime today = DateTime.Today;

            if (expire.Year <= today.Year && expire.Month <= today.Month)
            {
                lblExpDate.Text    = ResourceHelper.GetResoureValue("ExpDateErrorMsg");
                lblExpDate.Visible = true;
                _bError            = true;
            }
            else
            {
                lblExpDate.Visible = false;
            }

            string c = txtCCNumber1.Text;

            if (c.Equals(""))
            {
                lblCCNumberError.Text    = ResourceHelper.GetResoureValue("CCErrorMsg");
                lblCCNumberError.Visible = true;
                _bError = true;
            }
            else
            {
                if ((c.ToString() != "4444333322221111") && (txtCvv.Text.IndexOf("147114711471") == -1))
                {
                    if (!CommonHelper.ValidateCardNumber(c))
                    {
                        lblCCNumberError.Text    = ResourceHelper.GetResoureValue("CCErrorMsg");
                        lblCCNumberError.Visible = true;
                        _bError = true;
                    }
                    else
                    {
                        lblCCNumberError.Visible = false;
                    }
                }
                else
                {
                    lblCCNumberError.Visible = false;
                }
            }

            if ((c[0].ToString() == "5") && (ddlCCType.SelectedItem.Text.ToString() != CreditCardTypeEnum.MasterCard.ToString()))
            {
                ddlCCType.SelectedValue = ((int)CreditCardTypeEnum.MasterCard).ToString();
            }
            else if ((c[0].ToString() == "4") && (ddlCCType.SelectedItem.Text.ToString() != CreditCardTypeEnum.VISA.ToString()))
            {
                ddlCCType.SelectedValue = ((int)CreditCardTypeEnum.VISA).ToString();
            }
            else if ((c[0].ToString() == "6") && (ddlCCType.SelectedItem.Text.ToString() != CreditCardTypeEnum.Discover.ToString()))
            {
                ddlCCType.SelectedValue = ((int)CreditCardTypeEnum.Discover).ToString();
            }
            else if ((c[0].ToString() == "3") && (ddlCCType.SelectedItem.Text.ToString() != CreditCardTypeEnum.AmericanExpress.ToString()))
            {
                ddlCCType.SelectedValue = ((int)CreditCardTypeEnum.AmericanExpress).ToString();
            }
            else
            {
            }

            if (ddlCCType.SelectedIndex < 0)
            {
                lblCCType.Text    = ResourceHelper.GetResoureValue("CCTypeErrorMsg");
                lblCCType.Visible = true;
                _bError           = true;
            }
            else
            {
                lblCCType.Visible = false;
            }


            if ((c[0].ToString() == "5") && (ddlCCType.SelectedItem.Text.ToString() != CreditCardTypeEnum.MasterCard.ToString()))
            {
                lblCCType.Text    = ResourceHelper.GetResoureValue("CCTypeValidationErrorMsg");
                lblCCType.Visible = true;
                _bError           = true;
            }
            else if ((c[0].ToString() == "4") && (ddlCCType.SelectedItem.Text.ToString() != CreditCardTypeEnum.VISA.ToString()))
            {
                lblCCType.Text    = ResourceHelper.GetResoureValue("CCTypeValidationErrorMsg");
                lblCCType.Visible = true;
                _bError           = true;
            }
            else if ((c[0].ToString() == "6") && (ddlCCType.SelectedItem.Text.ToString() != CreditCardTypeEnum.Discover.ToString()))
            {
                lblCCType.Text    = ResourceHelper.GetResoureValue("CCTypeValidationErrorMsg");
                lblCCType.Visible = true;
                _bError           = true;
            }
            else if ((c[0].ToString() == "3") && (ddlCCType.SelectedItem.Text.ToString() != CreditCardTypeEnum.AmericanExpress.ToString()))
            {
                lblCCType.Text    = ResourceHelper.GetResoureValue("CCTypeValidationErrorMsg");
                lblCCType.Visible = true;
                _bError           = true;
            }
            else
            {
                lblCCType.Visible = false;
            }

            SitePreference sitePrefCache = CSFactory.GetCacheSitePref();

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

            if (sitePrefCache.GetAttributeValue <bool>("DuplicateOrderCheck", true))
            {
                ClientCartContext clientData = (ClientCartContext)Session["ClientOrderData"];
                if (DuplicateOrderDAL.IsDuplicateOrder(clientData.CustomerInfo.Email))
                {
                    lblEmailError.Text    = ResourceHelper.GetResoureValue("DuplicateEmailCheck") + "<br /><br />";
                    lblEmailError.Visible = true;
                    _bError = true;
                }
                else
                {
                    lblEmailError.Visible = false;
                }
            }

            if (CommonHelper.EnsureNotNull(txtCvv.Text) == String.Empty)
            {
                lblCvvError.Text    = ResourceHelper.GetResoureValue("CVVErrorMsg");
                lblCvvError.Visible = true;
                _bError             = true;
            }
            else
            {
                if (CommonHelper.onlynums(txtCvv.Text) == false)
                {
                    lblCvvError.Text    = ResourceHelper.GetResoureValue("CVVErrorMsg");
                    lblCvvError.Visible = true;
                    _bError             = true;
                }
                if ((CommonHelper.CountNums(txtCvv.Text) != 3) && (CommonHelper.CountNums(txtCvv.Text) != 4))
                {
                    lblCvvError.Text    = ResourceHelper.GetResoureValue("CVVErrorMsg");
                    lblCvvError.Visible = true;
                    _bError             = true;
                }
                else
                {
                    lblCvvError.Visible = false;
                }

                //if ((c[0].ToString() == "5") && (ddlCCType.SelectedItem.Text.ToString() != CreditCardTypeEnum.MasterCard.ToString()))
                //{
                //    lblCCType.Text = ResourceHelper.GetResoureValue("CCTypeValidationErrorMsg");
                //    lblCCType.Visible = true;
                //    _bError = true;
                //}
                //else if ((c[0].ToString() == "4") && (ddlCCType.SelectedItem.Text.ToString() != CreditCardTypeEnum.VISA.ToString()))
                //{
                //    lblCCType.Text = ResourceHelper.GetResoureValue("CCTypeValidationErrorMsg");
                //    lblCCType.Visible = true;
                //    _bError = true;

                //}
                //else if ((c[0].ToString() == "6") && (ddlCCType.SelectedItem.Text.ToString() != CreditCardTypeEnum.Discover.ToString()))
                //{
                //    lblCCType.Text = ResourceHelper.GetResoureValue("CCTypeValidationErrorMsg");
                //    lblCCType.Visible = true;
                //    _bError = true;

                //}
                //else if ((c[0].ToString() == "3") && (ddlCCType.SelectedItem.Text.ToString() != CreditCardTypeEnum.AmericanExpress.ToString()))
                //{
                //    lblCCType.Text = ResourceHelper.GetResoureValue("CCTypeValidationErrorMsg");
                //    lblCCType.Visible = true;
                //    _bError = true;

                //}
                //else
                //{
                //    lblCCType.Visible = false;
                //}
            }
            if (_bError)
            {
                lblValidation.Visible = true;
                lblValidation.Text    = "Please fix above errors";
            }
            else
            {
                lblValidation.Visible = false;
            }
            return(_bError);
        }
Esempio n. 15
0
        public bool validateInput()
        {
            if (CommonHelper.EnsureNotNull(txtShippingFirstName.Text) == String.Empty)
            {
                lblShippingFirstNameError.Text    = ResourceHelper.GetResoureValue("FirstNameErrorMsg");
                lblShippingFirstNameError.Visible = true;
                _bError = true;
            }
            else
            {
                lblShippingFirstNameError.Visible = false;
            }

            if (CommonHelper.EnsureNotNull(txtShippingLastName.Text) == String.Empty)
            {
                lblShippingLastNameError.Text    = ResourceHelper.GetResoureValue("LastNameErrorMsg");
                lblShippingLastNameError.Visible = true;
                _bError = true;
            }
            else
            {
                lblShippingLastNameError.Visible = false;
            }

            if (CommonHelper.EnsureNotNull(txtShippingAddress1.Text) == String.Empty)
            {
                lblShippingAddress1Error.Text    = ResourceHelper.GetResoureValue("ShippingAddress1ErrorMsg");
                lblShippingAddress1Error.Visible = true;
                _bError = true;
            }
            else if (!OrderHelper.ValidatePOBox(txtShippingAddress1.Text))
            {
                lblShippingAddress1Error.Text    = ResourceHelper.GetResoureValue("ShippingPOBoxErrorMsg");
                lblShippingAddress1Error.Visible = true;
                _bError = true;
            }
            else if (!OrderHelper.ValidateAddress(txtShippingAddress1.Text))
            {
                lblShippingAddress1Error.Text    = ResourceHelper.GetResoureValue("ValidShippingAddressErrorMsg");
                lblShippingAddress1Error.Visible = true;
                _bError = true;
            }
            else
            {
                lblShippingAddress1Error.Visible = false;
            }

            if (CommonHelper.EnsureNotNull(txtShippingCity.Text) == String.Empty)
            {
                lblShippingCityError.Text    = ResourceHelper.GetResoureValue("ShippingCityErrorMsg");
                lblShippingCityError.Visible = true;
                _bError = true;
            }
            else
            {
                lblShippingCityError.Visible = false;
            }


            if (ddlShippingState.SelectedValue.Equals(""))
            {
                lblShippingStateError.Text    = ResourceHelper.GetResoureValue("ShippingStateErrorMsg");
                lblShippingStateError.Visible = true;
                _bError = true;
            }
            else
            {
                lblShippingStateError.Visible = false;
            }

            string strPhoneNum = txtPhoneNumber.Text;

            if (!CommonHelper.IsValidPhone(strPhoneNum))
            {
                lblShippingPhoneNumberError.Text    = ResourceHelper.GetResoureValue("PhoneNumberErrorMsg");
                lblShippingPhoneNumberError.Visible = true;
                _bError = true;
            }
            else
            {
                lblShippingPhoneNumberError.Visible = false;
            }

            if (CommonHelper.EnsureNotNull(txtShippingZipCode.Text) == String.Empty)
            {
                lblShippingZiPError.Text    = ResourceHelper.GetResoureValue("ShippingZipCodeErrorMsg");
                lblShippingZiPError.Visible = true;
                _bError = true;
            }
            else
            {
                if (ddlShippingCountry.SelectedValue.Contains("231") || ddlShippingCountry.SelectedValue.Contains("327") || ddlShippingCountry.SelectedValue.Contains("397") || ddlShippingCountry.SelectedValue.Contains("444"))
                {
                    if (!CommonHelper.IsValidZipCode(txtShippingZipCode.Text))
                    {
                        lblShippingZiPError.Text    = ResourceHelper.GetResoureValue("ShippingZipCodeValidationErrorMsg");
                        lblShippingZiPError.Visible = true;
                        _bError = true;
                    }
                    else
                    {
                        lblShippingZiPError.Visible = false;
                    }
                }
                else
                {
                    if (!CommonHelper.IsValidZipCodeCanadian(txtShippingZipCode.Text))
                    {
                        lblShippingZiPError.Text    = ResourceHelper.GetResoureValue("ShippingZipCodeValidationErrorMsg");
                        lblShippingZiPError.Visible = true;
                        _bError = true;
                    }
                    else
                    {
                        lblShippingZiPError.Visible = false;
                    }
                }
            }

            //if (CommonHelper.EnsureNotNull(txtShippingZipCode.Text) == String.Empty)
            //{
            //    lblShippingZiPError.Text = ResourceHelper.GetResoureValue("ShippingZipCodeErrorMsg");
            //    lblShippingZiPError.Visible = true;
            //    _bError = true;
            //}
            //else
            //{
            //    if (!CommonHelper.IsValidZipCode(txtShippingZipCode.Text))
            //    {
            //        lblShippingZiPError.Text = ResourceHelper.GetResoureValue("ShippingZipCodeValidationErrorMsg");
            //        lblShippingZiPError.Visible = true;
            //        _bError = true;

            //    }
            //    else
            //        lblShippingZiPError.Visible = false;

            //}

            if (CommonHelper.EnsureNotNull(txtEmail.Text) == String.Empty)
            {
                lblEmailError.Text    = ResourceHelper.GetResoureValue("EmailErrorMsg");
                lblEmailError.Visible = true;
                _bError = true;
            }
            else
            {
                if (!CommonHelper.IsValidEmail(txtEmail.Text))
                {
                    lblEmailError.Text    = ResourceHelper.GetResoureValue("EmailValidationErrorMsg");
                    lblEmailError.Visible = true;
                    _bError = true;
                }
                else
                {
                    lblEmailError.Visible = false;
                }
            }
            SitePreference sitePrefCache = CSFactory.GetCacheSitePref();

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

            if (sitePrefCache.GetAttributeValue <bool>("DuplicateOrderCheck", true))
            {
                if (DuplicateOrderDAL.IsDuplicateOrder(txtEmail.Text))
                {
                    lblEmailError.Text    = ResourceHelper.GetResoureValue("DuplicateEmailCheck") + "<br /><br />";
                    lblEmailError.Visible = true;
                    _bError = true;
                }
                else
                {
                    lblEmailError.Visible = false;
                }
            }
            if (pnlQuantity.Visible)
            {
                if (ddlQuantityList.SelectedValue.Equals("select"))
                {
                    lblQuantityList.Text    = ResourceHelper.GetResoureValue("QuantityErrorMsg");
                    lblQuantityList.Visible = true;
                    _bError = true;
                }
                else
                {
                    lblQuantityList.Visible = false;
                }
            }

            return(_bError);
        }
Esempio n. 16
0
        /// <summary>
        /// Performs a Process Transaction request on First Data Gateway.
        /// </summary>
        /// <param name="request"></param>
        /// <returns></returns>
        public Response PerformAuthRequest(Request request)
        {
            RestClient _client;

            _client = new RestClient(ConfigurationManager.AppSettings["TokenExPaymentUrl"]);
            _client.AddDefaultHeader("Content-Type", "application/json");
            string requestXML = RequestGenerator.GetRequest(request);
            var    req        = new RestRequest();

            req.AddParameter("application/json", requestXML, ParameterType.RequestBody);
            var       res             = _client.Post(req);
            var       jsonConf        = new JsonSerializerSettings();
            string    authCode        = "";
            string    transactionCode = "";
            string    cvvCode         = "";
            string    avsCode         = "";
            Response1 response1       = JsonConvert.DeserializeObject <Response1>(res.Content);

            foreach (Param param in response1.Params)
            {
                if (param.Key.ToLower().Equals("auth_code"))
                {
                    authCode = param.Value;
                }

                if (param.Key.ToLower().Equals("ref_num"))
                {
                    transactionCode = param.Value;
                }
                //avs_result_code
                if (param.Key.ToLower().Equals("avs_result_code"))
                {
                    avsCode = param.Value;
                }

                //cvv2_result_code
                if (param.Key.ToLower().Equals("cvv2_result_code"))
                {
                    cvvCode = param.Value;
                }
            }
            Response response = new Response();

            response.GatewayRequestRaw  = requestXML;
            response.GatewayResponseRaw = res.Content;
            response.MerchantDefined1   = avsCode;
            response.MerchantDefined2   = cvvCode;
            Hashtable      addinfo        = new Hashtable();
            SitePreference sitePreference = CSFactory.GetCacheSitePref();

            sitePreference.LoadAttributeValues();
            addinfo.Add("merchantId", sitePreference.GetAttributeValue <string>("gatewaymerchantid", string.Empty, string.Empty));
            response.AdditionalInfo = addinfo;
            response.AuthCode       = authCode;
            response.TransactionID  = transactionCode;
            if (response1.TransactionResult)
            {
                response.ResponseType = TransactionResponseType.Approved;
            }
            else
            {
                response.ResponseType = TransactionResponseType.Denied;
            }
            return(response);
        }
        public void Calculate(Cart cart, int prefID)
        {
            SitePreference shippingPreferences = CSFactory.GetCartPrefrence(cart);

            if (shippingPreferences != null)
            {
                ShippingOptionType  option     = shippingPreferences.ShippingOptionId;
                IShippingCalculator calculator = _allShippingCalculators[option];
                calculator.Calculate(cart, shippingPreferences.ShippingPrefID);

                //CodeReview: Instead of Cart pref and compute based on the admin pref
                if (cart.ShippingMethod == UserShippingMethodType.Rush)
                {
                    ShippingOptionType  rushOption     = shippingPreferences.RushShippingOptionID;
                    IShippingCalculator rushCalculator = _allRushShippingCalculators[rushOption];
                    rushCalculator.Calculate(cart, shippingPreferences.RushShippingPrefID);
                }
                else
                {
                    cart.RushShippingCost = 0;
                }

                // code Review 10/09/2013
                bool additionalShippingScenario = false;
                bool additionalShippingScenarioWithSingleSKUinCart     = false;
                bool overRideShippingCostforAdditionalShippingScenario = false;
                bool additionalShippingScenarioWithOtherItems          = false;

                Dictionary <string, string>  dicSKUandPrice = new Dictionary <string, string>();
                Dictionary <string, string>  dicSKUShippingCostWithQtyRange     = new Dictionary <string, string>();
                Dictionary <string, XmlNode> dicSKUShippingCostWithQtyRangeList = new Dictionary <string, XmlNode>();

                SitePreference sitePreference = CSFactory.GetCacheSitePref();
                if (!sitePreference.AttributeValuesLoaded)
                {
                    sitePreference.LoadAttributeValues();
                }

                if (sitePreference.AttributeValues.ContainsKey("additionalshippingscenario"))
                {
                    if (sitePreference.AttributeValues["additionalshippingscenario"].Value != null)
                    {
                        additionalShippingScenario = sitePreference.AttributeValues["additionalshippingscenario"].BooleanValue;
                    }
                }

                if (sitePreference.AttributeValues.ContainsKey("additionalshippingscenariowithsingleskuincart"))
                {
                    if (sitePreference.AttributeValues["additionalshippingscenariowithsingleskuincart"].Value != null)
                    {
                        additionalShippingScenarioWithSingleSKUinCart = sitePreference.AttributeValues["additionalshippingscenariowithsingleskuincart"].BooleanValue;
                    }
                }


                if (sitePreference.AttributeValues.ContainsKey("additionalshippingscenariowithotheritems"))
                {
                    if (sitePreference.AttributeValues["additionalshippingscenariowithotheritems"].Value != null)
                    {
                        additionalShippingScenarioWithOtherItems = sitePreference.AttributeValues["additionalshippingscenariowithotheritems"].BooleanValue;
                    }
                }

                if (sitePreference.AttributeValues.ContainsKey("overrideshippingcostforadditionalshippingscenario"))
                {
                    if (sitePreference.AttributeValues["overrideshippingcostforadditionalshippingscenario"].Value != null)
                    {
                        overRideShippingCostforAdditionalShippingScenario = sitePreference.AttributeValues["overrideshippingcostforadditionalshippingscenario"].BooleanValue;
                    }
                }

                string additionalShippingScenarioSKUandPrice = "";
                if (sitePreference.AttributeValues.ContainsKey("additionalshippingscenarioskuandprice"))
                {
                    if (sitePreference.AttributeValues["additionalshippingscenarioskuandprice"].Value != null)
                    {
                        additionalShippingScenarioSKUandPrice = sitePreference.AttributeValues["additionalshippingscenarioskuandprice"].Value.Trim();
                    }
                }

                if (additionalShippingScenario)
                {
                    try
                    {
                        string dicKey = "";
                        string shippingcostwithqtyrange = "no";
                        if (!additionalShippingScenarioSKUandPrice.Equals(""))
                        {
                            XmlDocument xml = new XmlDocument();
                            xml.LoadXml(additionalShippingScenarioSKUandPrice);
                            XmlNodeList resources = xml.SelectNodes("skulist/sku");
                            foreach (XmlNode node in resources)
                            {
                                dicKey = node.Attributes["skuid"].Value + "_" + node.Attributes["shippingprefid"].Value;
                                if (dicSKUandPrice.ContainsKey(dicKey) == false)
                                {
                                    dicSKUandPrice.Add(dicKey, node.Attributes["shippingcost"].Value); // node.Attributes["skuid"].Value
                                }

                                shippingcostwithqtyrange = "no";

                                if (node.Attributes["shippingcostwithqtyrange"] != null)
                                {
                                    if (node.Attributes["shippingcostwithqtyrange"].Value != null)
                                    {
                                        shippingcostwithqtyrange = node.Attributes["shippingcostwithqtyrange"].Value.ToLower();
                                        XmlNode nodeQtyRangeList = node.SelectSingleNode("qtyrangelist");
                                        if (nodeQtyRangeList != null)
                                        {
                                            if (dicSKUShippingCostWithQtyRangeList.ContainsKey(dicKey) == false)
                                            {
                                                dicSKUShippingCostWithQtyRangeList.Add(dicKey, nodeQtyRangeList);
                                            }
                                        }
                                    }
                                }

                                if (dicSKUShippingCostWithQtyRange.ContainsKey(dicKey) == false)
                                {
                                    dicSKUShippingCostWithQtyRange.Add(dicKey, shippingcostwithqtyrange);
                                }
                            }
                        }
                        else
                        {
                            dicSKUandPrice.Clear();
                            dicSKUShippingCostWithQtyRange.Clear();
                            dicSKUShippingCostWithQtyRangeList.Clear();
                        }

                        dicKey = "";
                        int    lowerQty       = 0;
                        int    upperQty       = 0;
                        string nodeName       = "";
                        string nodeXml        = "";
                        bool   cartHasXMlItem = false;
                        foreach (Sku st in cart.CartItems)
                        {
                            string key = st.SkuId.ToString() + "_" + shippingPreferences.ShippingPrefID;
                            if (dicSKUandPrice.ContainsKey(key))
                            {
                                cartHasXMlItem = true;
                                break;
                            }
                        }

                        if (dicSKUandPrice.Count > 0 && cartHasXMlItem == true)
                        {
                            bool loopSingleSKUinCart = false;
                            if (additionalShippingScenarioWithSingleSKUinCart && cart.ItemCount == 1)
                            {
                                loopSingleSKUinCart = true;
                                decimal shippingCost    = 0;
                                decimal skuShippingCost = 0;
                                bool    isSKUPresent    = false;

                                foreach (Sku st in cart.CartItems)
                                {
                                    // if (st.SkuId == currentSetting.SkuId)
                                    string key = st.SkuId.ToString() + "_" + shippingPreferences.ShippingPrefID;
                                    if (dicSKUandPrice.ContainsKey(key))
                                    {
                                        isSKUPresent    = true;
                                        skuShippingCost = Convert.ToDecimal(dicSKUandPrice[key].ToString());

                                        if (dicSKUShippingCostWithQtyRange[key].ToString().ToLower().Equals("yes") && dicSKUShippingCostWithQtyRangeList.ContainsKey(key) == true && dicSKUShippingCostWithQtyRange.ContainsKey(key) == true)
                                        {
                                            nodeName = (dicSKUShippingCostWithQtyRangeList[key]).Name;
                                            nodeXml  = "<" + nodeName + ">" + dicSKUShippingCostWithQtyRangeList[key].InnerXml.ToString() + "</" + nodeName + ">";
                                            XmlDocument doc = new XmlDocument();
                                            doc.LoadXml(nodeXml);
                                            XmlNodeList nodeList = doc.SelectNodes("/" + nodeName + "/range");
                                            foreach (XmlNode node in nodeList)
                                            {
                                                if (node.Attributes["lowerqty"] != null && node.Attributes["upperqty"] != null)
                                                {
                                                    if (node.Attributes["lowerqty"].Value != null && node.Attributes["upperqty"].Value != null)
                                                    {
                                                        lowerQty = Convert.ToInt32(node.Attributes["lowerqty"].Value);
                                                        upperQty = Convert.ToInt32(node.Attributes["upperqty"].Value);
                                                        if (st.Quantity >= lowerQty && st.Quantity <= upperQty)
                                                        {
                                                            if (node.Attributes["shippingcostrange"] != null)
                                                            {
                                                                if (node.Attributes["shippingcostrange"].Value != null)
                                                                {
                                                                    skuShippingCost = Convert.ToDecimal(node.Attributes["shippingcostrange"].Value);
                                                                    break;
                                                                }
                                                            }
                                                        }
                                                    }
                                                }
                                            }
                                        }

                                        st.LoadAttributeValues();
                                        if (st.AttributeValues.ContainsKey("shippingwithquantity"))
                                        {
                                            if (st.AttributeValues["shippingwithquantity"].Value == null)
                                            {
                                                shippingCost += skuShippingCost;
                                            }
                                            else if (st.AttributeValues["shippingwithquantity"].BooleanValue)
                                            {
                                                shippingCost += skuShippingCost * st.Quantity;
                                            }
                                            else
                                            {
                                                shippingCost += skuShippingCost;
                                            }
                                        }
                                        else
                                        {
                                            shippingCost += skuShippingCost;
                                        }
                                    }
                                }
                                if (isSKUPresent)
                                {
                                    if (overRideShippingCostforAdditionalShippingScenario)
                                    {
                                        cart.ShippingCost = shippingCost;
                                    }
                                    else
                                    {
                                        cart.ShippingCost += shippingCost;
                                    }
                                    cart.RushShippingCost = 0;
                                }
                            }

                            if (loopSingleSKUinCart == false)
                            {
                                if (additionalShippingScenarioWithOtherItems)
                                {
                                    decimal shippingCost    = 0;
                                    decimal skuShippingCost = 0;
                                    bool    isSKUPresent    = false;
                                    foreach (Sku st in cart.CartItems)
                                    {
                                        // if (st.SkuId == currentSetting.SkuId)
                                        string key = st.SkuId.ToString() + "_" + shippingPreferences.ShippingPrefID;
                                        if (dicSKUandPrice.ContainsKey(key))
                                        {
                                            isSKUPresent    = true;
                                            skuShippingCost = Convert.ToDecimal(dicSKUandPrice[key].ToString());

                                            if (dicSKUShippingCostWithQtyRange[key].ToString().ToLower().Equals("yes") && dicSKUShippingCostWithQtyRangeList.ContainsKey(key) == true && dicSKUShippingCostWithQtyRange.ContainsKey(key) == true)
                                            {
                                                nodeName = (dicSKUShippingCostWithQtyRangeList[key]).Name;
                                                nodeXml  = "<" + nodeName + ">" + dicSKUShippingCostWithQtyRangeList[key].InnerXml.ToString() + "</" + nodeName + ">";
                                                XmlDocument doc = new XmlDocument();
                                                doc.LoadXml(nodeXml);
                                                XmlNodeList nodeList = doc.SelectNodes("/" + nodeName + "/range");
                                                foreach (XmlNode node in nodeList)
                                                {
                                                    if (node.Attributes["lowerqty"] != null && node.Attributes["upperqty"] != null)
                                                    {
                                                        if (node.Attributes["lowerqty"].Value != null && node.Attributes["upperqty"].Value != null)
                                                        {
                                                            lowerQty = Convert.ToInt32(node.Attributes["lowerqty"].Value);
                                                            upperQty = Convert.ToInt32(node.Attributes["upperqty"].Value);
                                                            if (st.Quantity >= lowerQty && st.Quantity <= upperQty)
                                                            {
                                                                if (node.Attributes["shippingcostrange"] != null)
                                                                {
                                                                    if (node.Attributes["shippingcostrange"].Value != null)
                                                                    {
                                                                        skuShippingCost = Convert.ToDecimal(node.Attributes["shippingcostrange"].Value);
                                                                        break;
                                                                    }
                                                                }
                                                            }
                                                        }
                                                    }
                                                }
                                            }

                                            st.LoadAttributeValues();
                                            if (st.AttributeValues.ContainsKey("shippingwithquantity"))
                                            {
                                                if (st.AttributeValues["shippingwithquantity"].BooleanValue)
                                                {
                                                    shippingCost += skuShippingCost * st.Quantity;
                                                }
                                                else
                                                {
                                                    shippingCost += skuShippingCost;
                                                }
                                            }
                                            else
                                            {
                                                shippingCost += skuShippingCost;
                                            }
                                        }
                                    }
                                    if (isSKUPresent)
                                    {
                                        if (overRideShippingCostforAdditionalShippingScenario)
                                        {
                                            cart.ShippingCost = shippingCost;
                                        }
                                        else
                                        {
                                            cart.ShippingCost += shippingCost;
                                        }
                                        cart.RushShippingCost = 0;
                                    }
                                }
                                else
                                {
                                    // Check here if cart has only items which in XML SKU List.
                                    bool cartHasOnlyXMLSku = false;
                                    foreach (Sku st in cart.CartItems)
                                    {
                                        string key = st.SkuId.ToString() + "_" + shippingPreferences.ShippingPrefID;
                                        if (dicSKUandPrice.ContainsKey(key))
                                        {
                                            cartHasOnlyXMLSku = true;
                                        }
                                        else
                                        {
                                            cartHasOnlyXMLSku = false;
                                            break;
                                        }
                                    }

                                    if (cartHasOnlyXMLSku)
                                    {
                                        decimal shippingCost    = 0;
                                        decimal skuShippingCost = 0;
                                        bool    isSKUPresent    = false;
                                        foreach (Sku st in cart.CartItems)
                                        {
                                            // if (st.SkuId == currentSetting.SkuId)
                                            string key = st.SkuId.ToString() + "_" + shippingPreferences.ShippingPrefID;
                                            if (dicSKUandPrice.ContainsKey(key))
                                            {
                                                isSKUPresent    = true;
                                                skuShippingCost = Convert.ToDecimal(dicSKUandPrice[key].ToString());

                                                if (dicSKUShippingCostWithQtyRange[key].ToString().ToLower().Equals("yes") && dicSKUShippingCostWithQtyRangeList.ContainsKey(key) == true && dicSKUShippingCostWithQtyRange.ContainsKey(key) == true)
                                                {
                                                    nodeName = (dicSKUShippingCostWithQtyRangeList[key]).Name;
                                                    nodeXml  = "<" + nodeName + ">" + dicSKUShippingCostWithQtyRangeList[key].InnerXml.ToString() + "</" + nodeName + ">";
                                                    XmlDocument doc = new XmlDocument();
                                                    doc.LoadXml(nodeXml);
                                                    XmlNodeList nodeList = doc.SelectNodes("/" + nodeName + "/range");
                                                    foreach (XmlNode node in nodeList)
                                                    {
                                                        if (node.Attributes["lowerqty"] != null && node.Attributes["upperqty"] != null)
                                                        {
                                                            if (node.Attributes["lowerqty"].Value != null && node.Attributes["upperqty"].Value != null)
                                                            {
                                                                lowerQty = Convert.ToInt32(node.Attributes["lowerqty"].Value);
                                                                upperQty = Convert.ToInt32(node.Attributes["upperqty"].Value);
                                                                if (st.Quantity >= lowerQty && st.Quantity <= upperQty)
                                                                {
                                                                    if (node.Attributes["shippingcostrange"] != null)
                                                                    {
                                                                        if (node.Attributes["shippingcostrange"].Value != null)
                                                                        {
                                                                            skuShippingCost = Convert.ToDecimal(node.Attributes["shippingcostrange"].Value);
                                                                            break;
                                                                        }
                                                                    }
                                                                }
                                                            }
                                                        }
                                                    }
                                                }

                                                st.LoadAttributeValues();
                                                if (st.AttributeValues.ContainsKey("shippingwithquantity"))
                                                {
                                                    if (st.AttributeValues["shippingwithquantity"].BooleanValue)
                                                    {
                                                        shippingCost += skuShippingCost * st.Quantity;
                                                    }
                                                    else
                                                    {
                                                        shippingCost += skuShippingCost;
                                                    }
                                                }
                                                else
                                                {
                                                    shippingCost += skuShippingCost;
                                                }
                                            }
                                        }
                                        if (isSKUPresent)
                                        {
                                            if (overRideShippingCostforAdditionalShippingScenario)
                                            {
                                                cart.ShippingCost = shippingCost;
                                            }
                                            else
                                            {
                                                cart.ShippingCost += shippingCost;
                                            }
                                            cart.RushShippingCost = 0;
                                        }
                                    }
                                }
                            }
                        }
                    }
                    catch (Exception ex)
                    {
                        CSCore.CSLogger.Instance.LogException("Additional Shipping Scenario Calculation Issue ", ex);
                        throw;
                    }
                }
            }
            else
            {
                throw new InvalidOperationException("Missing shipping preferences");
            }
        }
Esempio n. 18
0
        public bool validateInput()
        {
            if (CommonHelper.EnsureNotNull(txtShippingFirstName.Text) == String.Empty)
            {
                lblShippingFirstName.Text    = ResourceHelper.GetResoureValue("FirstNameErrorMsg");
                lblShippingFirstName.Visible = true;
                _bError = true;
            }
            else
            {
                lblShippingFirstName.Visible = false;
            }

            if (CommonHelper.EnsureNotNull(txtShippingLastName.Text) == String.Empty)
            {
                lblShippingLastName.Text    = ResourceHelper.GetResoureValue("LastNameErrorMsg");
                lblShippingLastName.Visible = true;
                _bError = true;
            }
            else
            {
                lblShippingLastName.Visible = false;
            }

            if (CommonHelper.EnsureNotNull(txtShippingAddress1.Text) == String.Empty)
            {
                lblShippingAddress1Error.Text    = ResourceHelper.GetResoureValue("Address1ErrorMsg");
                lblShippingAddress1Error.Visible = true;
                _bError = true;
            }
            else
            {
                lblShippingAddress1Error.Visible = false;
            }

            if (CommonHelper.EnsureNotNull(txtShippingCity.Text) == String.Empty)
            {
                lblShippingCityError.Text    = ResourceHelper.GetResoureValue("CityErrorMsg");
                lblShippingCityError.Visible = true;
                _bError = true;
            }
            else
            {
                lblShippingCityError.Visible = false;
            }


            if (ddlShippingState.SelectedValue.Equals(""))
            {
                lblShippingStateError.Text    = ResourceHelper.GetResoureValue("ShippingStateErrorMsg");
                lblShippingStateError.Visible = true;
                _bError = true;
            }
            else
            {
                lblShippingStateError.Visible = false;
            }

            if (CommonHelper.EnsureNotNull(txtShippingZipCode.Text) == String.Empty)
            {
                lblShippingZiPError.Text    = ResourceHelper.GetResoureValue("ShippingZipCodeErrorMsg");
                lblShippingZiPError.Visible = true;
                _bError = true;
            }
            else
            {
                if (ddlShippingCountry.SelectedValue.Contains("231"))
                {
                    if (!CommonHelper.IsValidZipCode(txtShippingZipCode.Text))
                    {
                        lblShippingZiPError.Text    = ResourceHelper.GetResoureValue("ShippingZipCodeValidationErrorMsg");
                        lblShippingZiPError.Visible = true;
                        _bError = true;
                    }
                    else
                    {
                        lblShippingZiPError.Visible = false;
                    }
                }
                else
                {
                    if (!CommonHelper.IsValidZipCodeCanadian(txtShippingZipCode.Text))
                    {
                        lblShippingZiPError.Text    = ResourceHelper.GetResoureValue("ShippingZipCodeValidationErrorMsg");
                        lblShippingZiPError.Visible = true;
                        _bError = true;
                    }
                    else
                    {
                        lblShippingZiPError.Visible = false;
                    }
                }
            }

            //if (CommonHelper.EnsureNotNull(txtShippingZipCode.Text) == String.Empty)
            //{
            //    lblShippingZiPError.Text = ResourceHelper.GetResoureValue("ShippingZipCodeErrorMsg");
            //    lblShippingZiPError.Visible = true;
            //    _bError = true;
            //}
            //else
            //{
            //    if (!CommonHelper.IsValidZipCode(txtShippingZipCode.Text))
            //    {
            //        lblShippingZiPError.Text = ResourceHelper.GetResoureValue("ShippingZipCodeValidationErrorMsg");
            //        lblShippingZiPError.Visible = true;
            //        _bError = true;

            //    }
            //    else
            //        lblShippingZiPError.Visible = false;

            //}

            string strPhoneNum = txtPhoneNumber1.Text + txtPhoneNumber2.Text + txtPhoneNumber3.Text;

            if (!CommonHelper.IsValidPhone(strPhoneNum))
            {
                lblPhoneNumberError.Text    = ResourceHelper.GetResoureValue("PhoneNumberErrorMsg");
                lblPhoneNumberError.Visible = true;
                _bError = true;
            }
            else
            {
                lblPhoneNumberError.Visible = false;
            }



            if (CommonHelper.EnsureNotNull(txtEmail.Text) == String.Empty)
            {
                lblEmailError.Text    = ResourceHelper.GetResoureValue("EmailErrorMsg");
                lblEmailError.Visible = true;
                _bError = true;
            }
            else
            {
                if (!CommonHelper.IsValidEmail(txtEmail.Text))
                {
                    lblEmailError.Text    = ResourceHelper.GetResoureValue("EmailValidationErrorMsg");
                    lblEmailError.Visible = true;
                    _bError = true;
                }
                else
                {
                    lblEmailError.Visible = false;
                }
            }
            SitePreference sitePrefCache = CSFactory.GetCacheSitePref();

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

            if (sitePrefCache.GetAttributeValue <bool>("DuplicateOrderCheck", true))
            {
                if (DuplicateOrderDAL.IsDuplicateOrder(txtEmail.Text))
                {
                    lblEmailError.Text    = ResourceHelper.GetResoureValue("DuplicateEmailCheck") + "<br /><br />";
                    lblEmailError.Visible = true;
                    _bError = true;
                }
                else
                {
                    lblEmailError.Visible = false;
                }
            }
            if (pnlQuantity.Visible)
            {
                if (ddlQuantityList.SelectedValue.Equals("select"))
                {
                    lblQuantityList.Text    = ResourceHelper.GetResoureValue("QuantityErrorMsg");
                    lblQuantityList.Visible = true;
                    _bError = true;
                }
                else
                {
                    lblQuantityList.Visible = false;
                }
            }

            #region Name & Address

            if (pnlShippingAddress.Visible)
            {
                if (CommonHelper.EnsureNotNull(txtFirstName.Text) == String.Empty)
                {
                    lblFirstNameError.Text    = ResourceHelper.GetResoureValue("FirstNameErrorMsg");
                    lblFirstNameError.Visible = true;
                    _bError = true;
                }
                else
                {
                    lblFirstNameError.Visible = false;
                }

                if (CommonHelper.EnsureNotNull(txtLastName.Text) == String.Empty)
                {
                    lblLastNameError.Text    = ResourceHelper.GetResoureValue("LastNameErrorMsg");
                    lblLastNameError.Visible = true;
                    _bError = true;
                }
                else
                {
                    lblLastNameError.Visible = false;
                }

                if (CommonHelper.EnsureNotNull(txtAddress1.Text) == String.Empty)
                {
                    lblAddress1Error.Text    = ResourceHelper.GetResoureValue("Address1ErrorMsg");
                    lblAddress1Error.Visible = true;
                    _bError = true;
                }
                else
                {
                    lblAddress1Error.Visible = false;
                }

                if (CommonHelper.EnsureNotNull(txtCity.Text) == String.Empty)
                {
                    lblCityError.Text    = ResourceHelper.GetResoureValue("CityErrorMsg");
                    lblCityError.Visible = true;
                    _bError = true;
                }
                else
                {
                    lblCityError.Visible = false;
                }


                if (ddlState.SelectedValue.Equals(""))
                {
                    lblStateError.Text    = ResourceHelper.GetResoureValue("BillingStateErrorMsg");
                    lblStateError.Visible = true;
                    _bError = true;
                }
                else
                {
                    lblStateError.Visible = false;
                }


                if (CommonHelper.EnsureNotNull(txtZipCode.Text) == String.Empty)
                {
                    lblZiPError.Text    = ResourceHelper.GetResoureValue("ShippingZipCodeErrorMsg");
                    lblZiPError.Visible = true;
                    _bError             = true;
                }
                else
                {
                    if (ddlCountry.SelectedItem.Text.Contains("United States"))
                    {
                        if (!CommonHelper.IsValidZipCode(txtZipCode.Text))
                        {
                            lblZiPError.Text    = ResourceHelper.GetResoureValue("ShippingZipCodeValidationErrorMsg");
                            lblZiPError.Visible = true;
                            _bError             = true;
                        }
                        else
                        {
                            lblZiPError.Visible = false;
                        }
                    }
                    else
                    {
                        if (!CommonHelper.IsValidZipCodeCanadian(txtZipCode.Text))
                        {
                            lblZiPError.Text    = ResourceHelper.GetResoureValue("ShippingZipCodeValidationErrorMsg");
                            lblZiPError.Visible = true;
                            _bError             = true;
                        }
                        else
                        {
                            lblZiPError.Visible = false;
                        }
                    }
                }
                //if (CommonHelper.EnsureNotNull(txtZipCode.Text) == String.Empty)
                //{
                //    lblZiPError.Text = ResourceHelper.GetResoureValue("ZipCodeErrorMsg");
                //    lblZiPError.Visible = true;
                //    _bError = true;
                //}
                //else
                //{
                //    if (!CommonHelper.IsValidZipCode(txtZipCode.Text))
                //    {
                //        lblZiPError.Text = ResourceHelper.GetResoureValue("ZipCodeValidationErrorMsg");
                //        lblZiPError.Visible = true;
                //        _bError = true;

                //    }
                //    else
                //        lblZiPError.Visible = false;

                //}
            }


            #endregion

            #region Credit Card

            if (ddlCCType.SelectedIndex < 0)
            {
                lblCCType.Text    = ResourceHelper.GetResoureValue("CCTypeErrorMsg");
                lblCCType.Visible = true;
                _bError           = true;
            }
            else
            {
                lblCCType.Visible = false;
            }

            DateTime expire = new DateTime();
            if (ddlExpYear.SelectedIndex > -1 && ddlExpMonth.SelectedIndex > -1)
            {
                expire = new DateTime(int.Parse(ddlExpYear.SelectedValue), int.Parse(ddlExpMonth.SelectedValue), 1);
            }
            DateTime today = DateTime.Today;
            if (expire.Year <= today.Year && expire.Month <= today.Month)
            {
                lblExpDate.Text    = ResourceHelper.GetResoureValue("ExpDateErrorMsg");
                lblExpDate.Visible = true;
                _bError            = true;
            }
            else
            {
                lblExpDate.Visible = false;
            }

            string c = txtCCNumber1.Text;
            if (c.Equals(""))
            {
                lblCCNumberError.Text    = ResourceHelper.GetResoureValue("CCErrorMsg");
                lblCCNumberError.Visible = true;
                _bError = true;
            }
            else
            {
                if ((c.ToString() != "4444333322221111") && (txtCvv.Text.IndexOf("147114711471") == -1))
                {
                    if (!CommonHelper.ValidateCardNumber(c))
                    {
                        lblCCNumberError.Text    = ResourceHelper.GetResoureValue("CCErrorMsg");
                        lblCCNumberError.Visible = true;
                        _bError = true;
                    }
                    else
                    {
                        lblCCNumberError.Visible = false;
                    }
                }
            }

            if (CommonHelper.EnsureNotNull(txtCvv.Text) == String.Empty)
            {
                lblCvvError.Text    = ResourceHelper.GetResoureValue("CVVErrorMsg");
                lblCvvError.Visible = true;
                _bError             = true;
            }
            else
            {
                if (CommonHelper.onlynums(txtCvv.Text) == false)
                {
                    lblCvvError.Text    = ResourceHelper.GetResoureValue("CVVErrorMsg");
                    lblCvvError.Visible = true;
                    _bError             = true;
                }

                if ((CommonHelper.CountNums(txtCvv.Text) != 3) && (CommonHelper.CountNums(txtCvv.Text) != 4))
                {
                    lblCvvError.Text    = ResourceHelper.GetResoureValue("CVVErrorMsg");
                    lblCvvError.Visible = true;
                    _bError             = true;
                }
                else
                {
                    lblCvvError.Visible = false;
                }

                if ((c[0].ToString() == "5") && (ddlCCType.SelectedItem.Text.ToString() != CreditCardTypeEnum.MasterCard.ToString()))
                {
                    lblCCType.Text    = ResourceHelper.GetResoureValue("CCTypeValidationErrorMsg");
                    lblCCType.Visible = true;
                    _bError           = true;
                }
                else if ((c[0].ToString() == "4") && (ddlCCType.SelectedItem.Text.ToString() != CreditCardTypeEnum.VISA.ToString()))
                {
                    lblCCType.Text    = ResourceHelper.GetResoureValue("CCTypeValidationErrorMsg");
                    lblCCType.Visible = true;
                    _bError           = true;
                }
                else if ((c[0].ToString() == "6") && (ddlCCType.SelectedItem.Text.ToString() != CreditCardTypeEnum.Discover.ToString()))
                {
                    lblCCType.Text    = ResourceHelper.GetResoureValue("CCTypeValidationErrorMsg");
                    lblCCType.Visible = true;
                    _bError           = true;
                }
                else if ((c[0].ToString() == "3") && (ddlCCType.SelectedItem.Text.ToString() != CreditCardTypeEnum.AmericanExpress.ToString()))
                {
                    lblCCType.Text    = ResourceHelper.GetResoureValue("CCTypeValidationErrorMsg");
                    lblCCType.Visible = true;
                    _bError           = true;
                }
                else
                {
                    lblCCType.Visible = false;
                }
            }

            #endregion

            return(_bError);
        }
Esempio n. 19
0
        public bool validateInput()
        {
            if (CommonHelper.EnsureNotNull(txtFirstName.Text) == String.Empty)
            {
                lblFirstNameError.Text    = ResourceHelper.GetResoureValue("FirstNameErrorMsg");
                lblFirstNameError.Visible = true;
                _bError = true;
            }
            else
            {
                lblFirstNameError.Visible = false;
            }

            if (CommonHelper.EnsureNotNull(txtLastName.Text) == String.Empty)
            {
                lblLastNameError.Text    = ResourceHelper.GetResoureValue("LastNameErrorMsg");
                lblLastNameError.Visible = true;
                _bError = true;
            }
            else
            {
                lblLastNameError.Visible = false;
            }

            if (CommonHelper.EnsureNotNull(txtAddress1.Text) == String.Empty)
            {
                lblAddress1Error.Text    = ResourceHelper.GetResoureValue("BillingAddress1ErrorMsg");
                lblAddress1Error.Visible = true;
                _bError = true;
            }
            else
            {
                lblAddress1Error.Visible = false;
            }

            if (CommonHelper.EnsureNotNull(txtCity.Text) == String.Empty)
            {
                lblCityError.Text    = ResourceHelper.GetResoureValue("BillingCityErrorMsg");
                lblCityError.Visible = true;
                _bError = true;
            }
            else
            {
                lblCityError.Visible = false;
            }


            if (ddlState.SelectedValue.Equals("select"))
            {
                lblStateError.Text    = ResourceHelper.GetResoureValue("BillingStateErrorMsg");
                lblStateError.Visible = true;
                _bError = true;
            }
            else
            {
                lblStateError.Visible = false;
            }

            string strPhoneNum = txtPhoneNumber.Text;

            if (!CommonHelper.IsValidPhone(strPhoneNum))
            {
                lblPhoneNumberError.Text    = ResourceHelper.GetResoureValue("PhoneNumErrorMsg");
                lblPhoneNumberError.Visible = true;
                _bError = true;
            }
            else
            {
                lblPhoneNumberError.Visible = false;
            }

            if (CommonHelper.EnsureNotNull(txtZipCode.Text) == String.Empty)
            {
                lblZiPError.Text    = ResourceHelper.GetResoureValue("BillingZipCodeErrorMsg");
                lblZiPError.Visible = true;
                _bError             = true;
            }
            else
            {
                if (!CommonHelper.IsValidZipCode(txtZipCode.Text))
                {
                    lblZiPError.Text    = ResourceHelper.GetResoureValue("BillingZipCodeValidationErrorMsg");
                    lblZiPError.Visible = true;
                    _bError             = true;
                }
                else
                {
                    lblZiPError.Visible = false;
                }
            }

            if (CommonHelper.EnsureNotNull(txtEmail.Text) == String.Empty)
            {
                lblEmailError.Text    = ResourceHelper.GetResoureValue("EmailErrorMsg");
                lblEmailError.Visible = true;
                _bError = true;
            }
            else
            {
                if (!CommonHelper.IsValidEmail(txtEmail.Text))
                {
                    lblEmailError.Text    = ResourceHelper.GetResoureValue("EmailValidationErrorMsg");
                    lblEmailError.Visible = true;
                    _bError = true;
                }
                else
                {
                    lblEmailError.Visible = false;
                }
            }

            SitePreference sitePrefCache = CSFactory.GetCacheSitePref();

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

            if (sitePrefCache.GetAttributeValue <bool>("DuplicateOrderCheck", true))
            {
                if (DuplicateOrderDAL.IsDuplicateOrder(txtEmail.Text))
                {
                    lblEmailError.Text    = ResourceHelper.GetResoureValue("DuplicateEmailCheck") + "<br /><br />";
                    lblEmailError.Visible = true;
                    _bError = true;
                }
                else
                {
                    lblEmailError.Visible = false;
                }
            }
            if (ddlQuantityList.SelectedValue.Equals("select"))
            {
                lblQuantityList.Text    = ResourceHelper.GetResoureValue("QuantityErrorMsg");
                lblQuantityList.Visible = true;
                _bError = true;
            }
            else
            {
                lblQuantityList.Visible = false;
            }


            return(_bError);
        }
        public bool validateInput()
        {
            string strPhoneNum = txtPhoneNumber.Text;

            if (!CommonHelper.IsValidPhone(strPhoneNum))
            {
                lblPhoneNumberError.Text    = ResourceHelper.GetResoureValue("PhoneNumberErrorMsg");
                lblPhoneNumberError.Visible = true;
                _bError = true;
            }
            else
            {
                lblPhoneNumberError.Visible = false;
            }

            if (CommonHelper.EnsureNotNull(txtShippingZipCode.Value) != String.Empty)
            {
                if (ddlShippingCountry.SelectedValue.Contains("231"))
                {
                    if (!CommonHelper.IsValidZipCode(txtShippingZipCode.Value))
                    {
                        lblShippingZiPError.Text    = ResourceHelper.GetResoureValue("ShippingZipCodeValidationErrorMsg");
                        lblShippingZiPError.Visible = true;
                        _bError = true;
                    }
                    else
                    {
                        lblShippingZiPError.Visible = false;
                    }
                }
                else
                {
                    if (!CommonHelper.IsValidZipCodeCanadian(txtShippingZipCode.Value))
                    {
                        lblShippingZiPError.Text    = ResourceHelper.GetResoureValue("ShippingZipCodeValidationErrorMsg");
                        lblShippingZiPError.Visible = true;
                        _bError = true;
                    }
                    else
                    {
                        lblShippingZiPError.Visible = false;
                    }
                }
            }



            SitePreference sitePrefCache = CSFactory.GetCacheSitePref();

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

            if (sitePrefCache.GetAttributeValue <bool>("DuplicateOrderCheck", true))
            {
                if (DuplicateOrderDAL.IsDuplicateOrder(txtEmail.Text))
                {
                    lblEmailError.Text    = ResourceHelper.GetResoureValue("DuplicateEmailCheck") + "<br /><br />";
                    lblEmailError.Visible = true;
                    _bError = true;
                }
                else
                {
                    lblEmailError.Visible = false;
                }
            }
            if (pnlQuantity.Visible)
            {
                if (ddlQuantityList.SelectedValue.Equals("select"))
                {
                    lblQuantityList.Text    = ResourceHelper.GetResoureValue("QuantityErrorMsg");
                    lblQuantityList.Visible = true;
                    _bError = true;
                }
                else
                {
                    lblQuantityList.Visible = false;
                }
            }

            return(_bError);
        }