예제 #1
0
        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);
        }
예제 #2
0
        public ClientsViewModel(MainViewModel mainViewModel)
            : base(mainViewModel.Context)
        {
            _mainViewModel = mainViewModel;

            CloseEditClientDialogCommand = new DelegateCommand(() => EditClientDialogViewModel = null);
        }
예제 #3
0
        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);
        }
예제 #4
0
        public GuardsViewModel(MainViewModel mainViewModel)
            : base(mainViewModel.Context)
        {
            _mainViewModel = mainViewModel;

            CloseAddGuardDialogCommand = new DelegateCommand(() => AddGuardDialogViewModel = null);
            CloseEditGuardDialogCommand = new DelegateCommand(() => EditGuardDialogViewModel = null);
        }
예제 #5
0
        public SalesmenViewModel(MainViewModel mainViewModel)
            : base(mainViewModel.Context)
        {
            _mainViewModel = mainViewModel;

            CloseAddSalesmanDialogCommand = new DelegateCommand(() => AddSalesmanDialogViewModel = null);
            CloseEditSalesmanDialogCommand = new DelegateCommand(() => EditSalesmanDialogViewModel = null);
        }
예제 #6
0
        public SoldProductsViewModel(MainViewModel mainViewModel)
            : base(mainViewModel)
        {
            DeleteProductCommand = new DelegateCommand(DeleteProduct, () => SelectedProduct != null);

            ClearSerialNumberFilterCommand = new DelegateCommand(() => SerialNumberFilter = "");
            ClearModelFilterCommand = new DelegateCommand(() => ModelFilter = "");
        }
예제 #7
0
        public RepairersViewModel(MainViewModel mainViewModel)
            : base(mainViewModel.Context)
        {
            _mainViewModel = mainViewModel;

            CloseAddRepairerDialogCommand = new DelegateCommand(() => AddRepairerDialogViewModel = null);
            CloseEditRepairerDialogCommand = new DelegateCommand(() => EditRepairerDialogViewModel = null);
        }