public void Init()
 {
     ctx = EFContext.CreateContext();
     repo = new ProductCategoryRepository(ctx);
     entity = new ProductCategory()
     {
         Home = ctx.HomeSet.FirstOrDefault(p => p.Title == "LaCorderie"),
         Title = "EFTest",
         RefHide = false
     };
 }
Example #2
0
        public void CountOneProductCategoryRepositoryTest()
        {
            var pc = new ProductCategory()
            {
                Name = ""
            };

            using (var context = new GamersUnitedContext(GetOption(System.Reflection.MethodBase.GetCurrentMethod().Name)))
            {
                context.Database.EnsureDeleted();

                var repo = new ProductCategoryRepository(context);
                repo.Add(pc);
                Assert.Equal(1, repo.Count());
            }
        }
Example #3
0
        public SitemapResult GetProductCategoriesSiteMap(Controller sitemapsController)
        {
            var sitemapItems = new List <SitemapItem>();

            sitemapItems = new List <SitemapItem>();
            var categories = ProductCategoryRepository.GetProductCategoriesByStoreIdFromCache(StoreId,
                                                                                              StoreConstants.ProductType);

            foreach (var category in categories)
            {
                var productDetailLink = LinkHelper.GetProductCategoryIdRouteValue(category);
                var siteMap           = new SitemapItem(sitemapsController.Url.AbsoluteAction("category", "productcategories", new { id = productDetailLink }),
                                                        changeFrequency: SitemapChangeFrequency.Monthly, priority: 1.0);
                sitemapItems.Add(siteMap);
            }
            return(new SitemapResult(sitemapItems));
        }
Example #4
0
        public BaseApiController()
        {
            _objectService = new ObjectService <UserViewModel>();

            #region Load Repository
            userRepository            = new UserRepository(_db);
            roleRepository            = new RoleRepository(_db);
            categoryRepository        = new CategoryRepository(_db);
            productRepository         = new ProductRepository(_db);
            supplierRepository        = new SupplierRepository(_db);
            priceRepository           = new PriceRepository(_db);
            productCategoryRepository = new ProductCategoryRepository(_db);
            purchaseRepository        = new PurchaseRepository(_db);
            receivedProductRepository = new ReceivedProductRepository(_db);
            saleRepository            = new SaleRepository(_db);
            #endregion
        }
Example #5
0
        public FeedResult GetProductRss(int take, int description, int imageHeight, int imageWidth, int isDetailLink)
        {
            var products = ProductRepository.GetProductsByProductType(StoreId, null, null, null, StoreConstants.ProductType, 1,
                                                                      take, true, "random", null);
            var productCategories = ProductCategoryRepository.GetProductCategoriesByStoreId(StoreId, StoreConstants.ProductType, true);

            var rssHelper = new RssHelper();
            var feed      = rssHelper.GetProductsRssFeed(MyStore, products, productCategories, description, isDetailLink);

            rssHelper.ImageWidth  = imageWidth;
            rssHelper.ImageHeight = imageHeight;

            var comment = new StringBuilder();

            comment.AppendLine("Take=Number of rss item; Default value is 10  ");
            comment.AppendLine("Description=The length of description text.Default value is 300  ");
            return(new FeedResult(feed, comment));
        }
Example #6
0
        public ActionResult StoreDetails(int id = 0)
        {
            try
            {
                Product         product           = ProductRepository.GetSingle(id);
                Store           s                 = StoreRepository.GetSingle(product.StoreId);
                ProductCategory cat               = ProductCategoryRepository.GetSingle(product.ProductCategoryId);
                var             productDetailLink = LinkHelper.GetProductLink(product, cat.Name);
                String          detailPage        = String.Format("http://{0}{1}", s.Domain, productDetailLink);

                return(Redirect(detailPage));
            }
            catch (Exception ex)
            {
                Logger.Error(ex);
                return(new EmptyResult());
            }
        }
Example #7
0
        public void CreateInvalidProductCategoryRepositoryTestExpectArgumentNullException()
        {
            var pc = new ProductCategory()
            {
                ProductCategoryId = 1
            };

            using (var context = new GamersUnitedContext(GetOption(System.Reflection.MethodBase.GetCurrentMethod().Name)))
            {
                context.Database.EnsureDeleted();

                var repo = new ProductCategoryRepository(context);
                Assert.Throws <ArgumentNullException>(() =>
                {
                    repo.Add(pc);
                });
            }
        }
