private void Save_Event() { if (Validation() != false) { switch (fAction) { case BtnEvent.Open: this.Hide(); RaiseEvent_NeedToRefresh(); break; case BtnEvent.Edit: try { var vData = CollectData(); dalsession = new DAL(); dalsession.BeginTransaction(); CCompany.Update(vData, dalsession); dalsession.Commit(); MessageBox.Show(this.FindForm(), "Record Updated Successfully.", "Update...", MessageBoxButtons.OK, MessageBoxIcon.Asterisk); this.Hide(); RaiseEvent_NeedToRefresh(); } catch (Exception ex) { if (dalsession != null) { dalsession.Rollback(); } MessageBox.Show(this.FindForm(), "Something Goes Wrong \r\n" + ex.Message, "Could Not Update...", MessageBoxButtons.OK, MessageBoxIcon.Error); SetFocus(); return; } break; } } }