Пример #1
0
 public void AddInsurance(AirlineInsurance insurance)
 {
     InsurancePolicies.Add(insurance);
 }
Пример #2
0
 public void RemoveInsurance(AirlineInsurance insurance)
 {
     InsurancePolicies.Remove(insurance);
 }
Пример #3
0
 public void addAirlineInsurance(AirlineInsurance insurance)
 {
     Insurances.Add(insurance);
     Airline.AddInsurance(insurance);
 }
        public static void ReceiveInsurancePayout(Airline airline, AirlineInsurance policy, InsuranceClaim claim)
        {
            if (claim.Damage > policy.Deductible)
            {
                claim.Damage -= (int) policy.Deductible;
                airline.Money -= policy.Deductible;
                policy.Deductible = 0;
                policy.InsuredAmount -= claim.Damage;
                airline.Money += claim.Damage;
                var news = new News(News.NewsType.AirlineNews, GameObject.GetInstance().GameTime, "Insurance Claim Payout",
                                    "You have received an insurance payout in the amount of $" + claim.Damage.ToString(CultureInfo.InvariantCulture) + ". This was for claim number " + claim.Index);
            }

            else if (claim.Damage < policy.Deductible)
            {
                policy.Deductible -= claim.Damage;
                //Warnings.AddWarning("Low Damage", "The damage incurred was less than your deductible, so you will not receive an insurance payout for this claim! \n Reference: " + claim.Index);
            }
        }
 //for general damage or claims
 public static void FileInsuranceClaim(Airline airline, AirlineInsurance policy, int damage)
 {
     var claim = new InsuranceClaim(airline, null, null, GameObject.GetInstance().GameTime, damage);
     airline.InsuranceClaims.Add(claim);
     var news = new News(News.NewsType.AirlineNews, GameObject.GetInstance().GameTime, "Insurance Claim Filed", "You have filed an insurance claim. Reference: " + claim.Index);
 }
 //extend or modify policy
 public static void ModifyPolicy(Airline airline, string index, AirlineInsurance newPolicy)
 {
     //AirlineInsurance oldPolicy = airline.InsurancePolicies[index];
     //use the index to compare the new policy passed in to the existing one and make changes
 }
        //add insurance policy
        public static AirlineInsurance CreatePolicy(Airline airline, AirlineInsurance.InsuranceType type, AirlineInsurance.InsuranceScope scope, AirlineInsurance.PaymentTerms terms, bool allAirliners,
                                                    double length, int amount)
        {
            #region Method Setup

            var rnd = new Random();
            double modifier = GetRatingModifier(airline);
            double hub = airline.GetHubs().Count()*0.1;
            var policy = new AirlineInsurance(type, scope, terms, amount)
                {
                    InsuranceEffective = GameObject.GetInstance().GameTime,
                    InsuranceExpires = GameObject.GetInstance().GameTime.AddYears((int) length),
                    PolicyIndex = GameObject.GetInstance().GameTime.ToString(CultureInfo.InvariantCulture) + airline,
                    TermLength = length
                };
            switch (policy.InsTerms)
            {
                case AirlineInsurance.PaymentTerms.Monthly:
                    policy.RemainingPayments = length*12;
                    break;
                case AirlineInsurance.PaymentTerms.Quarterly:
                    policy.RemainingPayments = length*4;
                    break;
                case AirlineInsurance.PaymentTerms.Biannual:
                    policy.RemainingPayments = length*2;
                    break;
                case AirlineInsurance.PaymentTerms.Annual:
                    policy.RemainingPayments = length;
                    break;
            }
            //sets up multipliers based on the type and scope of insurance policy
            var typeMultipliers = new Dictionary<AirlineInsurance.InsuranceType, double>();
            var scopeMultipliers = new Dictionary<AirlineInsurance.InsuranceScope, double>();
            double typeMPublic = modifier;
            double typeMPassenger = modifier + 0.2;
            double typeMCSL = modifier + 0.5;
            double typeMFull = modifier + 1;

            double scMAirport = modifier;
            double scMDomestic = modifier + 0.2;
            double scMHub = modifier + hub + 0.5;
            double scMGlobal = modifier + hub + 1;

            #endregion

            #region Domestic/Int'l Airport Counter

            int i = 0;
            int j = 0;
            foreach (Airport airport in GameObject.GetInstance().HumanAirline.Airports)
            {
                if (airport.Profile.Country != GameObject.GetInstance().HumanAirline.Profile.Country)
                {
                    i++;
                }
                else j++;
            }

            #endregion

            // all the decision making for monthly payment amounts and deductibles

            #region Public Liability

            switch (type)
            {
                case AirlineInsurance.InsuranceType.PublicLiability:
                    switch (scope)
                    {
                        case AirlineInsurance.InsuranceScope.Airport:
                            policy.Deductible = amount*0.005;
                            policy.PaymentAmount = policy.InsuredAmount*(4/10)*typeMPublic*scMAirport;
                            if (terms == AirlineInsurance.PaymentTerms.Annual) policy.PaymentAmount = policy.InsuredAmount/length;
                            if (terms == AirlineInsurance.PaymentTerms.Biannual) policy.PaymentAmount = policy.InsuredAmount/length/2;
                            if (terms == AirlineInsurance.PaymentTerms.Quarterly) policy.PaymentAmount = policy.InsuredAmount/length/4;
                            if (terms == AirlineInsurance.PaymentTerms.Monthly) policy.PaymentAmount = policy.InsuredAmount/length/12;

                            break;

                        case AirlineInsurance.InsuranceScope.Domestic:
                            policy.Deductible = amount*0.001;
                            policy.PaymentAmount = policy.InsuredAmount*(4/10)*typeMPublic*scMDomestic;
                            if (terms == AirlineInsurance.PaymentTerms.Annual) policy.PaymentAmount = policy.InsuredAmount/length;
                            if (terms == AirlineInsurance.PaymentTerms.Biannual) policy.PaymentAmount = policy.InsuredAmount/length/2;
                            if (terms == AirlineInsurance.PaymentTerms.Quarterly) policy.PaymentAmount = policy.InsuredAmount/length/4;
                            if (terms == AirlineInsurance.PaymentTerms.Monthly) policy.PaymentAmount = policy.InsuredAmount/length/12;
                            break;

                        case AirlineInsurance.InsuranceScope.Hub:
                            policy.Deductible = amount*0.001;
                            policy.PaymentAmount = policy.InsuredAmount*(4/10)*typeMPublic*scMHub;
                            if (terms == AirlineInsurance.PaymentTerms.Annual) policy.PaymentAmount = policy.InsuredAmount/length;
                            if (terms == AirlineInsurance.PaymentTerms.Biannual) policy.PaymentAmount = policy.InsuredAmount/length/2;
                            if (terms == AirlineInsurance.PaymentTerms.Quarterly) policy.PaymentAmount = policy.InsuredAmount/length/4;
                            if (terms == AirlineInsurance.PaymentTerms.Monthly) policy.PaymentAmount = policy.InsuredAmount/length/12;
                            break;

                        case AirlineInsurance.InsuranceScope.Global:
                            policy.Deductible = amount*0.001;
                            policy.PaymentAmount = policy.InsuredAmount*(4/10)*typeMPublic*scMGlobal;
                            if (terms == AirlineInsurance.PaymentTerms.Annual) policy.PaymentAmount = policy.InsuredAmount/length;
                            if (terms == AirlineInsurance.PaymentTerms.Biannual) policy.PaymentAmount = policy.InsuredAmount/length/2;
                            if (terms == AirlineInsurance.PaymentTerms.Quarterly) policy.PaymentAmount = policy.InsuredAmount/length/4;
                            if (terms == AirlineInsurance.PaymentTerms.Monthly) policy.PaymentAmount = policy.InsuredAmount/length/12;
                            break;
                    }
                    break;

                    #endregion

                    #region Passenger Liability

                case AirlineInsurance.InsuranceType.PassengerLiability:
                    switch (scope)
                    {
                        case AirlineInsurance.InsuranceScope.Airport:
                            policy.Deductible = amount*0.005;
                            policy.PaymentAmount = policy.InsuredAmount*(4/10)*typeMPassenger*scMAirport;
                            if (terms == AirlineInsurance.PaymentTerms.Annual) policy.PaymentAmount = policy.InsuredAmount/length;
                            if (terms == AirlineInsurance.PaymentTerms.Biannual) policy.PaymentAmount = policy.InsuredAmount/length/2;
                            if (terms == AirlineInsurance.PaymentTerms.Quarterly) policy.PaymentAmount = policy.InsuredAmount/length/4;
                            if (terms == AirlineInsurance.PaymentTerms.Monthly) policy.PaymentAmount = policy.InsuredAmount/length/12;
                            break;

                        case AirlineInsurance.InsuranceScope.Domestic:
                            policy.Deductible = amount*0.001;
                            policy.PaymentAmount = policy.InsuredAmount*(4/10)*typeMPassenger*scMDomestic;
                            if (terms == AirlineInsurance.PaymentTerms.Annual) policy.PaymentAmount = policy.InsuredAmount/length;
                            if (terms == AirlineInsurance.PaymentTerms.Biannual) policy.PaymentAmount = policy.InsuredAmount/length/2;
                            if (terms == AirlineInsurance.PaymentTerms.Quarterly) policy.PaymentAmount = policy.InsuredAmount/length/4;
                            if (terms == AirlineInsurance.PaymentTerms.Monthly) policy.PaymentAmount = policy.InsuredAmount/length/12;
                            break;

                        case AirlineInsurance.InsuranceScope.Hub:
                            policy.Deductible = amount*0.001;
                            policy.PaymentAmount = policy.InsuredAmount*(4/10)*typeMPassenger*scMHub;
                            if (terms == AirlineInsurance.PaymentTerms.Annual) policy.PaymentAmount = policy.InsuredAmount/length;
                            if (terms == AirlineInsurance.PaymentTerms.Biannual) policy.PaymentAmount = policy.InsuredAmount/length/2;
                            if (terms == AirlineInsurance.PaymentTerms.Quarterly) policy.PaymentAmount = policy.InsuredAmount/length/4;
                            if (terms == AirlineInsurance.PaymentTerms.Monthly) policy.PaymentAmount = policy.InsuredAmount/length/12;
                            break;

                        case AirlineInsurance.InsuranceScope.Global:
                            policy.Deductible = amount*0.001;
                            policy.PaymentAmount = policy.InsuredAmount*(4/10)*typeMPassenger*scMGlobal;
                            if (terms == AirlineInsurance.PaymentTerms.Annual) policy.PaymentAmount = policy.InsuredAmount/length;
                            if (terms == AirlineInsurance.PaymentTerms.Biannual) policy.PaymentAmount = policy.InsuredAmount/length/2;
                            if (terms == AirlineInsurance.PaymentTerms.Quarterly) policy.PaymentAmount = policy.InsuredAmount/length/4;
                            if (terms == AirlineInsurance.PaymentTerms.Monthly) policy.PaymentAmount = policy.InsuredAmount/length/12;
                            break;
                    }
                    break;

                    #endregion

                    #region Combined Single Limit

                case AirlineInsurance.InsuranceType.CombinedSingleLimit:
                    switch (scope)
                    {
                        case AirlineInsurance.InsuranceScope.Airport:
                            policy.Deductible = amount*0.005;
                            policy.PaymentAmount = policy.InsuredAmount*(4/10)*typeMCSL*scMAirport;
                            if (terms == AirlineInsurance.PaymentTerms.Annual) policy.PaymentAmount = policy.InsuredAmount/length;
                            if (terms == AirlineInsurance.PaymentTerms.Biannual) policy.PaymentAmount = policy.InsuredAmount/length/2;
                            if (terms == AirlineInsurance.PaymentTerms.Quarterly) policy.PaymentAmount = policy.InsuredAmount/length/4;
                            if (terms == AirlineInsurance.PaymentTerms.Monthly) policy.PaymentAmount = policy.InsuredAmount/length/12;
                            break;

                        case AirlineInsurance.InsuranceScope.Domestic:
                            policy.Deductible = amount*0.001;
                            policy.PaymentAmount = policy.InsuredAmount*(4/10)*typeMCSL*scMDomestic;
                            if (terms == AirlineInsurance.PaymentTerms.Annual) policy.PaymentAmount = policy.InsuredAmount/length;
                            if (terms == AirlineInsurance.PaymentTerms.Biannual) policy.PaymentAmount = policy.InsuredAmount/length/2;
                            if (terms == AirlineInsurance.PaymentTerms.Quarterly) policy.PaymentAmount = policy.InsuredAmount/length/4;
                            if (terms == AirlineInsurance.PaymentTerms.Monthly) policy.PaymentAmount = policy.InsuredAmount/length/12;
                            break;

                        case AirlineInsurance.InsuranceScope.Hub:
                            policy.Deductible = amount*0.001;
                            policy.PaymentAmount = policy.InsuredAmount*(4/10)*typeMCSL*scMHub;
                            if (terms == AirlineInsurance.PaymentTerms.Annual) policy.PaymentAmount = policy.InsuredAmount/length;
                            if (terms == AirlineInsurance.PaymentTerms.Biannual) policy.PaymentAmount = policy.InsuredAmount/length/2;
                            if (terms == AirlineInsurance.PaymentTerms.Quarterly) policy.PaymentAmount = policy.InsuredAmount/length/4;
                            if (terms == AirlineInsurance.PaymentTerms.Monthly) policy.PaymentAmount = policy.InsuredAmount/length/12;
                            break;

                        case AirlineInsurance.InsuranceScope.Global:
                            policy.Deductible = amount*0.001;
                            policy.PaymentAmount = policy.InsuredAmount*(4/10)*typeMCSL*scMGlobal;
                            if (terms == AirlineInsurance.PaymentTerms.Annual) policy.PaymentAmount = policy.InsuredAmount/length;
                            if (terms == AirlineInsurance.PaymentTerms.Biannual) policy.PaymentAmount = policy.InsuredAmount/length/2;
                            if (terms == AirlineInsurance.PaymentTerms.Quarterly) policy.PaymentAmount = policy.InsuredAmount/length/4;
                            if (terms == AirlineInsurance.PaymentTerms.Monthly) policy.PaymentAmount = policy.InsuredAmount/length/12;
                            break;
                    }
                    break;

                    #endregion

                    #region Full Coverage

                case AirlineInsurance.InsuranceType.FullCoverage:
                    switch (scope)
                    {
                        case AirlineInsurance.InsuranceScope.Airport:
                            policy.Deductible = amount*0.005;
                            policy.PaymentAmount = policy.InsuredAmount*(4/10)*typeMFull*scMAirport;
                            if (terms == AirlineInsurance.PaymentTerms.Annual) policy.PaymentAmount = policy.InsuredAmount/length;
                            if (terms == AirlineInsurance.PaymentTerms.Biannual) policy.PaymentAmount = policy.InsuredAmount/length/2;
                            if (terms == AirlineInsurance.PaymentTerms.Quarterly) policy.PaymentAmount = policy.InsuredAmount/length/4;
                            if (terms == AirlineInsurance.PaymentTerms.Monthly) policy.PaymentAmount = policy.InsuredAmount/length/12;
                            break;

                        case AirlineInsurance.InsuranceScope.Domestic:
                            policy.Deductible = amount*0.001;
                            policy.PaymentAmount = policy.InsuredAmount*(4/10)*typeMFull*scMDomestic;
                            if (terms == AirlineInsurance.PaymentTerms.Annual) policy.PaymentAmount = policy.InsuredAmount/length;
                            if (terms == AirlineInsurance.PaymentTerms.Biannual) policy.PaymentAmount = policy.InsuredAmount/length/2;
                            if (terms == AirlineInsurance.PaymentTerms.Quarterly) policy.PaymentAmount = policy.InsuredAmount/length/4;
                            if (terms == AirlineInsurance.PaymentTerms.Monthly) policy.PaymentAmount = policy.InsuredAmount/length/12;
                            break;

                        case AirlineInsurance.InsuranceScope.Hub:
                            policy.Deductible = amount*0.001;
                            policy.PaymentAmount = policy.InsuredAmount*(4/10)*typeMFull*scMHub;
                            if (terms == AirlineInsurance.PaymentTerms.Annual) policy.PaymentAmount = policy.InsuredAmount/length;
                            if (terms == AirlineInsurance.PaymentTerms.Biannual) policy.PaymentAmount = policy.InsuredAmount/length/2;
                            if (terms == AirlineInsurance.PaymentTerms.Quarterly) policy.PaymentAmount = policy.InsuredAmount/length/4;
                            if (terms == AirlineInsurance.PaymentTerms.Monthly) policy.PaymentAmount = policy.InsuredAmount/length/12;
                            break;

                        case AirlineInsurance.InsuranceScope.Global:
                            policy.Deductible = amount*0.001;
                            policy.PaymentAmount = policy.InsuredAmount*(4/10)*typeMFull*scMGlobal;
                            if (terms == AirlineInsurance.PaymentTerms.Annual) policy.PaymentAmount = policy.InsuredAmount/length;
                            if (terms == AirlineInsurance.PaymentTerms.Biannual) policy.PaymentAmount = policy.InsuredAmount/length/2;
                            if (terms == AirlineInsurance.PaymentTerms.Quarterly) policy.PaymentAmount = policy.InsuredAmount/length/4;
                            if (terms == AirlineInsurance.PaymentTerms.Monthly) policy.PaymentAmount = policy.InsuredAmount/length/12;
                            break;
                    }

                    #endregion

                    break;
            }

            if (allAirliners)
            {
                amount *= airline.Fleet.Count();
                policy.PaymentAmount *= (airline.Fleet.Count()*0.95);
            }
            return policy;
        }