コード例 #1
0
 public List <MaterialViewModel> Read(MaterialBindingModel model)
 {
     if (model == null)
     {
         return(_materialStorage.GetFullList());
     }
     if (model.Id.HasValue)
     {
         return(new List <MaterialViewModel> {
             _materialStorage.GetElement(model)
         });
     }
     return(_materialStorage.GetFilteredList(model));
 }
コード例 #2
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);
        }
コード例 #3
0
        public List <ReportSupplyGarnituresViewModel> GetSupplyGarnitures(List <GarnitureViewModel> garnitures)
        {
            var materials = _materialStorage.GetFullList();
            var supplys   = _supplyStorage.GetFullList();
            var list      = new List <ReportSupplyGarnituresViewModel>();
            var cache     = new List <string>();

            foreach (var garniture in garnitures)
            {
                foreach (var material in materials)
                {
                    if (garniture.GarnitureMaterials.ContainsKey(material.Id))
                    {
                        foreach (var supply in supplys)
                        {
                            if (supply.SupplyMaterials.ContainsKey(material.Id) && !cache.Contains(supply.Name))
                            {
                                var dict = new Dictionary <int, (string, int)>();
                                foreach (var elem in garnitures)
                                {
                                    if (elem.GarnitureMaterials.ContainsKey(material.Id))
                                    {
                                        dict.Add(elem.Id, (elem.Name, (int)elem.Price));
                                    }
                                }

                                list.Add(new ReportSupplyGarnituresViewModel
                                {
                                    Name       = supply.Name,
                                    Price      = supply.Price,
                                    Date       = supply.Date,
                                    Garnitures = dict
                                });
                                cache.Add(supply.Name);
                            }
                        }
                    }
                }
            }
            return(list);
        }
コード例 #4
0
        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);
        }