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 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 LST_ITEM_LIST_KeyDown(object sender, KeyEventArgs e) { if (e.KeyCode == Keys.Up) { if (LST_ITEM_LIST.Items[0].Selected == true) { TXT_ITEMNAME.Focus(); } } if (e.KeyCode == Keys.Enter) { ITEM_CODE = LST_ITEM_LIST.SelectedItems[0].SubItems[0].Text; ITEM_NAME = LST_ITEM_LIST.SelectedItems[0].SubItems[2].Text; BARCODE = LST_ITEM_LIST.SelectedItems[0].SubItems[1].Text; TXT_ITEMNAME.Text = ITEM_NAME; LST_ITEM_LIST.Hide(); TXT_QTY.Focus(); } }