Beispiel #1
0
 private void tempBtnAddCityClick(object sender, RoutedEventArgs e)
 {
     try
     {
         DataLayer dl   = new DataLayer();
         City      city = new City();
         city.cityName = txtCompanyName.Text;
         city.state    = "temp";
         city.pincode  = "000";
         city.stdCode  = "1234";
         city.country  = "India";
         Response res = dl.AddCity(city);
         if (res.success)
         {
             MessageBox.Show("City added with name " + city.cityName);
         }
         else if (res.isException)
         {
             MessageBox.Show("Cannot add : " + res.exception);
         }
     }
     catch (Exception ex)
     {
         MessageBox.Show(ex.Message);
     }
 }
        private void btnAddCity_Click(object sender, RoutedEventArgs e)
        {
            City city = new City();

            city.cityName = txtCity.Text;
            city.state    = getSelectedState().stateName;
            city.pincode  = txtPincode.Text;
            city.stdCode  = txtPhone.Text;
            city.country  = txtCountry.Text;

            DataLayer dl  = new DataLayer();
            Response  res = dl.AddCity(city);

            if (res.success)
            {
                // city addded
            }
            else if (res.isException)
            {
                MessageBox.Show(res.exception);
            }
        }