Exemple #1
0
        private void btnAdd_Click(object sender, EventArgs e)
        {
            var frmDetail = new DistrictDetailForm(_cityRepository, _districtRepository);

            frmDetail.Text = "Add new District";
            frmDetail.ShowDialog();
        }
Exemple #2
0
 private void btnEdit_Click(object sender, EventArgs e)
 {
     if (dataGridView1.SelectedRows.Count > 0)
     {
         var districtViewModel = dataGridView1.SelectedRows[0].DataBoundItem as DistrictViewModel;
         if (districtViewModel != null)
         {
             var frmDetail = new DistrictDetailForm(_cityRepository, _districtRepository, districtViewModel.DistrictCode);
             frmDetail.Text = "Edit district ";
             frmDetail.ShowDialog();
         }
     }
     else
     {
         MessageBox.Show("Please select a district to edit", "Warning", MessageBoxButtons.OK, MessageBoxIcon.Exclamation);
     }
 }