public static bool CheckOrderDateTime(Plocation location, Puser user) { List <Porder> orders = new Crud().GetOrders(); for (int i = orders.Count - 1; i >= 0; i--) { if (orders[i].PUser.PUserId == user.PUserId) //Extract the latest Order by the user { DateTime now = DateTime.Now; DateTime datetime = DateTime.Parse(orders[i].PDate + " " + orders[i].PTime); if (orders[i].CLocationId != location.LocationId) //Checks NOT Location { if ((now - datetime).TotalHours <= 24) //Checks within 24 hours period { return(false); } } if (orders[i].CLocationId == location.LocationId) //Checks YES Location { if ((now - datetime).TotalHours <= 2) //Checks within 2 hours period { return(false); } } } } return(true); }
public static bool InsertLocation(string street, string city, string state, string zipcode) { Plocation location = new Plocation(); location.Street = street; location.City = city; location.PState = state; location.Zipcode = zipcode; int count = new Crud().AddLocation(location); if (count != 0) { return(true); } return(false); }
private void CustomerLocation() { locations = LocationHandler.GetLocationData(); Console.WriteLine("Choose from the Store Locations below: "); LocationView.DisplayLocationsOptions(locations); do { Console.WriteLine(); index = base.GetValidatedOption(locations.Count - 1); } while (index == -1); location = locations[index]; LocationView.DisplayLocation(locations, index); Console.WriteLine(); Console.WriteLine(); }
public static List <Pizza> GetPizzasFromLocation(Plocation location) { return(new Crud().GetPizzasFromLocation(location)); }