public IHttpActionResult PostQuote(Quote quote)
        {
            try
            {
                if (!ModelState.IsValid)
                {
                    return BadRequest(ModelState);
                }

                db.Quotes.Add(quote);
                db.SaveChanges();

                return CreatedAtRoute("DefaultApi", new { id = quote.Id }, quote);
            }
            catch (DbEntityValidationException e)
            {
                var str = String.Empty;
                foreach (var eve in e.EntityValidationErrors)
                {
                    str  += String.Format("Entity of type \"{0}\" in state \"{1}\" has the following validation errors:",
                        eve.Entry.Entity.GetType().Name, eve.Entry.State);
                    foreach (var ve in eve.ValidationErrors)
                    {
                        str += String.Format("- Property: \"{0}\", Error: \"{1}\"",
                            ve.PropertyName, ve.ErrorMessage);
                    }
                }
                throw;
            }
        }
Beispiel #2
0
        public static ActiveQuoteViewModel convertQuoteToViewModel(Quote quote)
        {
            ActiveQuoteViewModel quoteVM = new ActiveQuoteViewModel();
            quoteVM.ClaimInLastFive = quote.ClaimInLastFive;
            quoteVM.CustomerAddress = quote.CustomerAddress;
            quoteVM.CustomerDob = quote.CustomerDob;
            quoteVM.CustomerName = quote.CustomerFirstName + " " + quote.CustomerLastName;
            quoteVM.CustomerPhone = quote.CustomerPhone;
            quoteVM.CustomerSsn = quote.CustomerSsn;
            quoteVM.ForceMultiDiscount = quote.ForceMultiDiscount;
            quoteVM.Id = quote.Id;
            quoteVM.MovingViolation = quote.MovingViolation;
            quoteVM.PreviousCarrier = quote.PreviousCarrier;
            quoteVM.Price = (double)quote.Price;
            quoteVM.State = quote.State;
            quoteVM.Submitted = quote.Submitted;
            quoteVM.SubmissionTime = quote.SubmissionTime.ToString().Split(' ')[0];
            quoteVM.User = quote.User;
            quoteVM.AIAUserId = quote.AIAUserId;
            ObservableCollection<DriverViewModel> dvmcollection = new ObservableCollection<DriverViewModel>();
            foreach (var driver in quote.Drivers)
            {
                dvmcollection.Add(Converter.convertDriverToDriverViewModel(driver));

            }
            quoteVM.Drivers = dvmcollection;
            ObservableCollection<VehicleViewModel> vvmcollection = new ObservableCollection<VehicleViewModel>();
            foreach (var vehicle in quote.Vehicles)
            {
                vvmcollection.Add(Converter.convertVehicletoVehicleViewModel(vehicle));
            }
            quoteVM.Vehicles = vvmcollection;
            return quoteVM;
        }
        public IHttpActionResult PutQuote(long id, Quote quote)
        {
            if (!ModelState.IsValid)
            {
                return BadRequest(ModelState);
            }

            if (id != quote.Id)
            {
                return BadRequest();
            }

            db.Entry(quote).State = EntityState.Modified;

            try
            {
                db.SaveChanges();
            }
            catch (DbUpdateConcurrencyException)
            {
                if (!QuoteExists(id))
                {
                    return NotFound();
                }
                else
                {
                    throw;
                }
            }

            return StatusCode(HttpStatusCode.NoContent);
        }
