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

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


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


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

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

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

                            SaveContact(this.txtEmail.Text);
                            this.txtEmail.Text = "";
                            lblmsg.Visible     = true;
                        }
                        else
                        {
                            this.txtEmail.Text = "";
                            lblmsg.Visible     = true;
                            lblmsg.ForeColor   = System.Drawing.Color.Red;
                            lblmsg.Text        = "Email address entered is already registered";
                        }
                    }
                }
                else
                {
                    lblmsg.Visible   = true;
                    lblmsg.ForeColor = System.Drawing.Color.Red;
                    lblmsg.Text      = "Please enter a valid email address";
                }
            }
            else
            {
                lblmsg.Visible   = true;
                lblmsg.Text      = "Please enter an email address";
                lblmsg.ForeColor = System.Drawing.Color.Red;
            }
        }
        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 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);
        }
        public static string GetPrivacyPolicy()
        {
            SitePreference sitePref = CSFactory.GetCacheSitePref();

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

            return(sitePref.GetAttributeValue <string>("privacypolicy", string.Empty));
        }
        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);
        }
Example #6
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);
        }
Example #7
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);
        }
Example #8
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);
        }
Example #9
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);
        }
Example #10
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);
        }
        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);
        }