public void Setup()
 {
     _testProduct = TestCommon.TestProduct1;
     TestDbContext.ClearData();
     _viewMock  = new ProductPageMock();
     _presenter = new ProductPresenter(_viewMock, TestDbContext.Instance);
 }
 public ProductPresenter(IProductView view, IProductRepository repository, IOpenFileDialog openFileDialog)
 {
     this.view = view;
     view.Initialize(this);
     this.repository     = repository;
     this.openFileDialog = openFileDialog;
 }
Exemple #3
0
 /// <summary>
 /// Initializes a new instance of the <see cref="ProductPresenter" /> class.
 /// </summary>
 /// <param name="productView">The product view.</param>
 /// <param name="productRepository">The product repository.</param>
 /// <param name="openFileDialog">The open file dialog.</param>
 public ProductPresenter(IProductView productView, IProductRepository productRepository, IOpenFileDialog openFileDialog)
 {
     this.productView       = productView;
     this.productRepository = productRepository;
     this.openFileDialog    = openFileDialog;
     this.productView.Initialize(this); //connecting presenter with the ui
 }
Exemple #4
0
 public ProductPresenter(IProductView view, ApplicationController appController, IProductRepository repository, IReportCreator reportCreator)
 {
     this.view          = view;
     this.appController = appController;
     this.repository    = repository;
     this.reportCreator = reportCreator;
 }
        public ProductPresenter(IProductView view)
        {
            this.view = view;
            view.Initialize(this);

            productRepository = new ProductRepository();
        }
Exemple #6
0
 public ProductPresenter(IProductView view, IProductRepository repository, IOpenFileDialog openFileDialog)
 {
     this.view = view;
     view.Initialize(this);
     this.repository = repository;
     this.openFileDialog = openFileDialog;
 }
        public ProductPresenter(IProductView view)
        {
            productMapper = new ProductMapper();

            deliveryTypeMapper = new DeliveryTypeMapper();

            _unitOFWork = new UnitOfWork(new ApplicationContext());

            _productService = new ProductService(_unitOFWork);

            _deliveryTypeService = new DeliveryTypeService(_unitOFWork);

            deliveryTypes = _deliveryTypeService.GetAllDeliveryTypes().Select(delType => deliveryTypeMapper.FromDomainToModel(delType)).ToList();

            products = _productService.GetAllProducts().Select(prod => productMapper.FromDomainToModel(prod)).ToList();

            _view = view;

            _view.DisplayData(deliveryTypes, products);

            _view.ProductSelected += SelectTheProduct;

            _view.CategorySelected += RebuildCategoryTable;

            _view.textChanged += FindByText;

            _view.parametersChanged += FindByParameters;

            //this.initialize();
        }
        public ProductPresenter(IProductView view, Produto produto, IUnityContainer container)
        {
            if (view == null)
            {
                throw new ArgumentNullException("view");
            }
            if (produto == null)
            {
                throw new ArgumentNullException("produto");
            }
            if (container == null)
            {
                throw new ArgumentNullException("container");
            }

            this.SubmitCommand = new DelegateCommand <object>(this.Submit, this.CanSubmit);
            this.CancelCommand = new DelegateCommand <object>(this.Cancel);

            this.SearchUnitCommand     = new DelegateCommand <object>(this.SearchUnit);
            this.SearchProducerCommand = new DelegateCommand <object>(this.SearchProducer);
            this.SearchGroupCommand    = new DelegateCommand <object>(this.SearchGroup);
            this.SearchSubGroupCommand = new DelegateCommand <object>(this.SearchSubGroup, this.CanSearchSubGroup);

            this._view = view;
            this._view.SetPresenter(this);
            this._container = container;

            this.Produto = produto;
        }
        public ProductOperations(IProductView view, DataAccessProduct productData)
        {
            this.view        = view;
            this.productData = productData;

            var products = productData.RetrieveProduct();

            this.view.LoadProduct(products);


            view.Add += () =>
            {
                var p = view.AddProduct();
                productData.AddProduct(p);
            };

            view.Updatee += () =>
            {
                var p = view.UpdateProduct();
                productData.UpdateProduct(p);
            };

            view.Deletee += () =>
            {
                var p = view.DeleteProduct();
                productData.DeleteProduct(p);
            };

            view.Ret += () =>
            {
                products = productData.RetrieveProduct();
                this.view.LoadProduct(products);
            };
        }
 public ProductPresenter()
 {
     view = new ViewForm();
     view.Initialize(this);
     repository     = new ProductRepository();
     openFileDialog = new OpenFileDialog();
 }
 public ProductPresenter(IProductView view, INavigationService navigationService, IProductService productService, IBasketService basketService)
 {
     _view = view;
     _navigationService = navigationService;
     _productService = productService;
     _basketService = basketService;
 }
 public ProductPresenter(IProductView view, ProductModel model)
 {
     _view  = view;
     _model = model;
     _categoryRepository = _model.CategoryRepository;
     InitializeProductFields();
     _categories = new BindingList <Category>(_categoryRepository.GetAll().ToList());
 }
 protected virtual void SetupContext()
 {
     // Arrange
     repository = MockRepository.GenerateMock <IProductRepository>();
     view       = MockRepository.GenerateMock <IProductView>();
     dialog     = MockRepository.GenerateMock <IOpenFileDialog>();
     presenter  = new ProductPresenter(view, repository, dialog);
 }
 public ProductPresenter(IProductView view, ProductModel model)
 {
     _view = view;
     _model = model;
     _categoryRepository = _model.CategoryRepository;
     InitializeProductFields();
     _categories = new BindingList<Category>(_categoryRepository.GetAll().ToList());
 }
