public void OnGet(string vendor) { furnitureRepository = new FurnitureRepository(QueryMode.ByVendorCode, vendor); furnitureRepository.Initialize(); Furniture = furnitureRepository.Items.FirstOrDefault(); // Furniture.CategoryID = Furniture.Category.ID; Furniture.ManufacturerID = Furniture.Manufacturer.ID; Furniture.CollectionID = Furniture.Collection.ID; // CollectionRepository = new CollectionRepository(); CollectionRepository.Initialize(); // ManufacturerRepository = new ManufacturerRepository(); ManufacturerRepository.Initialize(); // CategoryRepository = new CategoryRepository(); CategoryRepository.Initialize(); // ColorRepository = new ColorRepository(); ColorRepository.Initialize(); // MaterialRepository = new MaterialRepository(); MaterialRepository.Initialize(); }
public void OnGet() { ManufacturerRepository manufacturerRepository = new ManufacturerRepository(); manufacturerRepository.Initialize(); Manufacturers = manufacturerRepository.Items.OrderBy(i => i.ID).ToList(); }
public void OnGet() { CollectionRepository = new CollectionRepository(); CollectionRepository.Initialize(); // ManufacturerRepository = new ManufacturerRepository(); ManufacturerRepository.Initialize(); // CategoryRepository = new CategoryRepository(); CategoryRepository.Initialize(); }
public IndexModel() { CategoryRepository categoryRepository = new CategoryRepository(); categoryRepository.Initialize(); Categories = categoryRepository.Items.ToArray(); // ManufacturerRepository manufacturerRepository = new ManufacturerRepository(); manufacturerRepository.Initialize(); Manufacturers = manufacturerRepository.Items.ToArray(); // CollectionRepository collectionRepository = new CollectionRepository(); collectionRepository.Initialize(); Collections = collectionRepository.Items.ToArray(); }
public StatisticsModel() { orderRepository = new OrderRepository(); orderRepository.Initialize(); userRepository = new AppUserRepository(); userRepository.Initialize(); furnitureRepository = new FurnitureRepository(); furnitureRepository.Initialize(); categoryRepository = new CategoryRepository(); categoryRepository.Initialize(); manufacturerRepository = new ManufacturerRepository(); manufacturerRepository.Initialize(); // // AppUserTotalStats = orderRepository.Items.GroupBy(oh => new { ID = oh.AppUserID, Name = oh.AppUser.Name }) .Select(g => new AppUserTotal(g.Key.ID, g.Key.Name, g.Sum(oh => oh.GetSum()))) .OrderByDescending(ut => ut.Total); // IEnumerable <int> totals = orderRepository.Items .Where(oh => oh.Date != null) .Select(oh => (int)oh.GetSum()); ReceiptStats = (totals.Min(), (int)totals.Average(), totals.Max()); // categoryManufacturerAverage = new Dictionary <string, Dictionary <string, List <decimal> > >(); furnitureRepository.Items.ForEach(f => { if (categoryManufacturerAverage.ContainsKey(f.Category.Name)) { if (categoryManufacturerAverage[f.Category.Name].ContainsKey(f.Manufacturer.Name)) { categoryManufacturerAverage[f.Category.Name][f.Manufacturer.Name].Add(f.Price); } else { categoryManufacturerAverage[f.Category.Name][f.Manufacturer.Name] = new List <decimal>(); categoryManufacturerAverage[f.Category.Name][f.Manufacturer.Name].Add(f.Price); } } else { categoryManufacturerAverage[f.Category.Name] = new Dictionary <string, List <decimal> >(); categoryManufacturerAverage[f.Category.Name][f.Manufacturer.Name] = new List <decimal>(); categoryManufacturerAverage[f.Category.Name][f.Manufacturer.Name].Add(f.Price); } }); // foreach (var oh in orderRepository.Items) { if (oh.Date == null) { continue; } // DateTime date = ((DateTime)oh.Date).Date; int numberOfOrders = 1; if (ordersByDate.ContainsKey(date)) { numberOfOrders += ordersByDate[date]; } ordersByDate[date] = numberOfOrders; // oh.OrderDetails.ForEach(od => { int bought = od.Quantity; if (furnitureBought.ContainsKey(od.VendorCode)) { bought += furnitureBought[od.VendorCode]; } furnitureBought[od.VendorCode] = bought; }); } }