コード例 #1
0
        private void LoadAllAvailableCountriesAndAssignRegistriesForAddresses()
        {
            List <CountryAddressDTO> countries = CountryAddressDTO.GetAllCountries();

            ctrlAddress.Countries         = countries;
            ctrlAddress.RegisterCountries = true;
        }
コード例 #2
0
        /// <summary>
        /// Checked Address Information based on Address Type
        /// And Validate
        /// </summary>
        /// <param name="thisAddress">Address Information</param>
        /// <param name="type">[Enum] Address Type</param>
        /// <returns>bool: true/false</returns>
        public bool CheckToValidate(Address thisAddress, AddressTypes type)
        {
            // For AddressType Objects
            Address billingAddress  = null;
            Address shippingAddress = null;

            bool retCheck = false;

            if (type == AddressTypes.Billing)
            {
                thisAddress.CardName   = ctrlAddress.AccountName;
                this.hidBillCtrl.Value = string.Concat(ctrlAddress.FindControl("WithStateCity").ClientID.ToString(), "*", ctrlAddress.FindControl("WithStatePostalCode").ClientID.ToString(), "*ctrlBillingAddress_WithStateState", "*", ctrlAddress.FindControl("WithoutStateCity").ClientID.ToString(), "*", ctrlAddress.FindControl("WithoutStatePostalCode").ClientID.ToString());
                var billCountry = CountryAddressDTO.Find(thisAddress.Country);
                billingAddress             = thisAddress;
                this.hidBillCheck.Value    = CommonLogic.CheckIfAddressIsCorrect(thisAddress, billCountry);
                this.hidBlnWithState.Value = billCountry.withState.ToString();
            }
            else
            {
                this.hidShipCtrl.Value = string.Concat(ctrlAddress.FindControl("WithStateCity").ClientID.ToString(), "*", ctrlAddress.FindControl("WithStatePostalCode").ClientID.ToString(), "*ctrlShippingAddress_WithStateState", "*", ctrlAddress.FindControl("WithoutStateCity").ClientID.ToString(), "*", ctrlAddress.FindControl("WithoutStatePostalCode").ClientID.ToString());
                var shipCountry = CountryAddressDTO.Find(thisAddress.Country);
                shippingAddress            = thisAddress;
                this.hidShipCheck.Value    = CommonLogic.CheckIfAddressIsCorrect(thisAddress, shipCountry);
                this.hidShpWithState.Value = shipCountry.withState.ToString();
            }

            DisplayErrorIfAny(type);

            // Checked if either Billing Address or Shipping Address is Correct
            if (!string.IsNullOrEmpty(this.hidBillCheck.Value) || !string.IsNullOrEmpty(this.hidShipCheck.Value))
            {
                // Set the PopUp window to Show Up
                hidValid.Value = "false";
                retCheck       = true;

                hidSkinID.Value = ThisCustomer.SkinID.ToString();
                hidLocale.Value = ThisCustomer.LocaleSetting.ToString();

                if (AddressType == AddressTypes.Billing)
                {
                    this.hidBillTitle.Value = string.Concat(AppLogic.GetString("createaccount.aspx.87", ThisCustomer.SkinID, ThisCustomer.LocaleSetting));

                    this.hidBlnState.Value      = billingAddress.State;
                    this.hidBlnPostalCode.Value = billingAddress.PostalCode;
                    this.hidBlnCountry.Value    = billingAddress.Country;
                    this.hidBlnCity.Value       = billingAddress.City;
                }
                else
                {
                    this.hidShipTitle.Value = string.Concat(AppLogic.GetString("createaccount.aspx.88", ThisCustomer.SkinID, ThisCustomer.LocaleSetting));

                    this.hidShpState.Value      = shippingAddress.State;
                    this.hidShpPostalCode.Value = shippingAddress.PostalCode;
                    this.hidShpCountry.Value    = shippingAddress.Country;
                    this.hidShpCity.Value       = shippingAddress.City;
                }
            }

            return(retCheck);
        }
コード例 #3
0
        private void LoadAllAvailableCountriesAndAssignRegistriesForAddresses(AddressControl2 ctrlShippingAddress)
        {
            if (null == _countries || _countries.Count == 0)
            {
                _countries = CountryAddressDTO.GetAllCountries();
            }

            ctrlShippingAddress.Countries         = _countries;
            ctrlShippingAddress.RegisterCountries = shouldRegisterAddressCountries;

            // avoid re-registering
            shouldRegisterAddressCountries = false;
        }