Exemple #15
0
        public ProductPresenter(IUnityContainer container, IProductView view)
        {
            View           = view;
            this.container = container;
            this.service   = new WMSServiceClient();
            View.Model     = this.container.Resolve <ProductModel>();

            //Event Delegate
            View.LoadSearch            += new EventHandler <DataEventArgs <string> >(this.OnLoadSearch);
            View.New                   += new EventHandler <EventArgs>(this.OnNew);
            View.LoadData              += new EventHandler <DataEventArgs <Product> >(this.OnLoadData);
            View.Save                  += new EventHandler <EventArgs>(this.OnSave);
            View.Delete                += new EventHandler <EventArgs>(this.OnDelete);
            View.AssignBinToProduct    += new EventHandler <DataEventArgs <Bin> >(OnAssignBinToProduct);
            View.RemoveFromList        += new EventHandler <EventArgs>(this.OnRemoveFromList);
            View.AddProductTrackOption += new EventHandler <EventArgs>(OnAddProductTrackOption);
            View.AddProductUnit        += new EventHandler <EventArgs>(OnAddProductUnit);
            View.LoadUnitsFromGroup    += new EventHandler <EventArgs>(OnLoadUnitsFromGroup);
            //View.LoadBins += new EventHandler<DataEventArgs<string>>(OnLoadBins);
            View.SetRequired          += new EventHandler <DataEventArgs <object> >(View_SetRequired);
            View.UnSetRequired        += new EventHandler <DataEventArgs <object> >(View_UnSetRequired);
            View.UpdateBinToProduct   += new EventHandler <DataEventArgs <ZoneBinRelation> >(View_UpdateBinToProduct);
            View.AddAlternateProduct  += new EventHandler <EventArgs>(View_AddAlternateProduct);
            View.AddProductAccount    += new EventHandler <DataEventArgs <ProductAccountRelation> >(View_AddProductAccount);
            View.UpdateProductAccount += new EventHandler <DataEventArgs <object> >(View_UpdateProductAccount);
            //View.SetIsMain += new EventHandler<DataEventArgs<object>>(View_SetIsMain);
            //View.UnSetIsMain += new EventHandler<DataEventArgs<object>>(View_UnSetIsMain);


            ProcessWindow pw = new ProcessWindow("Loading ...");

            View.Model.EntityList = service.GetProductApp(new Product {
                Company = App.curCompany, Reference = App.curLocation.LocationID.ToString()
            }, 25);
            View.Model.Record     = null;
            View.Model.StatusList = App.EntityStatusList;
            //Load Pick Methods
            View.Model.PickMethods  = App.PickMethodList;
            view.Model.TemplateList = service.GetLabelTemplate(new LabelTemplate {
                LabelType = new DocumentType {
                    DocTypeID = LabelType.ProductLabel
                }
            });
            view.Model.TemplateList.Add(new LabelTemplate());

            //List Height
            View.ListRecords.MaxHeight = SystemParameters.FullPrimaryScreenHeight - 250;
            View.Model.CurAltern       = new ProductAlternate();

            //USE CASN
            if (Util.GetConfigOption("USECASN").Equals("T"))
            {
                View.TbItmCasN.Visibility = Visibility.Visible;
            }


            pw.Close();
        }
 public OrderViewModel()
 {
     this.quattroRepository = new QuattroRepository();
     this.customerRepository = new CustomerRepository();
     this.productRepository = new ProductRepository();
     this._salesHeaderView = SalesFactory.createNewSalesHeader();
     this.selectedProduct = ProductFactory.createProduct();
     selectedCustomer = CustomerFactory.createNew();
 }
