public decimal EstimateFare(GeoCoordinate start, GeoCoordinate end) { FareModel model = fareRepository.GetFareModel(start); decimal estimate = ApplyBaseFare(model); estimate = ApplyTariff(estimate, model.Tariff, start, end); estimate = ApplyAirportLevy(estimate, model.AirportLevy, start, end); return(estimate); }
public FareModel GetFareModel(GeoCoordinate coordinate) { /* Details of retrieving the Model is obscurred for the sake of brevity. * We would have used the coordinate parameter to figure out appropriate fare models to use, * typically retrieved from a database or similar. */ var fareModel = new FareModel() { Description = "Standard pricing", BookingFee = 1, Flagfall = 3, Tariff = 2, }; return(fareModel); }
public void Init() { fareRepoMock = new Mock <IFareRepository>(); routeServiceMock = new Mock <IRouteService>(); fareModel = new FareModel() { Description = "Standard pricing", BookingFee = 1, Flagfall = 3, Tariff = 2, AirportLevy = 5 }; fareRepoMock.Setup(repo => repo.GetFareModel(It.IsAny <GeoCoordinate>())).Returns(fareModel); }
public FareModel GetIndianLccFare(int PNRId) { FareModel model = new FareModel(); int TicketStatusId = _ent.TBO_MasterPNRs.Where(x => x.MPNRId == PNRId).FirstOrDefault().TicketStatusId; if (TicketStatusId == 12) { Int64 VoucherNo = _ent.GL_VoucherNumber.Where(x => x.TranId == PNRId).OrderByDescending(x => x.VoucherNumber).FirstOrDefault().VoucherNumber; int Agentid = _ent.TBO_MasterPNRs.Where(x => x.MPNRId == PNRId).FirstOrDefault().AgentId; Int64 AgentLedgerId = _ent.GL_Ledgers.Where(x => x.AccTypeId == 2 && x.Id == Agentid).FirstOrDefault().LedgerId; if (_ent.GL_Transactions.Where(x => x.VoucherNo == VoucherNo && x.LedgerId == AgentLedgerId && x.Dr_Cr == "D").FirstOrDefault() != null) { model.Fare = _ent.GL_Transactions.Where(x => x.VoucherNo == VoucherNo && x.LedgerId == AgentLedgerId && x.Dr_Cr == "D").FirstOrDefault().Amount; } if (_ent.GL_Transactions.Where(x => x.VoucherNo == VoucherNo && x.LedgerId == AgentLedgerId && x.Dr_Cr == "C").FirstOrDefault() != null) { model.Discount = _ent.GL_Transactions.Where(x => x.VoucherNo == VoucherNo && x.LedgerId == AgentLedgerId && x.Dr_Cr == "C").FirstOrDefault().Amount; } } return(model); }
public FareModel GetFare(int PNRId) { FareModel model = new FareModel(); TBO_MasterPNRs newResult = null; var result = _ent.PNRs.Where(x => x.PNRId == PNRId).FirstOrDefault(); if (result != null) { int TicketStatusId = result.TicketStatusId; var collection = _ent.Passengers.Where(x => x.PNRId == PNRId).ToList(); double Fare = 0; double discount = 0; double Tax = 0; double ServiceCharge = 0; foreach (var item in collection) { Fare += item.Fare + item.MarkupAmount + item.FSC; discount += item.DiscountAmount; Tax += item.TaxAmount; ServiceCharge += item.ServiceCharge; } model.Fare = Fare; model.Discount = discount; model.Tax = Tax; model.ServiceCharge = ServiceCharge; } else if ((newResult = _ent.TBO_MasterPNRs.Where(x => x.MPNRId == PNRId).FirstOrDefault()) != null) { int TicketStatusId = newResult.TicketStatusId; var collection = _ent.TBO_PNRTickets.Where(x => x.MPNRId == PNRId).ToList(); double Fare = 0; double discount = 0; double Tax = 0; double ServiceCharge = 0; foreach (var item in collection) { Fare += item.BaseFare + item.MarkupAmount + item.FSC; discount += item.DiscountAmount; Tax += item.SellingTax; ServiceCharge += item.ServiceCharge; } model.Fare = Fare; model.Discount = discount; model.Tax = Tax; model.ServiceCharge = ServiceCharge; } //if (TicketStatusId == 12) // { // Int64 VoucherNo = _ent.GL_VoucherNumber.Where(x => x.TranId == PNRId).OrderByDescending(x=>x.VoucherNumber).FirstOrDefault().VoucherNumber; // int Agentid = _ent.PNRs.Where(x => x.PNRId == PNRId).FirstOrDefault().AgentId; // Int64 AgentLedgerId = _ent.GL_Ledgers.Where(x => x.AccTypeId == 2 && x.Id == Agentid).FirstOrDefault().LedgerId; // if(_ent.GL_Transactions.Where(x => x.VoucherNo == VoucherNo && x.LedgerId == AgentLedgerId && x.Dr_Cr == "D")!=null) // model.Fare = _ent.GL_Transactions.Where(x => x.VoucherNo == VoucherNo && x.LedgerId == AgentLedgerId && x.Dr_Cr == "D").FirstOrDefault().Amount; // if(_ent.GL_Transactions.Where(x => x.VoucherNo == VoucherNo && x.LedgerId == AgentLedgerId && x.Dr_Cr == "C").FirstOrDefault()!=null) // model.Discount = _ent.GL_Transactions.Where(x => x.VoucherNo == VoucherNo && x.LedgerId == AgentLedgerId && x.Dr_Cr == "C").FirstOrDefault().Amount; // } return(model); }
private decimal ApplyBaseFare(FareModel model) { return(model.BookingFee + model.Flagfall); }
public ActionResult Fare(int id) { _modFare = _PNRDetailprovider.GetFare(id); return(PartialView("VUC_Fare", _modFare)); }
public ActionResult DomesticFare(int id) { _modFare = _provider.GetIndianLccFare(id); return(PartialView("VUC_Fare", _modFare)); }