public Master.UOMMaster getUOM()
 {
     try
     {
         Master.UOMMaster obj = new Master.UOMMaster();
         DataGridViewSelectedRowCollection row = gridUOMMaster.SelectedRows;
         if (row.Count > 0)
         {
             uommaster           = uommaster.getUOM(Convert.ToInt32(row[0].Cells["UOMId"].Value));
             obj.txtUOMId.Text   = uommaster.UOMId.ToString();
             obj.txtUOMName.Text = uommaster.UOMName.ToString();
             obj.txtUnit.Text    = uommaster.Unit.ToString();
             return(obj);
         }
         else
         {
             return(new Master.UOMMaster());
         }
     }
     catch (Exception ex)
     {
         Common.showDenger(ex.Message);
         return(null);
     }
 }
 private void btnNewUOM_Click(object sender, EventArgs e)
 {
     try
     {
         Master.UOMMaster objForm = new Master.UOMMaster();
         objForm.ShowDialog();
         onPageLoad();
     }
     catch (Exception ex)
     {
         Common.showDenger(ex.Message);
     }
 }
 private void btnEditUOM_Click(object sender, EventArgs e)
 {
     try
     {
         Master.UOMMaster objForm = getUOM();
         btn             = objForm.btnSave;
         objForm.btnSave = Common.setUpdate(btn);
         objForm.ShowDialog();
         onPageLoad();
     }
     catch (Exception ex)
     {
         Common.showDenger(ex.Message);
     }
 }