public SearchProductViewModel( 
            IEventAggregator eventAggregator,
            ProductService productService,
            IUnityContainer container,
            ProductVMContainer productVMContainer
            )
        {
            this.container = container;
            this.eventAggregator = eventAggregator;
            this.productService = productService;
            this.productVMContainer = productVMContainer;

            this.cleanFilterTxtCommand = new DelegateCommand(() => this.FilterTxt = string.Empty);

            Reload();

            this.eventAggregator.GetEvent<ProductSellPriceChangedEvent>()
                .Subscribe(ProductSellPriceChangedEventHandler);
            this.eventAggregator.GetEvent<SelectedItemsToCurrentBillEvent>()
                .Subscribe(SelectedItemsToCurrentBillEventHandler);

            this.eventAggregator.GetEvent<BillQuickActionEvent>()
                .Subscribe(BillQuickActionEventHandler);
           
        }
Пример #2
0
        public ProductListViewModel( IEventAggregator eventAggregator,
            ProductService productService,
            ProductVMContainer productVMContainer,
            IUnityContainer container,
            ProductExportToPdfService productExportToPdfService,
            DomainProductSrcriptExecuter scriptExecuter,
            AppStatusManager status
            )
        {

            this.container = container;
            this.scriptExecuter = scriptExecuter;
            this.productExportToPdfService = productExportToPdfService;
            this.eventAggregator = eventAggregator;
            this.productService = productService;
            this.productVMContainer = productVMContainer;
            this.status = status;

            this.cleanFilterTxtCommand = new DelegateCommand(() => this.FilterTxt = string.Empty);
            
            var dmProductList = productService.GetAllProduct();

            var list= dmProductList.Select(x =>
               CreateVM(container, x)
               ).ToList().OrderBy(x => x.DomainProduct.Brand).ThenBy(x => x.DomainProduct.Name);

            this.ProductList = new ObservableCollection<ProductItemViewModel>(list);
       
            this.ProductListCollectionView = CollectionViewSource.GetDefaultView(this.ProductList);
            this.ProductListCollectionView.Filter = FilterFunction;

            this.ScriptText = this.status.Get("DomainProduct.ScriptText", "");
            this.eventAggregator.GetEvent<ProductSellPriceChangedEvent>().Subscribe(ProductSellPriceChangedEventHandler);
             
        }
Пример #3
0
        public BillListViewModel(
                IEventAggregator eventAggregator,
                BillService billService,
                ProductVMContainer productVMContainer,
                IUnityContainer container
            )
        {
            this.productVMContainer = productVMContainer;
            this.billService = billService;

            this.eventAggregator = eventAggregator;
            this.container = container;

            this.eventAggregator.GetEvent<ProductItemDoubleClickEvent>().Subscribe(OnProductItemDoubleClickEventHandler);
            this.eventAggregator.GetEvent<ProductSellPriceChangedEvent>().Subscribe(ProductSellPriceChangedEventHandler);
            this.eventAggregator.GetEvent<SelectedItemsToNewBillEvent>().Subscribe(OnSelectedItemsToNewBillEventHandler);

            var dmBillList = billService.GetAllBills();

            var list = dmBillList.Select(x =>
               CreateVM(container, x)
               ).ToList();

            this.BillList = new ObservableCollection<BillViewModel>(list);

            this.BillListCollectionView = CollectionViewSource.GetDefaultView(this.billList);
            this.BillListCollectionView.Filter = FilterFunction;

        }