public void Run(Quote quote) { var db = new QuotesDBEntities(); if (quote.HasMovingViolations) { var stateId = (int) db.Drivers.First().DLState; var discount = db.DiscountPerStates.Single(d => d.DiscountId == discountId && d.StateId == stateId); var appliedDiscountValue = new QuoteDiscount() { DiscountId = this.discountId, StateId = stateId, QuoteId = quote.ID, AppliedDiscountValue = discount.Amount }; db.AddToQuoteDiscounts(appliedDiscountValue); } db.SaveChanges(); }
public void Run(Quote quote) { var db = new QuotesDBEntities(); if (quote.HasMovingViolations) { var stateId = (int)db.Drivers.First().DLState; var discount = db.DiscountPerStates.Single(d => d.DiscountId == discountId && d.StateId == stateId); var appliedDiscountValue = new QuoteDiscount() { DiscountId = this.discountId, StateId = stateId, QuoteId = quote.ID, AppliedDiscountValue = discount.Amount }; db.AddToQuoteDiscounts(appliedDiscountValue); } db.SaveChanges(); }
public void Run(Quote quote) { var db = new QuotesDBEntities(); if (quote.ForceMultiCarDiscount) { var stateId = quote.StateId; var discount = db.DiscountPerStates.Single(d => d.DiscountId == discountId && d.StateId == stateId); var appliedDiscountValue = new QuoteDiscount() { DiscountId = this.discountId, StateId = stateId, QuoteId = quote.ID, AppliedDiscountValue = discount.Amount }; db.AddToQuoteDiscounts(appliedDiscountValue); } db.SaveChanges(); }
public void Run(Quote quote) { var db = new QuotesDBEntities(); if (quote.PreviousCarrier != null) if (quote.PreviousCarrier.ToLower().Contains("pervasive")) { var stateId = quote.StateId; var discount = db.DiscountPerStates.Single(d => d.DiscountId == discountId && d.StateId == stateId); var appliedDiscountValue = new QuoteDiscount() { DiscountId = this.discountId, StateId = stateId, QuoteId = quote.ID, AppliedDiscountValue = discount.Amount }; db.AddToQuoteDiscounts(appliedDiscountValue); } db.SaveChanges(); }
public void Run(Quote quote) { var db = new QuotesDBEntities(); if (quote.PreviousCarrier != null) { if (quote.PreviousCarrier.ToLower().Contains("pervasive")) { var stateId = quote.StateId; var discount = db.DiscountPerStates.Single(d => d.DiscountId == discountId && d.StateId == stateId); var appliedDiscountValue = new QuoteDiscount() { DiscountId = this.discountId, StateId = stateId, QuoteId = quote.ID, AppliedDiscountValue = discount.Amount }; db.AddToQuoteDiscounts(appliedDiscountValue); } } db.SaveChanges(); }