Example #8
0
        public void CreateValidProductCategoryRepositoryTestAutoincrement()
        {
            var pc = new ProductCategory()
            {
                ProductCategoryId = 9999, Name = ""
            };

            // Run the test against one instance of the context
            using (var context = new GamersUnitedContext(GetOption(System.Reflection.MethodBase.GetCurrentMethod().Name)))
            {
                context.Database.EnsureDeleted();

                var repo = new ProductCategoryRepository(context);
                var npc  = repo.Add(pc);

                Assert.NotEqual(pc.ProductCategoryId, npc.ProductCategoryId);
            }
        }
        //
        // GET: /Categories/Edit/5
        public ActionResult SaveOrEdit(int id = 0)
        {
            ProductCategory category = new ProductCategory();

            if (id == 0)
            {
                category.CreatedDate = DateTime.Now;
                category.State       = true;
            }
            else
            {
                category             = ProductCategoryRepository.GetProductCategory(id);
                category.UpdatedDate = DateTime.Now;
            }
            category.CategoryType = StoreConstants.ProductType;

            return(View(category));
        }
 public UnitOfWork(ApplicationDbContext context)
 {
     _context          = context;
     MarketEntries     = new MarketEntryRepository(context);
     FinalProducts     = new FinalProductRepository(context);
     Auctions          = new AuctionRepository(context);
     Storages          = new StorageRepository(context);
     Locations         = new LocationRepository(context);
     Products          = new ProductRepository(context);
     ProductCategories = new ProductCategoryRepository(context);
     Roles             = new RoleRepository(context);
     ProductQualities  = new ProductQualityRepository(context);
     UserNotifications = new UserNotificationRepository(context);
     Notifications     = new NotificationRepository(context);
     Users             = new UserRepository(context);
     ContactForms      = new ContactFormRepository(context);
     TradeMatches      = new TradeMatchRepository(context);
 }
Example #11
0
        public void GetAllProductCategoryRepositoryTest()
        {
            var pcl = new List <ProductCategory> {
                new ProductCategory()
                {
                    Name = "1"
                },
                new ProductCategory()
                {
                    Name = "2"
                },
                new ProductCategory()
                {
                    Name = "3"
                },
                new ProductCategory()
                {
                    Name = "4"
                },
                new ProductCategory()
                {
                    Name = "5"
                }
            };

            using (var context = new GamersUnitedContext(GetOption(System.Reflection.MethodBase.GetCurrentMethod().Name)))
            {
                context.Database.EnsureDeleted();

                var repo = new ProductCategoryRepository(context);
                for (int i = 0; i < pcl.Count; i++)
                {
                    repo.Add(pcl[i]);
                }

                var npcl = repo.GetAll();
                for (int i = 0; i < pcl.Count; i++)
                {
                    Assert.Equal(pcl[i].Name, npcl[i].Name);
                }

                Assert.Equal(5, context.ProductCategory.Count());
            }
        }
Example #12
0
        public void GetInvalidIdProductCategoryRepositoryTest()
        {
            var pc = new ProductCategory()
            {
                Name = "test"
            };

            using (var context = new GamersUnitedContext(GetOption(System.Reflection.MethodBase.GetCurrentMethod().Name)))
            {
                context.Database.EnsureDeleted();

                var repo = new ProductCategoryRepository(context);
                var npc  = repo.Add(pc);

                Assert.Throws <ArgumentOutOfRangeException>(() => {
                    var get = repo.GetById(context.ProductCategory.Count());
                });
            }
        }
        public ProductCategoryRepositoryFixture()
        {
            // Configure our repository
            var serviceProvider = new ServiceCollection()
                                  .AddEntityFrameworkSqlServer()
                                  .BuildServiceProvider();

            var builder = new DbContextOptionsBuilder <ProductInfoContext>();

            builder.UseSqlServer(ConstantValues.connectionString).UseInternalServiceProvider(serviceProvider);

            var context = new ProductInfoContext(builder.Options);

            // validate we have the last version of the database and at least the minimum set of data
            context.Database.Migrate();
            context.EnsureSeedDataForContext();

            Repository = new ProductCategoryRepository(context);
        }
