public void Load() { mybl = FactorySingletonBl.getInstanceBl(); DishGroup = mybl.dish_Profits(); date = mybl.time_Profits(); local = mybl.Profits_by_location(); }
private void select_Click(object sender, RoutedEventArgs e) { mybl = FactorySingletonBl.getInstanceBl(); error.Visibility = Visibility.Hidden; foreach (var item in odL) { if (item.amount != 0) { total += ((item.amount) * (item.d_price)); Ordered_Dish od = new Ordered_Dish(); od.get_dish_id = item.dish_id; od.get_quantity = item.amount; MainWindow.order.Get_time = DateTime.Now; mybl.add_ordered_d(od); intlist.Add((int)od.Get_D_Order_code); // add order_dish id to order's list } } MainWindow.order.get_list = intlist; if (mybl.order_payment_limit(MainWindow.order)) { PlaceOrder.oD_d = true; Close(); } else { intlist.Clear(); error.Visibility = Visibility.Visible; } }
public void load() { mybl = FactorySingletonBl.getInstanceBl(); br = mybl.search_b(MainWindow.order.Get_branch_id); if ((odL.Count == 0) && (br.get_menu != null)) // only do it once, and no empty menu { //return all available meals foreach (var item in br.get_menu) { dL.Add(mybl.search_d(item)); // add them to a list (like a copy constructor :) */ } foreach (var dish in dL) { Dish_to_OD tmpod = new Dish_to_OD(); tmpod.Calories = dish.get_cal; tmpod.dish_id = dish.Get_Dish_id; tmpod.dish_name = dish.Get_name; tmpod.d_price = dish.get_price; tmpod.size = dish.get_size; tmpod.type = dish.get_typ; tmpod.supervision = dish.get_sup; odL.Add(tmpod); } } }
public void load() { mybl = FactorySingletonBl.getInstanceBl(); if (SelectMeal.odL.Count != 0) { foreach (var item in SelectMeal.odL) { amount += item.amount; } } }
private void LogIn_Click(object sender, RoutedEventArgs e) { myBL = FactorySingletonBl.getInstanceBl(); string Signin = sign.Text; bool is_member = false; bool exists = false; Client tmp = new Client(); foreach (var item in myBL.get_client_list()) // find user by name { if (Signin == item.get_name) // found { if (item.get_member_b == true) { // if he's a member (not a guest) is_member = true; tmp = item; break; } else { exists = true; // if he's a member of course he exists } } } if (exists) // meaning he's not a member but a guest once more { ; } if (is_member) { client = tmp; Window logged = new Logged(); logged.Show(); base.Close(); } }
private void select_Click(object sender, RoutedEventArgs e) { //order mybl = FactorySingletonBl.getInstanceBl(); if (!mybl.get_client_list().Exists(i => i.Get_Cus_id == MainWindow.client.Get_Cus_id)) { mybl.add_client((Client)MainWindow.client.Clone()); } MainWindow.order.Get_client_id = MainWindow.client.Get_Cus_id; mybl.add_order(MainWindow.order); // branch Branch mybranch = new Branch(); mybranch = (Branch)mybl.get_branch_list().First(i => i.Get_Branch_id == MainWindow.order.Get_branch_id).Clone(); mybranch.Get_emp_a--; mybl.update_branch((Branch)mybranch.Clone()); PlaceOrder.pO_d = true; base.Close(); }
public MainWindow() { InitializeComponent(); myBL = FactorySingletonBl.getInstanceBl(); }
public static void Main() { IBL test = FactorySingletonBl.getInstanceBl(); List <group_local> zoo = new List <group_local>(); List <group_Order_dish> loo = new List <group_Order_dish>(); List <group_time> woo = new List <group_time>(); List <List <string_int> > poo = new List <List <string_int> >(); List <List <string_int> > goo = new List <List <string_int> >(); List <Branch> doo = new List <Branch>(); List <Branch> soo = new List <Branch>(); int hoo = new int(); double koo = new double(); Dish shnitzal = new Dish { Get_Dish_id = 1, get_cal = 400, Get_name = "shnitzal", get_price = 70, get_size = Sizes.Medium, get_sup = Supervision.Glatt, get_typ = Types.Meat }; Dish tost = new Dish { Get_Dish_id = 2, get_cal = 350, Get_name = "tost", get_price = 25, get_size = Sizes.Medium, get_sup = Supervision.Glatt, get_typ = Types.Dairy }; Dish salad = new Dish { Get_Dish_id = 3, get_cal = 250, Get_name = "salad", get_price = 45, get_size = Sizes.Small, get_sup = Supervision.Basic, get_typ = Types.Vegeterian }; Dish ravioly = new Dish { Get_Dish_id = 4, get_cal = 380, Get_name = "ravioly", get_price = 56, get_size = Sizes.Medium, get_sup = Supervision.Mehadrin, get_typ = Types.Dairy }; Dish shawarma = new Dish { Get_Dish_id = 5, get_cal = 500, Get_name = "shawarma", get_price = 42, get_size = Sizes.Large, get_sup = Supervision.Mehadrin, get_typ = Types.Meat }; Dish tiras = new Dish { Get_Dish_id = 6, get_cal = 400, Get_name = "tiras", get_price = 70, get_size = Sizes.Medium, get_sup = Supervision.Glatt, get_typ = Types.Vegeterian }; Dish melauach = new Dish { Get_Dish_id = 7, get_cal = 350, Get_name = "melauach", get_price = 25, get_size = Sizes.Medium, get_sup = Supervision.Glatt, get_typ = Types.Dairy }; Dish bread = new Dish { Get_Dish_id = 8, get_cal = 250, Get_name = "bread", get_price = 45, get_size = Sizes.Small, get_sup = Supervision.Basic, get_typ = Types.Dairy }; Dish chicken = new Dish { Get_Dish_id = 9, get_cal = 380, Get_name = "chicken", get_price = 56, get_size = Sizes.Medium, get_sup = Supervision.Mehadrin, get_typ = Types.Meat }; Dish chips = new Dish { Get_Dish_id = 10, get_cal = 500, Get_name = "chips", get_price = 42, get_size = Sizes.Large, get_sup = Supervision.Mehadrin, get_typ = Types.Vegeterian }; test.add_dish(shnitzal); test.add_dish(tost); test.add_dish(salad); test.add_dish(ravioly); test.add_dish(shawarma); test.add_dish(tiras); test.add_dish(melauach); test.add_dish(bread); test.add_dish(chicken); test.add_dish(chips); Ordered_Dish A = new Ordered_Dish { get_dish_id = 1, Get_D_Order_code = 30, get_quantity = 7 }; Ordered_Dish B = new Ordered_Dish { get_dish_id = 2, Get_D_Order_code = 31, get_quantity = 8 }; Ordered_Dish C = new Ordered_Dish { get_dish_id = 3, Get_D_Order_code = 32, get_quantity = 9 }; Ordered_Dish D = new Ordered_Dish { get_dish_id = 4, Get_D_Order_code = 33, get_quantity = 10 }; Ordered_Dish E = new Ordered_Dish { get_dish_id = 5, Get_D_Order_code = 34, get_quantity = 11 }; Ordered_Dish F = new Ordered_Dish { get_dish_id = 6, Get_D_Order_code = 35, get_quantity = 5 }; Ordered_Dish G = new Ordered_Dish { get_dish_id = 7, Get_D_Order_code = 36, get_quantity = 1 }; Ordered_Dish H = new Ordered_Dish { get_dish_id = 8, Get_D_Order_code = 37, get_quantity = 12 }; Ordered_Dish I = new Ordered_Dish { get_dish_id = 9, Get_D_Order_code = 38, get_quantity = 2 }; Ordered_Dish J = new Ordered_Dish { get_dish_id = 10, Get_D_Order_code = 39, get_quantity = 15 }; test.add_ordered_d(A); test.add_ordered_d(B); test.add_ordered_d(C); test.add_ordered_d(D); test.add_ordered_d(E); test.add_ordered_d(F); test.add_ordered_d(G); test.add_ordered_d(H); test.add_ordered_d(I); test.add_ordered_d(J); List <int> list_dish_b = new List <int>(); // basic list_dish_b.Add(salad.Get_Dish_id); list_dish_b.Add(bread.Get_Dish_id); List <int> list_dish_g = new List <int>(); // glat list_dish_g.Add(shnitzal.Get_Dish_id); list_dish_g.Add(tost.Get_Dish_id); list_dish_g.Add(melauach.Get_Dish_id); List <int> list_dish_m = new List <int>(); // mehadrin list_dish_m.Add(tiras.Get_Dish_id); list_dish_m.Add(chicken.Get_Dish_id); list_dish_m.Add(chips.Get_Dish_id); list_dish_m.Add(ravioly.Get_Dish_id); list_dish_m.Add(shawarma.Get_Dish_id); Branch a = new Branch { Get_name = "tovale", Get_add = "lala", Get_Branch_id = 60, Get_emp = 6, Get_emp_a = 6, Get_kosher = Supervision.Basic, get_location = Location.Center, get_menu = list_dish_b }; Branch b = new Branch { Get_name = "musaka", Get_add = "ababa", Get_Branch_id = 61, Get_emp = 11, Get_emp_a = 11, Get_kosher = Supervision.Glatt, get_location = Location.Judea_and_Samaria, get_menu = list_dish_g }; Branch c = new Branch { Get_name = "tovli", Get_add = "dada", Get_Branch_id = 62, Get_emp = 15, Get_emp_a = 15, Get_kosher = Supervision.Mehadrin, get_location = Location.Jerusalem, get_menu = list_dish_m }; Branch d = new Branch { Get_name = "torat", Get_add = "picha", Get_Branch_id = 63, Get_emp = 15, Get_emp_a = 15, Get_kosher = Supervision.Mehadrin, get_location = Location.Jerusalem, get_menu = list_dish_m }; test.add_branch(a); test.add_branch(b); test.add_branch(c); test.add_branch(d); Client ma = new Client { get_age = 50, Get_Cus_id = 100, get_name = "Ma", get_phone = 054848, get_cus_lo = Location.Center, get_card = 0303030, get_member_b = true, get_add = "newzeland", get_email = "*****@*****.**" }; Client Da = new Client { get_age = 30, Get_Cus_id = 101, get_name = "Da", get_phone = 054868, get_cus_lo = Location.Jerusalem, get_card = 045630 }; Client ga = new Client { get_age = 20, Get_Cus_id = 102, get_name = "ga", get_phone = 054548, get_cus_lo = Location.Judea_and_Samaria, get_card = 0306000 }; Client la = new Client { get_age = 10, Get_Cus_id = 103, get_name = "la", get_phone = 0543438, get_cus_lo = Location.Center, get_card = 789055 }; Client ta = new Client { get_age = 19, Get_Cus_id = 104, get_name = "ta", get_phone = 0543438, get_cus_lo = Location.North, get_card = 045630 }; test.add_client(ma); test.add_client(Da); test.add_client(ga); test.add_client(la); test.add_client(ta); List <int> od_b = new List <int>(); od_b.Add(32); List <int> od_g = new List <int>(); od_g.Add(30); od_g.Add(31); List <int> od_m = new List <int>(); od_m.Add(33); od_m.Add(34); Order Aa = new Order { Get_Order_code = 200, Get_branch_id = 60, Get_client_id = 100, get_location = Location.Center, Get_time = DateTime.Now, get_list = od_b }; Order Ba = new Order { Get_Order_code = 201, Get_branch_id = 61, Get_client_id = 101, get_location = Location.Jerusalem, Get_time = DateTime.Now, get_list = od_m }; Order Fa = new Order { Get_Order_code = 202, Get_branch_id = 62, Get_client_id = 102, get_location = Location.Judea_and_Samaria, Get_time = DateTime.Now, get_list = od_g }; Order Ra = new Order { Get_Order_code = 203, Get_branch_id = 62, Get_client_id = 103, get_location = Location.Center, Get_time = DateTime.Now, get_list = od_b }; Order Ea = new Order { Get_Order_code = 204, Get_branch_id = 61, Get_client_id = 104, get_location = Location.Center, Get_time = DateTime.Now, get_list = od_b }; test.add_order(Aa); test.add_order(Ba); test.add_order(Fa); test.add_order(Ra); test.add_order(Ea); poo = test.client_order_history(100); // poo goo = test.Brach_order_history(a); // goo doo = test.available_b(Location.Center); // doo soo = test.find_by_kosher(Supervision.Glatt); // soo hoo = test.All_Calories(od_g); // hoo koo = test.oreder_bill(Ea); // koo zoo = test.Profits_by_location(); // zoo loo = test.dish_Profits(); // loo woo = test.time_Profits(); // woo ///////////////////////////////////////////////////////////////////////////// Console.WriteLine("client_order_history"); foreach (var item in poo) { foreach (var items in item) { Console.WriteLine("dish: " + items.name + " quantity:" + items.number + " price: " + items.oo_number); } //Console.WriteLine("\n"); } Console.WriteLine("end"); ///////////////////////////////////////////////////////////////////////////// Console.WriteLine("Brach_order_history"); foreach (var item in goo) { foreach (var items in item) { Console.WriteLine("dish: " + items.name + " quantity:" + items.number + " price: " + items.oo_number); } } Console.WriteLine("end"); ///////////////////////////////////////////////////////////////////////////// Console.WriteLine("available_b"); foreach (var item in doo) { Console.WriteLine("branch id :" + item.Get_Branch_id + " location :" + item.get_location.ToString()); } Console.WriteLine("end"); ///////////////////////////////////////////////////////////////////////////// Console.WriteLine("find_by_kosher"); foreach (var item in soo) { Console.WriteLine("branch id :" + item.Get_Branch_id + " location :" + item.get_location.ToString() + " kosher : " + item.Get_kosher.ToString()); } Console.WriteLine("end"); ///////////////////////////////////////////////////////////////////////////// Console.WriteLine("All_Calories"); Console.WriteLine("cloriot: " + hoo); Console.WriteLine("end"); ///////////////////////////////////////////////////////////////////////////// Console.WriteLine("oreder_bill"); Console.WriteLine("bill: " + koo); Console.WriteLine("end"); ///////////////////////////////////////////////////////////////////////////// Console.WriteLine("Profits_by_location"); foreach (var item in zoo) { Console.WriteLine("location :" + item.local.ToString() + " profit : " + item.sum_p); } Console.WriteLine("end"); ///////////////////////////////////////////////////////////////////////////// Console.WriteLine("dish_Profits"); foreach (var item in loo) { Console.WriteLine("dish name :" + item.name.ToString() + " profit : " + item.sum_p + " quantity: " + item.sum_q); } Console.WriteLine("end"); ///////////////////////////////////////////////////////////////////////////// Console.WriteLine("time_Profits"); foreach (var item in woo) { Console.WriteLine("date:" + item.date.ToString() + " profit : " + item.sum_p); } Console.WriteLine("end"); /////////////////////////////////////////////////////////////////////////////////////////// ///delegate run!! // o_p(); if (true) { ; // debugging test.. } }