public void ProductControllerSetup()
 {
     _tabs = new ReadOnlyCollection<ProductTab>(new List<ProductTab> {new ProductTab {Name = "Flaf"} });
     _fakeProductDao = Substitute.For<IProductDao>();
     _fakeProductDao.GetProductTabs(true).Returns(_tabs);
     _uut = new ProductController(_fakeProductDao);
 }
Exemple #2
0
 public SalesController(ISalesDao salesDao, ICustomerDao customerDao, IProductDao productDao, IStoreDao storeDao)
 {
     this._salesDao    = salesDao;
     this._customerDao = customerDao;
     this._productDao  = productDao;
     this._storeDao    = storeDao;
 }
 public CatalogService(DaoManager daoManager)
 {
     _daoManager  = daoManager;
     _categoryDao = _daoManager[typeof(ICategoryDao)] as ICategoryDao;
     _productDao  = _daoManager[typeof(IProductDao)] as IProductDao;
     _itemDao     = _daoManager[typeof(IItemDao)] as IItemDao;
 }
Exemple #4
0
        /// <summary>
        /// 依據數量做Group取傳入欄位總和
        /// </summary>
        /// <param name="column">要Group的欄位</param>
        /// <param name="groupCnt">要Group的數量</param>
        /// <returns></returns>
        public static List <int> GetSum(this IProductDao productList, ProductColumn column, int groupCnt)
        {
            //TODO:依據傳入欄位、數量做群組並計算該欄位總和,處理的資料來源為ctor裡面的productList
            switch (column)
            {
            case ProductColumn.Id:
                return(new List <int>());

            case ProductColumn.Cost:
                return(new List <int>()
                {
                    6, 15, 24, 21
                });

            case ProductColumn.Revenue:
                return(new List <int>()
                {
                    50, 66, 60
                });

            case ProductColumn.SellPrice:
                return(new List <int>());

            default:
                return(new List <int>());
            }
        }
 private CatalogService()
 {
     _daoManager  = ServiceConfig.GetInstance().DaoManager;
     _categoryDao = _daoManager[typeof(ICategoryDao)] as ICategoryDao;
     _productDao  = _daoManager[typeof(IProductDao)] as IProductDao;
     _itemDao     = _daoManager[typeof(IItemDao)] as IItemDao;
 }
Exemple #6
0
 public ProductBll(ILogger logger, ICategoryBll categoryBll, IProductDao productDao, ICommodityUnitDao commodityUnitDao)
 {
     _logger           = logger;
     _categoryBll      = categoryBll;
     _productDao       = productDao;
     _commodityUnitDao = commodityUnitDao;
 }
 public ShoppingListRepository(IShoppingListDao shoppingListDao, IProductDao productDao,
                               IProductTypeDao productTypeDao)
 {
     _shoppingListDao = shoppingListDao;
     _productDao      = productDao;
     _productTypeDao  = productTypeDao;
 }
Exemple #8
0
 public static void MyClassInitialize(TestContext testContext)
 {
     kernel         = TestManager.ConfigureNInjectKernel();
     productDao     = kernel.Get <IProductDao>();
     categoryDao    = kernel.Get <ICategoryDao>();
     commentDao     = kernel.Get <ICommentDao>();
     userProfileDao = kernel.Get <IUserProfileDao>();
 }
Exemple #9
0
 public static void MyClassInitialize(TestContext testContext)
 {
     kernel      = TestManager.ConfigureNInjectKernel();
     categoryDao = kernel.Get <ICategoryDao>();
     productDao  = kernel.Get <IProductDao>();
     tagDao      = kernel.Get <ITagDao>();
     tagService  = kernel.Get <ITagService>();
 }
Exemple #10
0
 public ProductService(ISession session)
 {
     BaseServiceSession = session;
     _categoryDao       = new ProductDao()
     {
         BaseDaoSession = BaseServiceSession
     };
 }
 public ProductController(IProductDao productDao, ILogger <ProductController> logger, IPropertyMappingService propertyMappingService, IPropertyCheckerService propertyCheckerService, IMapper mapper)
 {
     this._logger                 = logger ?? throw new ArgumentNullException(nameof(logger));
     this._productDao             = productDao ?? throw new ArgumentNullException(nameof(productDao));
     this._propertyMappingService = propertyMappingService ?? throw new ArgumentNullException(nameof(propertyMappingService));
     this._propertyCheckerService = propertyCheckerService ?? throw new ArgumentNullException(nameof(propertyCheckerService));
     this._mapper                 = mapper ?? throw new ArgumentNullException(nameof(mapper));
 }
