Esempio n. 1
0
        public List <ReportShipmentMaterialsViewModel> GetMaterialShipments(List <MaterialViewModel> materials)
        {
            var garnitures = _garnitureStorage.GetFullList();
            var shipments  = _shipmentStorage.GetFullList();
            var list       = new List <ReportShipmentMaterialsViewModel>();
            var cache      = new List <string>();

            foreach (var material in materials)
            {
                foreach (var garniture in garnitures)
                {
                    if (garniture.GarnitureMaterials.ContainsKey(material.Id))
                    {
                        foreach (var shipment in shipments)
                        {
                            if (shipment.ShipmentGarnitures.ContainsKey(garniture.Id) && !cache.Contains(shipment.Name))
                            {
                                list.Add(new ReportShipmentMaterialsViewModel
                                {
                                    Name      = shipment.Name,
                                    Date      = shipment.Date,
                                    Price     = shipment.Price,
                                    Materials = garniture.GarnitureMaterials
                                });
                                cache.Add(shipment.Name);
                            }
                        }
                    }
                }
            }
            return(list);
        }
Esempio n. 2
0
 public List <GarnitureViewModel> Read(GarnitureBindingModel model)
 {
     if (model == null)
     {
         return(_garnitureStorage.GetFullList());
     }
     if (model.Id.HasValue)
     {
         return(new List <GarnitureViewModel> {
             _garnitureStorage.GetElement(model)
         });
     }
     return(_garnitureStorage.GetFilteredList(model));
 }
Esempio n. 3
0
        public List <ReportShipmentViewModel> GetShipmentSupply(ReportCustomerBindingModel model)
        {
            var supplys = _supplyStorage.GetFilteredList(new SupplyBindingModel
            {
                DateFrom = model.DateFrom,
                DateTo   = model.DateTo
            });
            var materials  = _materialStorage.GetFullList();
            var garnitures = _garnitureStorage.GetFullList();
            var shipments  = _shipmentStorage.GetFullList();
            var list       = new List <ReportShipmentViewModel>();

            foreach (var supply in supplys)
            {
                foreach (var material in materials)
                {
                    if (supply.SupplyMaterials.ContainsKey(material.Id))
                    {
                        foreach (var garniture in garnitures)
                        {
                            if (garniture.GarnitureMaterials.ContainsKey(material.Id))
                            {
                                foreach (var shipment in shipments)
                                {
                                    if (garniture.GarnitureMaterials.ContainsKey(material.Id))
                                    {
                                        list.Add(new ReportShipmentViewModel
                                        {
                                            SupplyName   = supply.Name,
                                            ShipmentName = shipment.Name,
                                            SupplyDate   = supply.Date,
                                            ShipmentDate = shipment.Date
                                        });
                                    }
                                }
                            }
                        }
                    }
                }
            }
            return(list);
        }
        public List <ReportSupplyViewModel> GetGarnitureSupply(ReportProviderBindingModel model)
        {
            var supplys = _supplyStorage.GetFilteredList(new SupplyBindingModel
            {
                DateFrom = model.DateFrom,
                DateTo   = model.DateTo
            });
            var materials  = _materialStorage.GetFullList();
            var garnitures = _garnitureStorage.GetFullList();

            var list = new List <ReportSupplyViewModel>();

            foreach (var supply in supplys)
            {
                foreach (var material in materials)
                {
                    if (supply.SupplyMaterials.ContainsKey(material.Id))
                    {
                        foreach (var garniture in garnitures)
                        {
                            if (garniture.GarnitureMaterials.ContainsKey(material.Id))
                            {
                                list.Add(new ReportSupplyViewModel
                                {
                                    Date          = supply.Date,
                                    SupplyName    = supply.Name,
                                    SupplyPrice   = supply.Price.ToString(),
                                    GarnitureName = garniture.Name
                                });
                            }
                        }
                    }
                }
            }
            return(list);
        }