Example #1
0
        public IActionResult ProposalTerms(string QRFID)
        {
            ProposalTermsViewModel model = new ProposalTermsViewModel();
            List <App.ViewModels.TermsAndConditions> lstTerms = new List <App.ViewModels.TermsAndConditions>();

            #region Get Proposal Terms by QRFId
            proposalGetReq               = new ProposalGetReq();
            proposalGetReq.QRFID         = QRFID;
            proposalGetReq.DocType       = "QUOTATION-NEW";
            proposalGetReq.Section       = "General";
            proposalGetRes               = coProviders.GetProposal(proposalGetReq, token).Result;
            model.Terms                  = proposalGetRes.Proposal.Terms;
            model.ProposalIncludeRegions = proposalGetRes.Proposal.ProposalIncludeRegions ?? new ProposalIncludeRegions();
            #endregion

            #region Inclusion/Exclusion binding
            foreach (var p in proposalGetRes.TermsAndConditions)
            {
                lstTerms.Add(new App.ViewModels.TermsAndConditions {
                    Section = p.Section, Tcs = p.Tcs, OrderNumber = p.OrderNr
                });
            }
            model.TermsList = lstTerms;
            #endregion

            return(PartialView("_ProposalTerms", model));
        }
Example #2
0
        public async Task <ProposalGetRes> GetProposal([FromBody] ProposalGetReq request)
        {
            var response = new ProposalGetRes();

            try
            {
                if (!string.IsNullOrEmpty(request.QRFID) && request != null)
                {
                    //response = await _itineraryRepository.GetItinerary(request);
                    //response.ResponseStatus.Status = "Success";

                    ProposalGetRes result = _proposalRepository.GetProposal(request);

                    response.ResponseStatus.Status       = "Success";
                    response.ResponseStatus.ErrorMessage = result != null ? "" : "No Records Found.";

                    response = result;
                }
                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);
        }
Example #3
0
        public async Task <ProposalGetRes> GetHotelSummaryByQrfId(ProposalGetReq proposalGetReq, string ticket)
        {
            ProposalGetRes proposalGetRes = new ProposalGetRes();

            proposalGetRes = await serviceProxy.PostData(_configuration.GetValue <string>("ServiceProposal:GetHotelSummaryByQrfId"), proposalGetReq, typeof(ProposalGetRes), ticket);

            return(proposalGetRes);
        }
Example #4
0
        public IActionResult Proposal()
        {
            string QRFID     = Request.Query["QRFId"];
            bool   GetStatus = false;

            ProposalViewModel model = new ProposalViewModel();

            model.MenuViewModel.QRFID    = QRFID;
            model.MenuViewModel.MenuName = "Proposal";
            model.CurrentDate            = DateTime.Now.ToString("dd MMM yyyy");
            string username = "";

            username       = HttpContext.Request.Cookies["UserName"] ?? ckUserName;
            model.UserName = username;

            #region Get Costing Officer Tour Info Header By QRFId
            NewQuoteViewModel modelQuote = new NewQuoteViewModel();
            modelQuote.QRFID                    = QRFID;
            model.COHeaderViewModel             = cOCommonLibrary.GetCOTourInfoHeader(ref modelQuote, token);
            model.MenuViewModel.EnquiryPipeline = modelQuote.mdlMenuViewModel.EnquiryPipeline;
            #endregion

            ProposalLibrary proposalLibrary = new ProposalLibrary(_configuration);

            CompanyOfficerGetRes officerGetRes = new CompanyOfficerGetRes();
            CompanyOfficerGetReq officerGetReq = new CompanyOfficerGetReq();
            officerGetReq.CompanyId = ckUserCompanyId;
            officerGetReq.UserRole  = "Product Accountant";
            officerGetRes           = agentProviders.GetCompanyOfficers(officerGetReq, token).Result;

            model.OfficerList = officerGetRes.ContactDetails;
            var salespipelineres = agentProviders.GetAutomatedSalesPipelineRoles(new SettingsAutomatedGetReq {
                CompanyId = ckUserCompanyId, QRFId = QRFID, UserRole = officerGetReq.UserRole
            }, token).Result;
            if (!string.IsNullOrEmpty(salespipelineres?.ResponseStatus?.Status))
            {
                model.Officer = salespipelineres.UserEmailId;
            }
            #region PriceBreakUp
            if (!string.IsNullOrEmpty(QRFID))
            {
                model.QRFID = QRFID;
                GetStatus   = proposalLibrary.GetProposalPriceBreakupByQRFId(_configuration, token, ref model, QRFID);
            }

            ProposalGetReq request  = new ProposalGetReq();
            ProposalGetRes response = new ProposalGetRes();
            request.QRFID = QRFID;
            response      = coProviders.GetProposal(request, token).Result;
            if (response != null)
            {
                model.ProposalId = response.Proposal.ProposalId;
                model.ProposalPriceBreakupViewModel.PriceBreakUp = response.Proposal.PriceBreakup;
            }

            #endregion
            return(View(model));
        }
