protected ProductsViewModel(MainViewModel mainViewModel) { MainViewModel = mainViewModel; FromDateFilter = DateTime.Today.AddDays(-14); ThroughDateFilter = DateTime.Today.AddDays(1); CategoryFilter = mainViewModel.Context.Categories.ToList(); CategoryFilter.Insert(0, new Category{Name = "Any"}); SelectedCategoryFilter = CategoryFilter.FirstOrDefault(); SalesmanFilter = mainViewModel.Context.Salesmen.ToList(); SalesmanFilter.Insert(0, new Salesman{Contragent = new Contragent{LastName = "Any"}}); SelectedSalesmanFilter = SalesmanFilter.FirstOrDefault(); OriginFilter = new List<TranType>{TranType.Any, TranType.Bought, TranType.ToRepair, TranType.ToPawn}; SelectedOriginFilter = OriginFilter.FirstOrDefault(); Products = new ObservableCollection<ProductViewModel>(GetProducts(MainViewModel.Context)); ProductsView = CollectionViewSource.GetDefaultView(Products); ProductsView.Filter = Filter; CloseSellProductDialog = new DelegateCommand(() => SellProductDialogViewModel = null); CloseEditProductDialogCommand = new DelegateCommand(() => EditProductDialogViewModel = null); ShowAllTransactionsCommand = new DelegateCommand(ShowAllTransactions); CloseShowAllTransactionsDialogCommand = new DelegateCommand(() => ShowAllTransactionsDialogViewModel = null); FilterCommand = new DelegateCommand(ProductsView.Refresh); }
public ClientsViewModel(MainViewModel mainViewModel) : base(mainViewModel.Context) { _mainViewModel = mainViewModel; CloseEditClientDialogCommand = new DelegateCommand(() => EditClientDialogViewModel = null); }
public CashTransactionsViewModel(MainViewModel mainViewModel) { _mainViewModel = mainViewModel; FromDateFilter = DateTime.Today.AddDays(-14); ThroughDateFilter = DateTime.Today.AddDays(1); SalesmanFilter = mainViewModel.Context.Salesmen.ToList(); SalesmanFilter.Insert(0, new Salesman { Contragent = new Contragent { LastName = "Any" } }); SelectedSalesmanFilter = SalesmanFilter.FirstOrDefault(); ContragentsFilter = mainViewModel.Context.Salesmen.Select(x => x.Contragent).ToList(); ContragentsFilter.AddRange(mainViewModel.Context.Guards.Select(x => x.Contragent).ToList()); ContragentsFilter.Insert(0, new Contragent{LastName = "Any"}); SelectedContragentFilter = ContragentsFilter.FirstOrDefault(); TypeFilter = new List<TranType> {TranType.Any, TranType.CashIn, TranType.CashOut, TranType.Coffee, TranType.Salary}; SelectedTypeFilter = TypeFilter.FirstOrDefault(); CashTransactions = new ObservableCollection<CashTransactionViewModel>(GetCashTransactions(_mainViewModel.Context)); CashTransactionsView = CollectionViewSource.GetDefaultView(CashTransactions); CashTransactionsView.Filter = Filter; AddCashTransactionCommand = new DelegateCommand(AddCashTransaction); CloseAddDialogCommand = new DelegateCommand(() => AddCashViewModel = null); PaySalaryCommand = new DelegateCommand(PaySalary); ClosePaySalaryDialogCommand = new DelegateCommand(() => PaySalaryViewModel = null); DeleteCashTransactionCommand = new DelegateCommand(DeleteCashTransaction, () => SelectedCashTransaction != null); FilterCommand = new DelegateCommand(CashTransactionsView.Refresh); }
public GuardsViewModel(MainViewModel mainViewModel) : base(mainViewModel.Context) { _mainViewModel = mainViewModel; CloseAddGuardDialogCommand = new DelegateCommand(() => AddGuardDialogViewModel = null); CloseEditGuardDialogCommand = new DelegateCommand(() => EditGuardDialogViewModel = null); }
public SalesmenViewModel(MainViewModel mainViewModel) : base(mainViewModel.Context) { _mainViewModel = mainViewModel; CloseAddSalesmanDialogCommand = new DelegateCommand(() => AddSalesmanDialogViewModel = null); CloseEditSalesmanDialogCommand = new DelegateCommand(() => EditSalesmanDialogViewModel = null); }
public SoldProductsViewModel(MainViewModel mainViewModel) : base(mainViewModel) { DeleteProductCommand = new DelegateCommand(DeleteProduct, () => SelectedProduct != null); ClearSerialNumberFilterCommand = new DelegateCommand(() => SerialNumberFilter = ""); ClearModelFilterCommand = new DelegateCommand(() => ModelFilter = ""); }
public RepairersViewModel(MainViewModel mainViewModel) : base(mainViewModel.Context) { _mainViewModel = mainViewModel; CloseAddRepairerDialogCommand = new DelegateCommand(() => AddRepairerDialogViewModel = null); CloseEditRepairerDialogCommand = new DelegateCommand(() => EditRepairerDialogViewModel = null); }