Example #14
0
        public void GetValidIdProductCategoryRepositoryTest()
        {
            var pc = new ProductCategory()
            {
                Name = "test"
            };

            using (var context = new GamersUnitedContext(GetOption(System.Reflection.MethodBase.GetCurrentMethod().Name)))
            {
                context.Database.EnsureDeleted();

                var repo = new ProductCategoryRepository(context);
                var npc  = repo.Add(pc);

                var get = repo.GetById(npc.ProductCategoryId);

                Assert.Equal(npc.ProductCategoryId, get.ProductCategoryId);
                Assert.Equal(pc.Name, get.Name);
            }
        }
Example #15
0
        public void AddCategory_GivenANewCategory_AddsToDatabase()
        {
            // arrange
            ProductCategory category = new ProductCategory()
            {
                ID = 12
            };
            Mock <DbSet <ProductCategory> > mockSet = new Mock <DbSet <ProductCategory> >();
            Mock <InventoryDb> mockContext          = new Mock <InventoryDb>();

            mockContext.Setup(c => c.Categories).Returns(mockSet.Object);
            ProductCategoryRepository sut = new ProductCategoryRepository(mockContext.Object);

            // act
            sut.AddCategory(category);

            // assert
            mockSet.Verify(s => s.Add(It.Is <ProductCategory>(c => c.ID == 12)), Times.Once());
            mockContext.Verify(c => c.SaveChanges(), Times.Once());
        }
        /// <summary>
        /// Retrieves all instances of ProductCategory that are subcategories of the ProductCategory with the given identifier.
        /// </summary>
        /// <param name="parentId">Parent ProductCategory's database identifier.</param>
        /// <returns>Returns a list with ModelViews of all the instances of ProductCategory that are subcategories of the given ProductCategory.</returns>
        public GetAllProductCategoriesModelView findAllSubCategories(long parentId)
        {
            ProductCategoryRepository repository = PersistenceContext.repositories().createProductCategoryRepository();

            ProductCategory parentCategory = repository.find(parentId);

            if (parentCategory == null)
            {
                throw new ArgumentException(ERROR_PARENT_NOT_FOUND);
            }

            IEnumerable <ProductCategory> subCategories = repository.findSubCategories(parentCategory);

            //check if any categories have been added
            if (!subCategories.Any())
            {
                throw new ArgumentException(ERROR_NO_CATEGORIES_FOUND);
            }

            return(ProductCategoryModelViewService.fromCollection(subCategories));
        }
 public AdminUserController(ContextEntities context) : base(context)
 {
     context = _context;
     user    = new UserManager()
     {
         Name     = "defualt",
         Password = null
     };
     adminUserRepository        = new AdminUserRepository(context);
     websiteUserRepository      = new WebsiteUserRepository(context);
     productRepository          = new ProductRepository(context);
     reviewRepository           = new ReviewRepository(context);
     orderRepository            = new OrderRepository(context);
     dropOffFacilityRepository  = new DropOffFacilityRepository(context);
     facilityEmployeeRepository = new FacilityEmployeeRepository(context);
     flaggedOrderRepository     = new FlaggedOrderRepository(context);
     flaggedProductRepository   = new FlaggedProductRepository(context);
     flaggedReviewRepository    = new FlaggedReviewRepository(context);
     flaggedUserRepository      = new FlaggedUserRepository(context);
     productCategoryRepository  = new ProductCategoryRepository(context);
     productTypeRepository      = new ProductTypeRepository(context);
 }
        /// <summary>
        /// Updates a ProductCategory with a given database identifier with the data in given ModelView.
        /// </summary>
        /// <param name="id">ProductCategory's database identifier.</param>
        /// <param name="modelView">ModelView containing the data being updated.</param>
        /// <returns>A ModelView with the updated ProductCategory data.</returns>
        public GetProductCategoryModelView updateProductCategory(long id, UpdateProductCategoryModelView modelView)
        {
            ProductCategoryRepository repository = PersistenceContext.repositories().createProductCategoryRepository();

            ProductCategory category = repository.find(id);

            string newName = modelView.name;

            if (!category.changeName(newName))
            {
                throw new ArgumentException(ERROR_INVALID_NAME);
            }

            category = repository.update(category);

            if (category == null)
            {
                throw new ArgumentException(ERROR_DUPLICATE_NAME);
            }

            return(ProductCategoryModelViewService.fromEntity(category));
        }
