Ejemplo n.º 1
0
        protected void btnNew_Click(object sender, ImageClickEventArgs e)
        {
            this.MessageBox1.ClearMessage();

            Zone z = new Zone();
            z.Name = this.NewZoneField.Text.Trim();
            z.StoreId = MTApp.CurrentStore.Id;
            if (z.IsValid())
            {
                if (MTApp.OrderServices.ShippingZones.Create(z))
                {
                    this.MessageBox1.ShowOk("Zone Created");
                }
                else
                {
                    this.MessageBox1.ShowWarning("Unable to create zone");
                }
            }
            else
            {
                this.MessageBox1.RenderViolations(z.GetRuleViolations());
            }

            LoadZones();
        }
Ejemplo n.º 2
0
 public static Zone UnitedStatesAll()
 {
     Zone usAll = new Zone();
     usAll.Id = -100;
     usAll.Name = "United States - All";
     usAll.Areas.Add(new ZoneArea() { CountryIsoAlpha3 = "USA", RegionAbbreviation = "" });
     return usAll;
 }
 private void LoadZone(long id)
 {
     zone = MTApp.OrderServices.ShippingZones.Find(id);
     if (zone.StoreId == MTApp.CurrentStore.Id)
     {
         this.ZoneNameField.Text = zone.Name;
         LoadAreas(zone);
     }
     else
     {
         Response.Redirect("Shipping_Zones.aspx");
     }
 }
        protected override void OnLoad(EventArgs e)
        {
            base.OnLoad(e);
            msg.ClearMessage();

            zone = new Zone();

            if (!Page.IsPostBack)
            {

                string id = Request.QueryString["id"];

                PopulateCountries();
                string homeCountry = WebAppSettings.ApplicationCountryBvin;
                lstCountry.SelectedValue = homeCountry;
                PopulateRegions(lstCountry.SelectedItem.Value);

                LoadZone(long.Parse(id));

            }
        }
 private void LoadAreas(Zone z)
 {
     this.litAreas.Text = string.Empty;
     foreach (ZoneArea a in z.Areas)
     {
         RenderArea(a, z.Id);
     }
 }
        protected void btnNew_Click(object sender, System.Web.UI.ImageClickEventArgs e)
        {
            string zid = Request.QueryString["id"];
            long zoneId = long.Parse(zid);
            zone = MTApp.OrderServices.ShippingZones.Find(zoneId);

            ZoneArea a = new ZoneArea();
            a.CountryIsoAlpha3 = this.lstCountry.SelectedItem.Value;
            a.RegionAbbreviation = this.lstState.SelectedItem.Value;

            zone.Areas.Add(a);
            MTApp.OrderServices.ShippingZones.Update(zone);
            LoadZone(zone.Id);
        }
 private bool Save()
 {
     string ids = Request.QueryString["id"];
     long id = long.Parse(ids);
     zone = MTApp.OrderServices.ShippingZones.Find(id);
     zone.Name = this.ZoneNameField.Text;
     return MTApp.OrderServices.ShippingZones.Update(zone);
 }
