private IList <Country> GetProvinceCountries() { if (_ShipZone.CountryRule == FilterRule.All) { return(CountryDataSource.LoadAll()); } IList <Country> includedCountries = new List <Country>(); if (_ShipZone.CountryRule == FilterRule.IncludeSelected) { foreach (Country country in _ShipZone.Countries) { includedCountries.Add(country); } } else { IList <Country> allCountries = CountryDataSource.LoadAll(); foreach (Country c in allCountries) { if (_ShipZone.Countries.IndexOf(c) < 0) { includedCountries.Add(c); } } } return(includedCountries); }
protected void Page_Load(object sender, EventArgs e) { if (!Page.IsPostBack) { // set default start/end date range // use query parameters if found, otherwise default to start beginning of current month ending current day DateTime localNow = LocaleHelper.LocalNow; StartDate.SelectedDate = AlwaysConvert.ToDateTime(Request.QueryString["SDate"], new DateTime(localNow.Year, localNow.Month, 1)); EndDate.SelectedDate = AlwaysConvert.ToDateTime(Request.QueryString["EDate"], new DateTime(localNow.Year, localNow.Month, DateTime.DaysInMonth(localNow.Year, localNow.Month))); // set up country list list_Country.DataSource = CountryDataSource.LoadAll(); list_Country.DataTextField = "Name"; list_Country.DataValueField = "CountryCode"; list_Country.DataBind(); // set country to default to primary warehouse country string defCountry = Request.QueryString["CountryCode"]; if (string.IsNullOrEmpty(defCountry)) { defCountry = AbleContext.Current.Store.DefaultWarehouse.CountryCode; } ListItem findItem = list_Country.Items.FindByValue(defCountry); if (findItem != null) { list_Country.SelectedIndex = list_Country.Items.IndexOf(findItem); } // fire immediate report ProcessButton_Click(null, null); } }
protected void Page_Init(object sender, EventArgs e) { _subscriptionId = AlwaysConvert.ToInt(Request.QueryString["SubscriptionId"]); _subscription = SubscriptionDataSource.Load(_subscriptionId); CountryCode.DataSource = CountryDataSource.LoadAll("Name"); CountryCode.DataBind(); //INIT ADDRESS Address address = _subscription.GetShippingAddress(); FirstName.Text = address.FirstName; LastName.Text = address.LastName; Company.Text = address.Company; Address1.Text = address.Address1; Address2.Text = address.Address2; City.Text = address.City; Province.Text = address.Province; PostalCode.Text = address.PostalCode; ListItem selectedCountry = CountryCode.Items.FindByValue(AbleContext.Current.Store.DefaultWarehouse.CountryCode); if (!String.IsNullOrEmpty(address.CountryCode)) { selectedCountry = CountryCode.Items.FindByValue(address.CountryCode.ToString()); } if (selectedCountry != null) { CountryCode.SelectedIndex = CountryCode.Items.IndexOf(selectedCountry); } Phone.Text = address.Phone; Fax.Text = address.Fax; Residence.SelectedIndex = (address.Residence ? 0 : 1); }
protected void Page_Init(object sender, EventArgs e) { InitAddressBook(); Country.DataSource = CountryDataSource.LoadAll("Name"); Country.DataBind(); //LOAD VIEW STATE LoadCustomViewState(); }
protected void Page_Init(object sender, EventArgs e) { _userId = AlwaysConvert.ToInt(Request.QueryString["UserId"]); _User = UserDataSource.Load(_userId); CountryCode.DataSource = CountryDataSource.LoadAll("Name"); CountryCode.DataBind(); BindShippingAddresses(true); }
protected void Page_Init(object sender, EventArgs e) { _settings = AbleContext.Current.Store.Settings; if (AbleContext.Current.User.Basket.Items.Count == 0) { Response.Redirect(AbleCommerce.Code.NavigationHelper.GetBasketUrl()); } Country.DataSource = CountryDataSource.LoadAll(); Country.DataBind(); }
private List <string> GetValidCountryCodes() { List <string> allCountryCodes = new List <string>(); IList <Country> allCountries = CountryDataSource.LoadAll(); foreach (Country c in allCountries) { allCountryCodes.Add(c.Id); } return(allCountryCodes); }
protected void Page_Init(object sender, EventArgs e) { this.TrackViewState(); Country.DataSource = CountryDataSource.LoadAll(); Country.DataBind(); _Basket = AbleContext.Current.User.Basket; if (_Basket.Items.Count == 0) { Response.Redirect(NavigationHelper.GetMobileStoreUrl("~/Basket.aspx")); } }
protected void Page_Init(object sender, System.EventArgs e) { Country.DataSource = CountryDataSource.LoadAll(); Country.DataBind(); AbleCommerce.Code.PageHelper.ConvertEnterToTab(Name); AbleCommerce.Code.PageHelper.ConvertEnterToTab(Address1); AbleCommerce.Code.PageHelper.ConvertEnterToTab(Address2); AbleCommerce.Code.PageHelper.ConvertEnterToTab(City); AbleCommerce.Code.PageHelper.ConvertEnterToTab(Province); AbleCommerce.Code.PageHelper.ConvertEnterToTab(Province2); AbleCommerce.Code.PageHelper.ConvertEnterToTab(PostalCode); AbleCommerce.Code.PageHelper.ConvertEnterToTab(Country); AbleCommerce.Code.PageHelper.ConvertEnterToTab(Phone); AbleCommerce.Code.PageHelper.ConvertEnterToTab(Fax); AbleCommerce.Code.PageHelper.SetDefaultButton(Email, SaveButton.ClientID); }
protected void DoLoad(bool external) { _address = AddressDataSource.Load(AddressId); if (_address == null) { _address = new Address(); } if (!string.IsNullOrEmpty(ValidationGroupName)) { EmailAddressValid.ValidationGroup = ValidationGroupName; FirstNameRequired.ValidationGroup = ValidationGroupName; LastNameRequired.ValidationGroup = ValidationGroupName; Address1Required.ValidationGroup = ValidationGroupName; CityRequired.ValidationGroup = ValidationGroupName; PostalCodeRequired.ValidationGroup = ValidationGroupName; Province2Invalid.ValidationGroup = ValidationGroupName; Province2Required.ValidationGroup = ValidationGroupName; TelephoneRequired.ValidationGroup = ValidationGroupName; SaveButton.ValidationGroup = ValidationGroupName; RegisterValidationSummary.ValidationGroup = ValidationGroupName; // PASSWORD FIELDS PasswordRequired.ValidationGroup = ValidationGroupName; ConfirmPasswordRequired.ValidationGroup = ValidationGroupName; PasswordCompare.ValidationGroup = ValidationGroupName; DuplicateEmailValidator.ValidationGroup = ValidationGroupName; InvalidRegistration.ValidationGroup = ValidationGroupName; } if (!Page.IsPostBack || external) { Country.DataSource = CountryDataSource.LoadAll(); Country.DataBind(); InitAddressForm(); } // handle create account options CreateAccountUpdatePanel.Visible = AbleContext.Current.User.IsAnonymousOrGuest; if (CreateAccountUpdatePanel.Visible) { ShowPasswordPolicy(); } }
private void InitializeChangeCountryDialog() { AvailableCountries.Items.Clear(); SelectedCountries.Items.Clear(); IList <Country> allCountries = CountryDataSource.LoadAll(); foreach (Country c in allCountries) { ListItem newItem = new ListItem(c.Name, c.Id); bool countrySelected = (_ShipZone.Countries.IndexOf(c) > -1); if (countrySelected) { SelectedCountries.Items.Add(newItem); } else { AvailableCountries.Items.Add(newItem); } } }
protected void Page_Init(object sender, System.EventArgs e) { _WarehouseId = AlwaysConvert.ToInt(Request.QueryString["WarehouseId"]); _Warehouse = WarehouseDataSource.Load(_WarehouseId); if (_Warehouse == null) { RedirectMe(); } Caption.Text = string.Format(Caption.Text, _Warehouse.Name); AbleCommerce.Code.PageHelper.ConvertEnterToTab(Name); AbleCommerce.Code.PageHelper.ConvertEnterToTab(Address1); AbleCommerce.Code.PageHelper.ConvertEnterToTab(Address2); AbleCommerce.Code.PageHelper.ConvertEnterToTab(City); AbleCommerce.Code.PageHelper.ConvertEnterToTab(Province); AbleCommerce.Code.PageHelper.ConvertEnterToTab(Province2); AbleCommerce.Code.PageHelper.ConvertEnterToTab(PostalCode); AbleCommerce.Code.PageHelper.ConvertEnterToTab(Country); Country.DataSource = CountryDataSource.LoadAll(); Country.DataBind(); AbleCommerce.Code.PageHelper.ConvertEnterToTab(Phone); AbleCommerce.Code.PageHelper.ConvertEnterToTab(Fax); AbleCommerce.Code.PageHelper.SetDefaultButton(Email, SaveButton.ClientID); }
/// <summary> /// Gets a list of countries for the store, sorted by name. /// </summary> /// <returns>A list of countries for the store, sorted by name.</returns> public static IList <Country> GetCountryList() { IList <Country> countries = CountryDataSource.LoadAll("Name"); //FIND STORE COUNTRY AND COPY TO FIRST POSITION string storeCountry = AbleContext.Current.Store.DefaultWarehouse.CountryCode; if (storeCountry.Length == 0) { storeCountry = "US"; } int index = countries.IndexOf(storeCountry); if (index > -1) { Country breakItem = new Country(storeCountry); breakItem.Name = "----------"; countries.Insert(0, breakItem); countries.Insert(0, countries[index + 1]); if (storeCountry == "US") { index = countries.IndexOf("CA"); if (index > -1) { countries.Insert(1, countries[index]); } } else if (storeCountry == "CA") { index = countries.IndexOf("US"); if (index > -1) { countries.Insert(1, countries[index]); } } } return(countries); }
private void InitializeCountries() { _Countries = CountryDataSource.LoadAll("Name"); //FIND STORE COUNTRY AND COPY TO FIRST POSITION string storeCountry = AbleContext.Current.Store.DefaultWarehouse.CountryCode; if (storeCountry.Length == 0) { storeCountry = "US"; } int index = _Countries.IndexOf(storeCountry); if (index > -1) { Country breakItem = new Country(storeCountry); breakItem.Name = "----------"; _Countries.Insert(0, breakItem); _Countries.Insert(0, _Countries[index + 1]); if (storeCountry == "US") { index = _Countries.IndexOf("CA"); if (index > -1) { _Countries.Insert(1, _Countries[index]); } } else if (storeCountry == "CA") { index = _Countries.IndexOf("US"); if (index > -1) { _Countries.Insert(1, _Countries[index]); } } } }
protected void Page_Init(object sender, EventArgs e) { this.TrackViewState(); Country.DataSource = CountryDataSource.LoadAll(); Country.DataBind(); }
protected void Page_Init(object sender, EventArgs e) { settings = AbleContext.Current.Store.Settings; Country.DataSource = CountryDataSource.LoadAll(); Country.DataBind(); }
private void InitEditForm() { User user = AbleContext.Current.User; TaxId.Text = user.TaxExemptionReference; if (this.Affiliate != null) { // INITIALIZE FORM Name.Text = this.Affiliate.Name; WebsiteUrl.Text = this.Affiliate.WebsiteUrl; Email.Text = this.Affiliate.Email; FirstName.Text = this.Affiliate.FirstName; LastName.Text = this.Affiliate.LastName; Address1.Text = this.Affiliate.Address1; Address2.Text = this.Affiliate.Address2; City.Text = this.Affiliate.City; Province.Text = this.Affiliate.Province; PostalCode.Text = this.Affiliate.PostalCode; Country.DataSource = CountryDataSource.LoadAll("Name"); Country.DataBind(); if (string.IsNullOrEmpty(this.Affiliate.CountryCode)) { this.Affiliate.CountryCode = AbleContext.Current.Store.DefaultWarehouse.CountryCode; } ListItem selectedCountry = Country.Items.FindByValue(this.Affiliate.CountryCode); if (selectedCountry != null) { Country.SelectedIndex = Country.Items.IndexOf(selectedCountry); } Phone.Text = this.Affiliate.PhoneNumber; MobileNumber.Text = this.Affiliate.MobileNumber; FaxNumber.Text = this.Affiliate.FaxNumber; Company.Text = this.Affiliate.Company; InitCountryAndProvince(this.Affiliate.CountryCode, this.Affiliate.Province); } else { Name.Text = user.PrimaryAddress.FullName; FirstName.Text = user.PrimaryAddress.FirstName; LastName.Text = user.PrimaryAddress.LastName; Email.Text = user.Email; Address1.Text = user.PrimaryAddress.Address1; Address2.Text = user.PrimaryAddress.Address2; City.Text = user.PrimaryAddress.City; Province.Text = user.PrimaryAddress.Province; PostalCode.Text = user.PrimaryAddress.PostalCode; Country.DataSource = CountryDataSource.LoadAll("Name"); Country.DataBind(); if (string.IsNullOrEmpty(user.PrimaryAddress.CountryCode)) { user.PrimaryAddress.CountryCode = AbleContext.Current.Store.DefaultWarehouse.CountryCode; } ListItem selectedCountry = Country.Items.FindByValue(user.PrimaryAddress.CountryCode); if (selectedCountry != null) { Country.SelectedIndex = Country.Items.IndexOf(selectedCountry); } Phone.Text = user.PrimaryAddress.Phone; FaxNumber.Text = user.PrimaryAddress.Fax; Company.Text = user.PrimaryAddress.Company; InitCountryAndProvince(user.PrimaryAddress.CountryCode, user.PrimaryAddress.Province); } }
protected void InitEditForm() { //INITIALIZE FORM Name.Text = _Affiliate.Name; Email.Text = _Affiliate.Email; CommissionRate.Text = _Affiliate.CommissionRate.ToString("#.##"); if (!_Affiliate.CommissionIsPercent) { CommissionType.SelectedIndex = 0; } else { CommissionType.SelectedIndex = (_Affiliate.CommissionOnTotal ? 2 : 1); } WebsiteUrl.Text = _Affiliate.WebsiteUrl; ListItem selectedReferralPeriod = ReferralPeriod.Items.FindByValue(((byte)_Affiliate.ReferralPeriod).ToString()); selectedReferralPeriod.Selected = true; if (_Affiliate.ReferralPeriod != AffiliateReferralPeriod.Persistent && _Affiliate.ReferralPeriod != AffiliateReferralPeriod.FirstOrder) { ReferralDays.Text = _Affiliate.ReferralDays.ToString(); EnableReferralDaysUI(true); } else { EnableReferralDaysUI(false); } if (_Affiliate.Group != null) { AffiliateGroup.DataBind(); ListItem selectedGroup = AffiliateGroup.Items.FindByValue(_Affiliate.Group.Id.ToString()); selectedGroup.Selected = true; } //INITIALIZE ADDRESS DATA FirstName.Text = _Affiliate.FirstName; LastName.Text = _Affiliate.LastName; Company.Text = _Affiliate.Company; Address1.Text = _Affiliate.Address1; Address2.Text = _Affiliate.Address2; City.Text = _Affiliate.City; Province.Text = _Affiliate.Province; PostalCode.Text = _Affiliate.PostalCode; //INITIALIZE COUNTRY CountryCode.DataSource = CountryDataSource.LoadAll("Name"); CountryCode.DataBind(); if (string.IsNullOrEmpty(_Affiliate.CountryCode)) { _Affiliate.CountryCode = AbleContext.Current.Store.DefaultWarehouse.CountryCode; } ListItem selectedCountry = CountryCode.Items.FindByValue(_Affiliate.CountryCode); if (selectedCountry != null) { CountryCode.SelectedIndex = CountryCode.Items.IndexOf(selectedCountry); } PhoneNumber.Text = _Affiliate.PhoneNumber; FaxNumber.Text = _Affiliate.FaxNumber; MobileNumber.Text = _Affiliate.MobileNumber; User user = _Affiliate.Group != null && _Affiliate.Group.Users.Count > 0 ? _Affiliate.Group.Users[0] : null; if (user != null) { TaxId.Text = user.TaxExemptionReference; } }