public static bool InsertOrders(List <Porder> orders) { bool inserted = false; int count = 0; foreach (Porder order in orders) { count = new Crud().AddOrder(order); if (count != 0) { inserted = true; } } List <Customer> customers = CustomerHandler.GetCustomers(); foreach (Customer customer in customers) { if (customer.PUserId != orders[0].PUserId) { inserted = CustomerHandler.AddCustomer(orders[0].PUserId); } } return(inserted); }
public CustomerWindow() { _customerHandler = new CustomerHandler(); CustomerSource = _customerHandler.GetCustomers(""); InitializeComponent(); RefreshButtonEnabled(); }
// GET: Customers //[HttpGet] public ActionResult Index() { int?pageSize = null; int?pageCurrent = null; if (pageSize == null) { pageSize = MessageResConst.PageSize; } if (pageCurrent == null) { pageCurrent = 1; } ViewBag.PageSize = ListPageSize.GetListPageSize(); var listCustomer = _customerHandler.GetCustomers((int)pageSize, (int)pageCurrent, "Name", "increase", null); CustomerViewModel viewModel = new CustomerViewModel(); viewModel.ListCustomerModel = listCustomer.Data; int size = listCustomer.CountData / (int)pageSize + 1; viewModel.DisplayPage = pageCurrent.ToString() + "/" + size.ToString(); viewModel.CountPage = size; return(View(viewModel)); }
public List <Customer> getCustomers() { return(CustomerHandler.GetCustomers()); }
public void displayView(Puser user) { this.user = user; Console.WriteLine("===================== ADMINISTRATOR =================="); Console.WriteLine(); Console.WriteLine($"Choose from the options below from 1 to {menuAdmin.Length}"); Console.WriteLine(); int listCount = 1; int option; for (int i = 0; i < menuAdmin.Length - 1; listCount++, i++) { Console.WriteLine($" ({listCount}) \t {menuAdmin[i]}"); } Console.WriteLine(); do { option = base.GetValidatedOption(menuAdmin.Length - 1); } while (option == -1); //Load Locations from domainusing List <Plocation> locations = LocationHandler.GetLocationData(); switch (option - 1) { case (int)menuAdminConst.Stores: { LocationView.DisplayLocationsOptions(locations); break; } case (int)menuAdminConst.Pizzas: { LocationView.DisplayLocationsOptions(locations); do { option = base.GetValidatedOption(locations.Count - 1); } while (option == -1); //Load Pizzas from domain List <Pizza> pizzas = PizzaHandler.GetPizzasFromLocation(locations[option - 1]); //Display pizzas PizzaView.DisplayPizzas(pizzas); break; } case (int)menuAdminConst.Order: { List <Porder> orders = OrderHandler.GetOrders(); OrderView.DisplayOrders(orders); break; } case (int)menuAdminConst.Customer: { List <Customer> customers = CustomerHandler.GetCustomers(); CustomerDetailsView.DisplayCustomerDetails(customers); break; } case (int)menuAdminConst.Sales: { break; } case (int)menuAdminConst.Users: { List <Puser> users = UserHandler.GetUsers(); UserDetailsView.DisplayUserDetails(users); break; } } string option1; do { option1 = base.GetInput("Type in YES to continue or NO to quit. "); if (option1.ToLower().Equals("yes")) { displayView(user); } else if (option1.ToLower().Equals("no")) { Console.WriteLine("Thank you for choosing PizaBox"); Environment.Exit(0); } else { Console.WriteLine("Incorrect Option, pls try again."); Console.WriteLine(); } } while (option1.ToLower().Equals("yes") || option1.ToLower().Equals("no")); Console.WriteLine(); }
private void RefreshDataGrid() { CustomerSource = _customerHandler.GetCustomers(SearchTextBox.Text); CustomerDataGrid?.GetBindingExpression(ItemsControl.ItemsSourceProperty)?.UpdateTarget(); CustomerDataGrid?.Items.Refresh(); }