Exemple #1
0
        private void btnAdd_Click(object sender, EventArgs e)
        {
            var frmDetail    = new DistrictDetailForm(true);
            var dialogResult = frmDetail.ShowDialog();

            if (dialogResult == DialogResult.OK)
            {
                MessageBox.Show(@"Successfully added district", @"Message", MessageBoxButtons.OK, MessageBoxIcon.Information);
                SearchDistrictInformations();
            }
        }
Exemple #2
0
        private void btnEdit_Click(object sender, EventArgs e)
        {
            var districtViewModel = grdDistrict.SelectedRows[0].DataBoundItem as DistrictViewModel;

            if (districtViewModel != null)
            {
                var frmDetail    = new DistrictDetailForm(false, districtViewModel.DistrictCode);
                var dialogResult = frmDetail.ShowDialog();
                if (dialogResult == DialogResult.OK)
                {
                    MessageBox.Show(@"Successfully edited the district", @"Message", MessageBoxButtons.OK, MessageBoxIcon.Information);
                    SearchDistrictInformations();
                }
            }
        }
Exemple #3
0
 private void btnView_Click(object sender, EventArgs e)
 {
     if (grdDistrict.SelectedRows.Count > 0)
     {
         var districtViewModel = grdDistrict.SelectedRows[0].DataBoundItem as DistrictViewModel;
         if (districtViewModel != null)
         {
             var frmDetail = new DistrictDetailForm(EditMode.View, districtViewModel.DistrictCode);
             frmDetail.ShowDialog();
         }
     }
     else
     {
         MessageBox.Show(@"Please select a district to view details", @"Message", MessageBoxButtons.OK, MessageBoxIcon.Exclamation);
     }
 }