private void btnApplyLoan_Click(object sender, RoutedEventArgs e)
        {
            double amount = slAmount.Value;
            int length = Convert.ToInt16(slLenght.Value)*12;

            Loan loan = new Loan(GameObject.GetInstance().GameTime, amount, length, this.Airline.LoanRate);
            this.Airline.addLoan(loan);

            AirlineHelpers.AddAirlineInvoice(this.Airline.Airline, GameObject.GetInstance().GameTime, Invoice.InvoiceType.Loans, loan.Amount);
        }
        private void btnApplyLoan_Click(object sender, RoutedEventArgs e)
        {
            double amount = slAmount.Value;
            int length = Convert.ToInt16(slLenght.Value)*12;

            Loan loan = new Loan(GameObject.GetInstance().GameTime, amount, length, this.Airline.LoanRate);

            if (AirlineHelpers.CanApplyForLoan(GameObject.GetInstance().HumanAirline, loan))
            {

                this.Airline.addLoan(loan);

                AirlineHelpers.AddAirlineInvoice(this.Airline.Airline, GameObject.GetInstance().GameTime, Invoice.InvoiceType.Loans, loan.Amount);
            }
            else
                WPFMessageBox.Show(Translator.GetInstance().GetString("MessageBox", "2124"), Translator.GetInstance().GetString("MessageBox", "2124", "message"), WPFMessageBoxButtons.Ok);
        }
예제 #3
0
 //removes a loan
 public void removeLoan(Loan loan)
 {
     this.Loans.Remove(loan);
 }
예제 #4
0
 //adds a loan to the airline
 public void addLoan(Loan loan)
 {
     this.Loans.Add(loan);
 }
예제 #5
0
        //returns if an airline can apply for a loan
        public static Boolean CanApplyForLoan(Airline airline, Loan loan)
        {
            double loans = airline.Loans.Sum(l => l.Amount);

            return loan.Amount + loans < GetMaxLoanAmount(airline);
        }
 public LoanMVVM(Loan loan)
 {
     this.Loan = loan;
     this.PaymentLeft = loan.PaymentLeft;
     this.MonthsLeft = loan.MonthsLeft;
 }
        //adds a loan
        public void addLoan(Loan loan)
        {
            this.Loans.Add(new LoanMVVM(loan));

            this.Airline.addLoan(loan);

            setValues();
        }