public static DelieveryContract CreateContract(int targetCityID, double payment, int waggonCount, double totalWeight)
        {
            DelieveryContract contract = new DelieveryContract(targetCityID, payment, waggonCount, totalWeight, _idCounter);

            IncrementIdCounter();
            return(contract);
        }
        public static void SignContract(DelieveryContract contract, int cityIndex)
        {
            _newFlowingContractsList[cityIndex].Add(contract);

            _newFlowingStatusList[cityIndex] = new Status(_newFlowingStatusList[cityIndex].Weight + contract.TotalWeight,
                                                          _newFlowingStatusList[cityIndex].WaggonCount + contract.WaggonCount);
        }
Пример #3
0
        public void AddDelieveryContract(DelieveryContract delieveryContract)
        {
            if (delieveryContract.TargetCityID == _id)
            {
                Console.WriteLine("Cannot add contract with target set to source city");
                return;
            }

            _delieveryContracts.Add(delieveryContract);
        }
Пример #4
0
        public static void AddContractToCity(int sourceCityID, DelieveryContract delieveryContract)
        {
            if (delieveryContract.TargetCityID == sourceCityID)
            {
                Console.WriteLine("Cannot add contract with target set to source city");
                return;
            }

            _cities.Find(city => city.ID == sourceCityID).AddDelieveryContract(delieveryContract);
            _contracts.Add(delieveryContract);
        }