Example #5
0
        public ProposalGetRes GetProposal(ProposalGetReq request)
        {
            try
            {
                if (!string.IsNullOrEmpty(request.QRFID))
                {
                    ProposalGetRes response = new ProposalGetRes();
                    response.Proposal = _MongoContext.mProposal.AsQueryable().Where(a => a.QRFID == request.QRFID).OrderByDescending(x => x.Version).FirstOrDefault();
                    if (!string.IsNullOrWhiteSpace(request.DocType) && request.DocType.ToUpper() == "QUOTATION-NEW")
                    {
                        response.TermsAndConditions = _MongoContext.mTermsAndConditions.AsQueryable().Where(a => a.DocumentType.ToLower() == request.DocType.ToLower() && (a.Section == "" || a.Section == null || a.Section.ToLower() == request.Section.ToLower())).OrderBy(x => x.OrderNr).ToList();
                    }
                    else
                    {
                        response.TermsAndConditions = _MongoContext.mTermsAndConditions.AsQueryable().Where(a => a.Section == request.Section).OrderBy(x => x.OrderNr).ToList();
                    }

                    if (request.Section == "Exclusions" && (response.Proposal == null || string.IsNullOrEmpty(response.Proposal.Exclusions)))
                    {
                        var res = _MongoContext.mQRFPosition.AsQueryable().Where(a => a.QRFID == request.QRFID && (a.ProductType.ToUpper() == "LDC" || a.ProductType.ToUpper() == "COACH")).ToList();
                        if (res != null && res.Count > 0)
                        {
                            List <string> lstExclusions = new List <string>();
                            foreach (var item in res)
                            {
                                if (item.IsCityPermit)
                                {
                                    lstExclusions.Add("City Permit (" + item.ProductType + " starting in " + item.ProductName + " on " + item.StartingFrom + ": " + item.FromPickUpLoc + ")");
                                }
                                if (item.IsParkingCharges)
                                {
                                    lstExclusions.Add("Parking Charges (" + item.ProductType + " starting in " + item.ProductName + " on " + item.StartingFrom + ": " + item.FromPickUpLoc + ")");
                                }
                                if (item.IsRoadTolls)
                                {
                                    lstExclusions.Add("Road Tolls (" + item.ProductType + " starting in " + item.ProductName + " on " + item.StartingFrom + ": " + item.FromPickUpLoc + ")");
                                }
                            }
                            response.TermsAndConditions.AddRange(lstExclusions.Select(a => new mTermsAndConditions {
                                OrderNr = response.TermsAndConditions.Count + 1, Section = "Exclusions", Tcs = a
                            }));
                        }
                    }

                    return(response);
                }
                else
                {
                    return(null);
                }
            }
            catch (Exception ex)
            {
                Console.WriteLine(ex.Message);
            }
            return(null);
        }
Example #6
0
        public IActionResult ProposalInclusionsExclusions(string QRFID)
        {
            ProposalInclusionsExclusionsViewModel    model         = new ProposalInclusionsExclusionsViewModel();
            List <App.ViewModels.TermsAndConditions> lstInclusions = new List <App.ViewModels.TermsAndConditions>();
            List <App.ViewModels.TermsAndConditions> lstExclusions = new List <App.ViewModels.TermsAndConditions>();

            #region Get Proposal Inclusions by QRFId
            proposalGetReq         = new ProposalGetReq();
            proposalGetReq.QRFID   = QRFID;
            proposalGetReq.Section = "Inclusions";
            proposalGetRes         = coProviders.GetProposal(proposalGetReq, token).Result;

            if (!string.IsNullOrEmpty(proposalGetRes.Proposal.Inclusions))
            {
                model.Inclusions = proposalGetRes.Proposal.Inclusions;
            }
            else
            {
                foreach (var p in proposalGetRes.TermsAndConditions)
                {
                    lstInclusions.Add(new App.ViewModels.TermsAndConditions {
                        Section = p.Section, Tcs = p.Tcs, OrderNumber = p.OrderNr
                    });
                }
            }
            #endregion

            #region Get Proposal Exclusions by QRFId
            proposalGetReq         = new ProposalGetReq();
            proposalGetReq.QRFID   = QRFID;
            proposalGetReq.Section = "Exclusions";
            proposalGetRes         = coProviders.GetProposal(proposalGetReq, token).Result;

            if (!string.IsNullOrEmpty(proposalGetRes.Proposal.Inclusions))
            {
                model.Exclusions = proposalGetRes.Proposal.Exclusions;
            }
            else
            {
                foreach (var p in proposalGetRes.TermsAndConditions)
                {
                    lstExclusions.Add(new App.ViewModels.TermsAndConditions {
                        Section = p.Section, Tcs = p.Tcs, OrderNumber = p.OrderNr
                    });
                }
            }
            #endregion

            #region Inclusion/Exclusion binding
            model.InclusionList = lstInclusions;
            model.ExclusionList = lstExclusions;
            #endregion

            return(PartialView("_ProposalInclusionsExclusions", model));
        }
