public static object ShowPopUp(AirlineInsurance policy)
        {
            PopUpWindow window = new PopUpConfirmInsurance(policy);
            window.ShowDialog();

            return window.Selected;
        }
        public PopUpConfirmInsurance(AirlineInsurance policy)
        {
            this.Insurance = policy;
            this.DataContext = this.Insurance;

            InitializeComponent();
        }
Ejemplo n.º 3
0
 //removes a policy
 public void removeInsurance(AirlineInsurance insurance)
 {
     this.InsurancePolicies.Remove(insurance);
 }
Ejemplo n.º 4
0
 //adds an insurance to the airline
 public void addInsurance(AirlineInsurance insurance)
 {
     this.InsurancePolicies.Add(insurance);
 }
Ejemplo n.º 5
0
        //add insurance policy
        public static AirlineInsurance CreatePolicy(Airline airline, AirlineInsurance.InsuranceType type, AirlineInsurance.InsuranceScope scope, AirlineInsurance.PaymentTerms terms, bool allAirliners, int length, int amount)
        {
            #region Method Setup
            Random rnd = new Random();
            double modifier = GetRatingModifier(airline);
            double hub = airline.getHubs().Count() * 0.1;
            AirlineInsurance policy = new AirlineInsurance(type, scope, terms, amount);
            policy.InsuranceEffective = GameObject.GetInstance().GameTime;
            policy.InsuranceExpires = GameObject.GetInstance().GameTime.AddYears(length);
            policy.PolicyIndex = GameObject.GetInstance().GameTime.ToString() + airline.ToString();
            policy.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
            Dictionary<AirlineInsurance.InsuranceType, Double> typeMultipliers = new Dictionary<AirlineInsurance.InsuranceType, double>();
            Dictionary<AirlineInsurance.InsuranceScope, Double> 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.Public_Liability:
                    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.Passenger_Liability:
                    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.Combined_Single_Limit:
                    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.Full_Coverage:
                    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 == true)
            {
                amount *= airline.Fleet.Count();
                policy.PaymentAmount *= (airline.Fleet.Count() * 0.95);
            }
            return policy;
        }
Ejemplo n.º 6
0
        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;
                News news = new News(News.NewsType.Airline_News, GameObject.GetInstance().GameTime, "Insurance Claim Payout", "You have received an insurance payout in the amount of $" + claim.Damage.ToString() + ". 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);
            }
        }
Ejemplo n.º 7
0
        //for general damage or claims
        public static void FileInsuranceClaim(Airline airline, AirlineInsurance policy, int damage)
        {
            InsuranceClaim claim = new InsuranceClaim(airline, null, null, GameObject.GetInstance().GameTime, damage);
            airline.InsuranceClaims.Add(claim);
            News news = new News(News.NewsType.Airline_News, GameObject.GetInstance().GameTime, "Insurance Claim Filed", "You have filed an insurance claim. Reference: " + claim.Index);

        }
Ejemplo n.º 8
0
 //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
 }
Ejemplo n.º 9
0
 //removes a policy
 public void removeInsurance(AirlineInsurance insurance)
 {
     this.InsurancePolicies.Remove(insurance);
 }
Ejemplo n.º 10
0
 //adds an insurance to the airline
 public void addInsurance(AirlineInsurance insurance)
 {
     this.InsurancePolicies.Add(insurance);
 }
Ejemplo n.º 11
0
 //adds an airline insurance
 public void addAirlineInsurance(AirlineInsurance insurance)
 {
     this.Insurances.Add(insurance);
     this.Airline.addInsurance(insurance);
 }