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!"; } } }
private void NewO_Add_button() { bool empty = true; bool n = true; bool z = true; for (int i = 0; i < New_Order_Details.Count; i++) { int u = New_Order_Details[i].Count; if (New_Order_Details[i].Food.Equals(Selected_food) && z == true) { New_Order_Details.RemoveAt(i); New_Order_Details.Add(new Model.New_order_details { Food = Selected_food, Count = Selected_Count + u, Food_ID = Selected_food_index + 1, Price = ListofFood[Selected_food_index + 1].Price }); n = true; z = false; empty = false; } else { n = false; } } if ((n == false && z == true) || empty == true) { New_Order_Details.Add(new Model.New_order_details { Food = Selected_food, Count = Selected_Count, Food_ID = Selected_food_index + 1, Price = ListofFood[Selected_food_index + 1].Price }); } }