Example #7
0
        public ProposalGetRes GetHotelSummaryByQrfId(ProposalGetReq request)
        {
            ProposalGetRes response = new ProposalGetRes();

            try
            {
                var itineraryId = _MongoContext.mProposal.AsQueryable().Where(x => x.QRFID == request.QRFID).Select(x => x.ItineraryId).FirstOrDefault();
                if (!string.IsNullOrEmpty(itineraryId))
                {
                    var itinerary = _MongoContext.mItinerary.AsQueryable().Where(x => x.ItineraryID == itineraryId).FirstOrDefault();
                    response.Hotels = itinerary.ItineraryDays.OrderBy(x => x.Date).SelectMany(x => x.Hotel).Where(x => x.IsDeleted == false).ToList();
                }
                return(response);
            }
            catch (Exception ex)
            {
                throw;
            }
        }
Example #8
0
        public IActionResult Proposal(string QRFID)
        {
            ProposalViewModel model = new ProposalViewModel();

            model.MenuViewModel.QRFID    = QRFID;
            model.MenuViewModel.MenuName = "Proposal";

            bool GetStatus = false;

            #region Get Costing Officer Tour Info Header By QRFId
            NewQuoteViewModel modelQuote = new NewQuoteViewModel();
            modelQuote.QRFID                            = QRFID;
            model.COHeaderViewModel                     = cOCommonLibrary.GetCOTourInfoHeader(ref modelQuote, token);
            model.MenuViewModel.EnquiryPipeline         = modelQuote.mdlMenuViewModel.EnquiryPipeline;
            model.AgentApprovalHeaderButtons            = new AgentApprovalHeaderButtons();
            model.AgentApprovalHeaderButtons.QRFID      = QRFID;
            model.AgentApprovalHeaderButtons.QRFPriceID = model.COHeaderViewModel.QRFPriceID;
            #endregion

            ProposalLibrary proposalLibrary = new ProposalLibrary(_configuration);

            #region PriceBreakUp
            if (!string.IsNullOrEmpty(QRFID))
            {
                model.QRFID = QRFID;
                GetStatus   = proposalLibrary.GetProposalPriceBreakupByQRFId(_configuration, token, ref model, QRFID);
            }

            ProposalGetReq request  = new ProposalGetReq();
            ProposalGetRes response = new ProposalGetRes();
            request.QRFID = QRFID;
            response      = coProviders.GetProposal(request, token).Result;
            if (response != null)
            {
                model.ProposalId = response.Proposal.ProposalId;
                model.ProposalPriceBreakupViewModel.PriceBreakUp = response.Proposal.PriceBreakup;
            }
            #endregion

            return(View("Proposal/Proposal", model));
        }
Example #9
0
        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));
        }
Example #10
0
        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);
        }