Ejemplo n.º 8
0
        public static Zone UnitedStates48Contiguous()
        {
            Zone us48 = new Zone();
            us48.Id = -101;
            us48.Name = "United States - 48 contiguous states";

            us48.Areas.Add(new ZoneArea() { CountryIsoAlpha3 = "USA", RegionAbbreviation = "AL" });
            us48.Areas.Add(new ZoneArea() { CountryIsoAlpha3 = "USA", RegionAbbreviation = "AZ" });
            us48.Areas.Add(new ZoneArea() { CountryIsoAlpha3 = "USA", RegionAbbreviation = "AR" });
            us48.Areas.Add(new ZoneArea() { CountryIsoAlpha3 = "USA", RegionAbbreviation = "AE" });
            us48.Areas.Add(new ZoneArea() { CountryIsoAlpha3 = "USA", RegionAbbreviation = "AA" });
            us48.Areas.Add(new ZoneArea() { CountryIsoAlpha3 = "USA", RegionAbbreviation = "AE" });
            us48.Areas.Add(new ZoneArea() { CountryIsoAlpha3 = "USA", RegionAbbreviation = "AP" });
            us48.Areas.Add(new ZoneArea() { CountryIsoAlpha3 = "USA", RegionAbbreviation = "CA" });
            us48.Areas.Add(new ZoneArea() { CountryIsoAlpha3 = "USA", RegionAbbreviation = "CO" });
            us48.Areas.Add(new ZoneArea() { CountryIsoAlpha3 = "USA", RegionAbbreviation = "CT" });
            us48.Areas.Add(new ZoneArea() { CountryIsoAlpha3 = "USA", RegionAbbreviation = "DE" });
            us48.Areas.Add(new ZoneArea() { CountryIsoAlpha3 = "USA", RegionAbbreviation = "DC" });
            us48.Areas.Add(new ZoneArea() { CountryIsoAlpha3 = "USA", RegionAbbreviation = "FL" });
            us48.Areas.Add(new ZoneArea() { CountryIsoAlpha3 = "USA", RegionAbbreviation = "GA" });
            us48.Areas.Add(new ZoneArea() { CountryIsoAlpha3 = "USA", RegionAbbreviation = "ID" });
            us48.Areas.Add(new ZoneArea() { CountryIsoAlpha3 = "USA", RegionAbbreviation = "IL" });
            us48.Areas.Add(new ZoneArea() { CountryIsoAlpha3 = "USA", RegionAbbreviation = "IN" });
            us48.Areas.Add(new ZoneArea() { CountryIsoAlpha3 = "USA", RegionAbbreviation = "IA" });
            us48.Areas.Add(new ZoneArea() { CountryIsoAlpha3 = "USA", RegionAbbreviation = "KS" });
            us48.Areas.Add(new ZoneArea() { CountryIsoAlpha3 = "USA", RegionAbbreviation = "KY" });
            us48.Areas.Add(new ZoneArea() { CountryIsoAlpha3 = "USA", RegionAbbreviation = "LA" });
            us48.Areas.Add(new ZoneArea() { CountryIsoAlpha3 = "USA", RegionAbbreviation = "ME" });
            us48.Areas.Add(new ZoneArea() { CountryIsoAlpha3 = "USA", RegionAbbreviation = "MD" });
            us48.Areas.Add(new ZoneArea() { CountryIsoAlpha3 = "USA", RegionAbbreviation = "MA" });
            us48.Areas.Add(new ZoneArea() { CountryIsoAlpha3 = "USA", RegionAbbreviation = "MI" });
            us48.Areas.Add(new ZoneArea() { CountryIsoAlpha3 = "USA", RegionAbbreviation = "MN" });
            us48.Areas.Add(new ZoneArea() { CountryIsoAlpha3 = "USA", RegionAbbreviation = "MS" });
            us48.Areas.Add(new ZoneArea() { CountryIsoAlpha3 = "USA", RegionAbbreviation = "MO" });
            us48.Areas.Add(new ZoneArea() { CountryIsoAlpha3 = "USA", RegionAbbreviation = "MT" });
            us48.Areas.Add(new ZoneArea() { CountryIsoAlpha3 = "USA", RegionAbbreviation = "NE" });
            us48.Areas.Add(new ZoneArea() { CountryIsoAlpha3 = "USA", RegionAbbreviation = "NV" });
            us48.Areas.Add(new ZoneArea() { CountryIsoAlpha3 = "USA", RegionAbbreviation = "NH" });
            us48.Areas.Add(new ZoneArea() { CountryIsoAlpha3 = "USA", RegionAbbreviation = "NJ" });
            us48.Areas.Add(new ZoneArea() { CountryIsoAlpha3 = "USA", RegionAbbreviation = "NM" });
            us48.Areas.Add(new ZoneArea() { CountryIsoAlpha3 = "USA", RegionAbbreviation = "NY" });
            us48.Areas.Add(new ZoneArea() { CountryIsoAlpha3 = "USA", RegionAbbreviation = "NC" });
            us48.Areas.Add(new ZoneArea() { CountryIsoAlpha3 = "USA", RegionAbbreviation = "ND" });
            us48.Areas.Add(new ZoneArea() { CountryIsoAlpha3 = "USA", RegionAbbreviation = "OH" });
            us48.Areas.Add(new ZoneArea() { CountryIsoAlpha3 = "USA", RegionAbbreviation = "OK" });
            us48.Areas.Add(new ZoneArea() { CountryIsoAlpha3 = "USA", RegionAbbreviation = "OR" });
            us48.Areas.Add(new ZoneArea() { CountryIsoAlpha3 = "USA", RegionAbbreviation = "PA" });
            us48.Areas.Add(new ZoneArea() { CountryIsoAlpha3 = "USA", RegionAbbreviation = "RI" });
            us48.Areas.Add(new ZoneArea() { CountryIsoAlpha3 = "USA", RegionAbbreviation = "SC" });
            us48.Areas.Add(new ZoneArea() { CountryIsoAlpha3 = "USA", RegionAbbreviation = "SD" });
            us48.Areas.Add(new ZoneArea() { CountryIsoAlpha3 = "USA", RegionAbbreviation = "TN" });
            us48.Areas.Add(new ZoneArea() { CountryIsoAlpha3 = "USA", RegionAbbreviation = "TX" });
            us48.Areas.Add(new ZoneArea() { CountryIsoAlpha3 = "USA", RegionAbbreviation = "UT" });
            us48.Areas.Add(new ZoneArea() { CountryIsoAlpha3 = "USA", RegionAbbreviation = "VT" });
            us48.Areas.Add(new ZoneArea() { CountryIsoAlpha3 = "USA", RegionAbbreviation = "VA" });
            us48.Areas.Add(new ZoneArea() { CountryIsoAlpha3 = "USA", RegionAbbreviation = "WA" });
            us48.Areas.Add(new ZoneArea() { CountryIsoAlpha3 = "USA", RegionAbbreviation = "WV" });
            us48.Areas.Add(new ZoneArea() { CountryIsoAlpha3 = "USA", RegionAbbreviation = "WI" });
            us48.Areas.Add(new ZoneArea() { CountryIsoAlpha3 = "USA", RegionAbbreviation = "WY" });

            return us48;
        }
Ejemplo n.º 9
0
        public static Zone International(string homeCountryIsoAlpha3)
        {
            Zone international = new Zone();
            international.Id = -103;
            international.Name = "International";
            foreach (Country c in Country.FindAll())
            {
                if (c.IsoAlpha3.Trim().ToLowerInvariant() != homeCountryIsoAlpha3.Trim().ToLowerInvariant())
                {
                    international.Areas.Add(new ZoneArea() { CountryIsoAlpha3 = c.IsoAlpha3, RegionAbbreviation = "" });
                }
            }

            return international;
        }
Ejemplo n.º 10
0
        public static Zone UnitedStatesAlaskaAndHawaii()
        {
            Zone z = new Zone();
            z.Id = -102;
            z.Name = "United States - Alaska and Hawaii";

            z.Areas.Add(new ZoneArea() { CountryIsoAlpha3 = "USA", RegionAbbreviation = "AK" });
            z.Areas.Add(new ZoneArea() { CountryIsoAlpha3 = "USA", RegionAbbreviation = "HI" });

            return z;
        }