コード例 #4
0
        /// <summary>
        /// Saving/Updating of Editted Address
        /// </summary>
        /// <param name="sender"></param>
        /// <param name="e"></param>
        public void btnSaveAddress_Click(object sender, EventArgs e)
        {
            if (this.IsValid)
            {
                ThisCustomer.RequireCustomerRecord();

                Address thisAddress = Address.Get(ThisCustomer, AddressType, AddressID);

                thisAddress.Name          = ctrlAddress.AccountName;
                thisAddress.Country       = ctrlAddress.CountryCode;
                thisAddress.Address1      = ctrlAddress.Address;
                thisAddress.ResidenceType = ctrlAddress.ResidenceType;
                ThisCustomer.BusinessType = ctrlAddress.BusinessType;
                ThisCustomer.TaxNumber    = ctrlAddress.TaxNumber;
                thisAddress.City          = ctrlAddress.City;
                thisAddress.State         = ctrlAddress.State;
                thisAddress.PostalCode    = ctrlAddress.PostalCode;
                thisAddress.County        = ctrlAddress.County;
                thisAddress.Phone         = ctrlAddress.PhoneNumber;

                Address billingAddress  = null;
                Address shippingAddress = null;

                if (AddressType == AddressTypes.Billing)
                {
                    thisAddress.CardName   = ctrlAddress.AccountName;
                    this.hidBillCtrl.Value = string.Concat(ctrlAddress.FindControl("WithStateCity").ClientID.ToString(), "*", ctrlAddress.FindControl("WithStatePostalCode").ClientID.ToString(), "*ctrlBillingAddress_WithStateState", "*", ctrlAddress.FindControl("WithoutStateCity").ClientID.ToString(), "*", ctrlAddress.FindControl("WithoutStatePostalCode").ClientID.ToString());
                    CountryAddressDTO billCountry = CountryAddressDTO.Find(thisAddress.Country);

                    // Checked to see if Country selected is 'WithState'
                    //if (billCountry.withState)
                    //{
                    billingAddress             = thisAddress;
                    this.hidBillCheck.Value    = CommonLogic.CheckIfAddressIsCorrect(thisAddress, billCountry);
                    this.hidBlnWithState.Value = billCountry.withState.ToString();
                    //}
                }
                else
                {
                    this.hidShipCtrl.Value = string.Concat(ctrlAddress.FindControl("WithStateCity").ClientID.ToString(), "*", ctrlAddress.FindControl("WithStatePostalCode").ClientID.ToString(), "*ctrlShippingAddress_WithStateState", "*", ctrlAddress.FindControl("WithoutStateCity").ClientID.ToString(), "*", ctrlAddress.FindControl("WithoutStatePostalCode").ClientID.ToString());
                    CountryAddressDTO shipCountry = CountryAddressDTO.Find(thisAddress.Country);
                    shippingAddress            = thisAddress;
                    this.hidShipCheck.Value    = CommonLogic.CheckIfAddressIsCorrect(thisAddress, shipCountry);
                    this.hidShpWithState.Value = shipCountry.withState.ToString();
                }

                DisplayErrorIfAny(AddressType);

                // Checked if either Billing Address or Shipping Address is Correct
                if (!string.IsNullOrEmpty(this.hidBillCheck.Value) || !string.IsNullOrEmpty(this.hidShipCheck.Value))
                {
                    // Set the PopUp window to Show Up
                    hidValid.Value = "false";

                    hidSkinID.Value = ThisCustomer.SkinID.ToString();
                    hidLocale.Value = ThisCustomer.LocaleSetting.ToString();

                    if (AddressType == AddressTypes.Billing)
                    {
                        this.hidBillTitle.Value = string.Concat(AppLogic.GetString("createaccount.aspx.87", ThisCustomer.SkinID, ThisCustomer.LocaleSetting));

                        this.hidBlnState.Value      = billingAddress.State;
                        this.hidBlnPostalCode.Value = billingAddress.PostalCode;
                        this.hidBlnCountry.Value    = billingAddress.Country;
                        this.hidBlnCity.Value       = billingAddress.City;
                    }
                    else
                    {
                        this.hidShipTitle.Value = string.Concat(AppLogic.GetString("createaccount.aspx.88", ThisCustomer.SkinID, ThisCustomer.LocaleSetting));

                        this.hidShpState.Value      = shippingAddress.State;
                        this.hidShpPostalCode.Value = shippingAddress.PostalCode;
                        this.hidShpCountry.Value    = shippingAddress.Country;
                        this.hidShpCity.Value       = shippingAddress.City;
                    }



                    // No need for Billing Address if blank
                    if (billingAddress != null)
                    {
                        this.hidBillTitle.Value = string.Concat(AppLogic.GetString("createaccount.aspx.87", ThisCustomer.SkinID, ThisCustomer.LocaleSetting));
                    }

                    // No need for Shipping Address if blank
                    if (shippingAddress != null)
                    {
                        this.hidShipTitle.Value = string.Concat(AppLogic.GetString("createaccount.aspx.88", ThisCustomer.SkinID, ThisCustomer.LocaleSetting));
                    }
                }
                else
                {
                    Address.Update(ThisCustomer, thisAddress);
                    Response.Redirect(String.Format("selectaddress.aspx?Checkout={0}&AddressType={1}", checkOutMode.ToString(), AddressType));
                }
            }
        }