Esempio n. 1
0
 //adds an invoice to an airline
 public static void AddAirlineInvoice(Airline airline, DateTime date, Invoice.InvoiceType type, double amount)
 {
     if (airline.IsHuman && GameObject.GetInstance().HumanAirline == airline)
     {
         GameObject.GetInstance().addHumanMoney(amount);
         GameObject.GetInstance().HumanAirline.addInvoice(new Invoice(date, type, amount), false);
     }
     else
         airline.addInvoice(new Invoice(date, type, amount));
 }
        public static void MakeInsurancePayment(FleetAirliner airliner, Airline airline)
        {
            foreach (AirlinerInsurance policy in airliner.InsurancePolicies)
            {
                if (policy.RemainingPayments > 0)
                {
                    if (policy.NextPaymentDue.Month == GameObject.GetInstance().GameTime.Month)
                    {
                        airline.Money -= policy.PaymentAmount;
                        Invoice payment = new Invoice(GameObject.GetInstance().GameTime, Invoice.InvoiceType.Maintenances, policy.PaymentAmount);
                        airline.addInvoice(payment);
                        policy.RemainingPayments--;
                        switch (policy.insTerms)
                        {
                            case AirlinerInsurance.PaymentTerms.Monthly:
                                policy.NextPaymentDue = GameObject.GetInstance().GameTime.AddMonths(1);
                                break;
                            case AirlinerInsurance.PaymentTerms.Quarterly:
                                policy.NextPaymentDue = GameObject.GetInstance().GameTime.AddMonths(3);
                                break;
                            case AirlinerInsurance.PaymentTerms.Biannual:
                                policy.NextPaymentDue = GameObject.GetInstance().GameTime.AddMonths(6);
                                break;
                            case AirlinerInsurance.PaymentTerms.Annual:
                                policy.NextPaymentDue = GameObject.GetInstance().GameTime.AddMonths(12);
                                break;
                        }
                    }
                }

            }
        }