public ProposalDocumentGetRes GetProposalDocumentHeaderDetails([FromBody] QuoteAgentGetReq request) { var response = new ProposalDocumentGetRes(); try { if (!string.IsNullOrEmpty(request.QRFID) && request != null) { response = _proposalRepository.GetProposalDocumentHeaderDetails(request); response.ResponseStatus.Status = "Success"; response.ResponseStatus.ErrorMessage = response != null ? "" : "No Records Found."; } else { response.ResponseStatus.Status = "Failure"; response.ResponseStatus.ErrorMessage = "QRFId can not be Null/Zero."; } } catch (Exception ex) { response.ResponseStatus.Status = "Failure"; response.ResponseStatus.ErrorMessage = "An Error Occurs :- " + ex.Message; } return(response); }
public async Task <ProposalDocumentGetRes> GetProposalDocumentHeaderDetails(QuoteAgentGetReq proposalGetReq, string ticket) { ProposalDocumentGetRes proposalGetRes = new ProposalDocumentGetRes(); proposalGetRes = await serviceProxy.PostData(_configuration.GetValue <string>("ServiceProposal:GetProposalDocumentHeaderDetails"), proposalGetReq, typeof(ProposalDocumentGetRes), ticket); return(proposalGetRes); }
public async Task <GetQRFForCopyQuoteRes> GetQRFDataForCopyQuote(QuoteAgentGetReq request, string ticket) { GetQRFForCopyQuoteRes response = new GetQRFForCopyQuoteRes(); response = await serviceProxy.PostData(_configuration.GetValue <string>("ServiceQuote:GetQRFDataForCopyQuote"), request, typeof(GetQRFForCopyQuoteRes), ticket); return(response); }
public async Task <QuoteAgentGetRes> GetQRFAgentByQRFID(QuoteAgentGetReq objQuoteAgentGetReq, string ticket) { QuoteAgentGetRes objQuoteAgentGetRes = new QuoteAgentGetRes(); objQuoteAgentGetRes = await serviceProxy.PostData(_configuration.GetValue <string>("ServiceAgent:GetQRFAgentByQRFID"), objQuoteAgentGetReq, typeof(QuoteAgentGetRes), ticket); return(objQuoteAgentGetRes); }
public ProposalDocumentGetRes GetProposalDocumentDetailsByQRFID(QuoteAgentGetReq request) { ProposalDocumentGetRes proposalDoc = new ProposalDocumentGetRes { QRFQuote = _MongoContext.mQRFPrice.AsQueryable().Where(q => q.QRFID == request.QRFID).FirstOrDefault(), Proposal = _MongoContext.mProposal.AsQueryable().Where(q => q.QRFID == request.QRFID && q.IsDeleted == false).FirstOrDefault(), Itinerary = _MongoContext.mItinerary.AsQueryable().Where(a => a.QRFID == request.QRFID).FirstOrDefault(), GenericImages = _MongoContext.mGenericImages.AsQueryable().Where(a => a.ImageType == "GENERIC_PRODUCT").ToList(), }; proposalDoc.Itinerary.ItineraryDays.ForEach(a => a.ItineraryDescription = a.ItineraryDescription.Where(b => b.IsDeleted == false).ToList()); if (proposalDoc.QRFQuote.RoutingInfo != null && proposalDoc.QRFQuote.RoutingInfo.Count > 0 && !string.IsNullOrEmpty(proposalDoc.QRFQuote.RoutingInfo[0].FromCityName)) { var resort = _MongoContext.mResort.AsQueryable().Where(q => q.ResortType == "Country" && q.ResortName == proposalDoc.QRFQuote.RoutingInfo[0].FromCityName.Split(',', StringSplitOptions.None)[1].Trim()).ToList(); proposalDoc.ProductImages = resort.Select(a => new Images { ImageIdentifier = "country", ImageURL = a.ImageURL }).ToList(); } if (proposalDoc.Itinerary != null) { proposalDoc.Itinerary.ItineraryDays.ForEach(b => b.ItineraryDescription = b.ItineraryDescription.OrderBy(c => c.StartTime).ToList()); } #region Commented do not delete (may be used later) //List<ItineraryDescriptionInfo> list = new List<ItineraryDescriptionInfo>(); //foreach (var item in proposalDocument.Itinerary.ItineraryDays) //{ // list = new List<ItineraryDescriptionInfo>(); // list.AddRange(item.ItineraryDescription.Where(a => a.ProductType == "Domestic Flight").OrderBy(c => c.StartTime).ToList()); // list.AddRange(item.ItineraryDescription.Where(a => a.ProductType == "VISA").OrderBy(c => c.StartTime).ToList()); // list.AddRange(item.ItineraryDescription.Where(a => a.ProductType == "LDC").OrderBy(c => c.StartTime).ToList()); // list.AddRange(item.ItineraryDescription.Where(a => a.ProductType == "Coach").OrderBy(c => c.StartTime).ToList()); // list.AddRange(item.ItineraryDescription.Where(a => a.ProductType == "Private Transfer").OrderBy(c => c.StartTime).ToList()); // list.AddRange(item.ItineraryDescription.Where(a => a.ProductType == "Scheduled Transfer").OrderBy(c => c.StartTime).ToList()); // list.AddRange(item.ItineraryDescription.Where(a => a.ProductType == "Ferry Transfer").OrderBy(c => c.StartTime).ToList()); // list.AddRange(item.ItineraryDescription.Where(a => a.ProductType == "Ferry Passenger").OrderBy(c => c.StartTime).ToList()); // list.AddRange(item.ItineraryDescription.Where(a => a.ProductType == "Train").OrderBy(c => c.StartTime).ToList()); // list.AddRange(item.ItineraryDescription.Where(a => a.ProductType == "Hotel").OrderBy(c => c.StartTime).ToList()); // list.AddRange(item.ItineraryDescription.Where(a => a.ProductType == "Overnight Ferry").OrderBy(c => c.StartTime).ToList()); // list.AddRange(item.ItineraryDescription.Where(a => a.ProductType == "Attractions").OrderBy(c => c.StartTime).ToList()); // list.AddRange(item.ItineraryDescription.Where(a => a.ProductType == "Sightseeing - CityTour").OrderBy(c => c.StartTime).ToList()); // list.AddRange(item.ItineraryDescription.Where(a => a.ProductType == "Guide").OrderBy(c => c.StartTime).ToList()); // list.AddRange(item.ItineraryDescription.Where(a => a.ProductType == "Meal").OrderBy(c => c.StartTime).ToList()); // list.AddRange(item.ItineraryDescription.Where(a => !list.Select(b => b.ProductType).ToList().Contains(a.ProductType)).OrderBy(c => c.ProductType).ThenBy(c => c.StartTime).ToList()); // //proposalDocument.Itinerary.ItineraryDays.Find(a => a.ItineraryDescription == item.ItineraryDescription).ItineraryDescription = list; // item.ItineraryDescription = list; //} #endregion return(proposalDoc); }
public ProposalDocumentGetRes GetProposalDocumentHeaderDetails(QuoteAgentGetReq request) { var System = _MongoContext.mSystem.AsQueryable().FirstOrDefault(); var company = _MongoContext.mContacts.AsQueryable().Where(c => c.Company_Id == System.CoreCompany_Id && c.MAIL.ToLower() == "*****@*****.**") .Select(c => new CompanyDetailsRes { SystemEmail = c.MAIL, SystemPhone = c.TEL, SystemWebsite = c.WEB }).FirstOrDefault(); ProposalDocumentGetRes proposalDocument = new ProposalDocumentGetRes { SystemEmail = company.SystemEmail ?? "", SystemPhone = company.SystemPhone ?? "", SystemWebsite = company.SystemWebsite ?? "" }; return(proposalDocument); }
public COHeaderViewModel GetProposalDocumentHeaderDetails(string QRFID, HttpRequest request, HttpResponse response, string token) { COHeaderViewModel model = new COHeaderViewModel(); //if (string.IsNullOrEmpty(request.Cookies["TourName"])) //{ QuoteAgentGetReq objQRFAgentRequest = new QuoteAgentGetReq() { QRFID = QRFID }; COProviders objCOProvider = new COProviders(_configuration); ProposalDocumentGetRes objProposalRes = objCOProvider.GetProposalDocumentHeaderDetails(objQRFAgentRequest, token).Result; NewQuoteViewModel modelQuote = new NewQuoteViewModel { QRFID = QRFID }; model = GetCOTourInfoHeader(ref modelQuote, token); //model.SystemEmail = objProposalRes.SystemEmail; //model.SystemPhone = objProposalRes.SystemPhone; model.SystemEmail = model.SalesPerson ?? ""; model.SystemPhone = model.SalesPersonMobile ?? ""; model.SystemWebsite = objProposalRes.SystemWebsite ?? ""; //response.Cookies.Append("SystemEmail", objProposalRes.SystemEmail); //response.Cookies.Append("SystemPhone", objProposalRes.SystemPhone); //response.Cookies.Append("SystemWebsite", objProposalRes.SystemWebsite); //response.Cookies.Append("TravelDate", model.TravelDate.ToString()); //response.Cookies.Append("TourName", model.TourName); //response.Cookies.Append("ContactPerson", model.ContactPerson); //response.Cookies.Append("AgentName", model.AgentName); //response.Cookies.Append("PaxCount", model.Pax.ToString()); //} //else //{ // model.SystemEmail = request.Cookies["SystemEmail"]; // model.SystemPhone = request.Cookies["SystemPhone"]; // model.SystemWebsite = request.Cookies["SystemWebsite"]; // model.TravelDate = Convert.ToDateTime(request.Cookies["TravelDate"]); // model.TourName = request.Cookies["TourName"]; // model.ContactPerson = request.Cookies["ContactPerson"]; // model.AgentName = request.Cookies["AgentName"]; // model.Pax = Convert.ToInt32(request.Cookies["PaxCount"]); //} return(model); }
public IActionResult GetCopyQuoteData(string QRFID) { try { CopyQuoteViewModel model = new CopyQuoteViewModel(); GetQRFForCopyQuoteRes response = new GetQRFForCopyQuoteRes(); QuoteAgentGetReq request = new QuoteAgentGetReq(); request.QRFID = QRFID; response = salesProviders.GetQRFDataForCopyQuote(request, token).Result; if (response == null || response?.ResponseStatus?.Status == "Error") { return(PartialView("_CopyQuote", model)); } model.QRFID = QRFID; model.TourName = response.TourName; model.AgentId = response.AgentInfo?.AgentID; model.AgentName = response.AgentInfo?.AgentName; model.ExisitingDepatures = response.ExisitingDepatures; model.CopyQuoteDepartures.Add(new CopyQuoteDeparturesNew() { NewDepartureDate = DateTime.Now.ToString("dd/MM/yyyy") }); AgentContactReq objContactRequest = new AgentContactReq() { Company_Id = response.AgentInfo?.AgentID }; AgentContactRes objContactResponse = salesProviders.GetContactListForAgent(objContactRequest, token).Result; model.ContactPersonList = objContactResponse.ContactProperties; model.ContactPerson = response.AgentInfo?.ContactPersonID; model.MobileNo = response.AgentInfo?.MobileNo; model.Email = response.AgentInfo?.EmailAddress; return(PartialView("_CopyQuote", model)); } catch (Exception ex) { throw; } }
public IActionResult ProposalCoveringNote(string QRFID) { ProposalCoveringNoteViewModel model = new ProposalCoveringNoteViewModel(); #region Get Proposal Details by QRFId proposalGetReq = new ProposalGetReq(); proposalGetReq.QRFID = QRFID; proposalGetRes = coProviders.GetProposal(proposalGetReq, token).Result; //model.CoveringNote = proposalGetRes.Proposal.CoveringNote; model.ProposalIncludeRegions = proposalGetRes.Proposal.ProposalIncludeRegions; model.CoveringNote = model.CoveringNote != null?ReplaceCoveringNoteTableOfContents(proposalGetRes.Proposal.CoveringNote, proposalGetRes.Proposal.ProposalIncludeRegions) : null; #endregion #region Get Quote Info By QRFId SalesProviders objSalesProvider = new SalesProviders(_configuration); QuoteAgentGetReq objQRFAgentRequest = new QuoteAgentGetReq() { QRFID = QRFID }; QuoteAgentGetRes objQRFAgentResponse = objSalesProvider.GetQRFAgentByQRFID(objQRFAgentRequest, token).Result; QuoteAgentGetProperties objResult = objQRFAgentResponse.QuoteAgentGetProperties; model.QRFID = QRFID; model.CompanyName = !string.IsNullOrEmpty(objQRFAgentResponse.QuoteAgentGetProperties.SalesPersonCompany) ? objQRFAgentResponse.QuoteAgentGetProperties.SalesPersonCompany : ""; model.Destination = !string.IsNullOrEmpty(objResult.AgentProductInfo.Destination) && objResult.AgentProductInfo.Destination.Contains('|') ? objResult.AgentProductInfo.Destination.Split('|')[1] : ""; model.SalesPersonUserName = !string.IsNullOrEmpty(objQRFAgentResponse.QuoteAgentGetProperties.SalesPersonUserName) ? objQRFAgentResponse.QuoteAgentGetProperties.SalesPersonUserName : ""; #endregion #region Agent Person Binding var agentContactPersonId = objResult.AgentInfo.ContactPersonID; AgentContactDetailsReq req = new AgentContactDetailsReq() { VoyagerContact_Id = agentContactPersonId }; AgentContactDetailsRes res = objSalesProvider.GetContactDetailsByContactID(req, token).Result; model.AgentTitle = res.AgentContactDetailsProperties != null && !string.IsNullOrEmpty(res.AgentContactDetailsProperties.CommonTitle) ? res.AgentContactDetailsProperties.CommonTitle : ""; model.AgentFirstName = res.AgentContactDetailsProperties != null && !string.IsNullOrEmpty(res.AgentContactDetailsProperties.FirstName) ? res.AgentContactDetailsProperties.FirstName : ""; model.AgentLastName = res.AgentContactDetailsProperties != null && !string.IsNullOrEmpty(res.AgentContactDetailsProperties.LastName) ? res.AgentContactDetailsProperties.LastName : ""; #endregion #region Sales Person Details Binding var salesPersonContactEmail = objQRFAgentResponse.QuoteAgentGetProperties.SalesPerson; ContactDetailsRequest req1 = new ContactDetailsRequest() { Email = salesPersonContactEmail }; ContactDetailsResponse res1 = loginProviders.GetContactDetails(req1, token).Result; model.SalesPersonCommonTitle = res1.Contacts != null && !string.IsNullOrEmpty(res1.Contacts.CommonTitle) ? res1.Contacts.CommonTitle : ""; model.SalesPersonTitle = res1.Contacts != null && !string.IsNullOrEmpty(res1.Contacts.TITLE) ? res1.Contacts.TITLE : ""; model.SalesPersonFullName = res1.Contacts != null && !string.IsNullOrEmpty(res1.Contacts.FIRSTNAME) && !string.IsNullOrEmpty(res1.Contacts.LastNAME) ? res1.Contacts.FIRSTNAME + " " + res1.Contacts.LastNAME : objQRFAgentResponse.QuoteAgentGetProperties.SalesPersonUserName; model.SalesPersonEmail = res1.Contacts != null && !string.IsNullOrEmpty(res1.Contacts.MAIL) ? res1.Contacts.MAIL : salesPersonContactEmail; model.SalesPersonFax = res1.Contacts != null && !string.IsNullOrEmpty(res1.Contacts.FAX) ? res1.Contacts.FAX : ""; model.SalesPersonPhone = res1.Contacts != null && !string.IsNullOrEmpty(res1.Contacts.MOBILE) ? res1.Contacts.MOBILE : ""; #endregion return(PartialView("_ProposalCoveringNote", model)); }
public ProposalDocumentViewModel ProposalDocumentData() { string QRFID = Request.Query["QRFId"]; ProposalDocumentViewModel model = new ProposalDocumentViewModel(); if (!string.IsNullOrEmpty(QRFID)) { try { #region fetching all data from service COProviders objCOProvider = new COProviders(_configuration); QuoteAgentGetReq objQRFAgentRequest = new QuoteAgentGetReq() { QRFID = QRFID }; ProposalDocumentGetRes objProposalRes = objCOProvider.GetProposalDocumentDetailsByQRFID(objQRFAgentRequest, token).Result; model.COHeaderViewModel = COCommonLibrary.GetProposalDocumentHeaderDetails(QRFID, Request, Response, token); model.Itinerary = objProposalRes.Itinerary; model.Proposal = objProposalRes.Proposal; model.QRFQuote = objProposalRes.QRFQuote; model.ProductImages = objProposalRes.ProductImages; model.GenericImages = objProposalRes.GenericImages; model.CountryImageInitial = _configuration.GetValue <string>("SystemSettings:CountryImageInitial"); model.URLinitial = model.COHeaderViewModel.URLinitial = HttpContext.Request.Scheme + "://" + HttpContext.Request.Host.Value; model.RoutingCities.AddRange(objProposalRes.Itinerary.ItineraryDays.Select(a => a.City + "," + a.Country)); model.RoutingCities.AddRange(objProposalRes.Itinerary.ItineraryDays.Select(a => a.ToCityName + "," + a.ToCountryName)); model.RoutingCities = model.RoutingCities.Distinct().ToList(); model.RoutingCities.RemoveAll(a => string.IsNullOrEmpty(a) || a == ","); model.Itinerary.ItineraryDays.ForEach(a => a.Hotel = a.Hotel.Where(b => b.IsDeleted == false).ToList()); model.Itinerary.ItineraryDays.ForEach(a => a.Meal = a.Meal.Where(b => b.IsDeleted == false).ToList()); if (model.Proposal != null && model.Proposal.ProposalIncludeRegions == null) { model.Proposal.ProposalIncludeRegions = new ProposalIncludeRegions(); } #endregion #region creating dates list for date range DateTime date; string month; var list = new List <ProposalDepartDate>(); foreach (var item in model.QRFQuote.Departures.OrderBy(a => a.Date)) { date = Convert.ToDateTime(item.Date); month = date.ToString("MMMM"); list.Add(new ProposalDepartDate { Day = date.Day.ToString(), Month = month, Year = date.Year.ToString() }); } var list2 = new List <ProposalDepartDate>(); foreach (var item in list) { month = item.Month + " " + item.Year; if (list2.Where(a => a.Month == month).Count() > 0) { list2.Where(a => a.Month == month).FirstOrDefault().Day += (", " + item.Day); } else { list2.Add(new ProposalDepartDate { Month = month, Day = item.Day }); } } model.DatesList = list2; #endregion #region google maps section StaticMap._configuration = _configuration; //GeocoderLocation geocoder = StaticMap.Locate(model.QRFQuote.AgentProductInfo.Destination.Split('|')[1]); string mapURL = "https://maps.googleapis.com/maps/api/staticmap?center={0}&zoom=3&size=233x206&maptype=roadmap&key=GoogleAPIKey&markers=color:red|label:AA|{0}"; mapURL = string.Format(mapURL, model.QRFQuote.AgentProductInfo.Destination.Split('|')[1]); if (StaticMap.RenderImage(mapURL, QRFID + "_ProposalDocument_smallmap.png", out string output)) { model.SmallMapURL = output; } mapURL = "https://maps.googleapis.com/maps/api/staticmap?size=773x682&maptype=roadmap&key=GoogleAPIKey"; foreach (string city in model.RoutingCities) { //geocoder = StaticMap.Locate(city); mapURL += "&markers=color:red|label:AA|{0}"; mapURL = string.Format(mapURL, city); } if (StaticMap.RenderImage(mapURL, QRFID + "_ProposalDocument_bigmap.png", out output)) { model.BigMapURL = output; } string ProdId = ""; for (int i = 0; i < model.Itinerary.ItineraryDays.Count; i++) { for (int j = 0; j < model.Itinerary.ItineraryDays[i].Hotel.Count; j++) { if (!string.IsNullOrEmpty(model.Itinerary.ItineraryDays[i].Hotel[j].Lat) && !string.IsNullOrEmpty(model.Itinerary.ItineraryDays[i].Hotel[j].Long) && model.Itinerary.ItineraryDays[i].Hotel[j].IsDeleted == false) { ProdId = !string.IsNullOrEmpty(model.Itinerary.ItineraryDays[i].Hotel[j].HotelId) ? model.Itinerary.ItineraryDays[i].Hotel[j].HotelId : model.Itinerary.ItineraryDays[i].Hotel[j].PositionId; mapURL = "https://maps.googleapis.com/maps/api/staticmap?zoom=10&size=284x191&maptype=roadmap&key=GoogleAPIKey"; mapURL += "&markers=color:red|label:AA|{0},{1}"; mapURL = string.Format(mapURL, model.Itinerary.ItineraryDays[i].Hotel[j].Lat, model.Itinerary.ItineraryDays[i].Hotel[j].Long); if (StaticMap.RenderImage(mapURL, ProdId + "_ProposalDocument_hotelmap.png", out output)) { model.Itinerary.ItineraryDays[i].Hotel[j].HotelMapURL = output; } } } } #endregion #region Proposal Terms string templatePath = _configuration.GetValue <string>("Pages:ProposalTermsTemplate"); var pathToFile = Path.Combine(Directory.GetCurrentDirectory(), templatePath); var builder = new StringBuilder(); using (StreamReader SourceReader = System.IO.File.OpenText(pathToFile)) { builder.Append(SourceReader.ReadToEnd()); model.Proposal.Terms += Environment.NewLine + builder.ToString(); } #endregion #region fetching hotel images from expedia string HotelMapImage; List <ArrProductResources> HotelRes = new List <ArrProductResources>(); foreach (var days in model.Itinerary.ItineraryDays) { foreach (var hotel in days.Hotel) { if (hotel.ProdResources != null) { HotelRes = hotel.ProdResources.Where(a => a.ResourceType == "Image").OrderBy(a => a.OrderNr).ToList(); } if (hotel.ProdResources == null || HotelRes == null || HotelRes.Count < 1 || (HotelRes.Count > 0 && string.IsNullOrEmpty(HotelRes[0].ImageSRC))) { if (StaticMap.RenderExpediaImage(hotel.HotelCode, ProdId + "_ProposalDocument_hotelimage.png", out output)) { HotelMapImage = output; } } } } #endregion #region replacing image urls from resources to ImageResources foreach (var ItineraryDay in model.Itinerary.ItineraryDays) { if (ItineraryDay.Hotel != null) { foreach (var Hotel in ItineraryDay.Hotel) { if (Hotel.ProdResources != null) { foreach (var ProdResource in Hotel.ProdResources) { if (ProdResource.ImageSRC != null) { ProdResource.ImageSRC = ProdResource.ImageSRC.Replace("resources/", "ImageResources/"); } } } } } } #endregion #region Get Hotel Summary details from Itinerary ProposalGetReq req = new ProposalGetReq(); ProposalGetRes res = new ProposalGetRes(); req.QRFID = QRFID; res = objCOProvider.GetHotelSummaryByQrfId(req, token).Result; var hotellist = res.Hotels; model.HotelList = hotellist.Select(x => new Hotel { HotelName = x.HotelName, Location = string.IsNullOrWhiteSpace(x.Location) ? "" : x.Location.Split(',')[0], Stars = x.Stars, Duration = x.Duration }).ToList(); #endregion } catch (Exception ex) { throw; //Console.WriteLine(ex.Message); } } return(model); }