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); }
public List <ShipmentViewModel> Read(ShipmentBindingModel model) { if (model == null) { return(_supplyStorage.GetFullList()); } if (model.Id.HasValue) { return(new List <ShipmentViewModel> { _supplyStorage.GetElement(model) }); } return(_supplyStorage.GetFilteredList(model)); }
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); }