public MainWindowViewModel(IDataAccess dataAccess = null, IShoppingListManager shoppingListManager = null) { // prepare for Unit Test DataAccess = dataAccess ?? new DataAccess(); ShoppingListManager = shoppingListManager ?? new ShoppingListManager(); // Get all data ShoppingLists = DataAccess.ToLoad(); // set WeekDay DayWeekTime = DateTime.Today.DayOfWeek; // Textbox: placeholder WantBuy = "e.g. apple ..."; // DataGrid: load data from Json, display on DataGrid todayShoppingList ToBuys = new ObservableCollection <ToBuy>(ShoppingListManager.TodayShoppingList(ShoppingLists)); // ClearButton ClearCommand = new ClearCommand(this); // AddButton AddCommand = new AddCommand(this); // Remove item Button RemoveSelectedCommand = new RemoveSelectedCommand(this); // arrange Button ArrangeCommand = new ArrangeCommand(this); // Monday ... Sunday Button MondayCommand = new MondayCommand(this); TuesdayCommand = new TuesdayCommand(this); WednesdayCommand = new WednesdayCommand(this); ThursdayCommand = new ThursdayCommand(this); FridayCommand = new FridayCommand(this); SaturdayCommand = new SaturdayCommand(this); SundayCommand = new SundayCommand(this); // print Btn PrintCommand = new PrintCommand(this); }
public async Task <IActionResult> ChangeProduct(int listId, int productId, [FromBody] ChangeProductArgs args) { if (listId == 0 || productId == 0 || (!args.Change.HasValue && string.IsNullOrWhiteSpace(args.NewName))) { return(new BadRequestResult()); } return(Json((await ShoppingListManager.ChangeProduct(Context, listId, Session.Id, productId, args.Change.HasValue ? args.Change.Value : 0, args.Order, args.NewName)))); }
public async Task <IActionResult> DeleteProduct(int listId, int productId) { if (listId == 0 || productId == 0) { return(new BadRequestResult()); } return(Json(await ShoppingListManager.DeleteProduct(Context, listId, Session.Id, productId))); }
public async Task <IActionResult> AddProduct(int listId, [FromBody] AddProductArgs args) { if (listId == 0 || (string.IsNullOrWhiteSpace(args.Gtin) && string.IsNullOrWhiteSpace(args.ProductName))) { return(new BadRequestResult()); } return(Json((await ShoppingListManager.AddProduct(Context, listId, Session.Id, args.ProductName, args.Gtin, args.Amount.Value, args.Order)))); }
public async Task <IActionResult> DeleteContributor(int listId, int contributorId) { if (listId == 0 || contributorId == 0) { return(new BadRequestResult()); } return(Json(await ShoppingListManager.DeleteContributor(Context, listId, Session.Id, contributorId))); }
public ShoppingList() { InitializeComponent(); manager = new ShoppingListManager(); this.BindingContext = manager; ItemList.ItemsSource = manager.Items; }
public ShoppingList() { InitializeComponent(); manager = new ShoppingListManager(); this.BindingContext = manager; ItemList.ItemsSource = manager.Items; }
public async Task <IActionResult> RenameList(int listId, [FromBody] ChangeListNameArgs args) { if (listId == 0 || string.IsNullOrWhiteSpace(args.Name)) { return(Json(new Result { Success = false, Error = "ListID is wrong or name is empty" })); } return(Json(await ShoppingListManager.ChangeListname(Context, listId, Session.Id, args.Name))); }
public async Task <IActionResult> GetContributors(int listId) { if (listId == 0) { return(Json(new GetContributorsResult { Error = "The list id was not provided", Success = false })); } return(Json(await ShoppingListManager.GetContributors(Context, listId, Session.Id))); }
public async Task <IActionResult> DeleteList(int listId) { if (listId == 0) { return(Json(new Result { Error = "No list id was provided", Success = false })); } return(Json((await ShoppingListManager.DeleteList(Context, listId, Session.Id)))); }
static void Main(string[] args) { var dataProvider = new ShopYourWayDataProvider(); var listManager = new ShoppingListManager(); var actionsHelper = new QueryStringHelper(); var actions = new IAction[] { new AddItemAction(listManager, dataProvider, actionsHelper), new FindItemAction(dataProvider, actionsHelper), new ShowShoppingListAction(listManager) }; var bot = new BotManager(new ActionResolver(actions)); bot.RunBot(); }
public async Task <IActionResult> BatchAction(int listId, string command, [FromBody] BatchProductArgs args) { if (listId == 0 || args.ProductIds.Count == 0 || string.IsNullOrWhiteSpace(command)) { return(new BadRequestResult()); } switch (command.ToLower()) { case "delete": return(Json(await ShoppingListManager.DeleteProducts(Context, listId, Session.Id, args.ProductIds))); case "change": return(Json(await ShoppingListManager.ChangeProducts(Context, listId, Session.Id, args.ProductIds, args.Amount))); default: return(Json(new Result { Error = "action could not be found", Success = false })); } }
// Start is called before the first frame update void Start() { gui_day = go_gui_day.GetComponent <TextMeshProUGUI>(); sc_aura = go_aura.GetComponent <AuraDetection>(); sc_pc = go_player.GetComponent <PlayerController_Sonic3>(); sc_pool = GetComponent <ObjectPooler>(); sc_list = GetComponent <ShoppingListManager>(); sc_spawn = GetComponent <ItemSpawnManager>(); sc_customer = GetComponent <CustomerManager>(); sc_grab = GetComponent <GrabManager>(); go_canvas.SetActive(true); sc_pool.FillPool(); SetMenu(MenuState.Start); }
public async Task <IActionResult> AddContributor(int listId, [FromBody] AddContributorArgs args) { if (listId == 0 || string.IsNullOrWhiteSpace(args.Name)) { return(Json(new AddContributorResult { Error = "Wrong arguments" })); // new Response { StatusCode = HttpStatusCode.BadRequest }; } User u = await UserManager.FindUserByName(Context.Connection, args.Name);; if (u == null) { return(Json(new AddContributorResult { Error = "User not found" })); } return(Json(await ShoppingListManager.AddContributor(Context, listId, Session.Id, u))); }
public async Task <IActionResult> GetLists() { return(Json(await ShoppingListManager.LoadShoppingLists(Context, Session.Id))); }
public async Task <IActionResult> GetList(int listId, bool alreadyBought) => listId != 0 ? (IActionResult)(Json(await ShoppingListManager.LoadShoppingList(listId, alreadyBought, Session.Id))) : new BadRequestResult();
// Start is called before the first frame update void Awake() { sc_list = go_GM.GetComponent <ShoppingListManager>(); }
public async Task <IActionResult> AddList([FromBody] AddListArgs args) => Json((await ShoppingListManager.AddList(Context, args.Name, Session.Id)));
void Start() { rotation = transform.rotation.eulerAngles; shoppingListManagerStatic = shoppingListManager; }