Exemple #12
0
 public static IProductDao GetProductDao()
 {
     if (_productDao == null)
     {
         _productDao = new FakeProductDao();
     }
     return _productDao;
 }
Exemple #13
0
        public ProductLogic(IProductDao iProductDao, ILoggerDao iLoggerDao)
        {
            NullCheck(iProductDao);
            NullCheck(iLoggerDao);

            productDao = iProductDao;
            loggerDao  = iLoggerDao;
        }
Exemple #14
0
 private static void BuildDAOFactory()
 {
     categoryDao    = factory.CategoryDao;
     productDao     = factory.ProductDao;
     memberDao      = factory.MemberDao;
     orderDao       = factory.OrderDao;
     orderDetailDao = factory.OrderDetailDao;
 }
        private System.Data.Entity.DbContext context;// = new DbContext();

        //ICompanyRepository gcompanyRepository;
        public UnitOfWork(System.Data.Entity.DbContext _context, IProductDao _productDao, IOrderDao _orderDao, IShopDao _shopDao, IUserDao _userDao, ILineItemDao _lineItemDao)
        {
            context     = _context;
            productDao  = _productDao;
            orderDao    = _orderDao;
            shopDao     = _shopDao;
            lineItemDao = _lineItemDao;
            userDao     = _userDao;
        }
 public CommodityUnitDao(ILogger logger, IProductDao productDao, IStatusDao statusDao, IStoreDao storeDao, IVendorDao vendorDao)
 {
     _logger           = logger;
     _productDao       = productDao;
     _statusDao        = statusDao;
     _storeDao         = storeDao;
     _vendorDao        = vendorDao;
     _connectionString = ConfigurationManager.ConnectionStrings["default"].ConnectionString;
 }
        /// <summary>
        /// Constructor
        /// </summary>
        public ProductService()
        {
            _productDb = ObjectFactory.GetInstance<ProductDao>();

            Mapper.CreateMap<ProductDomain, ProductDto>();
            Mapper.CreateMap<ProductDto, ProductDomain>();

            Mapper.CreateMap<ProductCategoryDomain, ProductCategoryDto>();
            Mapper.CreateMap<ProductCategoryDto, ProductCategoryDomain>();
        }
Exemple #18
0
 public static void MyClassInitialize(TestContext testContext)
 {
     kernel          = TestManager.ConfigureNInjectKernel();
     userProfileDao  = kernel.Get <IUserProfileDao>();
     creditCardDao   = kernel.Get <ICreditCardDao>();
     deliveryDao     = kernel.Get <IDeliveryDao>();
     deliveryLineDao = kernel.Get <IDeliveryLineDao>();
     productDao      = kernel.Get <IProductDao>();
     categoryDao     = kernel.Get <ICategoryDao>();
 }
 public InventoryService(
     IInventoryDao inventoryDao,
     IProductDao productDao,
     IProductService productService,
     IZoneService zoneService)
 {
     _inventoryDao   = inventoryDao;
     _productDao     = productDao;
     _productService = productService;
     _zoneService    = zoneService;
 }
Exemple #20
0
 public void ProductControllerSetup()
 {
     _tabs = new ReadOnlyCollection <ProductTab>(new List <ProductTab> {
         new ProductTab {
             Name = "Flaf"
         }
     });
     _fakeProductDao = Substitute.For <IProductDao>();
     _fakeProductDao.GetProductTabs(true).Returns(_tabs);
     _uut = new ProductController(_fakeProductDao);
 }
Exemple #21
0
 public ProductsController(SqlProduct proRepository, SqlProductLot proLotRepository, SqlColor colorRepository,
                           SqlBrand brandRepository, SqlTypeproduct typeRepository, SqlTradmark tradRepository, SqlOffer offerRepository)
 {
     this._proRepository    = proRepository;
     this._proLotRepository = proLotRepository;
     this._colorRepository  = colorRepository;
     this._brandRepository  = brandRepository;
     this._typeRepository   = typeRepository;
     this._tradRepository   = tradRepository;
     this._offerRepository  = offerRepository;
 }
        public static void MyClassInitialize(TestContext testContext)
        {
            kernel = TestManager.ConfigureNInjectKernel();

            productDao          = kernel.Get <IProductDao>();
            categoryDao         = kernel.Get <ICategoryDao>();
            specificPropertyDao = kernel.Get <ISpecificPropertyDao>();
            commentDao          = kernel.Get <ICommentDao>();
            tagDao  = kernel.Get <ITagDao>();
            userDao = kernel.Get <IUserProfileDao>();

            productService = kernel.Get <IProductService>();
        }