Exemple #17
0
        public void ExpectToCallGetAllProductsOnAppropriateEventReceived()
        {
            IProductView       view       = Substitute.For <IProductView>();
            IProductDataAccess dataAccess = Substitute.For <IProductDataAccess>();
            ProductPresenter   presenter  = new ProductPresenter(view, dataAccess);

            view.ViewLoad += Raise.EventWith(view, new EventArgs());
            dataAccess.Received().GetAllProducts();
        }
 public OrderViewModel()
 {
     this.quattroRepository  = new QuattroRepository();
     this.customerRepository = new CustomerRepository();
     this.productRepository  = new ProductRepository();
     this._salesHeaderView   = SalesFactory.createNewSalesHeader();
     this.selectedProduct    = ProductFactory.createProduct();
     selectedCustomer        = CustomerFactory.createNew();
 }
Exemple #19
0
        public ProductPresenter(IProductView p_view)
        {
            m_view = p_view;
            PopulateData();
            Product          productDataEntity = new Product();
            ProductViewModel productViewModel  = new ProductViewModel(productDataEntity);

            m_view.MyModel = productViewModel;
            m_view.ShowModel(productViewModel);
        }
        public void ExpectToCallGetAllProductOnAppropriateEventReceived()
        {
            IProductView     view           = Substitute.For <IProductView>();
            IRequestService  requestService = Substitute.For <IRequestService>();
            ProductPresenter presenter      = new ProductPresenter(view, requestService);

            view.ViewLoad += Raise.EventWith(view, new EventArgs());
            Received.InOrder(async() =>
            {
                await requestService.Received().GetAllProductsAsync();
            });
        }
