private void GetAllOrders() { if (_is_waiter == true || _is_manager == true) { Details.Clear(); Details2.Clear(); Orders.Clear(); conn = new MySqlConnection("Server=localhost;Database=szakdoga_db;Uid=root;Pwd=;SslMode=none"); string q_select = "SELECT o.Order_no, o.Table_no, o.State, w.Realname as Waiter, o.Time FROM orders o INNER JOIN workers w ON w.Worker_ID = o.Waiter ORDER BY o.Order_no"; try { conn.Open(); MySqlCommand cmd = new MySqlCommand(q_select, conn); MySqlDataReader dataReader = cmd.ExecuteReader(); while (dataReader.Read()) { Orders.Add(new Model.Orders { Order_no = Convert.ToInt32(dataReader["Order_no"]), Table_no = Convert.ToInt32(dataReader["Table_no"]), State = dataReader["State"].ToString(), Waiter = dataReader["Waiter"].ToString(), Time = Convert.ToDateTime(dataReader["Time"]).ToString("MM.dd, H:mm"), }); } dataReader.Close(); this.DisplayPage = new Orders_Grid(); conn.Close(); } catch (MySqlException ex) { MessageBox.Show(ex.ToString()); } } }
private void Add_button() { if (New_Order_Details.Count != 0) { List <New_order_details> nod_list = new List <New_order_details>(); for (int i = 0; i < New_Order_Details.Count; i++) { nod_list.Add(New_Order_Details[i]); } int asd = Row_num; nod_list[Row_num].Count += 1; New_Order_Details.Clear(); for (int i = 0; i < nod_list.Count; i++) { New_Order_Details.Add(new Model.New_order_details { Food = nod_list[i].Food, Count = nod_list[i].Count, Food_ID = nod_list[i].Food_ID, Price = nod_list[i].Price }); } } else if (Details2.Count != 0) { Select_State(); if (state_global == "In Progress") { List <New_order_details> list = new List <New_order_details>(); for (int i = 0; i < Details2.Count; i++) { list.Add(Details2[i]); } list[Row_num].Count += 1; Details2.Clear(); for (int i = 0; i < list.Count; i++) { Details2.Add(new Model.New_order_details { Food = list[i].Food, Count = list[i].Count, Food_ID = list[i].Food_ID, Price = list[i].Price }); } Sum_Prices(); } else if (state_global == "Completed") { Display_Message = "Not editable! Order completed!"; } else { Display_Message = "Not editable! Order canceled!"; } } }