/// <summary> /// Create this menu. /// </summary> /// <param name="appState">Global application state.</param> /// <returns>This menu.</returns> public Main(ApplicationData.State appState) : base(appState) { this.AddListMenuOption("Choose Store", ConsoleKey.D1, () => new StoreCliMenuUser.SelectLocation(appState)); this.AddListMenuOption("Order Items", ConsoleKey.D2, () => new StoreCliMenuUser.OrderItems(appState)); this.AddListMenuOption("Review Order", ConsoleKey.D3, () => new StoreCliMenuUser.ReviewOrder(appState)); this.AddListMenuOption("Edit Order", ConsoleKey.D4, () => new StoreCliMenuUser.EditOrder(appState)); this.AddListMenuOption("Order History", ConsoleKey.D5, () => new StoreCliMenuUser.OrderHistory(appState)); }
/// <summary> /// Create this menu. /// </summary> /// <param name="appState">Global application state.</param> /// <returns>This menu.</returns> public Main(ApplicationData.State appState) : base(appState) { this.AddListMenuOption("Customer", ConsoleKey.D1, () => new StoreCliMenuAdmin.Customer(appState)); this.AddListMenuOption("Query", ConsoleKey.D2, () => new StoreCliMenuAdmin.Query(appState)); this.AddListMenuOption("Location Management", ConsoleKey.D3, () => new StoreCliMenuAdmin.LocationManagement(appState)); this.AddListMenuSpace(); this.AddListMenuOption("Find customer by name", ConsoleKey.D4, () => new StoreCliMenuAdmin.FindCustomer(appState)); this.AddListMenuOption("Add new customer", ConsoleKey.D5, () => new StoreCliMenuAdmin.AddCustomer(appState)); this.AddListMenuOption("Add new location", ConsoleKey.D6, () => new StoreCliMenuAdmin.AddLocation(appState)); this.AddListMenuOption("Location order history", ConsoleKey.D7, () => new StoreCliMenuAdmin.LocationOrderHistory(appState)); }
/// <summary> /// Create this menu. /// </summary> /// <param name="appState">Global application state.</param> /// <returns>This menu.</returns> public Main(ApplicationData.State appState) : base(appState) { this.AddListMenuOption("User", ConsoleKey.D1, () => new StoreCliMenuUser.Landing(this.ApplicationState)); this.AddListMenuOption("Administrator", ConsoleKey.D2, () => new StoreCliMenuAdmin.Main(this.ApplicationState)); // This establishes a new database connection and will raise an exception if // there are any problems. We do this so we can detect any connection problems // immediately, and also so there is an active connection for later queries // (the user will not have to wait for a connection except on initial load). using (var db = new StoreDb.StoreContext(appState.DbOptions)){ db.Locations.FirstOrDefault(); } }
/// <summary> /// Entry point. /// </summary> /// <param name="args">CLI args currently not implemented.</param> static void Main(string[] args) { var dbOptions = new DbContextOptionsBuilder <StoreContext>() .UseSqlite("Data Source=store.sqlite") .UseLazyLoadingProxies() .Options; var state = new ApplicationData.State(); state.DbOptions = dbOptions; state.MenuController = new MenuController(state); state.MenuController.Run(); }
/// <summary> /// Create this menu. /// </summary> /// <param name="appState">Global application state.</param> /// <returns>This menu.</returns> public LocationManagement(ApplicationData.State appState) : base(appState) { this.AddListMenuOption("Add New Location", ConsoleKey.D1, () => new StoreCliMenuAdmin.AddLocation(appState)); this.AddListMenuOption("Order History", ConsoleKey.D2, () => new StoreCliMenuAdmin.LocationOrderHistory(appState)); }
/// <summary> /// Create a new List menu. /// </summary> /// <param name="appState">Current shared application state.</param> public CliMenu(ApplicationData.State appState) { this.ApplicationState = appState; this.MenuController = appState.MenuController; }
/// <summary> /// Create a MenuController with the provided global application state. /// </summary> /// <param name="appState">Global shared applicatino state.</param> public MenuController(ApplicationData.State appState) { this.AppState = appState; }
/// <summary> /// Create this menu. /// </summary> /// <param name="appState">Global application state.</param> /// <returns>This menu.</returns> public FindCustomer(ApplicationData.State appState) : base(appState) { }
/// <summary> /// Create this menu. /// </summary> /// <param name="appState">Global application state.</param> /// <returns>This menu.</returns> public ReviewOrder(ApplicationData.State appState) : base(appState) { }
/// <summary> /// Create this menu. /// </summary> /// <param name="appState">Global application state.</param> /// <returns>This menu.</returns> public Customer(ApplicationData.State appState) : base(appState) { this.AddListMenuOption("Find Customer", ConsoleKey.D1, () => new StoreCliMenuAdmin.FindCustomer(appState)); this.AddListMenuOption("Add Customer", ConsoleKey.D2, () => new StoreCliMenuAdmin.AddCustomer(appState)); }
/// <summary> /// Create this menu. /// </summary> /// <param name="appState">Global application state.</param> /// <returns>This menu.</returns> public Query(ApplicationData.State appState) : base(appState) { this.AddListMenuOption("Find Customer", ConsoleKey.D1, () => new StoreCliMenuAdmin.FindCustomer(appState)); this.AddListMenuOption("Get orders by location", ConsoleKey.D2, () => new StoreCliMenuAdmin.LocationOrderHistory(appState)); }
/// <summary> /// Create this menu. /// </summary> /// <param name="appState">Global application state.</param> /// <returns>This menu.</returns> public CreateAccount(ApplicationData.State appState) : base(appState) { }
/// <summary> /// Create this menu. /// </summary> /// <param name="appState">Global application state.</param> /// <returns>This menu.</returns> public LocationOrderHistory(ApplicationData.State appState) : base(appState) { this.SortKey = OrderSortKey.DateDesc; }
/// <summary> /// Create this menu. /// </summary> /// <param name="appState">Global application state.</param> /// <returns>This menu.</returns> public AddLocation(ApplicationData.State appState) : base(appState) { }
/// <summary> /// Create this menu. /// </summary> /// <param name="appState">Global application state.</param> /// <returns>This menu.</returns> public Landing(ApplicationData.State appState) : base(appState) { this.AddListMenuOption("Login", ConsoleKey.D1, () => new StoreCliMenuUser.Login(appState)); this.AddListMenuOption("Create Account", ConsoleKey.D2, () => new StoreCliMenuUser.CreateAccount(appState)); }
/// <summary> /// Create this menu. /// </summary> /// <param name="appState">Global application state.</param> /// <returns>This menu.</returns> public OrderItems(ApplicationData.State appState) : base(appState) { }
/// <summary> /// Create this menu. /// </summary> /// <param name="appState">Global application state.</param> /// <returns>This menu.</returns> public Login(ApplicationData.State appState) : base(appState) { }
/// <summary> /// Create this menu. /// </summary> /// <param name="appState">Global application state.</param> /// <returns>This menu.</returns> public EditOrder(ApplicationData.State appState) : base(appState) { }
/// <summary> /// Create this menu. /// </summary> /// <param name="appState">Global application state.</param> /// <returns>This menu.</returns> public SelectLocation(ApplicationData.State appState) : base(appState) { }