Exemple #21
0
        public void ExpectToCallDeleteProductOnAppropriateEventReceived()
        {
            IProductView       view       = Substitute.For <IProductView>();
            IProductDataAccess dataAccess = Substitute.For <IProductDataAccess>();
            ProductPresenter   presenter  = new ProductPresenter(view, dataAccess);



            view.DeleteProduct += Raise.Event <EventHandler <int> >(view, 2);

            dataAccess.Received().DeleteProduct(2);
        }
        public WishView()
        {
            using (var scope = DependencyResolver.Instance().BeginLifetimeScope())
            {
                this.wishService    = scope.Resolve <IWishService>();
                this.productView    = scope.Resolve <IProductView>();
                this.productService = scope.Resolve <IProductService>();
            }

            this.coupons["drop10"] = .1;
            this.coupons["drop20"] = .2;
            this.coupons["drop50"] = .5;
        }
        public ProductPresenter(IUnityContainer container, IProductView view)
        {
            View = view;
            this.container = container;
            this.service = new WMSServiceClient();
            View.Model = this.container.Resolve<ProductModel>();

            //Event Delegate
            View.LoadSearch += new EventHandler<DataEventArgs<string>>(this.OnLoadSearch);
            View.New += new EventHandler<EventArgs>(this.OnNew);
            View.LoadData += new EventHandler<DataEventArgs<Product>>(this.OnLoadData);
            View.Save += new EventHandler<EventArgs>(this.OnSave);
            View.Delete += new EventHandler<EventArgs>(this.OnDelete);
            View.AssignBinToProduct += new EventHandler<DataEventArgs<Bin>>(OnAssignBinToProduct);
            View.RemoveFromList += new EventHandler<EventArgs>(this.OnRemoveFromList);
            View.AddProductTrackOption += new EventHandler<EventArgs>(OnAddProductTrackOption);
            View.AddProductUnit += new EventHandler<EventArgs>(OnAddProductUnit);
            View.LoadUnitsFromGroup += new EventHandler<EventArgs>(OnLoadUnitsFromGroup);
            //View.LoadBins += new EventHandler<DataEventArgs<string>>(OnLoadBins);
            View.SetRequired += new EventHandler<DataEventArgs<object>>(View_SetRequired);
            View.UnSetRequired += new EventHandler<DataEventArgs<object>>(View_UnSetRequired);
            View.UpdateBinToProduct += new EventHandler<DataEventArgs<ZoneBinRelation>>(View_UpdateBinToProduct);
            View.AddAlternateProduct += new EventHandler<EventArgs>(View_AddAlternateProduct);
            View.AddProductAccount += new EventHandler<DataEventArgs<ProductAccountRelation>>(View_AddProductAccount);
            View.UpdateProductAccount += new EventHandler<DataEventArgs<object>>(View_UpdateProductAccount);
            //View.SetIsMain += new EventHandler<DataEventArgs<object>>(View_SetIsMain);
            //View.UnSetIsMain += new EventHandler<DataEventArgs<object>>(View_UnSetIsMain);


            ProcessWindow pw = new ProcessWindow("Loading ...");

            View.Model.EntityList = service.GetProductApp(new Product { Company = App.curCompany, Reference = App.curLocation.LocationID.ToString() }, 25);
            View.Model.Record = null;
            View.Model.StatusList = App.EntityStatusList;
            //Load Pick Methods
            View.Model.PickMethods = App.PickMethodList;
            view.Model.TemplateList = service.GetLabelTemplate(new LabelTemplate { LabelType = new DocumentType { DocTypeID = LabelType.ProductLabel } });
            view.Model.TemplateList.Add(new LabelTemplate());

            //List Height
            View.ListRecords.MaxHeight = SystemParameters.FullPrimaryScreenHeight - 250;
            View.Model.CurAltern = new ProductAlternate();

            //USE CASN
            if (Util.GetConfigOption("USECASN").Equals("T")) 
                View.TbItmCasN.Visibility = Visibility.Visible;
            

            pw.Close();

        }
        public void ExpectToCallDeleteProductOnAppropriateEventReceived()
        {
            IProductView     view           = Substitute.For <IProductView>();
            IRequestService  requestService = Substitute.For <IRequestService>();
            ProductPresenter presenter      = new ProductPresenter(view, requestService);



            view.DeleteProduct += Raise.Event <EventHandler <int> >(view, 2);
            Received.InOrder(async() =>
            {
                await requestService.Received().DeleteProductAsync(2);
            });
        }
Exemple #25
0
        public void ExpectToCallEditProductOnAppropriateEventReceived()
        {
            IProductView       view       = Substitute.For <IProductView>();
            IProductDataAccess dataAccess = Substitute.For <IProductDataAccess>();
            ProductPresenter   presenter  = new ProductPresenter(view, dataAccess);

            ProductViewModel viewModel = new ProductViewModel()
            {
                NameText  = "Test",
                PriceText = "2"
            };

            view.ModifyProduct += Raise.Event <EventHandler <ProductViewModel> >(view, viewModel);
            dataAccess.Received().EditProduct(Arg.Any <int>(), Arg.Is <Product>(x => x.Price == 2 && x.Name == "Test"));
        }
