public Contract ProduceContract(Factory factoryRequesting)
        {
            List <RawMaterialOffer> offers = RequestOffers();

            RawMaterialOffer offerForContract = BestOffer(offers);

            return(new Contract(offerForContract, this, offerForContract.SupplierRelated, factoryRequesting, DateTime.Now));
        }
 public Contract(RawMaterialOffer offer, Organisation organisation, Supplier supplier, Factory factoryRelated, DateTime startdate)
 {
     RelatedOffer        = offer;
     OrganisationRelated = organisation;
     SupplierRelated     = offer.SupplierRelated;
     FactoryRelated      = factoryRelated;
     StartDate           = startdate;
 }
Exemple #3
0
        //public RawMaterialOrder OrderMaterial(double quantity ,double price)
        //{
        //	//New Order Material
        //	RawMaterialOrder newOrder = new RawMaterialOrder(quantity, price);
        //	return newOrder;
        //}
        //public ChocolateOrder OrderChocolate(List<Chocolate> chocolates, IChocoBuyers buyer)
        //{
        //	//New Order Chocolate
        //	ChocolateOrder newOrder = new ChocolateOrder(chocolates, this, buyer);
        //	return newOrder;
        //}


        public RawMaterialOffer CreateOffer()
        {
            //Create an Offer
            Random selector = new Random();

            RawMaterialOffer newoffer = new RawMaterialOffer(selector.Next(2, 4), selector.Next(51, 300), this);

            Offers.Add(newoffer);

            return(newoffer);
        }
        private List <RawMaterialOffer> RequestOffers()
        {
            List <RawMaterialOffer> offers = new List <RawMaterialOffer>();

            foreach (var supplier in Suppliers)
            {
                RawMaterialOffer newOffer = supplier.CreateOffer();
                offers.Add(newOffer);
                Offers.Add(newOffer);
            }

            return(offers);
        }
        public Contract ProduceContract(Factory factory)
        {
            //Generating a list of offers from all curent suppliers
            List <RawMaterialOffer> offers = RequestOffers();

            //chosing best offer
            RawMaterialOffer bestOffer = BestOffer(offers);
            //creating contract depending on an offer
            Contract newContract = new Contract(bestOffer, this, bestOffer.SupplierRelated, factory, DateTime.Now);

            //adding contract to a factory
            return(newContract);
        }