コード例 #1
0
 private void btnEditCity_Click(object sender, EventArgs e)
 {
     if (gridCities.SelectedRows.Count == 1)
     {
         var item = (dynamic)gridCities.CurrentRow.DataBoundItem;
         var city = new City()
         {
             Name      = item.Name,
             Latitude  = item.Latitude,
             Longitude = item.Longitude,
             Demand    =
             {
                 Internet = item.Internet_Demand,
                 TV       = item.TV_Demand,
                 Phone    = item.Phone_Demand
             }
         };
         var frm = new NewCity(city);
         if (frm.ShowDialog() == DialogResult.OK)
         {
             TelcoSur.Cities[gridCities.CurrentRow.Index].Name            = frm.City.Name;
             TelcoSur.Cities[gridCities.CurrentRow.Index].Latitude        = frm.City.Latitude;
             TelcoSur.Cities[gridCities.CurrentRow.Index].Longitude       = frm.City.Longitude;
             TelcoSur.Cities[gridCities.CurrentRow.Index].Demand.Internet = frm.City.Demand.Internet;
             TelcoSur.Cities[gridCities.CurrentRow.Index].Demand.Phone    = frm.City.Demand.Phone;
             TelcoSur.Cities[gridCities.CurrentRow.Index].Demand.TV       = frm.City.Demand.TV;
             LoadConfig();
         }
     }
 }
コード例 #2
0
        private void btnNewCity_Click(object sender, EventArgs e)
        {
            var frm = new NewCity();

            if (frm.ShowDialog() == DialogResult.OK)
            {
                this.TelcoSur.Cities.Add(frm.City);
                LoadConfig();
            }
        }