Exemple #23
0
 public static void MyClassInitialize(TestContext testContext)
 {
     kernel         = TestManager.ConfigureNInjectKernel();
     categoryDao    = kernel.Get <ICategoryDao>();
     cardDao        = kernel.Get <ICardDao>();
     userDao        = kernel.Get <IUserProfileDao>();
     productDao     = kernel.Get <IProductDao>();
     orderDao       = kernel.Get <IOrderDao>();
     orderLineDao   = kernel.Get <IOrderLineDao>();
     orderService   = kernel.Get <IOrderService>();
     userService    = kernel.Get <IUserService>();
     cardService    = kernel.Get <ICardService>();
     productService = kernel.Get <IProductService>();
 }
        public void SetUp()
        {
            _receiptController = Substitute.For<IReceiptController>();
            _cashDrawer = Substitute.For<ICashDrawer>();
            _productDao = Substitute.For<IProductDao>();
            _paymentDao = Substitute.For<IPaymentDao>();
            _orderDao = Substitute.For<IOrderDao>();

            var paymentProviders = new List<IPaymentProvider> {new CashPayment()};
            _productController = new ProductController(_productDao);
            _paymentController = new PaymentController(paymentProviders, _receiptController, _paymentDao, _cashDrawer);
            _orderController = new OrderController(_orderDao);
            _salesController = new SalesController(_orderController, _receiptController, _productController,
                _paymentController);
        }
        public void Sum_Product_Revenue_GroupBy4()
        {
            //arrange
            IProductDao productList = Substitute.For <IProductDao>();

            productList.GetData().Returns(GetProductTestData());
            int groupCnt = 4;
            var column   = ProductColumn.Revenue;
            var expected = new List <int> {
                50, 66, 60
            };
            //act
            List <int> actual = productList.GetSum(column, groupCnt);

            //assert
            CollectionAssert.AreEqual(expected, actual);
        }
        public void Sum_Product_Cost_GroupBy3()
        {
            //arrange
            IProductDao productList = Substitute.For <IProductDao>();

            productList.GetData().Returns(GetProductTestData());
            int groupCnt = 3;
            var column   = ProductColumn.Cost;
            var expected = new List <int> {
                6, 15, 24, 21
            };
            //act
            var actual = productList.GetSum(column, groupCnt);

            //assert
            CollectionAssert.AreEqual(expected, actual);
        }
 private void BtConnect_Click(object sender, RoutedEventArgs e)
 {
     try
     {
         TcpClientChannel clientChannel = new TcpClientChannel();
         ChannelServices.RegisterChannel(clientChannel, false);
         IProductDao productDao = (IProductDao)Activator.GetObject(
             typeof(IProductDao), $"tcp://{tbHost.Text}:8090/Products");
         List <Product> products = productDao.GetAll();
         productsGrid.DataContext = products;
     }
     catch (Exception ex)
     {
         MessageBox.Show($"Error : \n{ex.Message}", "Connecting Error",
                         MessageBoxButton.OK, MessageBoxImage.Error);
     }
 }
Exemple #28
0
        public void SetUp()
        {
            _receiptController = Substitute.For <IReceiptController>();
            _cashDrawer        = Substitute.For <ICashDrawer>();
            _productDao        = Substitute.For <IProductDao>();
            _paymentDao        = Substitute.For <IPaymentDao>();
            _orderDao          = Substitute.For <IOrderDao>();

            var paymentProviders = new List <IPaymentProvider> {
                new CashPayment()
            };

            _productController = new ProductController(_productDao);
            _paymentController = new PaymentController(paymentProviders, _receiptController, _paymentDao, _cashDrawer);
            _orderController   = new OrderController(_orderDao);
            _salesController   = new SalesController(_orderController, _receiptController, _productController,
                                                     _paymentController);
        }
