private void LOAD_INVOICE_INFO() { try { CONNECTION.open_connection(); using (MySqlDataAdapter DA = new MySqlDataAdapter("SELECT tax_status FROM reservation WHERE reservation_id=@reservation_id", CONNECTION.CON)) { DA.SelectCommand.Parameters.Clear(); DA.SelectCommand.Parameters.AddWithValue("@reservation_id", REPORT.RESERVATION_NO); DataTable dt = new DataTable(); DA.Fill(dt); if (dt.Rows.Count > 0) { if (dt.Rows[0].Field <string>(0) == "1") { lbl_status.Text = "VAT INCLUDED"; } else { lbl_status.Text = "VAT NOT INCLUDED"; } } } } catch (Exception EX) { MSGBOX mdg = new MSGBOX(MessageAlertHeder.Alert(), EX.Message, MessageAlertImage.Alert()); mdg.ShowDialog(); } }
private void LOAD_KOT() { try { CONNECTION.open_connection(); using (MySqlDataAdapter DA = new MySqlDataAdapter("SELECT kot_order.order_no , resturant_table.table_no , kot_order.total_price FROM kot_order INNER JOIN resturant_table ON (kot_order.table_id = resturant_table.table_id) WHERE kot_order.reservation_no=@reservation_no", CONNECTION.CON)) { DA.SelectCommand.Parameters.Clear(); DA.SelectCommand.Parameters.AddWithValue("@reservation_no", REPORT.RESERVATION_NO); DataTable dt = new DataTable(); DA.Fill(dt); if (dt.Rows.Count > 0) { DGV_KOT.DataSource = dt; DGV_KOT.AutoGenerateColumns = false; } else { DGV_KOT.DataSource = null; } } } catch (Exception EX) { MSGBOX mdg = new MSGBOX(MessageAlertHeder.Alert(), EX.Message, MessageAlertImage.Alert()); mdg.ShowDialog(); } }
private void LOAD_MINI_BAR() { try { CONNECTION.open_connection(); using (MySqlDataAdapter DA = new MySqlDataAdapter("SELECT reservation.reservation_id, SUM(purchased_mini_bar_item.price) AS price FROM purchased_mini_bar_item INNER JOIN reservation ON ( purchased_mini_bar_item.reservation_no = reservation.reservation_id ) WHERE reservation_id = @reservation_id", CONNECTION.CON)) { DA.SelectCommand.Parameters.Clear(); DA.SelectCommand.Parameters.AddWithValue("@reservation_id", REPORT.RESERVATION_NO); DataTable dt = new DataTable(); DA.Fill(dt); if (dt.Rows.Count > 0) { FGV_MINI_BAR.DataSource = dt; FGV_MINI_BAR.AutoGenerateColumns = false; } else { FGV_MINI_BAR.DataSource = null; } } } catch (Exception EX) { MSGBOX mdg = new MSGBOX(MessageAlertHeder.Alert(), EX.Message, MessageAlertImage.Alert()); mdg.ShowDialog(); } }
private void LOAD_ROOMS() { try { CONNECTION.open_connection(); using (MySqlDataAdapter DA = new MySqlDataAdapter("SELECT recerved_rooms.reservation_no , room.room_id , room.room_name , recerved_rooms.room_charge FROM recerved_rooms INNER JOIN room ON (recerved_rooms.room_id = room.room_id) WHERE recerved_rooms.reservation_no=@reservation_no", CONNECTION.CON)) { DA.SelectCommand.Parameters.Clear(); DA.SelectCommand.Parameters.AddWithValue("@reservation_no", REPORT.RESERVATION_NO); DataTable dt = new DataTable(); DA.Fill(dt); if (dt.Rows.Count > 0) { DGV_RESERVED_ROOM.DataSource = dt; DGV_RESERVED_ROOM.AutoGenerateColumns = false; } else { DGV_RESERVED_ROOM.DataSource = null; } } } catch (Exception EX) { MSGBOX mdg = new MSGBOX(MessageAlertHeder.Alert(), EX.Message, MessageAlertImage.Alert()); mdg.ShowDialog(); } }
private void LOAD_MEAL_PRICE() { try { CONNECTION.open_connection(); using (MySqlDataAdapter DA = new MySqlDataAdapter("SELECT reservation_id,no_of_nights,recervation_price.total_adult_food_charges,recervation_price.total_child_food_charges FROM reservation INNER JOIN recervation_price ON (reservation.reservation_id=recervation_price.reservation_no) WHERE reservation.reservation_id=@reservation_id", CONNECTION.CON)) { DA.SelectCommand.Parameters.Clear(); DA.SelectCommand.Parameters.AddWithValue("@reservation_id", REPORT.RESERVATION_NO); DataTable dt = new DataTable(); DA.Fill(dt); if (dt.Rows.Count > 0) { DGV_MEAL.DataSource = dt; DGV_MEAL.AutoGenerateColumns = false; } else { DGV_MEAL.DataSource = null; } } } catch (Exception EX) { MSGBOX mdg = new MSGBOX(MessageAlertHeder.Alert(), EX.Message, MessageAlertImage.Alert()); mdg.ShowDialog(); } }
private void LOAD_ADDITIONAL_SERVICE() { try { CONNECTION.open_connection(); using (MySqlDataAdapter DA = new MySqlDataAdapter("SELECT additional_service.reservation_id ,room.room_name ,SUM( additional_service.additional_serivice_price) AS TOTAL FROM hyperfle_hms.additional_service INNER JOIN hyperfle_hms.additional_service_list ON (additional_service.additional_serivice_id = additional_service_list.id) INNER JOIN hyperfle_hms.room ON (additional_service.room_id = room.room_id) WHERE additional_service.reservation_id=@reservation_id GROUP BY room_name", CONNECTION.CON)) { DA.SelectCommand.Parameters.Clear(); DA.SelectCommand.Parameters.AddWithValue("@reservation_id", REPORT.RESERVATION_NO); DataTable dt = new DataTable(); DA.Fill(dt); if (dt.Rows.Count > 0) { DGV_ADDITIONAL_SERVICE.DataSource = dt; DGV_ADDITIONAL_SERVICE.AutoGenerateColumns = false; } else { DGV_ADDITIONAL_SERVICE.DataSource = null; } } } catch (Exception EX) { MSGBOX mdg = new MSGBOX(MessageAlertHeder.Alert(), EX.Message, MessageAlertImage.Alert()); mdg.ShowDialog(); } }
private void LOAD_ALL_ITEMS_BY_ITEM_NAME_ALL() { try { CONNECTION.open_connection(); using (MySqlDataAdapter DA = new MySqlDataAdapter("SELECT stock.stock_id AS STOCKID , item.item_id AS ITEMID , item.barcode AS BARCODE , item.item_name AS ITEM_NAME , item.item_status AS ITEM_STATUS , category.categry_id AS CATEGORYID, category.caegory_name AS CATEGORY_NAME, stock.qty AS QTY , stock.cost_price AS COST_PRICE , stock.sales_price AS SALE_PRICE , item_type.id AS TYPE_ID, item_type.type AS ITEM_TYPE FROM stock INNER JOIN item ON (stock.item_code = item.item_id) INNER JOIN item_type ON (item.item_type_id = item_type.id) INNER JOIN category ON (item.item_category = category.categry_id) WHERE item.item_status='ENABLE' AND (item.item_name LIKE @item_name || item.item_category=@item_category || item.item_type_id=@item_type_id)", CONNECTION.CON)) { DA.SelectCommand.Parameters.Clear(); DA.SelectCommand.Parameters.AddWithValue("@item_name", "%" + TXT_ITEM_NAME.Text + "%"); DA.SelectCommand.Parameters.AddWithValue("@item_category", CMB_CATEGORY.SelectedValue); DA.SelectCommand.Parameters.AddWithValue("@item_type_id", CMB_ITEM_TYPE.SelectedValue); DataTable DT = new DataTable(); DA.Fill(DT); if (DT.Rows.Count > 0) { dataGridView1.DataSource = DT; dataGridView1.AutoGenerateColumns = false; dataGridView1.Columns[0].Visible = false; dataGridView1.Columns[1].Visible = false; dataGridView1.Columns[5].Visible = false; dataGridView1.Columns[10].Visible = false; dataGridView1.Columns[3].Width = 200; dataGridView1.Columns[7].DefaultCellStyle.Format = "F3"; dataGridView1.Columns[8].DefaultCellStyle.Format = "F2"; dataGridView1.Columns[9].DefaultCellStyle.Format = "F2"; LBL_COUNT.Text = DT.Rows.Count.ToString(); } else { dataGridView1.DataSource = null; LBL_COUNT.Text = "0"; } } } catch (Exception EX) { MSGBOX mdg = new MSGBOX(MessageAlertHeder.Alert(), EX.Message, MessageAlertImage.Alert()); mdg.ShowDialog(); } finally { CONNECTION.close_connection(); } }
private void BTN_NEW_Click(object sender, EventArgs e) { if (hyflexComboBox1.SelectedIndex == -1) { hyflexComboBox1.Focus(); MSGBOX mdg = new MSGBOX(MessageAlertHeder.Alert(), "PLEASE SELECT OPTION!", MessageAlertImage.Alert()); mdg.ShowDialog(); } else { LOAD_lIST(); } }
private void UPDATE_ITEMS() { try { CONNECTION.open_connection(); using (MySqlCommand da = new MySqlCommand("UPDATE item SET barcode=@barcode,item_category=@item_category,item_name=@item_name,item_type_id=@item_type_id WHERE item_id=@item_id", CONNECTION.CON)) { da.Parameters.Clear(); da.Parameters.AddWithValue("@barcode", TXT_BARCODE.Text); da.Parameters.AddWithValue("@item_category", CMB_CATEGORY.SelectedValue); da.Parameters.AddWithValue("@item_name", TXT_ITEMNAME.Text); da.Parameters.AddWithValue("@item_id", LBL_ITEM_ID.Text); da.Parameters.AddWithValue("@item_type_id", CMB_ITEM_TYPE.SelectedValue); da.Parameters.AddWithValue("@item_status", "ENABLE"); if (da.ExecuteNonQuery() > 0) { MSGBOX mdg = new MSGBOX(MessageAlertHeder.Success(), "ITEM UPDATED SUCCESFULLY!", MessageAlertImage.Success()); mdg.ShowDialog(); } else { MSGBOX mdg = new MSGBOX(MessageAlertHeder.Alert(), "ITEM UPDATE FAILED!", MessageAlertImage.Alert()); mdg.ShowDialog(); } } } catch (Exception ex) { MSGBOX mdg = new MSGBOX(MessageAlertHeder.Error(), ex.Message, MessageAlertImage.Error()); mdg.ShowDialog(); } finally { CONNECTION.close_connection(); } }
private void SAVE_GUEST() { try { CONNECTION.open_connection(); using (MySqlCommand da = new MySqlCommand("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 )", CONNECTION.CON)) { da.Parameters.Clear(); da.Parameters.AddWithValue("@guest_id", CLS_GENERATE_ID.GEN_NEXT_GUEST_NO()); da.Parameters.AddWithValue("@id_no", TXT_ID_NUMBER.Text); da.Parameters.AddWithValue("@first_name", TXT_FNAME.Text); da.Parameters.AddWithValue("@last_name", TXT_LNAME.Text); da.Parameters.AddWithValue("@mobile_no", TXT_MOBILENO.Text); da.Parameters.AddWithValue("@gender", CMB_GENDER.Text); da.Parameters.AddWithValue("@passport_no", TXT_PASSPORT.Text); da.Parameters.AddWithValue("@address", TXT_ADDRESS.Text); da.Parameters.AddWithValue("@email", TXT_EMAIL.Text); da.Parameters.AddWithValue("@country_id", CMB_COUNTRY.SelectedValue); if (da.ExecuteNonQuery() > 0) { LBL_GUEST.Text = CLS_METHODS.GET_MAX_STRING_ID("SELECT MAX(guest_id) FROM guest"); MSGBOX mdg = new MSGBOX(MessageAlertHeder.Success(), "GUEST ADDED SUCCESFULLY!", MessageAlertImage.Success()); mdg.ShowDialog(); } else { MSGBOX mdg = new MSGBOX(MessageAlertHeder.Alert(), "GUEST ADDED FAILED!", MessageAlertImage.Alert()); mdg.ShowDialog(); } } } catch (Exception ex) { MSGBOX mdg = new MSGBOX(MessageAlertHeder.Error(), ex.Message, MessageAlertImage.Error()); mdg.ShowDialog(); } finally { CONNECTION.close_connection(); } }
private void SAVE_SUPPLIER() { try { CONNECTION.open_connection(); using (MySqlCommand da = new MySqlCommand("INSERT INTO supplier (supplier_name, company_name, address, contact1, contact2, note ) VALUES ( @supplier_name, @company_name, @address, @contact1, @contact2, @note )", CONNECTION.CON)) { da.Parameters.Clear(); da.Parameters.AddWithValue("@supplier_name", TXT_SUPPLIER_NAME.Text); da.Parameters.AddWithValue("@company_name", TXT_COMPANY_NAME.Text); da.Parameters.AddWithValue("@address", TXT_ADDRESS.Text); da.Parameters.AddWithValue("@contact1", TXT_CONTACT_01.Text); da.Parameters.AddWithValue("@contact2", TXT_CONTACT_02.Text); da.Parameters.AddWithValue("@note", TXT_NOTE.Text); if (da.ExecuteNonQuery() > 0) { LBL_SUPPLIER_ID.Text = GETMAXID(); MSGBOX mdg = new MSGBOX(MessageAlertHeder.Success(), "SUPPLIER ADDED SUCCESFULLY!", MessageAlertImage.Success()); mdg.ShowDialog(); } else { MSGBOX mdg = new MSGBOX(MessageAlertHeder.Alert(), "SUPPLIER ADDED FAILED!", MessageAlertImage.Alert()); mdg.ShowDialog(); } } } catch (Exception ex) { MSGBOX mdg = new MSGBOX(MessageAlertHeder.Error(), ex.Message, MessageAlertImage.Error()); mdg.ShowDialog(); } finally { CONNECTION.close_connection(); } }
private void UPDATE_SUPPLIERS_DATA() { try { CONNECTION.open_connection(); using (MySqlCommand da = new MySqlCommand("UPDATE supplier SET supplier_id = @supplier_id, supplier_name = @supplier_name, company_name = @company_name, address = @address, contact1 = @contact1, contact2 = @contact2, note = @note WHERE supplier_id = @supplier_id", CONNECTION.CON)) { da.Parameters.Clear(); da.Parameters.AddWithValue("@supplier_id", LBL_SUPPLIER_ID.Text); da.Parameters.AddWithValue("@supplier_name", TXT_SUPPLIER_NAME.Text); da.Parameters.AddWithValue("@company_name", TXT_COMPANY_NAME.Text); da.Parameters.AddWithValue("@address", TXT_ADDRESS.Text); da.Parameters.AddWithValue("@contact1", TXT_CONTACT_01.Text); da.Parameters.AddWithValue("@contact2", TXT_CONTACT_02.Text); da.Parameters.AddWithValue("@note", TXT_NOTE.Text); if (da.ExecuteNonQuery() > 0) { MSGBOX mdg = new MSGBOX(MessageAlertHeder.Success(), "SUPPLIER DETAILS UPDATED SUCCESFULLY!", MessageAlertImage.Success()); mdg.ShowDialog(); clearAll(); } else { MSGBOX mdg = new MSGBOX(MessageAlertHeder.Alert(), "SUPPLIER DETAILS UPDATE FAILED!", MessageAlertImage.Alert()); mdg.ShowDialog(); } } } catch (Exception ex) { MSGBOX mdg = new MSGBOX(MessageAlertHeder.Error(), ex.Message, MessageAlertImage.Error()); mdg.ShowDialog(); } finally { CONNECTION.close_connection(); } }
private void SAVE_ROOM_PACKAGE() { try { CONNECTION.open_connection(); using (MySqlCommand cmd = new MySqlCommand("INSERT INTO room_packages(package_name,description,`condition`,room_package_price,package_color) VALUES(@package_name,@description,@condition,@room_package_price,@package_color)", CONNECTION.CON)) { cmd.Parameters.Clear(); cmd.Parameters.AddWithValue("@package_name", TXT_PKG_NAME.Text); cmd.Parameters.AddWithValue("@description", TXT_DESCRIPTION.Text); cmd.Parameters.AddWithValue("@condition", CMB_ROOM_TYPE.Text); cmd.Parameters.AddWithValue("@room_package_price", Convert.ToDouble(TXT_PKG_RATE.Text)); cmd.Parameters.AddWithValue("@package_color", LBL_COLOR.Text); if (cmd.ExecuteNonQuery() > 0) { int room_pkg_no = 0; using (MySqlDataAdapter adp = new MySqlDataAdapter("SELECT MAX(room_package_id) FROM room_packages", CONNECTION.CON)) { DataTable tbl = new DataTable(); adp.Fill(tbl); if (tbl.Rows.Count > 0) { room_pkg_no = tbl.Rows[0].Field <Int32>(0); } } LBL_PKG_ID.Text = room_pkg_no.ToString(); MSGBOX mdg = new MSGBOX(MessageAlertHeder.Success(), "PACKAGE ADDED SUCCESSFULLY!", MessageAlertImage.Success()); mdg.ShowDialog(); DisableControls(); } else { MSGBOX mdg = new MSGBOX(MessageAlertHeder.Alert(), "FAILED TO ADD ROOM PACKAGE!", MessageAlertImage.Alert()); mdg.ShowDialog(); } } } catch (Exception ex) { MSGBOX mdg = new MSGBOX(MessageAlertHeder.Error(), ex.Message, MessageAlertImage.Error()); mdg.ShowDialog(); } finally { CONNECTION.close_connection(); } }
private void BTN_SAVE_Click(object sender, EventArgs e) { if (DGV_ITEMS_LIST.Rows.Count == 0) { TXT_ITEMNAME.Focus(); MSGBOX mdg = new MSGBOX(MessageAlertHeder.Alert(), "PLEASE ADD ITEMS FIRST!", MessageAlertImage.Alert()); mdg.ShowDialog(); } else if (CMB_SUPPLIER.SelectedIndex == -1) { CMB_SUPPLIER.Focus(); MSGBOX mdg = new MSGBOX(MessageAlertHeder.Alert(), "PLEASE SELECT SUPPLIER!", MessageAlertImage.Alert()); mdg.ShowDialog(); } else if (Convert.ToDouble(TXT_CARD.Text) <= 0 && TXT_CARD_NO.Text == string.Empty) { TXT_CARD_NO.Focus(); MSGBOX mdg = new MSGBOX(MessageAlertHeder.Alert(), "PLEASE ENTER CARD NO!", MessageAlertImage.Alert()); mdg.ShowDialog(); } else if (Convert.ToDouble(TXT_CHEQUE.Text) > 0 && (TXT_CHEQUE_NO.Text == string.Empty || CMB_CHEQUE_BANK.SelectedIndex == -1)) { TXT_CHEQUE_NO.Focus(); MSGBOX mdg = new MSGBOX(MessageAlertHeder.Alert(), "PLEASE ENTER CHEQUE INFORMATIONS!", MessageAlertImage.Alert()); mdg.ShowDialog(); } else { SAVEGRN(); } }
private void BTN_ADD_Click(object sender, EventArgs e) { if (ITEM_CODE == String.Empty) { TXT_QTY.Focus(); MSGBOX mdg = new MSGBOX(MessageAlertHeder.Alert(), "PLEASE SELECT ITEM!", MessageAlertImage.Alert()); mdg.ShowDialog(); } else if (Convert.ToDouble(TXT_QTY.Text) <= 0) { TXT_QTY.Focus(); MSGBOX mdg = new MSGBOX(MessageAlertHeder.Alert(), "PLEASE ENTER QTY!", MessageAlertImage.Alert()); mdg.ShowDialog(); } else if (Convert.ToDouble(TXT_COST.Text) <= 0) { TXT_COST.Focus(); MSGBOX mdg = new MSGBOX(MessageAlertHeder.Alert(), "PLEASE ENTER COST PRICE!", MessageAlertImage.Alert()); mdg.ShowDialog(); } //else if(Convert.ToDouble(TXT_SALE.Text) <= 0) //{ // TXT_SALE.Focus(); // MSGBOX mdg = new MSGBOX(MessageAlertHeder.Alert(), "PLEASE ENTER SALE PRICE!", MessageAlertImage.Alert()); // mdg.ShowDialog(); //} //else if(Convert.ToDouble(TXT_SALE.Text) <= Convert.ToDouble(TXT_COST.Text)) //{ // TXT_SALE.Focus(); // MSGBOX mdg = new MSGBOX(MessageAlertHeder.Alert(), "ENTERD SALE PRICE IS LESS THAN OR EQUAL COST PRICE!", MessageAlertImage.Alert()); // mdg.ShowDialog(); //} else { ADD_TO_TABLE(); CLEAR_BOX(); CAL_TOTAL_COST(); LBL_TOTAL_PAYABLE.Text = (Convert.ToDouble(LBL_TOT_GRN.Text) + Convert.ToDouble(LBL_PREVIOUS_DUES.Text)).ToString("F2"); ITEM_CODE = String.Empty; ITEM_NAME = String.Empty; BARCODE = String.Empty; TXT_ITEMNAME.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_ITEMS() { //try //{ CONNECTION.open_connection(); using (MySqlCommand da = new MySqlCommand("INSERT INTO item (barcode,item_category,item_name,item_status) VALUES(@barcode,@item_category,@item_name,@item_status)", CONNECTION.CON)) { da.Parameters.Clear(); da.Parameters.AddWithValue("@barcode", "N/A"); da.Parameters.AddWithValue("@item_category", CMB_CATEGORY.SelectedValue); da.Parameters.AddWithValue("@item_name", TXT_ITEMNAME.Text); da.Parameters.AddWithValue("@item_status", "ENABLE"); if (da.ExecuteNonQuery() > 0) { LBL_ITEM_ID.Text = GETMAXID(); if (TXT_BARCODE.Text == String.Empty) { using (MySqlCommand CM = new MySqlCommand("UPDATE item SET barcode=@barcode WHERE item_id=@item_id", CONNECTION.CON)) { CM.Parameters.Clear(); CM.Parameters.AddWithValue("@item_id", LBL_ITEM_ID.Text); CM.Parameters.AddWithValue("@barcode", LBL_ITEM_ID.Text); CM.ExecuteNonQuery(); } } else { using (MySqlCommand C = new MySqlCommand("UPDATE item SET barcode=@barcode WHERE item_id=@item_id", CONNECTION.CON)) { C.Parameters.Clear(); C.Parameters.AddWithValue("@item_id", LBL_ITEM_ID.Text); C.Parameters.AddWithValue("@barcode", TXT_BARCODE.Text); C.ExecuteNonQuery(); } } MSGBOX mdg = new MSGBOX(MessageAlertHeder.Success(), "ITEM ADDED SUCCESFULLY!", MessageAlertImage.Success()); mdg.ShowDialog(); } else { MSGBOX mdg = new MSGBOX(MessageAlertHeder.Alert(), "ITEM ADDED FAILED!", MessageAlertImage.Alert()); mdg.ShowDialog(); } } //} //catch (Exception ex) //{ // MSGBOX mdg = new MSGBOX(MessageAlertHeder.Error(), ex.Message, MessageAlertImage.Error()); // mdg.ShowDialog(); //} //finally //{ // CONNECTION.close_connection(); //} }