/// <summary> /// Constructor of the view model /// </summary> /// <param name="currentPage">Page of the view mode</param> /// <param name="userServices">Services for the "User" table</param> /// <param name="alertServices">Services for the "Alert" table</param> /// <param name="materialServices">Services for the "Material" table</param> /// <param name="productServices">Services for the "Product" table</param> /// <param name="materialsProductServices">Services for the "MaterialProduct" table</param> /// <param name="saleServices">Services for the "Sale" table</param> /// <param name="countAlerts">Number of alerts</param> public BoardViewModel(BoardWindow currentPage, UserServices userServices, AlertServices alertServices, MaterialServices materialServices, ProductServices productServices, MaterialsProductServices materialsProductServices, SaleServices saleServices, int countAlerts) { CurrentPage = currentPage; CurrentUserName = $"Welcome {AppSettings.CurrentUser.Login} {(AppSettings.CurrentUser.Role == ERole.Administrator.ToString() ? "(admin)" : "")} !"; CurrentUserAdmin = AppSettings.CurrentUser.Role == ERole.Administrator.ToString() ? Visibility.Visible : Visibility.Hidden; CurrentUserLambda = AppSettings.CurrentUser.Role == ERole.User.ToString() ? Visibility.Visible : Visibility.Hidden; UserServices = userServices; AlertServices = alertServices; MaterialServices = materialServices; ProductServices = productServices; MaterialsProductServices = materialsProductServices; SaleServices = saleServices; BadgeAlert = countAlerts; GoBackCommand = new CommandHandler(GoBack, () => true); GoToAddUserCommand = new CommandHandler(GoToAddUser, () => true); GoToAlertsCommand = new AsyncCommand(GoToAlerts, () => true); GoToListingElementsCommand = new AsyncCommand(GoToListingElements, () => true); GoToStatisticsCommand = new AsyncCommand(GoToStatistics, () => true); GoToUpdateStockCommand = new AsyncCommand(GoToUpdateStock, () => true); GoToAddElementCommand = new AsyncCommand(GoToAddElement, () => true); }
/// <summary> /// Constructor of the view model /// </summary> /// <param name="currentPage">Page of the view mode</param> /// <param name="userServices">Services for the "User" table</param> /// <param name="alertServices">Services for the "Alert" table</param> /// <param name="materialServices">Services for the "Material" table</param> /// <param name="productServices">Services for the "Product" table</param> /// <param name="materialsProductServices">Services for the "MaterialProduct" table</param> /// <param name="saleServices">Services for the "Sale" table</param> /// <param name="products">List of products</param> /// <param name="materials">List of materials</param> /// <param name="materialsProducts">List of materials product</param> public ListingElementsViewModel(ListingElementsWindow currentPage, UserServices userServices, AlertServices alertServices, MaterialServices materialServices, ProductServices productServices, MaterialsProductServices materialsProductServices, SaleServices saleServices, List <Product> products, List <Material> materials, List <MaterialsProduct> materialsProducts) { CurrentUserName = $"Welcome {AppSettings.CurrentUser.Login} {(AppSettings.CurrentUser.Role == ERole.Administrator.ToString() ? "(admin)" : "")} !"; CurrentPage = currentPage; UserServices = userServices; AlertServices = alertServices; MaterialServices = materialServices; ProductServices = productServices; MaterialsProductServices = materialsProductServices; SaleServices = saleServices; Products = products; Materials = materials; MaterialsProducts = materialsProducts; GenerateDatagrid(); GoBackCommand = new AsyncCommand(GoBack, () => true); }
/// <summary> /// This window is for adding a element /// </summary> /// <param name="userServices"></param> /// <param name="alertServices"></param> /// <param name="materialServices"></param> /// <param name="productServices"></param> /// <param name="materialsProductServices"></param> /// <param name="saleServices"></param> /// <param name="materials"></param> public AddElementWindow(UserServices userServices, AlertServices alertServices, MaterialServices materialServices, ProductServices productServices, MaterialsProductServices materialsProductServices, SaleServices saleServices, List <Material> materials) { InitializeComponent(); DataContext = new AddElementViewModel(this, userServices, alertServices, materialServices, productServices, materialsProductServices, saleServices, materials); }
public UpdateStockWindow(UserServices userServices, AlertServices alertServices, MaterialServices materialServices, ProductServices productServices, MaterialsProductServices materialsProductServices, SaleServices saleServices, List <Product> products, List <Material> materials) { InitializeComponent(); DataContext = new UpdateStockViewModel(this, userServices, alertServices, materialServices, productServices, materialsProductServices, saleServices, products, materials); }
/// <summary> /// Constructor of the view model /// </summary> /// <param name="currentPage">Page of the view mode</param> /// <param name="userServices">Services for the "User" table</param> /// <param name="alertServices">Services for the "Alert" table</param> /// <param name="materialServices">Services for the "Material" table</param> /// <param name="productServices">Services for the "Product" table</param> /// <param name="materialsProductServices">Services for the "MaterialProduct" table</param> /// <param name="saleServices">Services for the "Sale" table</param> /// <param name="countBySite">Data to the graphic "Count Sales By Site"</param> /// <param name="evolutionByMonth">Data to the graphic "Evolution by month"</param> /// <param name="moneyEarned">Money earned until the start</param> /// <param name="moneyEarnedByYear">Data to the graphic "Money by year"</param> public StatisticsViewModel(StatisticsWindow currentPage, UserServices userServices, AlertServices alertServices, MaterialServices materialServices, ProductServices productServices, MaterialsProductServices materialsProductServices, SaleServices saleServices, Dictionary <string, int> countBySite, List <Tuple <string, int, int, int> > evolutionByMonth, float moneyEarned, Dictionary <int, float> moneyEarnedByYear) { CurrentPage = currentPage; CurrentUserName = $"Welcome {AppSettings.CurrentUser.Login} {(AppSettings.CurrentUser.Role == ERole.Administrator.ToString() ? "(admin)" : "")} !"; UserServices = userServices; AlertServices = alertServices; MaterialServices = materialServices; ProductServices = productServices; MaterialsProductServices = materialsProductServices; SaleServices = saleServices; GenerateCountSalesBySite(countBySite); GenerateEvolutionByMonth(evolutionByMonth); GenerateMoneyEarnedByYear(moneyEarnedByYear); MoneyEarned = $"{moneyEarned:C}"; GoBackCommand = new AsyncCommand(GoBack, () => true); }
/// <summary> /// Creates a new window /// </summary> /// <param name="userServices"></param> /// <param name="alertServices"></param> /// <param name="countAlerts"></param> public BoardWindow(UserServices userServices, AlertServices alertServices, MaterialServices materialServices, ProductServices productServices, MaterialsProductServices materialsProductServices, SaleServices saleServices, int countAlerts) { InitializeComponent(); DataContext = new BoardViewModel(this, userServices, alertServices, materialServices, productServices, materialsProductServices, saleServices, countAlerts); }
/// <summary> /// Creates a new window /// </summary> public StatisticsWindow(UserServices userServices, AlertServices alertServices, MaterialServices materialServices, ProductServices productServices, MaterialsProductServices materialsProductServices, SaleServices saleServices, Dictionary <string, int> countBySite, List <Tuple <string, int, int, int> > evolutionByMonth, float moneyEarned, Dictionary <int, float> moneyEarnedByYear) { InitializeComponent(); DataContext = new StatisticsViewModel(this, userServices, alertServices, materialServices, productServices, materialsProductServices, saleServices, countBySite, evolutionByMonth, moneyEarned, moneyEarnedByYear); }
/// <summary> /// Method to go to the "Listing" page /// </summary> /// <returns></returns> private async Task GoToListingElements() { ListingElementsWindow page = new ListingElementsWindow(UserServices, AlertServices, MaterialServices, ProductServices, MaterialsProductServices, SaleServices, await ProductServices.GetAll(), await MaterialServices.GetAll(), await MaterialsProductServices.GetAll()); page.Show(); CurrentPage.Close(); }
/// <summary> /// Main window of the application. /// </summary> /// <param name="userServices"></param> /// <param name="alertServices"></param> public MainWindow(UserServices userServices, AlertServices alertServices, MaterialServices materialServices, ProductServices productServices, MaterialsProductServices materialsProductServices, SaleServices saleServices) { InitializeComponent(); DataContext = new MainWindowViewModel(this, userServices, alertServices, materialServices, productServices, materialsProductServices, saleServices); }