Exemple #29
0
 static void Main(string[] args)
 {
     try
     {
         Console.Write("Enter host : ");
         string host = Console.ReadLine();
         Console.WriteLine($"Connecting to : {host} ...");
         TcpClientChannel clientChannel = new TcpClientChannel();
         ChannelServices.RegisterChannel(clientChannel, false);
         IProductDao productDao = (IProductDao)Activator.GetObject(typeof(IProductDao), $"tcp://{host}:8090/Products");
         Console.WriteLine("Product Info : ");
         List <Product> products = productDao.GetAll();
         foreach (Product product in products)
         {
             Console.WriteLine($"id = {product.Id}, label = {product.Label}.");
         }
     }
     catch (Exception ex)
     {
         Console.WriteLine("Error : " + ex.Message);
     }
     Console.ReadKey(true);
 }
        public void SetUp()
        {
            _raisedEvent = 0;
            _discount    = new Discount();
            _product     = new Product("Test", 100, true);

            _printer    = Substitute.For <IPrinter>();
            _cashDrawer = Substitute.For <ICashDrawer>();
            _dalFacade  = Substitute.For <IDalFacade>();

            _productDao        = new ProductDao(_dalFacade);
            _paymentDao        = new PaymentDao(_dalFacade);
            _orderDao          = new OrderDao(_dalFacade);
            _receiptController = new ReceiptController(_printer);
            _productController = new ProductController(_productDao);
            var paymentProviders = new List <IPaymentProvider> {
                new CashPayment()
            };

            _paymentController = new PaymentController(paymentProviders, _receiptController, _paymentDao, _cashDrawer);
            _orderController   = new OrderController(_orderDao);
            _salesController   = new SalesController(_orderController, _receiptController, _productController,
                                                     _paymentController);
        }
 public FamilyMartProductService(ICategoryDao categoryDao, IProductDao productDao)
 {
     this.categoryDao = categoryDao;
     this.productDao = productDao;
 }
Exemple #32
0
 public OrderService(IOrderDao orderDao, IProductDao productDao)
 {
     _orderDao   = orderDao;
     _productDao = productDao;
 }
Exemple #33
0
 public ProductLogic()
 {
     this.productDao = DaoProvider.ProductDao;
     this.imageDao   = DaoProvider.ImageDao;
     this.validator  = new Validator();
 }
 public ProductService()
 {
     this._ProductDao = new ProductDao();
 }
Exemple #35
0
 /// <summary>
 /// Constructor
 /// </summary>
 /// <param name="dao">An IProductDao implementation.</param>
 public ProductController(IProductDao dao)
 {
     _dao = dao;
     RefreshProductTabs();
 }
 public void ProductDaoSetup()
 {
     _fakeDalFacade = Substitute.For<IDalFacade>();
     _uut = new ProductDao(_fakeDalFacade);
 }
Exemple #37
0
 public ProductController(IProductDao productDao)
 {
     _productDao = productDao;
 }
Exemple #38
0
 public IProductDao GetProductDao()
 {
     if (orderDao == null)
     {
         if (!DataCache.Instance.OpenMySqlDb)
         {
             //this.productDao = new ProductDaoMysql(dbHelper);
         }
         else
         {
             this.productDao = new ProductDaoMysql(MySqlDbHelper);
         }
     }
     return productDao;
 }
        public void SetUp()
        {
            _raisedEvent = 0;
            _discount = new Discount();
            _product = new Product("Test", 100, true);

            _printer = Substitute.For<IPrinter>();
            _cashDrawer = Substitute.For<ICashDrawer>();
            _dalFacade = Substitute.For<IDalFacade>();

            _productDao = new ProductDao(_dalFacade);
            _paymentDao = new PaymentDao(_dalFacade);
            _orderDao = new OrderDao(_dalFacade);
            _receiptController = new ReceiptController(_printer);
            _productController = new ProductController(_productDao);
            var paymentProviders = new List<IPaymentProvider> { new CashPayment() };
            _paymentController = new PaymentController(paymentProviders, _receiptController, _paymentDao, _cashDrawer);
            _orderController = new OrderController(_orderDao);
            _salesController = new SalesController(_orderController, _receiptController, _productController,
                _paymentController);
        }
 public ProductService(IProductDao ProductDao)
 {
     this._ProductDao = ProductDao;
 }
Exemple #41
0
 public ProductService(IProductDao productDao)
 {
     this.productDao = productDao;
 }
Exemple #42
0
 public MyItemManager()
 {
     productDao = DAOFactory.GetInstance().GetProductDao();
 }