Beispiel #4
0
        public static Quote convertViewModelToQuote(ActiveQuoteViewModel quoteVM)
        {
            Quote quote = new Quote();
            quote.ClaimInLastFive = quoteVM.ClaimInLastFive;
            quote.CustomerAddress = quoteVM.CustomerAddress;
            quote.CustomerDob = quoteVM.CustomerDob;
            quote.CustomerFirstName = quoteVM.CustomerName.Split(' ')[0];
            quote.CustomerLastName = quoteVM.CustomerName.Split(' ')[1];
            quote.CustomerPhone = quoteVM.CustomerPhone;
            quote.CustomerSsn = quoteVM.CustomerSsn;
            quote.ForceMultiDiscount = quoteVM.ForceMultiDiscount;
            quote.Id = quoteVM.Id;
            quote.MovingViolation = quoteVM.MovingViolation;
            quote.PreviousCarrier = quoteVM.PreviousCarrier;
            quote.Price = (decimal)quoteVM.Price;
            quote.State = quoteVM.State;
            quote.Submitted = quoteVM.Submitted;
            var times = quoteVM.SubmissionTime.Split('/');
            quote.SubmissionTime = new DateTime(Convert.ToInt32(times[1]), Convert.ToInt32(times[0]), Convert.ToInt32(times[2]));
            quote.User = quoteVM.User;
            quote.AIAUserId = quoteVM.AIAUserId;
            ObservableCollection<Driver> drivers = new ObservableCollection<Driver>();
            foreach (var driver in quoteVM.Drivers)
            {
                drivers.Add(Converter.convertDriverViewModelToDriver(driver));
            }
            quote.Drivers = drivers;
            ObservableCollection<Vehicle> vehicles = new ObservableCollection<Vehicle>();
            foreach (var vehicle in quoteVM.Vehicles)
            {
                vehicles.Add(Converter.convertVehicleViewModelToVehicle(vehicle));
            }
            quote.Drivers = drivers;
            quote.Vehicles = vehicles;

            return quote;
        }
        public static decimal calcQuote(Quote quote, List<Driver> drivers, List<Vehicle> vehicles)
        {
            decimal VehicleQuoteMultiplier = 1;
            decimal currentQuoteMultiplier = 1;
            decimal driverQuoteMultiplier = 1;
            decimal baseVehicleCost = 0;
            decimal vehicleCost;
            decimal driverCost;
            decimal driverBase = 0;
            decimal policyBase = 100;

            bool lessThan3years = false;

            switch (quote.State)
            {
                case "VT":
                    {
                        foreach (var d in drivers)
                        {

                            driverCost = 0;
                            driverBase += 200;

                            if (d.SafeDrivingSchool)
                            {
                                driverQuoteMultiplier *= .95m;
                            }
                            if (d.Dob > DateTime.Now.AddYears(-23)) { driverQuoteMultiplier *= 1.10m; }
                            if (d.LicenseDateStart > DateTime.Now.AddYears(-3)) { lessThan3years = true; }
                            driverBase *= driverQuoteMultiplier;
                            driverCost += driverBase;
                            policyBase += driverCost;
                            driverCostFinal.Add(driverCost);
                            driverId.Add(d.Id);

                        }
                        foreach (var v in vehicles)
                        {
                            baseVehicleCost = 0;
                            vehicleCost = 0;
                            baseVehicleCost += v.CurrentValue * .03m;
                            if (v.HasDaytimeRunningLights) { VehicleQuoteMultiplier *= .99m; }
                            if (v.HasAntilockBrakingSystem) { VehicleQuoteMultiplier *= .98m; }
                            if (v.AnnualMiles < 6000) { VehicleQuoteMultiplier *= .98m; }
                            if (v.PassiveRestraints) { VehicleQuoteMultiplier *= .97m; }
                            if (v.AntiTheft) { VehicleQuoteMultiplier *= .97m; }
                            if (v.DaysDrivenPerWeek > 4) { VehicleQuoteMultiplier *= 1.02m; }
                            if (v.MilesDrivenToWork <= 25) { VehicleQuoteMultiplier *= .98m; }
                            if (v.ReduceUse) { VehicleQuoteMultiplier *= .94m; }
                            if (v.GarageDifferent) { VehicleQuoteMultiplier *= 1.03m; }
                            baseVehicleCost *= VehicleQuoteMultiplier;
                            vehicleCost += baseVehicleCost;
                            policyBase += vehicleCost;
                            vehicleCostFinal.Add(vehicleCost);
                            vehicleId.Add(v.Id);
                        }

                        if (lessThan3years) { currentQuoteMultiplier *= 1.15m; }

                        if (quote.ClaimInLastFive) { currentQuoteMultiplier *= 1.20m; }
                        if (quote.ForceMultiDiscount) { currentQuoteMultiplier *= .95m; }

                        if (quote.MovingViolation) { currentQuoteMultiplier *= 1.20m; }

                        if (quote.PreviousCarrier == "Lizard Insurance") { currentQuoteMultiplier *= 1.05m; }
                        if (quote.PreviousCarrier == "Pervasive Insurance") { currentQuoteMultiplier *= .97m; }
                        policyBase *= currentQuoteMultiplier;
                        break;
                    }
                case "ME":
                    {
                        foreach (var d in drivers)
                        {

                            driverCost = 0;
                            driverBase += 200;

                            if (d.SafeDrivingSchool)
                            {
                                driverQuoteMultiplier *= .95m;
                            }
                            if (d.Dob > DateTime.Now.AddYears(-23)) { driverQuoteMultiplier *= 1.10m; }
                            if (d.LicenseDateStart > DateTime.Now.AddYears(-3)) { lessThan3years = true; }
                            driverBase *= driverQuoteMultiplier;
                            driverCost += driverBase;
                            policyBase += driverCost;
                            driverCostFinal.Add(driverCost);
                            driverId.Add(d.Id);
                        }
                        foreach (var v in vehicles)
                        {
                            baseVehicleCost = 0;
                            vehicleCost = 0;
                            baseVehicleCost += v.CurrentValue * .03m;
                            if (v.HasDaytimeRunningLights) { VehicleQuoteMultiplier *= .99m; }
                            if (v.HasAntilockBrakingSystem) { VehicleQuoteMultiplier *= .99m; }
                            if (v.AnnualMiles < 6000) { VehicleQuoteMultiplier *= .99m; }
                            if (v.PassiveRestraints) { VehicleQuoteMultiplier *= .97m; }
                            if (v.AntiTheft) { VehicleQuoteMultiplier *= .97m; }
                            if (v.DaysDrivenPerWeek > 4) { VehicleQuoteMultiplier *= 1.02m; }
                            if (v.MilesDrivenToWork <= 25) { VehicleQuoteMultiplier *= .98m; }
                            if (v.ReduceUse) { VehicleQuoteMultiplier *= .94m; }
                            if (v.GarageDifferent) { VehicleQuoteMultiplier *= 1.03m; }
                            baseVehicleCost *= VehicleQuoteMultiplier;
                            vehicleCost += baseVehicleCost;
                            policyBase += vehicleCost;
                            vehicleCostFinal.Add(vehicleCost);
                            vehicleId.Add(v.Id);
                        }

                        if (quote.ClaimInLastFive) { currentQuoteMultiplier *= 1.20m; }
                        if (lessThan3years) { currentQuoteMultiplier *= 1.15m; }
                        if (quote.ForceMultiDiscount) { currentQuoteMultiplier *= .95m; }

                        if (quote.MovingViolation) { currentQuoteMultiplier *= 1.23m; }
                        if (quote.PreviousCarrier == "Lizard Insurance") { currentQuoteMultiplier *= 1.05m; }
                        if (quote.PreviousCarrier == "Pervasive Insurance") { currentQuoteMultiplier *= .97m; }
                        policyBase *= currentQuoteMultiplier;
                        break;
                    }
                case "MA":
                    {
                        foreach (var d in drivers)
                        {

                            driverCost = 0;
                            driverBase += 200;

                            if (d.SafeDrivingSchool)
                            {
                                driverQuoteMultiplier *= .94m;
                            }
                            if (d.Dob > DateTime.Now.AddYears(-23)) { driverQuoteMultiplier *= 1.10m; }
                            if (d.LicenseDateStart > DateTime.Now.AddYears(-3)) { lessThan3years = true; }
                            driverBase *= driverQuoteMultiplier;
                            driverCost += driverBase;
                            policyBase += driverCost;
                            driverCostFinal.Add(driverCost);
                            driverId.Add(d.Id);
                        }
                        foreach (var v in vehicles)
                        {
                            baseVehicleCost = 0;
                            vehicleCost = 0;
                            baseVehicleCost += v.CurrentValue * .03m;
                            if (v.HasDaytimeRunningLights) { VehicleQuoteMultiplier *= .98m; }
                            if (v.HasAntilockBrakingSystem) { VehicleQuoteMultiplier *= .98m; }
                            if (v.AnnualMiles < 6000) { VehicleQuoteMultiplier *= .99m; }
                            if (v.PassiveRestraints) { VehicleQuoteMultiplier *= .97m; }
                            if (v.AntiTheft) { VehicleQuoteMultiplier *= .95m; }
                            if (v.DaysDrivenPerWeek > 4) { VehicleQuoteMultiplier *= 1.02m; }
                            if (v.MilesDrivenToWork <= 25) { VehicleQuoteMultiplier *= .99m; }
                            if (v.ReduceUse) { VehicleQuoteMultiplier *= .96m; }
                            if (v.GarageDifferent) { VehicleQuoteMultiplier *= 1.03m; }
                            baseVehicleCost *= VehicleQuoteMultiplier;
                            vehicleCost += baseVehicleCost;
                            policyBase += vehicleCost;
                            vehicleCostFinal.Add(vehicleCost);
                            vehicleId.Add(v.Id);
                        }

                        if (quote.ClaimInLastFive) { currentQuoteMultiplier *= 1.25m; }
                        if (lessThan3years) { currentQuoteMultiplier *= 1.20m; }
                        //if (quote.) { currentQuoteMultiplier *= .95m; }

                        if (quote.MovingViolation) { currentQuoteMultiplier *= 1.25m; }
                        if (quote.PreviousCarrier == "Lizard Insurance") { currentQuoteMultiplier *= 1.05m; }
                        if (quote.PreviousCarrier == "Pervasive Insurance") { currentQuoteMultiplier *= .97m; }
                        policyBase *= currentQuoteMultiplier;
                        break;
                    }
                case "NH":
                    {
                        foreach (var d in drivers)
                        {

                            driverCost = 0;
                            driverBase += 200;

                            if (d.SafeDrivingSchool)
                            {
                                driverQuoteMultiplier *= .95m;
                            }
                            if (d.Dob > DateTime.Now.AddYears(-23)) { driverQuoteMultiplier *= 1.10m; }
                            if (d.LicenseDateStart > DateTime.Now.AddYears(-3)) { lessThan3years = true; }
                            driverBase *= driverQuoteMultiplier;
                            driverCost += driverBase;
                            policyBase += driverCost;
                            driverCostFinal.Add(driverCost);
                            driverId.Add(d.Id);
                        }
                        foreach (var v in vehicles)
                        {
                            baseVehicleCost = 0;
                            vehicleCost = 0;
                            baseVehicleCost += v.CurrentValue * .03m;
                            if (v.HasDaytimeRunningLights) { VehicleQuoteMultiplier *= .99m; }
                            if (v.HasAntilockBrakingSystem) { VehicleQuoteMultiplier *= .98m; }
                            if (v.AnnualMiles < 6000) { VehicleQuoteMultiplier *= .99m; }
                            if (v.PassiveRestraints) { VehicleQuoteMultiplier *= .97m; }
                            if (v.AntiTheft) { VehicleQuoteMultiplier *= .97m; }
                            if (v.DaysDrivenPerWeek > 4) { VehicleQuoteMultiplier *= 1.02m; }
                            if (v.MilesDrivenToWork <= 25) { VehicleQuoteMultiplier *= .98m; }
                            if (v.ReduceUse) { VehicleQuoteMultiplier *= .94m; }
                            if (v.GarageDifferent) { VehicleQuoteMultiplier *= 1.03m; }
                            baseVehicleCost *= VehicleQuoteMultiplier;
                            vehicleCost += baseVehicleCost;
                            policyBase += vehicleCost;
                            vehicleCostFinal.Add(vehicleCost);
                            vehicleId.Add(v.Id);
                        }

                        if (quote.ClaimInLastFive) { currentQuoteMultiplier *= 1.20m; }
                        if (lessThan3years) { currentQuoteMultiplier *= 1.15m; }
                        if (quote.ForceMultiDiscount) { currentQuoteMultiplier *= .95m; }

                        if (quote.MovingViolation) { currentQuoteMultiplier *= 1.20m; }
                        if (quote.PreviousCarrier == "Lizard Insurance") { currentQuoteMultiplier *= 1.05m; }
                        if (quote.PreviousCarrier == "Pervasive Insurance") { currentQuoteMultiplier *= .97m; }
                        policyBase *= currentQuoteMultiplier;
                        break;
                    }
                case "CT":
                    {
                        foreach (var d in drivers)
                        {

                            driverCost = 0;
                            driverBase += 200;

                            if (d.SafeDrivingSchool)
                            {
                                driverQuoteMultiplier *= .95m;
                            }
                            if (d.Dob > DateTime.Now.AddYears(-23)) { driverQuoteMultiplier *= 1.10m; }
                            if (d.LicenseDateStart > DateTime.Now.AddYears(-3)) { lessThan3years = true; }
                            driverBase *= driverQuoteMultiplier;
                            driverCost += driverBase;
                            policyBase += driverCost;
                            driverCostFinal.Add(driverCost);
                            driverId.Add(d.Id);
                        }
                        foreach (var v in vehicles)
                        {
                            baseVehicleCost = 0;
                            vehicleCost = 0;
                            baseVehicleCost += v.CurrentValue * .03m;
                            if (v.HasDaytimeRunningLights) { VehicleQuoteMultiplier *= .99m; }
                            if (v.HasAntilockBrakingSystem) { VehicleQuoteMultiplier *= .97m; }
                            if (v.AnnualMiles < 6000) { VehicleQuoteMultiplier *= .99m; }
                            if (v.PassiveRestraints) { VehicleQuoteMultiplier *= .97m; }
                            if (v.AntiTheft) { VehicleQuoteMultiplier *= .97m; }
                            if (v.DaysDrivenPerWeek > 4) { VehicleQuoteMultiplier *= 1.02m; }
                            if (v.MilesDrivenToWork <= 25) { VehicleQuoteMultiplier *= .98m; }
                            if (v.ReduceUse) { VehicleQuoteMultiplier *= .94m; }
                            if (v.GarageDifferent) { VehicleQuoteMultiplier *= 1.03m; }
                            baseVehicleCost *= VehicleQuoteMultiplier;
                            vehicleCost += baseVehicleCost;
                            policyBase += vehicleCost;
                            vehicleCostFinal.Add(vehicleCost);
                            vehicleId.Add(v.Id);
                        }

                        if (quote.ClaimInLastFive) { currentQuoteMultiplier *= 1.20m; }
                        if (lessThan3years) { currentQuoteMultiplier *= 1.15m; }
                        if (quote.ForceMultiDiscount) { currentQuoteMultiplier *= .95m; }

                        if (quote.MovingViolation) { currentQuoteMultiplier *= 1.20m; }
                        if (quote.PreviousCarrier == "Lizard Insurance") { currentQuoteMultiplier *= 1.05m; }
                        if (quote.PreviousCarrier == "Pervasive Insurance") { currentQuoteMultiplier *= .97m; }
                        policyBase *= currentQuoteMultiplier;
                        break;
                    }
                case "PA":
                    {
                        foreach (var d in drivers)
                        {

                            driverCost = 0;
                            driverBase += 200;

                            if (d.SafeDrivingSchool)
                            {
                                driverQuoteMultiplier *= .95m;
                            }
                            if (d.Dob > DateTime.Now.AddYears(-23)) { driverQuoteMultiplier *= 1.10m; }
                            if (d.LicenseDateStart > DateTime.Now.AddYears(-3)) { lessThan3years = true; }
                            driverBase *= driverQuoteMultiplier;
                            driverCost += driverBase;
                            policyBase += driverCost;
                            driverCostFinal.Add(driverCost);
                            driverId.Add(d.Id);
                        }
                        foreach (var v in vehicles)
                        {
                            baseVehicleCost = 0;
                            vehicleCost = 0;
                            baseVehicleCost += v.CurrentValue * .03m;
                            if (v.HasDaytimeRunningLights) { VehicleQuoteMultiplier *= .99m; }
                            if (v.HasAntilockBrakingSystem) { VehicleQuoteMultiplier *= .98m; }
                            if (v.AnnualMiles < 6000) { VehicleQuoteMultiplier *= .99m; }
                            if (v.PassiveRestraints) { VehicleQuoteMultiplier *= .97m; }
                            if (v.AntiTheft) { VehicleQuoteMultiplier *= .97m; }
                            if (v.DaysDrivenPerWeek > 4) { VehicleQuoteMultiplier *= 1.02m; }
                            if (v.MilesDrivenToWork <= 25) { VehicleQuoteMultiplier *= .98m; }
                            if (v.ReduceUse) { VehicleQuoteMultiplier *= .94m; }
                            if (v.GarageDifferent) { VehicleQuoteMultiplier *= 1.03m; }
                            baseVehicleCost *= VehicleQuoteMultiplier;
                            vehicleCost += baseVehicleCost;
                            policyBase += vehicleCost;
                            vehicleCostFinal.Add(vehicleCost);
                            vehicleId.Add(v.Id);
                        }

                        if (quote.ClaimInLastFive) { currentQuoteMultiplier *= 1.20m; }
                        if (lessThan3years) { currentQuoteMultiplier *= 1.15m; }
                        if (quote.ForceMultiDiscount) { currentQuoteMultiplier *= .95m; }

                        if (quote.MovingViolation) { currentQuoteMultiplier *= 1.20m; }
                        if (quote.PreviousCarrier == "Lizard Insurance") { currentQuoteMultiplier *= 1.05m; }
                        if (quote.PreviousCarrier == "Pervasive Insurance") { currentQuoteMultiplier *= .97m; }
                        policyBase *= currentQuoteMultiplier;
                        break;
                    }
                case "NY":
                    {
                        foreach (var d in drivers)
                        {

                            driverCost = 0;
                            driverBase += 200;

                            if (d.SafeDrivingSchool)
                            {
                                driverQuoteMultiplier *= .94m;
                            }
                            if (d.Dob > DateTime.Now.AddYears(-23)) { driverQuoteMultiplier *= 1.10m; }
                            if (d.LicenseDateStart > DateTime.Now.AddYears(-3)) { lessThan3years = true; }
                            driverBase *= driverQuoteMultiplier;
                            driverCost += driverBase;
                            policyBase += driverCost;
                            driverCostFinal.Add(driverCost);
                            driverId.Add(d.Id);
                        }
                        foreach (var v in vehicles)
                        {
                            baseVehicleCost = 0;
                            vehicleCost = 0;
                            baseVehicleCost += v.CurrentValue * .03m;
                            if (v.HasDaytimeRunningLights) { VehicleQuoteMultiplier *= .99m; }
                            if (v.HasAntilockBrakingSystem) { VehicleQuoteMultiplier *= .97m; }
                            if (v.AnnualMiles < 6000) { VehicleQuoteMultiplier *= .99m; }
                            if (v.PassiveRestraints) { VehicleQuoteMultiplier *= .97m; }
                            if (v.AntiTheft) { VehicleQuoteMultiplier *= .94m; }
                            if (v.DaysDrivenPerWeek > 4) { VehicleQuoteMultiplier *= 1.02m; }
                            if (v.MilesDrivenToWork <= 25) { VehicleQuoteMultiplier *= .99m; }
                            if (v.ReduceUse) { VehicleQuoteMultiplier *= 1m; }
                            if (v.GarageDifferent) { VehicleQuoteMultiplier *= 1.03m; }
                            baseVehicleCost *= VehicleQuoteMultiplier;
                            vehicleCost += baseVehicleCost;
                            policyBase += vehicleCost;
                            vehicleCostFinal.Add(vehicleCost);
                            vehicleId.Add(v.Id);
                        }

                        if (quote.ClaimInLastFive) { currentQuoteMultiplier *= 1.30m; }
                        if (lessThan3years) { currentQuoteMultiplier *= 1.22m; }
                        if (quote.ForceMultiDiscount) { currentQuoteMultiplier *= 1m; }

                        if (quote.MovingViolation) { currentQuoteMultiplier *= 1.30m; }
                        if (quote.PreviousCarrier == "Lizard Insurance") { currentQuoteMultiplier *= 1.05m; }
                        if (quote.PreviousCarrier == "Pervasive Insurance") { currentQuoteMultiplier *= 1m; }
                        policyBase *= currentQuoteMultiplier;
                        break;
                    }
                case "SC":
                    {
                        foreach (var d in drivers)
                        {

                            driverCost = 0;
                            driverBase += 200;

                            if (d.SafeDrivingSchool)
                            {
                                driverQuoteMultiplier *= .93m;
                            }
                            if (d.Dob > DateTime.Now.AddYears(-23)) { driverQuoteMultiplier *= 1.10m; }
                            if (d.LicenseDateStart > DateTime.Now.AddYears(-3)) { lessThan3years = true; }
                            driverBase *= driverQuoteMultiplier;
                            driverCost += driverBase;
                            policyBase += driverCost;
                            driverCostFinal.Add(driverCost);
                            driverId.Add(d.Id);
                        }
                        foreach (var v in vehicles)
                        {
                            baseVehicleCost = 0;
                            vehicleCost = 0;
                            baseVehicleCost += v.CurrentValue * .03m;
                            if (v.HasDaytimeRunningLights) { VehicleQuoteMultiplier *= .98m; }
                            if (v.HasAntilockBrakingSystem) { VehicleQuoteMultiplier *= .98m; }
                            if (v.AnnualMiles < 6000) { VehicleQuoteMultiplier *= 1m; }
                            if (v.PassiveRestraints) { VehicleQuoteMultiplier *= .98m; }
                            if (v.AntiTheft) { VehicleQuoteMultiplier *= .97m; }
                            if (v.DaysDrivenPerWeek > 4) { VehicleQuoteMultiplier *= 1.02m; }
                            if (v.MilesDrivenToWork <= 25) { VehicleQuoteMultiplier *= .99m; }
                            if (v.ReduceUse) { VehicleQuoteMultiplier *= .96m; }
                            if (v.GarageDifferent) { VehicleQuoteMultiplier *= 1.03m; }
                            baseVehicleCost *= VehicleQuoteMultiplier;
                            vehicleCost += baseVehicleCost;
                            policyBase += vehicleCost;
                            vehicleCostFinal.Add(vehicleCost);
                            vehicleId.Add(v.Id);
                        }

                        if (quote.ClaimInLastFive) { currentQuoteMultiplier *= 1.22m; }
                        if (lessThan3years) { currentQuoteMultiplier *= 1.18m; }
                        if (quote.ForceMultiDiscount) { currentQuoteMultiplier *= 1m; }

                        if (quote.MovingViolation) { currentQuoteMultiplier *= 1.15m; }
                        if (quote.PreviousCarrier == "Lizard Insurance") { currentQuoteMultiplier *= 1m; }
                        if (quote.PreviousCarrier == "Pervasive Insurance") { currentQuoteMultiplier *= 1m; }
                        policyBase *= currentQuoteMultiplier;
                        break;
                    }
                case "WV":
                    {
                        foreach (var d in drivers)
                        {

                            driverCost = 0;
                            driverBase += 200;

                            if (d.SafeDrivingSchool)
                            {
                                driverQuoteMultiplier *= .95m;
                            }
                            if (d.Dob > DateTime.Now.AddYears(-23)) { driverQuoteMultiplier *= 1.10m; }
                            if (d.LicenseDateStart > DateTime.Now.AddYears(-3)) { lessThan3years = true; }
                            driverBase *= driverQuoteMultiplier;
                            driverCost += driverBase;
                            policyBase += driverCost;
                            driverCostFinal.Add(driverCost);
                            driverId.Add(d.Id);
                        }
                        foreach (var v in vehicles)
                        {
                            baseVehicleCost = 0;
                            vehicleCost = 0;
                            baseVehicleCost += v.CurrentValue * .03m;
                            if (v.HasDaytimeRunningLights) { VehicleQuoteMultiplier *= .99m; }
                            if (v.HasAntilockBrakingSystem) { VehicleQuoteMultiplier *= .98m; }
                            if (v.AnnualMiles < 6000) { VehicleQuoteMultiplier *= .99m; }
                            if (v.PassiveRestraints) { VehicleQuoteMultiplier *= .97m; }
                            if (v.AntiTheft) { VehicleQuoteMultiplier *= .97m; }
                            if (v.DaysDrivenPerWeek > 4) { VehicleQuoteMultiplier *= 1.02m; }
                            if (v.MilesDrivenToWork <= 25) { VehicleQuoteMultiplier *= .98m; }
                            if (v.ReduceUse) { VehicleQuoteMultiplier *= .94m; }
                            if (v.GarageDifferent) { VehicleQuoteMultiplier *= 1.03m; }
                            baseVehicleCost *= VehicleQuoteMultiplier;
                            vehicleCost += baseVehicleCost;
                            policyBase += vehicleCost;
                            vehicleCostFinal.Add(vehicleCost);
                            vehicleId.Add(v.Id);
                        }

                        if (quote.ClaimInLastFive) { currentQuoteMultiplier *= 1.18m; }
                        if (lessThan3years) { currentQuoteMultiplier *= 1.15m; }
                        if (quote.ForceMultiDiscount) { currentQuoteMultiplier *= 1m; }

                        if (quote.MovingViolation) { currentQuoteMultiplier *= 1.20m; }
                        if (quote.PreviousCarrier == "Lizard Insurance") { currentQuoteMultiplier *= 1.05m; }
                        if (quote.PreviousCarrier == "Pervasive Insurance") { currentQuoteMultiplier *= .97m; }
                        policyBase *= currentQuoteMultiplier;
                        break;
                    }
                case "VA":
                    {
                        foreach (var d in drivers)
                        {

                            driverCost = 0;
                            driverBase += 200;

                            if (d.SafeDrivingSchool)
                            {
                                driverQuoteMultiplier *= .95m;
                            }
                            if (d.Dob > DateTime.Now.AddYears(-23)) { driverQuoteMultiplier *= 1.10m; }
                            if (d.LicenseDateStart > DateTime.Now.AddYears(-3)) { lessThan3years = true; }
                            driverBase *= driverQuoteMultiplier;
                            driverCost += driverBase;
                            policyBase += driverCost;
                            driverCostFinal.Add(driverCost);
                            driverId.Add(d.Id);
                        }
                        foreach (var v in vehicles)
                        {
                            baseVehicleCost = 0;
                            vehicleCost = 0;
                            baseVehicleCost += v.CurrentValue * .03m;
                            if (v.HasDaytimeRunningLights) { VehicleQuoteMultiplier *= .99m; }
                            if (v.HasAntilockBrakingSystem) { VehicleQuoteMultiplier *= .98m; }
                            if (v.AnnualMiles < 6000) { VehicleQuoteMultiplier *= .99m; }
                            if (v.PassiveRestraints) { VehicleQuoteMultiplier *= .97m; }
                            if (v.AntiTheft) { VehicleQuoteMultiplier *= .97m; }
                            if (v.DaysDrivenPerWeek > 4) { VehicleQuoteMultiplier *= 1.02m; }
                            if (v.MilesDrivenToWork <= 25) { VehicleQuoteMultiplier *= .98m; }
                            if (v.ReduceUse) { VehicleQuoteMultiplier *= .94m; }
                            if (v.GarageDifferent) { VehicleQuoteMultiplier *= 1.03m; }
                            baseVehicleCost *= VehicleQuoteMultiplier;
                            vehicleCost += baseVehicleCost;
                            policyBase += vehicleCost;
                            vehicleCostFinal.Add(vehicleCost);
                            vehicleId.Add(v.Id);
                        }

                        if (quote.ClaimInLastFive) { currentQuoteMultiplier *= 1.20m; }
                        if (lessThan3years) { currentQuoteMultiplier *= 1.15m; }
                        if (quote.ForceMultiDiscount) { currentQuoteMultiplier *= 1m; }

                        if (quote.MovingViolation) { currentQuoteMultiplier *= 1.20m; }
                        if (quote.PreviousCarrier == "Lizard Insurance") { currentQuoteMultiplier *= 1.05m; }
                        if (quote.PreviousCarrier == "Pervasive Insurance") { currentQuoteMultiplier *= .97m; }
                        policyBase *= currentQuoteMultiplier;
                        break;
                    }
                default:
                    {
                        // policyBase = 0;
                        throw new Exception("Invalid Information");

                    }

            }

            return policyBase;
        }