Example #19
0
        public SitemapResult GetProductsSiteMap(Controller sitemapsController)
        {
            var sitemapItems = new List <SitemapItem>();

            sitemapItems = new List <SitemapItem>();
            var products   = ProductRepository.GetProductByTypeAndCategoryIdFromCache(StoreId, StoreConstants.ProductType, -1);
            var categories = ProductCategoryRepository.GetProductCategoriesByStoreIdFromCache(StoreId,
                                                                                              StoreConstants.ProductType);

            foreach (var product in products)
            {
                var cat = categories.FirstOrDefault(r => r.Id == product.ProductCategoryId);
                if (cat != null)
                {
                    var productDetailLink = LinkHelper.GetProductIdRouteValue(product, cat.Name);
                    var siteMap           = new SitemapItem(sitemapsController.Url.AbsoluteAction("Product", "Products", new { id = productDetailLink }),
                                                            changeFrequency: SitemapChangeFrequency.Monthly, priority: 1.0);
                    sitemapItems.Add(siteMap);
                }
            }
            return(new SitemapResult(sitemapItems));
        }
Example #20
0
        public DbContextCache(string stringConnection)
        {
            var userAdmittanceRepositoryDb         = new UserAdmittanceRepository(stringConnection);
            var userSystemRepositoryDb             = new UserSystemRepository(stringConnection, userAdmittanceRepositoryDb);
            var userAuthorizationTokenRepositoryDb = new UserAuthorizationTokenRepository(stringConnection, userSystemRepositoryDb);

            var productCategoryRepositoryDb    = new ProductCategoryRepository(stringConnection);
            var productInformationRepositoryDb = new ProductInformationRepository(stringConnection, productCategoryRepositoryDb);
            var productRepositoryDb            = new ProductRepository(stringConnection, productInformationRepositoryDb);
            var userOrderRepositoryDb          = new UserOrderRepository(stringConnection, productRepositoryDb, userSystemRepositoryDb);



            _userAdmittanceRepository         = new UserAdmittanceRepositoryCache(userAdmittanceRepositoryDb);
            _userSystemRepository             = new UserSystemRepositoryCache(userSystemRepositoryDb);
            _userAuthorizationTokenRepository = new UserAuthorizationTokenRepositoryCache(userAuthorizationTokenRepositoryDb);

            _productCategoryRepository    = new ProductCategoryRepositoryCache(productCategoryRepositoryDb);
            _productInformationRepository = new ProductInformationRepositoryCache(productInformationRepositoryDb);
            _productRepository            = new ProductRepositoryCache(productRepositoryDb);
            _userOrderRepository          = new UserOrderRepositoryCache(userOrderRepositoryDb);
        }
        /// <summary>
        /// Adds a new ProductCategory with the ProductCategory with the matching given identifier as its parent.
        /// </summary>
        /// <param parentId="parentId"></param>
        /// <param name="modelView">ModelView containing ProductCategory information.</param>
        /// <returns>Returns the added ProductCategory's ModelView.</returns>
        public GetProductCategoryModelView addSubProductCategory(long parentId, AddProductCategoryModelView modelView)
        {
            ProductCategoryRepository repository = PersistenceContext.repositories().createProductCategoryRepository();

            ProductCategory parentCategory = repository.find(parentId);

            if (parentCategory == null)
            {
                throw new ArgumentException(ERROR_PARENT_NOT_FOUND);
            }

            ProductCategory category = new ProductCategory(modelView.name, parentCategory);

            category = repository.save(category);

            //category was not able to be added (probably due to a violation of business identifiers)
            if (category == null)
            {
                throw new ArgumentException(ERROR_UNABLE_TO_ADD_CATEGORY);
            }

            return(ProductCategoryModelViewService.fromEntity(category));
        }
Example #22
0
 public AWUnitOfWork(AWContext context)
 {
     _context                = context;
     Address                 = new AddressRepository(context);
     BusinessEntity          = new BusinessEntityRepository(context);
     BusinessEntityAddress   = new BusinessEntityAddressRepository(context);
     PersonPhone             = new PersonPhoneRepository(context);
     StateProvince           = new StateProvinceRepository(context);
     Customer                = new CustomerRepository(context);
     SalesPerson             = new SalesPersonRepository(context);
     SalesOrderHeader        = new SalesOrderHeaderRepository(context);
     SalesOrderDetail        = new SalesOrderDetailRepository(context);
     ShoppingCartItem        = new ShoppingCartItemRepository(context);
     SalesTerritory          = new SalesTerritoryRepository(context);
     Product                 = new ProductRepository(context);
     ProductCategory         = new ProductCategoryRepository(context);
     ProductDescription      = new ProductDescriptionRepository(context);
     ProductInventory        = new ProductInventoryRepository(context);
     ProductListPriceHistory = new ProductListPriceHistoryRepository(context);
     ProductPhoto            = new ProductPhotoRepository(context);
     ProductProductPhoto     = new ProductProductPhotoRepository(context);
     Person = new PersonRepository(context);
 }
