public List <ETicketViewModel> GetAllLccPNRSegment(long?MPNRId) { List <ETicketViewModel> model = new List <ETicketViewModel>(); var result = ent.TBO_PNRsegments.Where(pp => (pp.MPNRId == MPNRId)); foreach (var aa in result) { ETicketViewModel obj = new ETicketViewModel { PNRId = aa.PNRId, MasterPNRId = aa.MPNRId, SectorID = aa.SectorId, AirLineId = aa.AirlineId, AirLineName = aa.Airlines.AirlineName, FlightNumber = aa.FlightNumber, DepartureCity = aa.AirlineCities.CityName, ArrivalDate = aa.ArrivalDate, ArrivalTime = aa.ArrivalTime, ArrivalCity = aa.AirlineCities1.CityName, DepartureDate = aa.DepartDate, DepartureTime = aa.DepartTime, BIC = aa.BIC, StartTerminalNumber = aa.StartTerminal, EndTerminalNumber = aa.EndTerminal, AirLineReferenceNumber = aa.AirlineRefNumber, // FlightDuration = (int) Convert.ToInt64( aa.FlightDuration), FlightDuration = aa.FlightDuration,// (int) Convert.ToInt64( (( aa.FlightDuration)==""?"" : aa.FlightDuration)) , VendorRemark = aa.VndRemarks, SegmentID = aa.SegmentId, }; model.Add(obj); } return(model.ToList()); }
public ActionResult ETicket(string id) { try { long PNRid = Int64.Parse(id); int agentid = ticketprovider.GetAgentIdbyPNRId(PNRid); ETicketViewModel viewmodel = ticketprovider.GetAllInformationForeTicket(PNRid, agentid); viewmodel.PNRSectorList = ticketprovider.DeterminePNRSectorCount(PNRid); viewmodel.PassengerList = ticketprovider.GetPassengerListByPNRID(PNRid, agentid); viewmodel.PNRSegmentList = ticketprovider.GetPNRSegmentListByPNRSectorID(PNRid); viewmodel.ShowFareOnETicket = ticketprovider.ShowFareOnETicket(agentid); viewmodel.ShowAgentLogoOnETicket = ticketprovider.ShowAgentLogoOnETicket(agentid); viewmodel.AirlineVendorLocators = ticketprovider.GetAirlineVendorLocatorsById(PNRid); viewmodel.OperatingAirline = ticketprovider.GetAirlineCodeByMasterPnrId(PNRid); string htmlContent = RenderPartialViewToString(viewmodel); using (ImagePathFixer pathFixer = new ImagePathFixer()) { htmlContent = pathFixer.FixImagePath(htmlContent); using (TempHtmlFile file = new TempHtmlFile()) { file.Write(htmlContent); DownloadPdf(file); } } } catch (Exception ex) { } return(new EmptyResult()); }
public ActionResult ViewETicket(string id, ETicketViewModel model1) { long PNRid = Int64.Parse(id); var ts = (TravelSession)Session["TravelPortalSessionInfo"]; int agentid = ticketprovider.GetAgentIdbyPNRId(PNRid); ETicketViewModel viewmodel = ticketprovider.GetAllInformationForeTicket(PNRid, agentid); viewmodel.PNRSectorList = ticketprovider.DeterminePNRSectorCount(PNRid); viewmodel.PassengerList = ticketprovider.GetPassengerListByPNRID(PNRid, agentid); viewmodel.PNRSegmentList = ticketprovider.GetPNRSegmentListByPNRSectorID(PNRid); viewmodel.ShowFareOnETicket = ticketprovider.ShowFareOnETicket(agentid); viewmodel.ShowAgentLogoOnETicket = ticketprovider.ShowAgentLogoOnETicket(agentid); viewmodel.AirlineVendorLocators = ticketprovider.GetAirlineVendorLocatorsById(PNRid); viewmodel.OperatingAirline = ticketprovider.GetAirlineCodeByMasterPnrId(PNRid); string serverPath = Server.MapPath("~") + "Content\\AgentLogo"; string resolved = Path.Combine(serverPath, viewmodel.AgentLogo); if (!System.IO.File.Exists(resolved)) { string directoryName = Path.GetDirectoryName(resolved); resolved = Path.Combine(directoryName, "DefaultLogo.png"); viewmodel.AgentLogo = "DefaultLogo.png"; if (!System.IO.File.Exists(resolved)) { // Images.DefaultLogo.Save(resolved); } } if (!ModelState.IsValid) { return(View("eTicket", viewmodel)); } string body = RenderPartialViewToString("ETicket", viewmodel); try { GeneralProvider provider = new GeneralProvider(); TravelSession travelSession = (TravelSession)Session["TravelPortalSessionInfo"]; Agents agent = provider.GetAgentById(viewmodel.AgentId); EmailEngine.EmailSender.Send(body, agent.Email, model1.txtEmailTo); ViewData["isEmailSent"] = "Your email is right on the way, you'll get email in a minute."; } catch (Exception ex) { ATLTravelPortal.Utility.ErrorLogging.LogException(ex); ViewData["isEmailSent"] = "Unable to send email"; } return(View("eTicket", viewmodel)); }
public List <ETicketViewModel> GetTBOAirlineVendorLocatorsById(long PNRId) { List <ETicketViewModel> model = new List <ETicketViewModel>(); var result = ent.TBO_Air_AirlineVendorLocators.Where(pp => (pp.MPNRId == PNRId)); foreach (var aa in result) { ETicketViewModel obj = new ETicketViewModel { PNRId = aa.PNRId, AirLineName = aa.AirlineCode, AirLineReferenceNumber = aa.VendorLocatorNo }; model.Add(obj); } return(model.ToList()); }
public List <ETicketViewModel> GetTBOPNRSegmentListByPNRSectorID(long PNRId) { List <ETicketViewModel> model = new List <ETicketViewModel>(); var result = ent.TBO_PNRsegments.Where(pp => (pp.MPNRId == PNRId)); foreach (var aa in result) { DateTime?nva = null; DateTime?nvb = null; if (aa.NVA != null) { nva = DateTime.Parse(aa.NVA); } if (aa.NVB != null) { nvb = DateTime.Parse(aa.NVB); } ETicketViewModel obj = new ETicketViewModel { SegmentID = aa.SegmentId, AirLineId = aa.AirlineId, AirLineName = aa.Airlines.AirlineName, FlightNumber = aa.FlightNumber, DepartureCity = aa.AirlineCities.CityName, ArrivalDate = aa.ArrivalDate, ArrivalTime = aa.ArrivalTime, ArrivalCity = aa.AirlineCities1.CityName, DepartureDate = aa.DepartDate, DepartureTime = aa.DepartTime, FIC = aa.FareBasis, BIC = aa.BIC, StartTerminalNumber = aa.StartTerminal, EndTerminalNumber = aa.EndTerminal, AirLineReferenceNumber = aa.AirlineRefNumber, NVA = nva, NVB = nvb, FlightDuration = aa.FlightDuration.ToString(), }; model.Add(obj); } return(model.ToList()); }
public ActionResult ViewETicket(string id) { try { long PNRid = Int64.Parse(id); var ts = (TravelSession)Session["TravelPortalSessionInfo"]; int agentid = ticketprovider.GetAgentIdbyPNRId(PNRid); //check for authorization ETicketViewModel viewmodel = ticketprovider.GetAllInformationForeTicket(PNRid, agentid); viewmodel.PNRSectorList = ticketprovider.DeterminePNRSectorCount(PNRid); viewmodel.PassengerList = ticketprovider.GetPassengerListByPNRID(PNRid, agentid); viewmodel.PNRSegmentList = ticketprovider.GetPNRSegmentListByPNRSectorID(PNRid); viewmodel.AirlineVendorLocators = ticketprovider.GetAirlineVendorLocatorsById(PNRid); viewmodel.OperatingAirline = ticketprovider.GetAirlineCodeByMasterPnrId(PNRid); viewmodel.ShowFareOnETicket = ticketprovider.ShowFareOnETicket(agentid); viewmodel.ShowAgentLogoOnETicket = ticketprovider.ShowAgentLogoOnETicket(agentid); string serverPath = Server.MapPath("~") + "Content\\AgentLogo"; string resolved = Path.Combine(serverPath, viewmodel.AgentLogo); if (!System.IO.File.Exists(resolved)) { string directoryName = Path.GetDirectoryName(resolved); resolved = Path.Combine(directoryName, "DefaultLogo.png"); viewmodel.AgentLogo = "DefaultLogo.png"; if (!System.IO.File.Exists(resolved)) { Images.DefaultLogo.Save(resolved); } } return(View("eTicket", viewmodel)); } catch (Exception ex) { ViewData["ErrorInfoMsg"] = "Access Denied / You are Unauthorized Agent to view this eTicket"; return(View("eTicket")); } }
public static List <ETicketViewModel> GetPassengerAdditionalInfoOnETicket(long SegmentId) { EntityModel ent = new EntityModel(); List <ETicketViewModel> model = new List <ETicketViewModel>(); var result = ent.TBO_PNRsegmentAdditionalInfo.Where(aa => (aa.SegmentId == SegmentId)); foreach (var aa in result) { ETicketViewModel obj = new ETicketViewModel { LccNVA = aa.NVA, LccNVB = aa.NVB, FlightKey = aa.FlightKey, FIC = aa.FareBasis, Baggage = aa.Baggage, }; model.Add(obj); } return(model.ToList()); }
public List <ETicketViewModel> GetLccPNRInformationForeTicket(long?MasterPNRId) { List <ETicketViewModel> model = new List <ETicketViewModel>(); var result = ent.TBO_PNRs.Where(aa => aa.MPNRId == MasterPNRId); foreach (var aa in result) { ETicketViewModel obj = new ETicketViewModel { PNRId = aa.PNRId, BookingId = aa.BookingId, StatusId = aa.TicketStatus.ticketStatusName, GDSReferenceNumber = aa.RecLoc, // OperatingAirline = aa.Airlines != null ? aa.Airlines.AirlineCode : null OperatingAirline = GetAirlineCodeByMasterPnrId(MasterPNRId), }; model.Add(obj); } return(model.ToList()); }
public List <ETicketViewModel> GetAllLccPNRPassenger(long?PNRId) { List <ETicketViewModel> model = new List <ETicketViewModel>(); var result = ent.TBO_Passengers.Where(pp => (pp.MPNRId == PNRId)); foreach (var aa in result) { ETicketViewModel obj = new ETicketViewModel { PNRId = aa.PNRId, MasterPNRId = aa.MPNRId, PassengerId = aa.PassengerId, PNRName = aa.LastName + " " + aa.FirstName + " " + (aa.MiddleName ?? "") + " " + aa.Prefix, DateOfBirth = aa.DOB, PassportNumber = aa.PassportNumber, Email = aa.Email, MobileNumber = aa.Phone, FrequentFlyerNo = aa.FFNumber, FrequentFlyerAirlineId = aa.FFAirline ?? 0, }; model.Add(obj); } return(model.ToList()); }
public List <ETicketViewModel> GetPNRSegmentListByPNRSectorID(long PNRId) { List <ETicketViewModel> model = new List <ETicketViewModel>(); var result = ent.PNRSegments.Where(pp => (pp.PNRId == PNRId)); foreach (var aa in result) { ETicketViewModel obj = new ETicketViewModel { SegmentID = aa.SegmentId, AirLineId = aa.AirlineId, AirLineName = aa.Airlines.AirlineName, FlightNumber = aa.FlightNumber, DepartureCity = aa.AirlineCities2.CityName, ArrivalDate = aa.ArriveDate, ArrivalTime = aa.ArriveTime, ArrivalCity = aa.AirlineCities1.CityName, DepartureDate = aa.DepartDate, DepartureTime = aa.DepartTime, FIC = aa.FIC, BIC = aa.BIC, StartTerminalNumber = aa.StartTerminal, EndTerminalNumber = aa.EndTerminal, AirLineReferenceNumber = aa.AirlineRefrenceNumber, NVA = aa.NVA, NVB = aa.NVB, FlightDuration = aa.FlightDuration.ToString(), }; model.Add(obj); } if (result.ToList().Count == 0) { return(GetTBOPNRSegmentListByPNRSectorID(PNRId)); } return(model.ToList()); }
public ActionResult ViewETicket(long id, ETicketViewModel model1) { long PNRid = id; int agentid = ticketprovider.GetAgentIdbyPNRId(PNRid); var masterpnrsresult = ticketprovider.GetTicketStatusIdByMPNRId(id); ETicketViewModel viewmodel; if (masterpnrsresult.TicketStatusId == 29) { viewmodel = ticketprovider.GetB2CMasterInformationForeTicket(id, masterpnrsresult.CreatedBy); } else { viewmodel = ticketprovider.GetLccMasterInformationForeTicket(id, agentid); } viewmodel.PNRList = ticketprovider.GetLccPNRInformationForeTicket(viewmodel.MasterPNRId); viewmodel.PNRSectorList = ticketprovider.GetAllLccPNRSector(viewmodel.MasterPNRId); viewmodel.PNRSegmentList = ticketprovider.GetAllLccPNRSegment(viewmodel.MasterPNRId); viewmodel.PassengerList = ticketprovider.GetAllLccPNRPassenger(id); viewmodel.ShowFareOnETicket = ticketprovider.ShowFareOnETicket(agentid); viewmodel.ShowAgentLogoOnETicket = ticketprovider.ShowAgentLogoOnETicket(agentid); viewmodel.ShowServiceChargeOnETicket = ticketprovider.isLccServiceChargeIncludeInTax(agentid); string serverPath = Server.MapPath("~") + "Content\\AgentLogo"; string resolved = Path.Combine(serverPath, viewmodel.AgentLogo); if (!System.IO.File.Exists(resolved)) { string directoryName = Path.GetDirectoryName(resolved); resolved = Path.Combine(directoryName, "DefaultLogo.png"); viewmodel.AgentLogo = "DefaultLogo.png"; if (!System.IO.File.Exists(resolved)) { Images.DefaultLogo.Save(resolved); } } if (!ModelState.IsValid) { return(View("eTicket", viewmodel)); } string body = RenderPartialViewToString("ETicket", viewmodel); try { ATLTravelPortal.Areas.Airline.Repository.GeneralProvider provider = new ATLTravelPortal.Areas.Airline.Repository.GeneralProvider(); Agents agent = provider.GetAgentById(agentid); EmailEngine.EmailSender.Send(body, agent.Email, model1.txtEmailTo); ViewData["isEmailSent"] = "Your email is right on the way, you'll get email in a minute."; } catch (Exception ex) { // ATLTravelPortalAgent.Utility.ErrorLogging.LogException(ex); ViewData["isEmailSent"] = "Unable to send email"; //swallow everything } return(View("eTicket", viewmodel)); }