private void btnSrcAdd_Click(object sender, EventArgs e)
 {
     using (frmSourceAddEdit frmAddEdit = new frmSourceAddEdit(0, maskingSource, ""))
     {
         DialogResult dR = frmAddEdit.ShowDialog();
         if (dR == DialogResult.OK)
         {
             SaveAndReloadChangesToGrid();
         }
         else if (dR == DialogResult.No)
         {
             this.BindingContext[dtConfiguration].EndCurrentEdit();
             SaveAndReloadChangesToGrid();
         }
     }
 }
 private void btnSrcEdit_Click(object sender, EventArgs e)
 {
     if (this.dgvSource.SelectedRows.Count <= 0)
     {
         MessageBox.Show("Please select any record to edit.", Constants.MessageBoxTitle, MessageBoxButtons.OK, MessageBoxIcon.Error);
     }
     else
     {
         int    SourceId        = Convert.ToInt32(dgvSource.SelectedRows[0].Cells["SourceId"].Value);
         string SubType         = Convert.ToString(dgvSource.SelectedRows[0].Cells["SubType"].Value);
         int    configurationId = dgvConfiguration.SelectedRows.Count > 0 ?
                                  Convert.ToInt32(dgvConfiguration.SelectedRows[0].Cells["ConfigurationId"].Value) : 0;
         using (frmSourceAddEdit frmAddEdit = new frmSourceAddEdit(SourceId, maskingSource, SubType))
         {
             DialogResult dR = frmAddEdit.ShowDialog();
             if (dR == DialogResult.OK)
             {
                 SaveAndReloadChangesToGrid(SourceId, configurationId);
             }
         }
     }
 }