Example #23
0
        public UserFriendlyInventory(DatabaseContext DatabaseContext)
        {
            this._dbContext = DatabaseContext;

            // Load all product categories into cache
            ProductCategoryRepository _productCategoryRepository = new ProductCategoryRepository(DatabaseContext);

            _allCategories.Clear();
            foreach (ProductCategory category in _productCategoryRepository.GetAll())
            {
                _allCategories.Add(category.Id, category);
            }

            // Load all products into cache
            // This may have to be changed if we get a lot of products
            ProductRepository _productRepository = new ProductRepository(DatabaseContext);

            _allItems.Clear();
            foreach (Product product in _productRepository.GetAll())
            {
                _allItems.Add(product.Id, product);
            }
        }
Example #24
0
        public EfCorePersistence(IEfcoreDatabaseService efcoreDatabaseService)
        {
            _efcoreDatabaseService = efcoreDatabaseService;

            #region -Initialize Concrete Implementations of IRepository-
            //The concrete implementations need to be initialized improve this logic
            _addresses = new AddressRepository(_efcoreDatabaseService);

            _customers = new CustomerRepository(_efcoreDatabaseService);

            _categories = new CategoryRepository(_efcoreDatabaseService);

            _productcategories = new ProductCategoryRepository(_efcoreDatabaseService);

            _productimages = new ProductImageRepository(_efcoreDatabaseService);

            _products = new ProductRepository(_efcoreDatabaseService);

            _sellers = new SellerRepository(_efcoreDatabaseService);

            _users = new UserRepository(_efcoreDatabaseService);
            #endregion
        }
Example #25
0
        public void GetAllCategories_OnNotEmptyTable_ReturnsAllRecords()
        {
            // arrange
            List <ProductCategory> expected = new List <ProductCategory>();

            expected.Add(new ProductCategory()
            {
                ID = 1
            });
            expected.Add(new ProductCategory()
            {
                ID = 2
            });
            expected.Add(new ProductCategory()
            {
                ID = 3
            });
            expected.Add(new ProductCategory()
            {
                ID = 4
            });
            expected.Add(new ProductCategory()
            {
                ID = 5
            });
            Mock <DbSet <ProductCategory> > mockSet = EntityMockFactory.CreateSet(expected.AsQueryable());
            Mock <InventoryDb> mockContext          = new Mock <InventoryDb>();

            mockContext.Setup(c => c.Categories).Returns(mockSet.Object);
            ProductCategoryRepository sut = new ProductCategoryRepository(mockContext.Object);

            // act
            var actual = sut.GetAllCategories();

            // assert
            Assert.IsTrue(Equality.AreEqual(expected, actual));
        }
Example #26
0
        public void CreateValidProductCategoryRepositoryTest()
        {
            var pc1 = new ProductCategory()
            {
                ProductCategoryId = 1, Name = "Testing category"
            };
            var pc2 = new ProductCategory()
            {
                ProductCategoryId = 2, Name = "category"
            };
            var pc3 = new ProductCategory()
            {
                ProductCategoryId = 3, Name = "Testing"
            };

            // Run the test against one instance of the context
            using (var context = new GamersUnitedContext(GetOption(System.Reflection.MethodBase.GetCurrentMethod().Name)))
            {
                context.Database.EnsureDeleted();

                var repo = new ProductCategoryRepository(context);

                var npc1 = repo.Add(pc1);
                Assert.Equal(1, context.ProductCategory.Count());

                var npc2 = repo.Add(pc2);
                Assert.Equal(2, context.ProductCategory.Count());

                var npc3 = repo.Add(pc3);
                Assert.Equal(3, context.ProductCategory.Count());

                Assert.Equal(pc1.Name, npc1.Name);
                Assert.Equal(pc2.Name, npc2.Name);
                Assert.Equal(pc3.Name, npc3.Name);
            }
        }