Example #11
0
        public bool GetProposalPriceBreakupByQRFId(IConfiguration _configuration, string token, ref ProposalViewModel model, string QRFID)
        {
            #region Get Costsheet by QRFId
            CostsheetGetReq request  = new CostsheetGetReq();
            CostsheetGetRes response = new CostsheetGetRes();
            request.QRFID = QRFID;
            //request.DepartureId = filterByDeparture == 0 ? objDepartureDatesRes.DepartureDates[0].Departure_Id : filterByDeparture;
            response = coProviders.GetCostsheet(request, token).Result;
            #endregion

            #region Price breakup data binding
            List <QRFPkgAndNonPkgPrice> lstDepartureDates         = new List <QRFPkgAndNonPkgPrice>();
            List <QRFPkgAndNonPkgPrice> lstTwinPkg                = new List <QRFPkgAndNonPkgPrice>();
            List <QRFPkgAndNonPkgPrice> lstDoublePkg              = new List <QRFPkgAndNonPkgPrice>();
            List <QRFPkgAndNonPkgPrice> lstSinglePkg              = new List <QRFPkgAndNonPkgPrice>();
            List <QRFPkgAndNonPkgPrice> lstPositionTypeSupplement = new List <QRFPkgAndNonPkgPrice>();
            List <QRFPkgAndNonPkgPrice> lstPositionTypeOptional   = new List <QRFPkgAndNonPkgPrice>();
            List <QRFPkgAndNonPkgPrice> lstNonPkgSupplement       = new List <QRFPkgAndNonPkgPrice>();
            List <QRFPkgAndNonPkgPrice> lstNonPkgOptional         = new List <QRFPkgAndNonPkgPrice>();

            foreach (var date in response.QrfPackagePrice)
            {
                if (lstDepartureDates.Where(x => x.DepartureId == date.Departure_Id).Count() <= 0)
                {
                    lstDepartureDates.Add(new QRFPkgAndNonPkgPrice {
                        DepartureDate = date.DepartureDate, DepartureId = date.Departure_Id, PaxSlabId = date.PaxSlab_Id, PaxSlab = date.PaxSlab
                    });
                }
            }

            var twinrooms   = new List <mQRFPackagePrice>();
            var doublerooms = new List <mQRFPackagePrice>();
            var singlerooms = new List <mQRFPackagePrice>();

            twinrooms = response.QrfPackagePrice.Where(x => x.RoomName.ToUpper() == "TWIN").ToList();
            if (twinrooms.Count() <= 0)
            {
                doublerooms = response.QrfPackagePrice.Where(x => x.RoomName.ToUpper() == "DOUBLE").ToList();
                if (doublerooms.Count() <= 0)
                {
                    singlerooms = response.QrfPackagePrice.Where(x => x.RoomName.ToUpper() == "SINGLE").ToList();
                }
            }

            if (twinrooms.Count() > 0)
            {
                foreach (var pkg in twinrooms)
                {
                    lstTwinPkg.Add(new QRFPkgAndNonPkgPrice {
                        SellPrice = pkg.SellPrice, QRFCurrency = pkg.QRFCurrency.Substring(0, 3).ToUpper(), PaxSlabId = pkg.PaxSlab_Id, PaxSlab = pkg.PaxSlab, RoomName = pkg.RoomName, DepartureDate = pkg.DepartureDate, DepartureId = pkg.Departure_Id
                    });
                }
            }

            if (doublerooms.Count() > 0)
            {
                foreach (var pkg in doublerooms)
                {
                    lstDoublePkg.Add(new QRFPkgAndNonPkgPrice {
                        SellPrice = pkg.SellPrice, QRFCurrency = pkg.QRFCurrency.Substring(0, 3).ToUpper(), PaxSlabId = pkg.PaxSlab_Id, PaxSlab = pkg.PaxSlab, RoomName = pkg.RoomName, DepartureDate = pkg.DepartureDate, DepartureId = pkg.Departure_Id
                    });
                }
            }

            if (singlerooms.Count() > 0)
            {
                foreach (var pkg in singlerooms)
                {
                    lstSinglePkg.Add(new QRFPkgAndNonPkgPrice {
                        SellPrice = pkg.SellPrice, QRFCurrency = pkg.QRFCurrency.Substring(0, 3).ToUpper(), PaxSlabId = pkg.PaxSlab_Id, PaxSlab = pkg.PaxSlab, RoomName = pkg.RoomName, DepartureDate = pkg.DepartureDate, DepartureId = pkg.Departure_Id
                    });
                }
            }

            //#region QRFNonPkgPrice Position Bindings
            //foreach (var a in response.QrfNonPackagePrice.Where(x => x.PositionKeepAs.ToUpper() == "SUPPLEMENT"))
            //{
            //    if (lstPositionTypeSupplement.Where(x => x.PositionId == a.PositionId).Count() <= 0)
            //    {
            //        lstPositionTypeSupplement.Add(new QRFPkgAndNonPkgPrice { PaxSlabId = a.PaxSlab_Id, PaxSlab = a.PaxSlab, SellPrice = a.SellPrice, RoomName = a.RoomName, PositionKeepAs = a.PositionKeepAs, PositionType = a.PositionType, PositionId = a.PositionId, ProductName = a.ProductName, DepartureDate = a.DepartureDate, DepartureId = a.Departure_Id });
            //    }
            //}

            //foreach (var a in response.QrfNonPackagePrice.Where(x => x.PositionKeepAs.ToUpper() == "OPTIONAL"))
            //{
            //    if (lstPositionTypeOptional.Where(x => x.PositionId == a.PositionId).Count() <= 0)
            //    {
            //        lstPositionTypeOptional.Add(new QRFPkgAndNonPkgPrice { PaxSlabId = a.PaxSlab_Id, PaxSlab = a.PaxSlab, SellPrice = a.SellPrice, RoomName = a.RoomName, PositionKeepAs = a.PositionKeepAs, PositionType = a.PositionType, PositionId = a.PositionId, ProductName = a.ProductName, DepartureDate = a.DepartureDate, DepartureId = a.Departure_Id });
            //    }
            //}
            //#endregion

            foreach (var nonpkg in response.QrfNonPackagePrice)
            {
                if (nonpkg.RoomName.ToUpper() == "ADULT" && nonpkg.PositionKeepAs.ToUpper() == "SUPPLEMENT")
                {
                    lstNonPkgSupplement.Add(new QRFPkgAndNonPkgPrice {
                        SellPrice = nonpkg.SellPrice, QRFCurrency = nonpkg.QRFCurrency.Substring(0, 3).ToUpper(), PaxSlabId = nonpkg.PaxSlab_Id, PaxSlab = nonpkg.PaxSlab, RoomName = nonpkg.RoomName, DepartureDate = nonpkg.DepartureDate, DepartureId = nonpkg.Departure_Id, PositionId = nonpkg.PositionId, PositionType = nonpkg.PositionType, ProductName = nonpkg.ProductName
                    });
                }
            }

            foreach (var nonpkg in response.QrfNonPackagePrice)
            {
                if (nonpkg.RoomName.ToUpper() == "ADULT" && nonpkg.PositionKeepAs.ToUpper() == "OPTIONAL")
                {
                    lstNonPkgOptional.Add(new QRFPkgAndNonPkgPrice {
                        SellPrice = nonpkg.SellPrice, QRFCurrency = nonpkg.QRFCurrency.Substring(0, 3).ToUpper(), PaxSlabId = nonpkg.PaxSlab_Id, PaxSlab = nonpkg.PaxSlab, RoomName = nonpkg.RoomName, DepartureDate = nonpkg.DepartureDate, DepartureId = nonpkg.Departure_Id, PositionId = nonpkg.PositionId, PositionType = nonpkg.PositionType, ProductName = nonpkg.ProductName
                    });
                }
            }

            model.ProposalPriceBreakupViewModel.DepartureDatesList    = lstDepartureDates.OrderBy(x => x.DepartureDate).ToList();
            model.ProposalPriceBreakupViewModel.QrfTwinPkgPriceList   = lstTwinPkg;
            model.ProposalPriceBreakupViewModel.QrfDoublePkgPriceList = lstDoublePkg;
            model.ProposalPriceBreakupViewModel.QrfSinglePkgPriceList = lstSinglePkg;
            //model.ProposalPriceBreakupViewModel.QRFNonPkgSupplementPositions = lstPositionTypeSupplement;
            //model.ProposalPriceBreakupViewModel.QRFNonPkgOptionalPositions = lstPositionTypeOptional;
            model.ProposalPriceBreakupViewModel.QrfNonPkgPriceSupplementList = lstNonPkgSupplement;
            model.ProposalPriceBreakupViewModel.QrfNonPkgPriceOptionalList   = lstNonPkgOptional;

            #region Get Costing Officer Tour Info Header By QRFId
            NewQuoteViewModel modelQuote = new NewQuoteViewModel();
            modelQuote.QRFID = QRFID;
            model.ProposalPriceBreakupViewModel.COHeaderViewModel = cOCommonLibrary.GetCOTourInfoHeader(ref modelQuote, token);
            #endregion

            #region Get Hotel Summary details from Itinerary

            ProposalGetReq req = new ProposalGetReq();
            ProposalGetRes res = new ProposalGetRes();

            req.QRFID = model.QRFID;
            res       = coProviders.GetHotelSummaryByQrfId(req, token).Result;
            var hotellist = res.Hotels;
            model.ProposalPriceBreakupViewModel.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

            #endregion

            return(true);
        }