private void BTN_SAVE_Click(object sender, EventArgs e) { if (CMB_TRANS_TYPE.SelectedIndex < 0) { MSGBOX mdg = new MSGBOX(MessageAlertHeder.Warning(), "PLEASE SELECT TRANSACTION CATEGORY TYPE!", MessageAlertImage.Warning()); mdg.ShowDialog(); CMB_TRANS_TYPE.Focus(); } else if (TXT_TRANS_CAT.Text == string.Empty) { MSGBOX mdg = new MSGBOX(MessageAlertHeder.Warning(), "PLEASE ENTER TRANSACTION CATEGORY NAME!", MessageAlertImage.Warning()); mdg.ShowDialog(); CMB_TRANS_TYPE.Focus(); } else { if (BTN_SAVE.Text == "SAVE") { string result = SAVE_TRANSACTION_CATEGORY(); if (result == "done") { MSGBOX mdg = new MSGBOX(MessageAlertHeder.Success(), "TRANSACTION CATEGORY SAVED SUCCESSFULLY", MessageAlertImage.Success()); mdg.ShowDialog(); CLEAR(); LOAD_OTHER_CATEGORY_LIST(); } } else { string result = UPDATE_TRANSACTION_CATEGORY(); if (result == "done") { MSGBOX mdg = new MSGBOX(MessageAlertHeder.Success(), "TRANSACTION CATEGORY UPDATED SUCCESSFULLY", MessageAlertImage.Success()); mdg.ShowDialog(); LOAD_OTHER_CATEGORY_LIST(); } } } }
private string SAVE_MEAL_PLAN() { try { if (TXT_DESCRIPTION.Text == string.Empty) { TXT_DESCRIPTION.Text = "N/A"; } CONNECTION.open_connection(); using (MySqlCommand cmd = new MySqlCommand("INSERT INTO meal_types(type,description,adult_meal_price,child_meal_price) VALUES(@type,@description,@adult_meal_price,@child_meal_price)", CONNECTION.CON)) { cmd.Parameters.Clear(); cmd.Parameters.AddWithValue("@type", TXT_MP_NAME.Text); cmd.Parameters.AddWithValue("@description", TXT_DESCRIPTION.Text); cmd.Parameters.AddWithValue("@adult_meal_price", Convert.ToDouble(TXT_ADULT_PRICE.Text)); cmd.Parameters.AddWithValue("@child_meal_price", Convert.ToDouble(TXT_CHILD_PRICE.Text)); if (cmd.ExecuteNonQuery() > 0) { int meal_plan_id = 0; using (MySqlDataAdapter adp = new MySqlDataAdapter("SELECT MAX(meal_type_id) FROM meal_types", CONNECTION.CON)) { DataTable tbl = new DataTable(); adp.Fill(tbl); if (tbl.Rows.Count > 0) { meal_plan_id = tbl.Rows[0].Field <Int32>(0); } } LBL_MP_ID.Text = meal_plan_id.ToString(); return("done"); } else { return("error"); } } } catch (Exception ex) { if (ex.Message.Contains("Duplicate entry")) { MSGBOX mdg = new MSGBOX(MessageAlertHeder.Warning(), "MEAL PLAN NAME ALREADY EXSIST!", MessageAlertImage.Warning()); mdg.ShowDialog(); } else { MSGBOX mdg = new MSGBOX(MessageAlertHeder.Error(), ex.Message, MessageAlertImage.Error()); mdg.ShowDialog(); } return("error"); } finally { CONNECTION.close_connection(); } }
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_CANCEL_ORDER_Click(object sender, EventArgs e) { if (DGV_KOT.SelectedRows.Count > 0) { DialogResult dialogResult = MessageBox.Show("Are you sure, Do you want to cancel the order ?", "Cancel Order", MessageBoxButtons.YesNo); if (dialogResult == DialogResult.Yes) { string result = CANCEL_ORDER(DGV_KOT.SelectedRows[0].Cells["Column1"].Value.ToString()); if (result == "done") { MSGBOX mdg = new MSGBOX(MessageAlertHeder.Success(), "ORDER CANCELED SUCCESSFULLY", MessageAlertImage.Success()); mdg.ShowDialog(); } } } else { MSGBOX mdg = new MSGBOX(MessageAlertHeder.Warning(), "PLEASE SELECT ORDER TO CANCEL", MessageAlertImage.Warning()); mdg.ShowDialog(); } }
private void BTN_SAVE_Click(object sender, EventArgs e) { if (TXT_ROOM_NO.Text == string.Empty) { TXT_ROOM_NO.Focus(); MSGBOX mdg = new MSGBOX(MessageAlertHeder.Warning(), "PLEASE ENTER ROOM NO/NAME", MessageAlertImage.Warning()); mdg.ShowDialog(); } else if (CMB_ROOM_PKG.SelectedIndex < 0) { CMB_ROOM_PKG.Focus(); MSGBOX mdg = new MSGBOX(MessageAlertHeder.Warning(), "PLEASE SELECT ROOM PACKAGE", MessageAlertImage.Warning()); mdg.ShowDialog(); } else if (CMB_ROOM_TYPE.SelectedIndex < 0) { CMB_ROOM_TYPE.Focus(); MSGBOX mdg = new MSGBOX(MessageAlertHeder.Warning(), "PLEASE SELECT ROOM TYPE", MessageAlertImage.Warning()); mdg.ShowDialog(); } else if (CMB_FLOOR.SelectedIndex < 0) { CMB_FLOOR.Focus(); MSGBOX mdg = new MSGBOX(MessageAlertHeder.Warning(), "PLEASE SELECT THE FLOOR", MessageAlertImage.Warning()); mdg.ShowDialog(); } else { if (BTN_SAVE.Text == "SAVE") { string result = SAVE_ROOM(); if (result == "done") { MSGBOX mdg = new MSGBOX(MessageAlertHeder.Success(), "ROOM ADDED SUCCESSFULLY!", MessageAlertImage.Success()); mdg.ShowDialog(); DisableControls(); } } else if (BTN_SAVE.Text == "UPDATE") { string result = UPDATE_ROOM_DETAILS(); if (result == "done") { MSGBOX mdg = new MSGBOX(MessageAlertHeder.Success(), "ROOM DETAILS UPDATED SUCCESSFULLY!", MessageAlertImage.Success()); mdg.ShowDialog(); } } LOAD_ROOM_lIST(); } }
private void BTN_SAVE_Click(object sender, EventArgs e) { if (TXT_PKG_NAME.Text == string.Empty) { TXT_PKG_NAME.Focus(); MSGBOX mdg = new MSGBOX(MessageAlertHeder.Warning(), "PLEASE ENTER PACKAGE NAME", MessageAlertImage.Warning()); mdg.ShowDialog(); } else if (CMB_ROOM_TYPE.SelectedIndex < 0) { CMB_ROOM_TYPE.Focus(); MSGBOX mdg = new MSGBOX(MessageAlertHeder.Warning(), "PLEASE SELECT ROOM TYPE", MessageAlertImage.Warning()); mdg.ShowDialog(); } else { if (BTN_SAVE.Text == "SAVE") { SAVE_ROOM_PACKAGE(); } else if (BTN_SAVE.Text == "UPDATE") { string result = UPDATE_PACKAGE(); if (result == "done") { MSGBOX mdg = new MSGBOX(MessageAlertHeder.Success(), "PACKAGE DETAILS UPDATED SUCCESSFULLY!", MessageAlertImage.Success()); mdg.ShowDialog(); LOAD_PACKAGE_LIST(); } } LOAD_PACKAGE_LIST(); } }
private string SAVE_ROOM() { try { if (TXT_DESCRIPTION.Text == string.Empty) { TXT_DESCRIPTION.Text = "N/A"; } CONNECTION.open_connection(); using (MySqlCommand cmd = new MySqlCommand("INSERT INTO room(room_name,room_package_id,room_floor,description,room_type) VALUES(@room_name,@room_package_id,@room_floor,@description,@room_type)", CONNECTION.CON)) { cmd.Parameters.Clear(); cmd.Parameters.AddWithValue("@room_name", TXT_ROOM_NO.Text); cmd.Parameters.AddWithValue("@room_package_id", CMB_ROOM_PKG.SelectedValue); cmd.Parameters.AddWithValue("@room_floor", CMB_FLOOR.Text); cmd.Parameters.AddWithValue("@description", TXT_DESCRIPTION.Text); cmd.Parameters.AddWithValue("@room_type", CMB_ROOM_TYPE.Text); if (cmd.ExecuteNonQuery() > 0) { return("done"); } else { return("error"); } } } catch (Exception ex) { if (ex.Message.Contains("Duplicate entry")) { MSGBOX mdg = new MSGBOX(MessageAlertHeder.Warning(), "ROOM NAME ALREADY EXSIST!", MessageAlertImage.Warning()); mdg.ShowDialog(); } else { MSGBOX mdg = new MSGBOX(MessageAlertHeder.Error(), ex.Message, MessageAlertImage.Error()); mdg.ShowDialog(); } return("error"); } finally { CONNECTION.close_connection(); } }
private void BTN_OK_Click_1(object sender, EventArgs e) { if (TXT_ITEM_NAME.Text == string.Empty) { MSGBOX mdg = new MSGBOX(MessageAlertHeder.Warning(), "PLEASE ENTER ITEM NAME", MessageAlertImage.Warning()); mdg.ShowDialog(); TXT_ITEM_NAME.Focus(); } else { string result = ADD_OPEN_FOOD(); if (result == "done") { MSGBOX mdg = new MSGBOX(MessageAlertHeder.Success(), "OPEN FOOD ADDED SUCCESSFULLY", MessageAlertImage.Success()); mdg.ShowDialog(); this.Close(); } } }
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 BTN_ADD_SERVICE_Click(object sender, EventArgs e) { CONNECTION.open_connection(); try { if (CMB_SERVICES.SelectedIndex == -1) { MSGBOX mdg = new MSGBOX(MessageAlertHeder.Warning(), "Select a Service", MessageAlertImage.Warning()); mdg.ShowDialog(); CMB_SERVICES.DroppedDown = true; } else if (TXT_QTY.Text == "0.00") { MSGBOX mdg = new MSGBOX(MessageAlertHeder.Warning(), "Enter Quantity", MessageAlertImage.Warning()); mdg.ShowDialog(); TXT_QTY.Focus(); } else { using (MySqlCommand addservice = new MySqlCommand("INSERT INTO additional_service(reservation_id,additional_serivice_id,additional_serivice_qty,additional_serivice_price,room_id) VALUES(@rid,@serviceid,@qty,@price,@roomid)", CONNECTION.CON)) { addservice.Parameters.AddWithValue("@rid", Reservation_id); addservice.Parameters.AddWithValue("@serviceid", CMB_SERVICES.SelectedValue); addservice.Parameters.AddWithValue("@qty", TXT_QTY.Text); addservice.Parameters.AddWithValue("@price", Convert.ToDouble(TXT_SUBTOTAL.Text)); addservice.Parameters.AddWithValue("@roomid", Room_id); int n1 = addservice.ExecuteNonQuery(); if (n1 == 1) { DISPLAY_ADDED_SERVICES(Reservation_id, Room_id); MSGBOX mdg = new MSGBOX(MessageAlertHeder.Success(), "Service Added Successfully", MessageAlertImage.Success()); mdg.ShowDialog(); } } } } catch (Exception ex) { MSGBOX mdg = new MSGBOX(MessageAlertHeder.Error(), ex.Message, MessageAlertImage.Error()); mdg.ShowDialog(); } finally { CONNECTION.close_connection(); } }
private void DGV_AGENT_LIST_MouseDoubleClick(object sender, MouseEventArgs e) { if (DGV_AGENT_LIST.SelectedRows.Count > 0) { foreach (DataGridViewRow dgvr in DGV_AGENT_LIST.SelectedRows) { LBL_AGENT_ID.Text = dgvr.Cells[0].Value.ToString(); TXT_AGENT_NAME.Text = dgvr.Cells[1].Value.ToString(); TXT_ADDRESS.Text = dgvr.Cells[2].Value.ToString(); TXT_COMPANY_NAME.Text = dgvr.Cells[3].Value.ToString(); TXT_CONTACT_NO.Text = dgvr.Cells[4].Value.ToString(); TXT_COMPANY_CONTACT_NO.Text = dgvr.Cells[5].Value.ToString(); TXT_DESCRIPTION.Text = dgvr.Cells[6].Value.ToString(); TXT_COM_RATE.Text = dgvr.Cells[7].Value.ToString(); } EnableControls(true); BTN_SAVE.Text = "UPDATE"; } else { MSGBOX mdg = new MSGBOX(MessageAlertHeder.Warning(), "No Rows Selected", MessageAlertImage.Warning()); mdg.ShowDialog(); } }
private void BTN_SAVE_Click(object sender, EventArgs e) { if (String.IsNullOrEmpty(TXT_AGENT_NAME.Text)) { MSGBOX mdg = new MSGBOX(MessageAlertHeder.Warning(), "Enter Agent Name", MessageAlertImage.Warning()); mdg.ShowDialog(); TXT_AGENT_NAME.Focus(); } else if (String.IsNullOrEmpty(TXT_ADDRESS.Text)) { MSGBOX mdg = new MSGBOX(MessageAlertHeder.Warning(), "Enter Agent Address", MessageAlertImage.Warning()); mdg.ShowDialog(); TXT_ADDRESS.Focus(); } else if (String.IsNullOrEmpty(TXT_COMPANY_NAME.Text)) { MSGBOX mdg = new MSGBOX(MessageAlertHeder.Warning(), "Enter Company Name", MessageAlertImage.Warning()); mdg.ShowDialog(); TXT_COMPANY_NAME.Focus(); } else if (String.IsNullOrEmpty(TXT_CONTACT_NO.Text)) { MSGBOX mdg = new MSGBOX(MessageAlertHeder.Warning(), "Enter Contact Number", MessageAlertImage.Warning()); mdg.ShowDialog(); TXT_CONTACT_NO.Focus(); } else if (String.IsNullOrEmpty(TXT_COMPANY_CONTACT_NO.Text)) { MSGBOX mdg = new MSGBOX(MessageAlertHeder.Warning(), "Enter Company Contact Number", MessageAlertImage.Warning()); mdg.ShowDialog(); TXT_COMPANY_CONTACT_NO.Focus(); } else if (String.IsNullOrEmpty(TXT_COM_RATE.Text)) { MSGBOX mdg = new MSGBOX(MessageAlertHeder.Warning(), "Enter Commision Rate", MessageAlertImage.Warning()); mdg.ShowDialog(); TXT_COM_RATE.Focus(); } else { if (BTN_SAVE.Text == "SAVE") { AddAgent(); } else if (BTN_SAVE.Text == "UPDATE") { UpdateAgent(); } } }
private void BTN_ADD_TO_MENU_Click(object sender, EventArgs e) { MySqlCommand cmd = CONNECTION.CON.CreateCommand(); MySqlTransaction myTrans = null; try { CONNECTION.open_connection(); cmd.Connection = CONNECTION.CON; cmd.Transaction = myTrans; myTrans = CONNECTION.CON.BeginTransaction(); if (CMB_MEAL_TYPE.SelectedIndex <= -1) { MSGBOX mdg = new MSGBOX(MessageAlertHeder.Warning(), "PLEASE SELECT MEAL TYPE", MessageAlertImage.Warning()); mdg.ShowDialog(); CMB_MEAL_TYPE.Focus(); } else if (LST_ITEMS.CheckedItems.Count <= 0) { MSGBOX mdg = new MSGBOX(MessageAlertHeder.Warning(), "PLEASE SELECT ITEMS TO ADD", MessageAlertImage.Warning()); mdg.ShowDialog(); LST_ITEMS.Focus(); } else { foreach (ListViewItem itm in LST_ITEMS.CheckedItems) { using (MySqlDataAdapter adp = new MySqlDataAdapter("SELECT id FROM daily_menu WHERE menu_date=@menu_date AND item_stock_id=@item_stock_id", CONNECTION.CON)) { adp.SelectCommand.Parameters.Clear(); adp.SelectCommand.Parameters.AddWithValue("@menu_date", DTP_MENU_DATE.Value.ToString("yyyy-MM-dd")); adp.SelectCommand.Parameters.AddWithValue("@item_stock_id", Convert.ToInt32(itm.SubItems[4].Text)); DataTable tbl = new DataTable(); adp.Fill(tbl); if (tbl.Rows.Count <= 0) { cmd.CommandText = "INSERT INTO daily_menu(meal_type,item_stock_id,menu_date,added_by) VALUES(@meal_type,@item_stock_id,@menu_date,@added_by)"; cmd.Parameters.Clear(); cmd.Parameters.AddWithValue("@meal_type", CMB_MEAL_TYPE.Text); cmd.Parameters.AddWithValue("@item_stock_id", Convert.ToInt32(itm.SubItems[4].Text)); cmd.Parameters.AddWithValue("@menu_date", DTP_MENU_DATE.Value.ToString("yyyy-MM-dd")); cmd.Parameters.AddWithValue("@added_by", Convert.ToInt32(CLS_CURRENT_LOGGER.LOGGED_IN_USERID)); cmd.ExecuteNonQuery(); } } } myTrans.Commit(); MSGBOX mdg = new MSGBOX(MessageAlertHeder.Success(), "MENU ITEMS ADDED SUCCESSFULLY", MessageAlertImage.Success()); mdg.ShowDialog(); LOAD_DAY_MENU(DTP_MENU_DATE.Value.ToString("yyyy-MM-dd")); foreach (ListViewItem itm in LST_ITEMS.CheckedItems) { itm.Checked = false; } } } catch (Exception EX) { myTrans.Rollback(); 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 (TXT_MP_NAME.Text == string.Empty) { TXT_MP_NAME.Focus(); MSGBOX mdg = new MSGBOX(MessageAlertHeder.Warning(), "PLEASE ENTER MEAL PLAN NAME", MessageAlertImage.Warning()); mdg.ShowDialog(); } else { if (BTN_SAVE.Text == "SAVE") { string result = SAVE_MEAL_PLAN(); if (result == "done") { MSGBOX mdg = new MSGBOX(MessageAlertHeder.Success(), "MEAL PLAN ADDED SUCCESSFULLY!", MessageAlertImage.Success()); mdg.ShowDialog(); DisableControls(); } } else { string result = UPDATE_MEAL_PLAN(); if (result == "done") { MSGBOX mdg = new MSGBOX(MessageAlertHeder.Success(), "PACKAGE DETAILS UPDATED SUCCESSFULLY!", MessageAlertImage.Success()); mdg.ShowDialog(); } } LOAD_MEAP_PLAN_lIST(); } }
private string ADD_FLOOR() { try { CONNECTION.open_connection(); using (MySqlCommand cmd = new MySqlCommand("INSERT INTO floor(floor_no) VALUES(@floor_no)", CONNECTION.CON)) { cmd.Parameters.Clear(); cmd.Parameters.AddWithValue("@floor_no", TXT_FLOOR_NAME.Text); if (cmd.ExecuteNonQuery() > 0) { return("done"); } else { return("error"); } } } catch (Exception ex) { if (ex.Message.Contains("Duplicate entry")) { MSGBOX mdg = new MSGBOX(MessageAlertHeder.Warning(), "fLOOR NAME ALREADY EXSIST!", MessageAlertImage.Warning()); mdg.ShowDialog(); } else { MSGBOX mdg = new MSGBOX(MessageAlertHeder.Error(), ex.Message, MessageAlertImage.Error()); mdg.ShowDialog(); } return("error"); } finally { CONNECTION.close_connection(); } }
public static string GetServer() { try { string serverip = Application.StartupPath + "\\config.ini"; string ip; StreamReader oReader = new StreamReader(serverip); ip = null; if (File.Exists(serverip)) { ip = oReader.ReadToEnd(); oReader.Close(); } else { MSGBOX mdg = new MSGBOX(MessageAlertHeder.Warning(), "invalied ip address", MessageAlertImage.Warning()); mdg.ShowDialog(); Application.Exit(); } return(ip); } catch (Exception EX) { return(EX.Message); } }
private void BTN_SAVE_Click(object sender, EventArgs e) { if (TXT_SV_NAME.Text == string.Empty) { TXT_SV_NAME.Focus(); MSGBOX mdg = new MSGBOX(MessageAlertHeder.Warning(), "PLEASE ENTER SERVICE NAME", MessageAlertImage.Warning()); mdg.ShowDialog(); } else { if (BTN_SAVE.Text == "SAVE") { string result = SAVE_SERVICE(); if (result == "done") { MSGBOX mdg = new MSGBOX(MessageAlertHeder.Success(), "ADDITIONAL SERVICE ADDED SUCCESSFULLY!", MessageAlertImage.Success()); mdg.ShowDialog(); DisableControls(); } } else if (BTN_SAVE.Text == "UPDATE") { string result = UPDATE_SERVICE_DETAILS(); if (result == "done") { MSGBOX mdg = new MSGBOX(MessageAlertHeder.Success(), "SERVICE DETAILS UPDATED SUCCESSFULLY!", MessageAlertImage.Success()); mdg.ShowDialog(); } } LOAD_SERVICE_lIST(); } }