Example #27
0
        public StoreHomePage GetHomePage()
        {
            int           page        = 1;
            StoreHomePage resultModel = new StoreHomePage();

            resultModel.SStore             = MyStore;
            resultModel.SCarouselImages    = FileManagerRepository.GetStoreCarousels(MyStore.Id);
            resultModel.SProductCategories = ProductCategoryRepository.GetProductCategoriesByStoreId(MyStore.Id);
            var products = ProductRepository.GetProductsCategoryId(MyStore.Id, null, StoreConstants.ProductType, true, page, 24);

            resultModel.SProducts = new PagedList <Product>(products.items, products.page - 1, products.pageSize, products.totalItemCount);
            var contents = ContentRepository.GetContentsCategoryId(MyStore.Id, null, StoreConstants.NewsType, true, page, 24);

            resultModel.SNews            = new PagedList <Content>(contents.items, contents.page - 1, contents.pageSize, contents.totalItemCount);
            contents                     = ContentRepository.GetContentsCategoryId(MyStore.Id, null, StoreConstants.BlogsType, true, page, 24);
            resultModel.SBlogs           = new PagedList <Content>(contents.items, contents.page - 1, contents.pageSize, contents.totalItemCount);
            resultModel.SBlogsCategories = CategoryRepository.GetCategoriesByStoreId(MyStore.Id, StoreConstants.BlogsType, true);
            resultModel.SNewsCategories  = CategoryRepository.GetCategoriesByStoreId(MyStore.Id, StoreConstants.NewsType, true);
            resultModel.SNavigations     = NavigationRepository.GetStoreActiveNavigations(this.MyStore.Id);
            resultModel.SSettings        = this.GetStoreSettings();


            return(resultModel);
        }
