Пример #1
0
        public bool TourPackageEnquiry(ProductTourPackage prodTour, string travelerdata, string enquiryQuestion, string tripid)
        {
            CheckoutProduct checkout    = (CheckoutProduct)Core.GetSession(Enumeration.SessionName.CheckoutProduct, tripid);
            bool            successSend = false;

            try
            {
                if (checkout != null)
                {
                    checkout.TourPackage.ContactPerson = prodTour.ContactPerson;

                    var tourdtl       = checkout.TourPackage.TourPackageDetails;
                    var tourinfo      = checkout.TourPackage.TourPackagesInfo;
                    var hotelSelected = "";
                    if (tourinfo.RoomListSelected != null)
                    {
                        int star = UtilitiesService.GetTourRoomRating(tourinfo.RoomListSelected.FirstOrDefault().RoomTypeID);
                        hotelSelected = star + (star > 1 ? " stars" : " star") + "<br/>" + string.Join("<br/>", tourinfo.TourRoomPackages.Select(x => x.RoomTypeName + " x " + x.Qty));
                    }

                    decimal ttlprice    = checkout.CheckOutSummary.GrandTtlAmt_BeforeDiscount;
                    decimal deposit     = ttlprice;
                    decimal depositrate = tourdtl.DepositRate ?? 0;
                    if ((tourdtl.IsDepositOnly ?? false) && depositrate > 0)
                    {
                        deposit = tourdtl.DepositTypeCode == "FIX" ? depositrate * tourinfo.NoOfPax : ttlprice * depositrate / 100;
                    }

                    Hashtable ht = new Hashtable();
                    ht.Add("<#UserName>", prodTour.ContactPerson.GivenName + " " + prodTour.ContactPerson.Surname);
                    ht.Add("<#PackageName>", tourdtl.TourPackageName);
                    ht.Add("<#TravelDate>", tourinfo.TravelDateFrom.ToString("dd/MM/yyyy") + " - " + tourinfo.TravelDateTo.ToString("dd/MM/yyyy"));
                    ht.Add("<#HotelSelection>", hotelSelected);
                    ht.Add("<#TourCode>", tourdtl.TourPackageCode);
                    ht.Add("<#TtlPrice>", ttlprice.ToString("n2"));
                    ht.Add("<#Email>", checkout.TourPackage.ContactPerson.Email);
                    ht.Add("<#EnquiryQ>", enquiryQuestion);

                    var CSemail = Core.GetSettingValue("MayflowerCSEmail");
                    successSend = CommonServiceController.SendEmail(CSemail, "Ground Package Enquiry Email", Core.getMailTemplate("tourpackageenquiry", ht));
                    if (!successSend)
                    {
                        logger.Fatal("errmsg", "Tour Package send enquiry email error." + " - " + DateTime.Now.ToLoggerDateTime());
                    }
                }
            }
            catch (Exception ex)
            {
                logger.Fatal(ex, "Tour Package enquiry email error" + " - " + DateTime.Now.ToLoggerDateTime());
            }

            return(successSend);
        }