Beispiel #1
0
 private void btnEditCity_Click(object sender, EventArgs e)
 {
     try
     {
         frmAddEditCity frm = new frmAddEditCity(this.SelectedCityID);
         if (frm.ShowDialog() == DialogResult.OK)
         {
             PopulateCitiesGrid();
         }
     }
     catch (Exception ex)
     {
         MessageBox.Show(ex.Message, "pageLocations::btnEditCity_Click", MessageBoxButtons.OK, MessageBoxIcon.Error);
     }
 }
Beispiel #2
0
 private void btnAddNewCity_Click(object sender, EventArgs e)
 {
     try
     {
         frmAddEditCity frm = new frmAddEditCity();
         frm.CountryID = this.selectedCountryID;
         frm.StateID   = this.selectedStateID;
         if (frm.ShowDialog() == DialogResult.OK)
         {
             selectedCityID = frm.CityID;
             PopulateCitiesDropdown();
             cboCities.SelectedItem = ((List <SelectListItem>)cboCities.DataSource).Where(x => x.ID == selectedCityID).FirstOrDefault();
         }
     }
     catch (Exception ex)
     {
         string errMessage = ex.Message;
         if (ex.InnerException != null)
         {
             errMessage += string.Format("\n{0}", ex.InnerException.Message);
         }
         MessageBox.Show(errMessage, "frmAddEditAddress::btnAddNewCity_Click", MessageBoxButtons.OK, MessageBoxIcon.Error);
     }
 }