private void btnDelete_Click(object sender, EventArgs e)
 {
     try
     {
         UOMCCategory uom = cat.Get(int.Parse(txtCatCode.Text));
         cat.Delete(uom);
         MessageBox.Show("Selected Category Successfully Deleted");
         RowFocusedIndex = 0;
         FRM_CategoryUnit_Load(null, null);
     }
     catch (Exception ex)
     {
         MessageBox.Show(ex.Message);
     }
 }
 private void btnModify_Click(object sender, EventArgs e)
 {
     try
     {
         if (txtCatName.Text == "")
         {
             MessageBox.Show("You Must Enter Unit Name");
             return;
         }
         UOMCCategory uom = cat.Get(int.Parse(txtCatCode.Text));
         uom.CatName = txtCatName.Text;
         cat.Update(uom);
         int ModifiedRowIndex = RowFocusedIndex;
         MessageBox.Show("Selected Category Successfully Modified");
         FRM_CategoryUnit_Load(null, null);
         GetFocusedRowData(ModifiedRowIndex);
         UnitCategoryView.FocusedRowHandle = ModifiedRowIndex;
     }
     catch (Exception ex)
     {
         MessageBox.Show(ex.Message);
     }
 }