Наследование: INotifyPropertyChanged
Пример #1
0
        private void btnRemoveContract_Click(object sender, RoutedEventArgs e)
        {
            ContractMVVM tContract = (ContractMVVM)((Button)sender).Tag;

            AirportContract contract = tContract.Contract;

            double penaltyFee = ((contract.YearlyPayment / 12) * contract.MonthsLeft) / 10;

            var contracts = this.Airport.Airport.AirlineContracts.Where(a => a.Airline == GameObject.GetInstance().HumanAirline&& a != contract).ToList();

            if (!AirportHelpers.CanFillRoutesEntries(this.Airport.Airport, GameObject.GetInstance().HumanAirline, contracts))
            {
                WPFMessageBox.Show(Translator.GetInstance().GetString("MessageBox", "2224"), Translator.GetInstance().GetString("MessageBox", "2224", "message"), WPFMessageBoxButtons.Ok);
            }
            else if (contract.Terminal != null)
            {
                WPFMessageBox.Show(Translator.GetInstance().GetString("MessageBox", "2226"), string.Format(Translator.GetInstance().GetString("MessageBox", "2226", "message"), contract.Terminal.Name), WPFMessageBoxButtons.Ok);
            }
            else
            {
                WPFMessageBoxResult result = WPFMessageBox.Show(Translator.GetInstance().GetString("MessageBox", "2225"), string.Format(Translator.GetInstance().GetString("MessageBox", "2225", "message"), new ValueCurrencyConverter().Convert(penaltyFee)), WPFMessageBoxButtons.YesNo);

                if (result == WPFMessageBoxResult.Yes)
                {
                    AirlineHelpers.AddAirlineInvoice(GameObject.GetInstance().HumanAirline, GameObject.GetInstance().GameTime, Invoice.InvoiceType.Purchases, -penaltyFee);

                    this.Airport.removeAirlineContract(tContract);
                }
            }
        }
Пример #2
0
        private void btnExtendContract_Click(object sender, RoutedEventArgs e)
        {
            ContractMVVM tContract = (ContractMVVM)((Button)sender).Tag;

            int length = 2;

            WPFMessageBoxResult result = WPFMessageBox.Show(Translator.GetInstance().GetString("MessageBox", "2228"), string.Format(Translator.GetInstance().GetString("MessageBox", "2228", "message"), length), WPFMessageBoxButtons.YesNo);

            if (result == WPFMessageBoxResult.Yes)
            {
                tContract.extendContract(length);
            }
        }
Пример #3
0
        //removes an airline contract from the airport
        public void removeAirlineContract(ContractMVVM contract)
        {
            this.Airport.removeAirlineContract(contract.Contract);

            this.Contracts.Remove(contract);

            this.FreeGates = this.Airport.Terminals.NumberOfFreeGates;

            foreach (AirportTerminalMVVM terminal in Terminals)
            {
                terminal.FreeGates = terminal.Terminal.getFreeGates();
            }
        }
Пример #4
0
        //removes an airline contract from the airport
        public void removeAirlineContract(ContractMVVM contract)
        {
            this.Airport.removeAirlineContract(contract.Contract);

            this.Contracts.Remove(contract);

            this.FreeGates = this.Airport.Terminals.NumberOfFreeGates;

            foreach (AirportTerminalMVVM terminal in Terminals)
            {
                terminal.FreeGates = terminal.Terminal.getFreeGates();
            }

            this.CanMakeCooperation = GameObject.GetInstance().HumanAirline.Airports.Exists(a => a == this.Airport);
        }
Пример #5
0
        private void btnExtendContract_Click(object sender, RoutedEventArgs e)
        {
            ContractMVVM tContract = (ContractMVVM)((Button)sender).Tag;

            AirportContract contract = new AirportContract(tContract.Contract.Airline, tContract.Contract.Airport, tContract.Contract.Type, tContract.Contract.ContractDate, tContract.Contract.NumberOfGates, tContract.Contract.Length, tContract.Contract.YearlyPayment, tContract.Contract.AutoRenew);

            object o = PopUpExtendContract.ShowPopUp(contract);

            if (o != null)
            {
                AirportContract nContract = (AirportContract)o;

                tContract.setNumberOfGates(nContract.NumberOfGates);
                tContract.setExpireDate(nContract.ExpireDate);
                tContract.Contract.AutoRenew = nContract.AutoRenew;
            }
        }
Пример #6
0
        //removes an airline contract from the airport
        public void removeAirlineContract(ContractMVVM contract)
        {
            this.Airport.removeAirlineContract(contract.Contract);

            this.Contracts.Remove(contract);

            this.FreeGates = this.Airport.Terminals.NumberOfFreeGates;

            foreach (AirportTerminalMVVM terminal in Terminals)
            {
                terminal.FreeGates = terminal.Terminal.getFreeGates();
            }
        }
Пример #7
0
        //removes an airline contract from the airport
        public void removeAirlineContract(ContractMVVM contract)
        {
            this.Airport.removeAirlineContract(contract.Contract);

            this.Contracts.Remove(contract);

            this.FreeGates = this.Airport.Terminals.NumberOfFreeGates;

            foreach (AirportTerminalMVVM terminal in Terminals)
            {
                terminal.FreeGates = terminal.Terminal.getFreeGates();
            }

            this.CanMakeCooperation = GameObject.GetInstance().HumanAirline.Airports.Exists(a => a == this.Airport);
        }