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);
        }
예제 #2
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);
        }
예제 #3
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);
        }
예제 #4
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);
        }
예제 #5
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);
        }
예제 #6
0
        public static bool ProcessOrder(int orderId)
        {
            try
            {
                if (orderId <= 0)
                {
                    throw new Exception("Invalid Order ID!");
                }

                Order orderData = CSResolve.Resolve <IOrderService>().GetOrderDetails(orderId, true);

                if (orderData.OrderStatusId == 2)
                {
                    return(true);
                } //throw new Exception("Order Already Processed!"); ;

                if (orderData.OrderStatusId != 5)
                {
                    if (OrderHelper.IsCustomerOrderFlowCompleted(orderData.OrderId))
                    {
                        return(true);
                    }
                }
                //Calculate order tax
                //Simpova.CalculateTax(orderId);

                if (orderData.OrderStatusId == 5)
                {
                    decimal tax = new DuplicateOrderDAL().CalculateTax(orderData);
                    CSResolve.Resolve <IOrderService>().UpdateOrderTax(orderId, tax);
                }

                string[] testCreditCards;
                testCreditCards = ResourceHelper.GetResoureValue("TestCreditCard").Split(new char[] { ',' }, StringSplitOptions.RemoveEmptyEntries);;
                foreach (string word in testCreditCards)
                {
                    if (orderData.CreditInfo.CreditCardNumber.Equals(word))
                    {
                        CSResolve.Resolve <IOrderService>().UpdateOrderStatus(orderData.OrderId, 7);
                        return(true);
                    }
                }
                bool authSuccess = false;
                // Check if payment gateway service is enabled or not.
                if (CSFactory.GetCacheSitePref().PaymentGatewayService)
                {
                    try
                    {
                        authSuccess = orderData.OrderStatusId == 4 ||
                                      orderData.OrderStatusId == 5 || // fulfillment failure (fulfillment was attempted after payment success), so don't charge again.
                                      OrderHelper.AuthorizeOrder(orderId);
                        if (!authSuccess)
                        {
                            OrderHelper.SendOrderDeclinedEmail(orderId);
                        }
                    }
                    catch (Exception ex)
                    {
                        CSLogger.Instance.LogException("AuthorizeOrder - auth error - orderid: " + Convert.ToString(orderId), ex);
                    }
                }
                else
                {
                    authSuccess = true;
                }

                string[] successCards;
                successCards = ResourceHelper.GetResoureValue("SuccessCard").Split(new char[] { ',' }, StringSplitOptions.RemoveEmptyEntries);;
                foreach (string successCard in successCards)
                {
                    if (orderData.CreditInfo.CreditCardNumber.Equals(successCard))
                    {
                        authSuccess = true;
                    }
                }

                if (authSuccess)
                {
                    // Check if fulfillment gateway service is enabled or not.
                    if (CSFactory.GetCacheSitePref().FulfillmentHouseService)
                    {
                        try
                        {
                            new FulfillmentHouse.MVISOrderLogix().PostOrder(orderId);
                            //Add fullfillment Order Post method
                        }
                        catch (Exception ex)
                        {
                            CSLogger.Instance.LogException("Fullfilment Error - orderid: " + Convert.ToString(orderId), ex);
                            OrderHelper.SendEmailToAdmins(orderId);
                        }
                        try
                        {
                            string token  = CSWeb.App_Code.Yotpo.Authentication();
                            var    result = CSWeb.App_Code.Yotpo.Subscribe(orderId, token);
                        }
                        catch
                        { }
                        return(true);
                    }
                    return(true);
                }
            }
            catch (Exception ex)
            {
                CSLogger.Instance.LogException("Batch error - ProcessOrder OrderID " + orderId.ToString(), ex);
                //OrderHelper.SendOrderFailedEmail(orderId,"custom",ex.Message);
            }
            return(false);
        }
        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);
        }