private void BTN_SAVE_Click(object sender, EventArgs e) { if (TXT_SUPPLIER_NAME.Text.Length == 0) { TXT_SUPPLIER_NAME.Focus(); MSGBOX mdg = new MSGBOX(MessageAlertHeder.Warning(), "PLEASE ENTER SUPPLIER NAME", MessageAlertImage.Warning()); mdg.ShowDialog(); } else if (BTN_SAVE.Text == "SAVE") { SAVE_SUPPLIER(); LOAD_SUPPLIER_lIST(); BTN_SAVE.Text = "SAVE"; BTN_NEW.Focus(); clearAll(); } else if (BTN_SAVE.Text == "UPDATE") { UPDATE_SUPPLIERS_DATA(); LOAD_SUPPLIER_lIST(); BTN_NEW.Focus(); BTN_SAVE.Text = "SAVE"; clearAll(); } }
private void BTN_SAVE_Click(object sender, EventArgs e) { if (CMB_CATEGORY.SelectedIndex == -1) { CMB_CATEGORY.Focus(); MSGBOX mdg = new MSGBOX(MessageAlertHeder.Warning(), "PLEASE SELECT CATEGORY", MessageAlertImage.Warning()); mdg.ShowDialog(); } else if (TXT_ITEMNAME.Text == String.Empty) { TXT_ITEMNAME.Focus(); MSGBOX mdg = new MSGBOX(MessageAlertHeder.Warning(), "PLEASE ENTER ITEM NAME", MessageAlertImage.Warning()); mdg.ShowDialog(); } else if (CMB_ITEM_TYPE.SelectedIndex < 0) { CMB_ITEM_TYPE.Focus(); MSGBOX mdg = new MSGBOX(MessageAlertHeder.Warning(), "PLEASE SELECT ITEM TYPE", MessageAlertImage.Warning()); mdg.ShowDialog(); } else if (BTN_SAVE.Text == "SAVE") { SAVE_ITEMS(); LOAD_ITEM_lIST(); BTN_SAVE.Text = "SAVE"; DisableControls(); BTN_NEW.Focus(); } else if (BTN_SAVE.Text == "UPDATE") { UPDATE_ITEMS(); LOAD_ITEM_lIST(); BTN_NEW.Focus(); } }
private void DisableControls() { TXT_SV_NAME.Enabled = false; TXT_DESCRIPTION.Enabled = false; TXT_SV_PRICE.Enabled = false; BTN_SAVE.Enabled = false; BTN_NEW.Focus(); }
private void DisableControls() { TXT_MP_NAME.Enabled = false; TXT_DESCRIPTION.Enabled = false; TXT_ADULT_PRICE.Enabled = false; TXT_CHILD_PRICE.Enabled = false; BTN_SAVE.Enabled = false; BTN_NEW.Focus(); }
private void DisableControls() { TXT_PKG_NAME.Enabled = false; TXT_DESCRIPTION.Enabled = false; CMB_ROOM_TYPE.Enabled = false; TXT_PKG_RATE.Enabled = false; BTN_SAVE.Enabled = false; LBL_COLOR.Enabled = false; BTN_NEW.Focus(); }
private void DisableControls() { TXT_ROOM_NO.Enabled = false; CMB_ROOM_PKG.Enabled = false; CMB_ROOM_TYPE.Enabled = false; CMB_FLOOR.Enabled = false; TXT_DESCRIPTION.Enabled = false; BTN_SAVE.Enabled = false; BTN_NEW.Focus(); }
private void BTN_SAVE_Click(object sender, EventArgs e) { if (TXT_ID_NUMBER.Text.Length == 0) { TXT_ID_NUMBER.Focus(); MSGBOX mdg = new MSGBOX(MessageAlertHeder.Alert(), "PLEASE ENTER ID NO!", MessageAlertImage.Alert()); mdg.ShowDialog(); } else if (TXT_FNAME.Text.Length == 0) { TXT_FNAME.Focus(); MSGBOX mdg = new MSGBOX(MessageAlertHeder.Alert(), "PLEASE ENTER FIRST NAME!", MessageAlertImage.Alert()); mdg.ShowDialog(); } else if (TXT_LNAME.Text.Length == 0) { TXT_LNAME.Focus(); MSGBOX mdg = new MSGBOX(MessageAlertHeder.Alert(), "PLEASE ENTER LAST NAME!", MessageAlertImage.Alert()); mdg.ShowDialog(); } else if (CMB_GENDER.SelectedIndex == -1) { CMB_GENDER.Focus(); MSGBOX mdg = new MSGBOX(MessageAlertHeder.Alert(), "PLEASE SELECT GENDER TYPE!", MessageAlertImage.Alert()); mdg.ShowDialog(); } else if (CMB_COUNTRY.SelectedIndex == -1) { CMB_COUNTRY.Focus(); MSGBOX mdg = new MSGBOX(MessageAlertHeder.Alert(), "PLEASE SELECT COUNTRY!", MessageAlertImage.Alert()); mdg.ShowDialog(); } else { groupBox2.Enabled = false; SAVE_GUEST(); groupBox2.Enabled = true; BTN_NEW.Focus(); } }
private void BTN_SAVE_Click(object sender, EventArgs e) { if (TXT_F_NAME.Text.Length == 0) { TXT_F_NAME.Focus(); MSGBOX mdg = new MSGBOX(MessageAlertHeder.Alert(), "PLEASE ENTER GUEST NAME!", MessageAlertImage.Alert()); mdg.ShowDialog(); } else if (TXT_TEL.Text.Length == 0) { TXT_TEL.Focus(); MSGBOX mdg = new MSGBOX(MessageAlertHeder.Alert(), "PLEASE ENTER TELEPHONE NO!", MessageAlertImage.Alert()); mdg.ShowDialog(); } else if (TXT_ADULT.Text.Length == 0) { TXT_ADULT.Focus(); MSGBOX mdg = new MSGBOX(MessageAlertHeder.Alert(), "PLEASE ENTER NO OF ADULTS!", MessageAlertImage.Alert()); mdg.ShowDialog(); } else if (CMB_RESERVE_BY.SelectedIndex == -1) { CMB_RESERVE_BY.Focus(); MSGBOX mdg = new MSGBOX(MessageAlertHeder.Alert(), "PLEASE SELECT RESERVATION TYPE!", MessageAlertImage.Alert()); mdg.ShowDialog(); } else if (CMB_RESERVE_BY.SelectedIndex == 3 && CMB_AGENT.SelectedIndex == -1) { CMB_RESERVE_BY.Focus(); MSGBOX mdg = new MSGBOX(MessageAlertHeder.Alert(), "PLEASE SELECT AGENT!", MessageAlertImage.Alert()); mdg.ShowDialog(); } else if (LST_SELECTED_ROOM.Items.Count == 0) { MSGBOX mdg = new MSGBOX(MessageAlertHeder.Alert(), "PLEASE SELECT ROOMS!", MessageAlertImage.Alert()); mdg.ShowDialog(); } else if (Convert.ToInt16(TXT_NO_OF_NIGHTS.Text) == 0) { MSGBOX mdg = new MSGBOX(MessageAlertHeder.Alert(), "PLEASE SELECT SPEND DATES!", MessageAlertImage.Alert()); mdg.ShowDialog(); } else if (CMB_TAX.SelectedIndex == -1) { MSGBOX mdg = new MSGBOX(MessageAlertHeder.Alert(), "PLEASE SELECT TAX TYPE!", MessageAlertImage.Alert()); mdg.ShowDialog(); } else if (CMB_AGENT.SelectedIndex > -1 && CMB_AGENT.SelectedIndex == -1) { MSGBOX mdg = new MSGBOX(MessageAlertHeder.Alert(), "PLEASE SELECT AGENT!", MessageAlertImage.Alert()); mdg.ShowDialog(); } else { BTN_SAVE.Enabled = false; SAVE_RESERVATION(); BTN_NEW.Focus(); } }
private void SAVE_RESERVATION() { try { Cursor.Current = Cursors.WaitCursor; LOCK_CONTROLLERS(); CONNECTION.open_connection(); myTrans = CONNECTION.CON.BeginTransaction(); cmd.Connection = CONNECTION.CON; cmd.Transaction = myTrans; string GUESTID = string.Empty; string RES = CHECK_GUEST_DATA(); string RESERVATION_ID = CLS_GENERATE_ID.GEN_NEXT_RESERVATION_NO(); if (RES != "N") { GUESTID = RES; } else { GUESTID = CLS_GENERATE_ID.GEN_NEXT_GUEST_NO(); cmd.CommandText = "INSERT INTO guest ( guest_id, id_no, first_name, last_name, mobile_no, gender, passport_no, address, email, country_id ) VALUES ( @guest_id, @id_no, @first_name, @last_name, @mobile_no, @gender, @passport_no, @address, @email, @country_id )"; cmd.Parameters.Clear(); cmd.Parameters.AddWithValue("@guest_id", GUESTID); cmd.Parameters.AddWithValue("@id_no", TXT_NIC_NO.Text); cmd.Parameters.AddWithValue("@first_name", TXT_F_NAME.Text); cmd.Parameters.AddWithValue("@last_name", TXT_L_NAME.Text); cmd.Parameters.AddWithValue("@mobile_no", TXT_TEL.Text); cmd.Parameters.AddWithValue("@gender", "MALE"); cmd.Parameters.AddWithValue("@passport_no", "N/A"); cmd.Parameters.AddWithValue("@address", "N/A"); cmd.Parameters.AddWithValue("@email", TXT_EMAIL.Text); cmd.Parameters.AddWithValue("@country_id", 199); cmd.ExecuteNonQuery(); } TEMP_GUEST_ID = CLS_METHODS.GET_MAX_STRING_ID("SELECT MAX(guest_id) FROM guest"); cmd.CommandText = "INSERT INTO reservation ( reservation_id, guest_id, no_of_adult, no_of_child, arrival_date, depature_Date, no_of_nights, reserved_by, agent_id, additional_note,added_date,added_time,added_by,no_of_rooms,tax_status ) VALUES ( @reservation_id, @guest_id, @no_of_adult, @no_of_child, @arrival_date, @depature_Date, @no_of_nights, @reserved_by, @agent_id, @additional_note,@added_date,CURTIME(),@added_by,@no_of_rooms,@tax_status )"; cmd.Parameters.Clear(); cmd.Parameters.AddWithValue("@reservation_id", RESERVATION_ID); cmd.Parameters.AddWithValue("@guest_id", GUESTID); cmd.Parameters.AddWithValue("@no_of_adult", Convert.ToInt16(TXT_ADULT.Text)); cmd.Parameters.AddWithValue("@no_of_child", Convert.ToInt16(TXT_CHILD.Text)); cmd.Parameters.AddWithValue("@arrival_date", DTP_ARRIVAL_DATE.Value.ToShortDateString()); cmd.Parameters.AddWithValue("@depature_Date", DTP_DEPATURE_DATE.Value.ToShortDateString()); cmd.Parameters.AddWithValue("@no_of_nights", (DTP_DEPATURE_DATE.Value - DTP_ARRIVAL_DATE.Value).TotalDays); cmd.Parameters.AddWithValue("@reserved_by", CMB_RESERVE_BY.Text); cmd.Parameters.AddWithValue("@no_of_rooms", Convert.ToInt16(TXT_NO_OF_ROOMS.Text)); if (CMB_TAX.SelectedIndex == 0) { cmd.Parameters.AddWithValue("@tax_status", "1"); } else { cmd.Parameters.AddWithValue("@tax_status", "0"); } if (CMB_RESERVE_BY.SelectedIndex == 3) { cmd.Parameters.AddWithValue("@agent_id", CMB_AGENT.SelectedValue); } else { cmd.Parameters.AddWithValue("@agent_id", "0"); } cmd.Parameters.AddWithValue("@additional_note", TXT_NOTE.Text); cmd.Parameters.AddWithValue("@added_date", DateTime.Now.ToShortDateString()); cmd.Parameters.AddWithValue("@added_by", CLS_CURRENT_LOGGER.LOGGED_IN_USERID); cmd.ExecuteNonQuery(); foreach (ListViewItem lvi in LST_SELECTED_ROOM.Items) { cmd.CommandText = "INSERT INTO recerved_rooms ( reservation_no, room_id, room_charge ) VALUES ( @reservation_no, @room_id, @room_charge)"; cmd.Parameters.Clear(); cmd.Parameters.AddWithValue("@reservation_no", RESERVATION_ID); cmd.Parameters.AddWithValue("@room_id", Convert.ToInt32(lvi.SubItems[0].Text)); cmd.Parameters.AddWithValue("@room_charge", Convert.ToDouble(lvi.SubItems[3].Text)); cmd.ExecuteNonQuery(); cmd.CommandText = "UPDATE room SET current_status=@current_status WHERE room_id=@room_id"; cmd.Parameters.Clear(); cmd.Parameters.AddWithValue("@room_id", Convert.ToInt32(lvi.SubItems[0].Text)); cmd.Parameters.AddWithValue("@current_status", "RESERVED"); cmd.ExecuteNonQuery(); } myTrans.Commit(); LBL_RESERVATION_ID.Text = RESERVATION_ID; MSGBOX mdg = new MSGBOX(MessageAlertHeder.Success(), "RESERVATION ADDED SUCCESFULLY" + Environment.NewLine + Environment.NewLine + "RESERVATION NO IS : " + RESERVATION_ID, MessageAlertImage.Success()); mdg.ShowDialog(); BTN_NEW.Focus(); } catch (Exception EX) { Cursor.Current = Cursors.Default; UNLOCK_CONTROLLERS(); myTrans.Rollback(); MSGBOX mdg = new MSGBOX(MessageAlertHeder.Error(), EX.Message, MessageAlertImage.Error()); mdg.ShowDialog(); } finally { UNLOCK_CONTROLLERS(); Cursor.Current = Cursors.Default; CONNECTION.close_connection(); } }
private void SAVEGRN() { try { Cursor.Current = Cursors.WaitCursor; CONNECTION.open_connection(); myTrans = CONNECTION.CON.BeginTransaction(); cmd.Connection = CONNECTION.CON; cmd.Transaction = myTrans; String GRN_NO = CLS_GENERATE_ID.GEN_NEXT_GRN_NO(); double total_price = Convert.ToDouble(LBL_TOT_GRN.Text); double credit = Convert.ToDouble(TXT_CREDIT.Text); double cash = Convert.ToDouble(TXT_CASH.Text); double cheque = Convert.ToDouble(TXT_CHEQUE.Text); double card = Convert.ToDouble(TXT_CARD.Text); string type = string.Empty; if (cash > 0 && cheque <= 0 && card <= 0) { type = "CASH"; } else if (cash <= 0 && cheque > 0 && card <= 0) { type = "CHEQUE"; } else if (cash <= 0 && cheque <= 0 && card > 0) { type = "CARD"; } else if (cash > 0 && cheque > 0 && card <= 0) { type = "CASH/CHEQUE"; } else if (cash > 0 && cheque > 0 && card > 0) { type = "CARD/CHEQUE/CARD"; } else if (cash <= 0 && cheque > 0 && card > 0) { type = "CHEQUE/CARD"; } else if (cash > 0 && cheque <= 0 && card > 0) { type = "CASH/CARD"; } else { type = "CREDIT"; } LBL_GRN_NO.Text = GRN_NO; cmd.CommandText = "INSERT INTO grn ( grn_no, payment_type, supplier_id, grn_total, added_by, added_date, added_time ) VALUES ( @grn_no, @payment_type, @supplier_id, @grn_total, @added_by, @added_date, @added_time )"; cmd.Parameters.Clear(); cmd.Parameters.AddWithValue("@grn_no", GRN_NO); cmd.Parameters.AddWithValue("@payment_type", type); cmd.Parameters.AddWithValue("@supplier_id", CMB_SUPPLIER.SelectedValue); cmd.Parameters.AddWithValue("@grn_total", Convert.ToDouble(LBL_TOT_GRN.Text)); cmd.Parameters.AddWithValue("@added_by", CLS_CURRENT_LOGGER.LOGGED_IN_USERID); cmd.Parameters.AddWithValue("@added_date", DTP_GRN_DATE.Value.ToString("yyyy-MM-dd")); cmd.Parameters.AddWithValue("@added_time", DTP_GRN_DATE.Value.ToString("HH:mm:ss")); cmd.ExecuteNonQuery(); foreach (DataGridViewRow dgvr in DGV_ITEMS_LIST.Rows) { cmd.CommandText = "INSERT INTO stock_items ( item_code, qty, cost_price, sales_price, grn_no ) VALUES (@item_code, @qty, @cost_price, @sales_price, @grn_no)"; cmd.Parameters.Clear(); cmd.Parameters.AddWithValue("@item_code", Convert.ToInt32(dgvr.Cells[0].Value)); cmd.Parameters.AddWithValue("@qty", Convert.ToDouble(dgvr.Cells[3].Value.ToString())); cmd.Parameters.AddWithValue("@cost_price", Convert.ToDouble(dgvr.Cells[4].Value.ToString())); cmd.Parameters.AddWithValue("@sales_price", Convert.ToDouble(dgvr.Cells[5].Value.ToString())); cmd.Parameters.AddWithValue("@grn_no", GRN_NO); cmd.ExecuteNonQuery(); using (MySqlDataAdapter adp = new MySqlDataAdapter("SELECT stock_id,qty FROM stock WHERE item_code=@item_code AND cost_price=@cost_price AND sales_price=@sales_price", CONNECTION.CON)) { adp.SelectCommand.Parameters.Clear(); adp.SelectCommand.Parameters.AddWithValue("@item_code", Convert.ToInt32(dgvr.Cells[0].Value.ToString())); adp.SelectCommand.Parameters.AddWithValue("@cost_price", Convert.ToDouble(dgvr.Cells[4].Value.ToString())); adp.SelectCommand.Parameters.AddWithValue("@sales_price", Convert.ToDouble(dgvr.Cells[5].Value.ToString())); DataTable dtb = new DataTable(); adp.Fill(dtb); if (dtb.Rows.Count > 0) { cmd.CommandText = "UPDATE stock SET qty=qty+@qty WHERE stock_id=@stock_id"; cmd.Parameters.Clear(); cmd.Parameters.AddWithValue("@stock_id", Convert.ToInt32(dtb.Rows[0].Field <int>(0))); double total_qty = Convert.ToDouble(dtb.Rows[0].Field <double>(1)) + Convert.ToDouble(dgvr.Cells[3].Value.ToString()); cmd.Parameters.AddWithValue("@qty", total_qty); cmd.ExecuteNonQuery(); } else { cmd.CommandText = "INSERT INTO stock( item_code, qty, cost_price, sales_price ) VALUES ( @item_code, @qty, @cost_price, @sales_price)"; cmd.Parameters.Clear(); cmd.Parameters.AddWithValue("@item_code", Convert.ToInt32(dgvr.Cells[0].Value.ToString())); cmd.Parameters.AddWithValue("@qty", Convert.ToDouble(dgvr.Cells[3].Value.ToString())); cmd.Parameters.AddWithValue("@cost_price", Convert.ToDouble(dgvr.Cells[4].Value.ToString())); cmd.Parameters.AddWithValue("@sales_price", Convert.ToDouble(dgvr.Cells[5].Value.ToString())); cmd.ExecuteNonQuery(); } } } if (credit > 0) { cmd.CommandText = "INSERT INTO supplier_account ( account_no, supplier_id, grn_no, grn_total, paid, due,added_date,added_time,added_by ) VALUES ( @account_no, @supplier_id, @grn_no, @grn_total, @paid, @due ,@added_date,@added_time,@added_by)"; cmd.Parameters.Clear(); cmd.Parameters.AddWithValue("@account_no", CLS_GENERATE_ID.GEN_NEXT_ACC_NO()); cmd.Parameters.AddWithValue("@supplier_id", CMB_SUPPLIER.SelectedValue); cmd.Parameters.AddWithValue("@grn_no", GRN_NO); cmd.Parameters.AddWithValue("@grn_total", total_price); cmd.Parameters.AddWithValue("@paid", cash); cmd.Parameters.AddWithValue("@due", credit); cmd.Parameters.AddWithValue("@added_date", DTP_GRN_DATE.Value.ToString("yyyy-MM-dd")); cmd.Parameters.AddWithValue("@added_time", DTP_GRN_DATE.Value.ToString("HH:mm:ss")); cmd.Parameters.AddWithValue("@added_by", CLS_CURRENT_LOGGER.LOGGED_IN_USERID); cmd.ExecuteNonQuery(); } if (cheque > 0) { cmd.CommandText = "INSERT INTO issue_cheque (grn_no, amount, cheque_date, issued_date, supplier_id, bank_id, cheque_no, issued_time, issued_by ) VALUES ( @grn_no, @amount, @cheque_date, @issued_date, @supplier_id, @bank_id, @cheque_no, @issued_time, @issued_by)"; cmd.Parameters.Clear(); cmd.Parameters.AddWithValue("@grn_no", GRN_NO); cmd.Parameters.AddWithValue("@amount", cheque); cmd.Parameters.AddWithValue("@cheque_date", DTP_CHEQUE_DATE.Value.ToString("yyyy-MM-dd")); cmd.Parameters.AddWithValue("@issued_date", DTP_GRN_DATE.Value.ToString("yyyy-MM-dd")); cmd.Parameters.AddWithValue("@supplier_id", CMB_SUPPLIER.SelectedValue); cmd.Parameters.AddWithValue("@bank_id", CMB_CHEQUE_BANK.SelectedValue); cmd.Parameters.AddWithValue("@cheque_no", TXT_CHEQUE_NO.Text); cmd.Parameters.AddWithValue("@issued_time", DateTime.Now.ToString("HH:mm:ss")); cmd.Parameters.AddWithValue("@issued_by", CLS_CURRENT_LOGGER.LOGGED_IN_USERID); cmd.ExecuteNonQuery(); } if (cash > 0) { cmd.CommandText = "INSERT INTO account(income_type, payment_type, payment, added_date, added_time, note ) VALUES ( @income_type, @payment_type, @payment, @added_date, @added_time, @note)"; cmd.Parameters.Clear(); cmd.Parameters.AddWithValue("@income_type", "EXPENCES"); cmd.Parameters.AddWithValue("@payment_type", "CASH"); cmd.Parameters.AddWithValue("@payment", cash); cmd.Parameters.AddWithValue("@added_date", DTP_GRN_DATE.Value.ToString("yyyy-MM-dd")); cmd.Parameters.AddWithValue("@added_time", DTP_GRN_DATE.Value.ToString("HH:mm:ss")); cmd.Parameters.AddWithValue("@note", "PAYMENT FOR GRN: " + GRN_NO); cmd.ExecuteNonQuery(); } if (cheque > 0) { cmd.CommandText = "INSERT INTO account(income_type, payment_type, payment, added_date, added_time, note, cheque_no) VALUES ( @income_type, @payment_type, @payment, @added_date, @added_time, @note, @cheque_no)"; cmd.Parameters.Clear(); cmd.Parameters.AddWithValue("@income_type", "EXPENCES"); cmd.Parameters.AddWithValue("@payment_type", "CHEQUE"); cmd.Parameters.AddWithValue("@payment", cheque); cmd.Parameters.AddWithValue("@added_date", DTP_GRN_DATE.Value.ToString("yyyy-MM-dd")); cmd.Parameters.AddWithValue("@added_time", DTP_GRN_DATE.Value.ToString("HH:mm:ss")); cmd.Parameters.AddWithValue("@note", "PAYMENT FOR GRN: " + GRN_NO); cmd.Parameters.AddWithValue("@cheque_no", TXT_CHEQUE_NO.Text); cmd.ExecuteNonQuery(); } if (card > 0) { cmd.CommandText = "INSERT INTO account(income_type, payment_type, payment, added_date, added_time, note , card_details) VALUES ( @income_type, @payment_type, @payment, @added_date, @added_time, @note, @card_details)"; cmd.Parameters.Clear(); cmd.Parameters.AddWithValue("@income_type", "EXPENCES"); cmd.Parameters.AddWithValue("@payment_type", "CARD"); cmd.Parameters.AddWithValue("@payment", card); cmd.Parameters.AddWithValue("@added_date", DTP_GRN_DATE.Value.ToString("yyyy-MM-dd")); cmd.Parameters.AddWithValue("@added_time", DTP_GRN_DATE.Value.ToString("HH:mm:ss")); cmd.Parameters.AddWithValue("@note", "PAYMENT FOR GRN: " + GRN_NO); cmd.Parameters.AddWithValue("@card_details", "CARD NO: " + TXT_CARD_NO.Text + " OWNER NAME: " + TXT_OWNER.Text); cmd.ExecuteNonQuery(); } myTrans.Commit(); MSGBOX mdg = new MSGBOX(MessageAlertHeder.Success(), "GRN DATA ADDED SUCCESSFULLY!", MessageAlertImage.Success()); mdg.ShowDialog(); DisableControls(); BTN_NEW.Focus(); } catch (Exception EX) { Cursor.Current = Cursors.Default; myTrans.Rollback(); MSGBOX mdg = new MSGBOX(MessageAlertHeder.Error(), EX.Message, MessageAlertImage.Error()); mdg.ShowDialog(); } finally { Cursor.Current = Cursors.Default; CONNECTION.close_connection(); } }