Exemple #26
0
            public MockProductPresenter(IProductView view)
            {
                var productService = Mock.Create<IProductService>();
                var navigationService = Mock.Create<INavigationService>();
                var basketService = Mock.Create<IBasketService>();

                // Setup for private methods
                Mock.Arrange(() => productService.GetByID("spr-product")).Returns(new Product());
                Mock.Arrange(() => basketService.ProductExists("spr-product")).Returns(true);
                Mock.Arrange(() => navigationService.GoTo("/not-found")).OccursOnce();

                Presenter = new ProductPresenter(
                                                view,
                                                navigationService,
                                                productService,
                                                basketService);
            }
        public void ExpectToCallEditProductOnAppropriateEventReceived()
        {
            IProductView     view           = Substitute.For <IProductView>();
            IRequestService  requestService = Substitute.For <IRequestService>();
            ProductPresenter presenter      = new ProductPresenter(view, requestService);

            ProductViewModel viewModel = new ProductViewModel()
            {
                NameText  = "Test",
                PriceText = "2"
            };

            view.ModifyProduct += Raise.Event <EventHandler <ProductViewModel> >(view, viewModel);
            Received.InOrder(async() =>
            {
                await requestService.Received().EditProductAsync(Arg.Is <Product>(x => x.Price == 2 && x.Name == "Test"));
            });
        }
Exemple #28
0
        public ProductPresenter(IProductView view)
        {
            if (Singleton <ProductBusiness> .Instance == null)
            {
                Singleton <ProductBusiness> .Instance = new ProductBusiness(Singleton <PosEngine> .Instance.Resolve <IRepository <Product> >());
            }
            _business = Singleton <ProductBusiness> .Instance;

            _businessPrice    = new ProductPriceBusiness(Singleton <PosEngine> .Instance.Resolve <IRepository <ProductPrice> >());
            _businessCategory = new CategoryBusiness(Singleton <PosEngine> .Instance.Resolve <IRepository <Category> >());
            _view             = view;

            Product product       = new Product();
            var     units         = new UnitBusiness(Singleton <PosEngine> .Instance.Resolve <IRepository <Unit> >()).GetAll().ToList();
            var     manufacturers = new ManufacturerBusiness(Singleton <PosEngine> .Instance.Resolve <IRepository <Manufacturer> >()).GetAll().ToList();

            _model = new ProductModel(product, units, manufacturers);
            _view.InitView(_model);
        }
        private void Page_Load(object sender, System.EventArgs e) {

            UrlHelper = new CatalogueUrlHelper(CatMod);

            try {

                if (CatMod.ProductID > 0) {
                    prodView = CatMod.CatalogueViewer.GetProductView(CatMod.Section.Node.Site.Id, CatMod.Section.Node.Culture, CatMod.ProductID);
                } else {
                  
                    DbProduct prod = CatMod.CatalogueViewer.GetECommerceProductByItemCode(CatMod.Section.Node.Site.Id, CatMod.Section.Node.Culture, CatMod.Sku);
                    if (prod != null) {
                        prodView = CatMod.CatalogueViewer.GetProductView(CatMod.Section.Node.Site.Id, CatMod.Section.Node.Culture, prod.ProductID);
                    }
                }
                
                if (prodView != null) {

                    List<IProduct> prodList = new List<IProduct>();
                    prodList.Add(prodView.ProductDetails);
                   
                    RenderProductDetails(prodList);
                    RenderBreadCrumbTrail(prodView);
                    txtProdID.Text = Convert.ToString(prodView.ProductDetails.ProductID);

                    ctlImages.RenderProductImages(prodView.ProductDetails.ProductImages);
                    ctlRelatedProducts.RenderRelatedProducts(prodView.ProductDetails);
                    ctlDocuments.RenderDocuments(prodView.ProductDetails);

                    if (Convert.ToBoolean(prodView.ProductDetails.StockedIndicator)) {
                        litStocked.Text = ITEM_STOCKED;
                    } else {
                        litStocked.Text = ITEM_NOT_STOCKED;
                    }
                }

            } catch (System.Threading.ThreadAbortException) {
            } catch (Exception f) {
                LogManager.GetLogger(GetType()).Error(f);
            }
        }