Example #28
0
        static void Main(string[] args)
        {
            /*
             * string fileName = @"C:\Users\lisse\Pictures\google_logo.svg";
             * byte[] file = System.IO.File.ReadAllBytes(fileName);
             * System.IO.FileInfo fileInfo = new System.IO.FileInfo(fileName);
             * Console.WriteLine(fileInfo.Length);
             */

            // Console.WriteLine(string.Join("", file));

            // AddressRepository aRepo = new AddressRepository();
            // Address address = aRepo.Get(1);

            /*
             * FilesRepository fileRepo = new FilesRepository();
             * Console.WriteLine(fileRepo.Get(1).FileName);
             * Files fileWrite = fileRepo.Get(2);
             * System.IO.File.WriteAllBytes(Path.Combine(@"C:\Users\lisse\Pictures\", fileWrite.FileName + "2"), fileWrite.FileByte);
             */

            /*
             * string fileName2 = @"C:\Users\lisse\Pictures\google_logo2.svg";
             * System.IO.FileInfo fileInfo2 = new System.IO.FileInfo(fileName2);
             * Files fileTest2 = new Files();
             * fileTest2.Name = "test import";
             * fileTest2.FileName = fileInfo2.Name;
             * fileTest2.FileExension = fileInfo2.Extension;
             * fileTest2.FileByte = System.IO.File.ReadAllBytes(fileName2);
             * fileTest2.FileSize = fileInfo2.Length;
             * fileTest2.CreateBy = 1;
             * Console.WriteLine(fileRepo.Insert(fileTest2));
             */

            /*
             * string projectDirectory = @"C:\Users\lisse\Documents\Technofuturtic\Projet";
             * string projectFilename = Path.Combine(projectDirectory, "ProjectFile.svg");
             * string productFilename = Path.Combine(projectDirectory, "ProductFile.svg");
             * byte[] projectByte = System.IO.File.ReadAllBytes(projectFilename);
             * byte[] productByte = System.IO.File.ReadAllBytes(productFilename);
             * string projectString = string.Empty;
             * string productString = string.Empty;
             *
             * foreach (byte b in projectByte)
             * {
             *  projectString = string.Concat(projectString, b.ToString());
             *  //Console.WriteLine(b.ToString());
             * }
             *
             * foreach (byte b in productByte)
             * {
             *  productString = string.Concat(productString, b.ToString());
             *  //Console.WriteLine(b.ToString());
             * }
             *
             * Console.WriteLine(projectString);
             */

            /*
             * // ************ City ***********
             * CitiesRepository cityR = new CitiesRepository();
             * Cities cityId = cityR.Get(1);
             * IEnumerable<Cities> cityByName = cityR.GetByName("lou");
             * IEnumerable<Cities> cityByPostalCode = cityR.GetByPostalCode("7110");
             * IEnumerable<Cities> cityByCountry = cityR.GetCityByCountry(21);
             */

            /*
             * // ************ Role ***********
             * RoleRepository roleR = new RoleRepository();
             * Roles role = roleR.Get(1);
             */

            /*
             * // ************ Account ***********
             * AccountRepository accR = new AccountRepository();
             * Account account = accR.Get(1);
             * Account account1 = accR.GetAccountByLogin("dave");
             * Account account2 = accR.GetAccountByLogin("davde");
             */


            /*
             * // ************ Supplier ***********
             * SupplierRepository suppR = new SupplierRepository();
             * Supplier supplier = suppR.Get(1);
             */

            /*
             * // ************ Project ***********
             * ProjectRepository projectR = new ProjectRepository();
             * Project project = projectR.Get(1);
             * IEnumerable<Project> projectAccount = projectR.GetProjectByAccountId(1);
             * IEnumerable<Project> projectByName = projectR.GetProjectByName("maison");
             */

            /*
             * // ************ Category ***********
             * CategoryRepository catR = new CategoryRepository();
             * Category cat = catR.Get(1);
             */


            // ************ ContactInfo ***********
            ContactInfoRepository ciR = new ContactInfoRepository();
            ContactInfo           ci  = ciR.Get(1);


            /*
             * // ************ Product ***********
             * ProductRepository productR = new ProductRepository();
             * Product p1 = productR.Get(1);
             * IEnumerable<Product> p2 = productR.GetAll();
             * IEnumerable<Product> p3 = productR.GetByManufacturer("Buderus");
             * IEnumerable<Product> p4 = productR.GetByName("Chaudière");
             */

            // ************ ProductCategory ***********
            ProductCategoryRepository     pdcR = new ProductCategoryRepository();
            IEnumerable <ProductCategory> pdc1 = pdcR.Get(1);

            // ************ ProjectCategory ***********
            ProjectCategoryRepository     pjcR = new ProjectCategoryRepository();
            IEnumerable <ProjectCategory> pjc1 = pjcR.Get(1);

            CountryService     countryService     = new CountryService();
            CitiesService      citiesService      = new CitiesService(countryService);
            AddressService     addressService     = new AddressService(citiesService);
            RolesService       rolesService       = new RolesService();
            ContactInfoService contactInfoService = new ContactInfoService();

            AccountService accServ = new AccountService(addressService, rolesService, contactInfoService);

            Console.WriteLine(accServ.Get(1).Address.Street);

            SupplierService supplierService = new SupplierService(addressService, contactInfoService);

            BLL.Models.Supplier supplier = supplierService.Get(1);

            FilesService filesService = new FilesService();

            BLL.Models.Files file = filesService.Get(1);

            CategoryService categoryService = new CategoryService();

            ProductCategoryService            productCategoryService = new ProductCategoryService(categoryService, filesService);
            List <BLL.Models.ProductCategory> productCategory        = productCategoryService.Get(1);

            ProductService productService = new ProductService(productCategoryService);

            ProjectCategoryProductService projectCategoryProductService = new ProjectCategoryProductService(productService, supplierService);

            ProjectCategoryService projectCategoryService = new ProjectCategoryService(categoryService, filesService, projectCategoryProductService);

            ProjectService projectService = new ProjectService(addressService, projectCategoryService);

            BLL.Models.Project project = projectService.Get(1);

            FilesRepository filesRepository = new FilesRepository();

            byte[] fileByte = filesRepository.Download(1);
        }
Example #29
0
 public IndexModel(ProductRepository products, ProductCategoryRepository categories)
 {
     _products   = products;
     _categories = categories;
 }
 public ProductManagerController()
 {
     context           = new ProductRepository();
     productCategories = new ProductCategoryRepository();
 }
Example #31
0
 public ProductCategoryManager()
 {
     _repository = new ProductCategoryRepository();
 }
        private void LoadSubCategory(string categoryid, string selectedValue)
        {
            ProductCategoryRepository facade = new ProductCategoryRepository();
            var model = facade.getProductCategory(categoryid).ToList();
            Util.LoadData2RadCombo(rcbSubCategory, model, "SubCatId", "SubCatName", "-Select a Sub Category-", false);

            if (!String.IsNullOrEmpty(selectedValue))
            {
                rcbSubCategory.SelectedValue = selectedValue;
            }

            //rcbSubCategory.DataBind();
        }