Esempio n. 1
0
        public void Run(int id, Provider provider, int count, DateTime dateTime, float allPurchasePrice, float allSalesPrice, Department department, Seller seller)
        {
            ArrivedGoods arrivedGoods = null;

            arrivedGoodsRepository.GetNewAll();
            foreach (ArrivedGoods curArrivedGoods in arrivedGoodsRepository.GetAll())
            {
                if (id.Equals(curArrivedGoods.Id))
                {
                    arrivedGoods = new ArrivedGoods()
                    {
                        Id               = id,
                        Provider         = provider,
                        Count            = count,
                        DateTime         = dateTime,
                        AllPurchasePrice = allPurchasePrice,
                        AllSalesPrice    = allPurchasePrice,
                        Department       = department,
                        Seller           = seller
                    };
                    arrivedGoodsRepository.Update(arrivedGoods);
                    break;
                }
            }

            if (arrivedGoods == null)
            {
                throw new Exception("The product is not updated and not found!");
            }
            ;
        }
        public List <ArrivedGoods> Run(Department department)
        {
            List <ArrivedGoods> arrivedGoodses = new List <ArrivedGoods>();

            arrivedGoodsRepository.GetNewAll();
            foreach (ArrivedGoods curArrivedGoods in arrivedGoodsRepository.GetAll())
            {
                if (department.Id.Equals(curArrivedGoods.Department.Id))
                {
                    ArrivedGoods arrivedGoods = new ArrivedGoods()
                    {
                        Id               = curArrivedGoods.Id,
                        Provider         = curArrivedGoods.Provider,
                        Count            = curArrivedGoods.Count,
                        DateTime         = curArrivedGoods.DateTime,
                        AllPurchasePrice = curArrivedGoods.AllPurchasePrice,
                        AllSalesPrice    = curArrivedGoods.AllSalesPrice,
                        Department       = curArrivedGoods.Department,
                        Seller           = curArrivedGoods.Seller
                    };

                    arrivedGoodses.Add(arrivedGoods);
                }
            }

            return(arrivedGoodses);
        }