Exemple #30
0
        public ProductPresenter(IProductView view)
        {
            baseUrl = @"http://lasmargaritasdev.azurewebsites.net/";
            if (ConfigurationManager.AppSettings["baseUrl"] != null)
            {
                baseUrl = ConfigurationManager.AppSettings["baseUrl"];
            }

            insertAction              = "Product/Add";
            updateAction              = "Product/Update";
            deleteAction              = "Product/Delete";
            getAllAction              = "Product/GetAll";
            getByIdAction             = "Product/GetById";
            getSelectableModelsAction = "Product/GetSelectableModels";
            // Need to create Method to load Units,presentation,productgroup,agricbrand
            getUnitsAction              = "Catalog/GetUnits";
            getPresentationsAction      = "Catalog/GetPresentations";
            getProductGroupsAction      = "Catalog/GetProductGroups";
            getAgriculturalBrandsAction = "Catalog/GetAgriculturalBrands";
            productView = view;
        }
        public static void AddProduct(IProductView product)
        {
            tbl_Prd Product = new tbl_Prd()
            {
                Prd_             = MerpDatabase().tbl_Prd.Count() + 1,
                PrdNumber        = product.ProductNumber,
                PrdName          = product.ProductName,
                PrdEAN           = product.Ean,
                PrdPricePurchase = product.PricePurchase,
                PrdPriceSale     = product.PriceSale,
            };

            MerpDatabase().tbl_Prd.AddObject(Product);
            try
            {
                MerpDatabase().SaveChanges();
            }
            catch (Exception e)
            {
            }
        }
        public static void AddProduct(IProductView product)
        {
            tbl_Prd Product = new tbl_Prd()
                                  {
                                      Prd_ = MerpDatabase().tbl_Prd.Count() + 1,
                                      PrdNumber = product.ProductNumber,
                                      PrdName = product.ProductName,
                                      PrdEAN = product.Ean,
                                      PrdPricePurchase = product.PricePurchase,
                                      PrdPriceSale = product.PriceSale,

                                  };

            MerpDatabase().tbl_Prd.AddObject(Product);
            try
            {
                MerpDatabase().SaveChanges();
            }
            catch (Exception e)
            {

            }
        }
 public void AddProduct(IProductView product)
 {
     ProductDataFactory.AddProduct(product);
 }
Exemple #34
0
 /// <summary>
 /// Initializes a new instance of the <see cref="BaseView"/> class.
 /// </summary>
 public BaseView(ILogger <BaseView> logger, IProductView productView)
 {
     _productView = productView ?? throw new ArgumentNullException(nameof(productView));
     _logger      = logger ?? throw new ArgumentNullException(nameof(logger));
 }
 public void AddProduct(IProductView product)
 {
     Service.AddProduct(product);
 }
 public ProductPresenter(IProductView view, IProductService productService)
 {
     this.view = view;
     this.productService = productService;
 }
Exemple #37
0
 public ProductPresenter(IProductView view, IProductService productService)
 {
     this.view           = view;
     this.productService = productService;
 }
Exemple #38
0
 public ProductPresenter(IProductView productView)
 {
     this.productView                  = productView;
     this.productRepository            = new ProductRepository();
     this.productView.ProductSelected += ProductView_ProductSelected;
 }
 public ProductPresenter(IProductView view, IProductRepository productRepository)
 {
     _view = view;
     _productRepository = productRepository;
 }
Exemple #40
0
 public ProductPresenter(IProductView view, IProductService service)
 {
     _view = view;
     _service = service;
 }
Exemple #41
0
 public ProductPresenter(IProductView pv)
 {
     productView = pv;
     EventAggregator.Instance.Subscribe <ProductSearch>(OnSearchTextChanged);
 }
Exemple #42
0
 public void AddProduct(IProductView product)
 {
     ProductDataFactory.AddProduct(product);
 }
 private void RenderBreadCrumbTrail(IProductView prodView) {
     if (ctlBreadCrumb != null) {
         ctlBreadCrumb.RenderBreadCrumbTrail(prodView.BreadCrumbTrail);
     }
 }
Exemple #44
0
 public ProductPresenter(IProductView productView)
 {
     this.productView = productView;
     Initilize();
 }