예제 #1
0
        protected void AddShipZoneButton_Click(object sender, EventArgs e)
        {
            ShipZone shipZone = new ShipZone();

            shipZone.Name = AddShipZoneName.Text;
            shipZone.Save();
            Response.Redirect("EditShipZone.aspx?ShipZoneId=" + shipZone.Id.ToString());
        }
예제 #2
0
        protected void ChangeCountryListOKButton_Click(object sender, System.EventArgs e)
        {
            string controlName = HiddenSelectedCountries.UniqueID;
            string postedValue = Request.Form[controlName];

            //REMOVE ALL COUNTRIES ASSOCIATED WITH SHIPZONE
            _ShipZone.Countries.Clear();
            _ShipZone.Save();
            if (!string.IsNullOrEmpty(postedValue))
            {
                //GET LIST OF VALID COUNTRY CODES
                List <string> validCountryCodes = GetValidCountryCodes();
                //ADD SELECTED COUNTRIES BACK IN
                string[] postedCountryCodes = postedValue.Split(",".ToCharArray());
                foreach (string tempCode in postedCountryCodes)
                {
                    string countryCode = tempCode.Trim();
                    if (validCountryCodes.Contains(countryCode))
                    {
                        Country country = CountryDataSource.Load(countryCode);
                        _ShipZone.Countries.Add(country);
                    }
                }
                _ShipZone.Save();
            }
            CountryList.Text = GetCountryList();
        }
예제 #3
0
 protected void ShipZoneGrid_RowCommand(object sender, GridViewCommandEventArgs e)
 {
     if (e.CommandName == "Copy")
     {
         int      shipZoneId = (int)ShipZoneGrid.DataKeys[Int32.Parse(e.CommandArgument.ToString())].Value;
         ShipZone copy       = ShipZone.Copy(shipZoneId, true);
         if (copy != null)
         {
             // THE NAME SHOULD NOT EXCEED THE MAX 255 CHARS
             String newName = "Copy of " + copy.Name;
             if (newName.Length > 255)
             {
                 newName = newName.Substring(0, 252) + "...";
             }
             copy.Name = newName;
             copy.Save();
             ShipZoneGrid.DataBind();
         }
     }
 }