Esempio n. 1
0
        public string GetSubject()
        {
            //Get Subject from setting
            subject = SettingService.GetSettingValueByKey("BackEnd_RequestEmail_Subject");
            gp      = GuestPlannerService.GetGuestPlannerByID(requestID);
            Hotel hotelInfo = HotelService.GetHotelByCode(gp.Hotel_Code);

            if (string.IsNullOrWhiteSpace(subject))
            {
                //subject = "Requests - " + gp.ConfirmationNum + " - "
                //    + (gp.EventDate.HasValue ? gp.EventDate.Value.ToShortDateString() : string.Empty) + " - " + gp.Event;

                subject = "Requests - " + gp.ConfirmationNum + " - "
                          + (gp.EventDate.HasValue ? gp.EventDate.Value.ToString(hotelInfo.DateFormat.ToLower().Replace("m", "M")) : string.Empty) + " - " + gp.Event;
            }
            else
            {
                //[Property Name] - [Category] - [Date] - [Confirmation #]
                subject = subject.Replace(SettingPlaceHolder.RequestConfirmEmailHoder.PROPERTY_NAME.ToString(), hotelInfo.Hotel_Name);
                subject = subject.Replace(SettingPlaceHolder.RequestConfirmEmailHoder.CATEGORY.ToString(), gp.Event);
                subject = subject.Replace(SettingPlaceHolder.RequestConfirmEmailHoder.DATE.ToString(), gp.EventDate.HasValue ? gp.EventDate.Value.ToShortDateString() : string.Empty);
                subject = subject.Replace(SettingPlaceHolder.RequestConfirmEmailHoder.CONFIRMATION_POUND_SIGN.ToString(), gp.ConfirmationNum);
            }

            return(subject);
        }
Esempio n. 2
0
        public string GetEmailBody()
        {
            //Email Boday
            var emailBody   = "";
            var textContext = "";

            var emailBody_grant = "We are pleased to let you know that your requested upgrade has been granted for the defined additional rates: \n[Content]";
            var emailBody_deny  = "We regret to inform you that your requested upgrade has been denied for the defined additional rates: \n[Content]";

            //TODO: change this call to constructor
            gp = GuestPlannerService.GetGuestPlannerByID(requestID);

            if (gp.Status == "Confirmed")
            {
                var setting_grantEmailBody = hotelSettingService.GetHotelSettingValue(gp.Hotel_Code, "UpgradeGrantEmailBody");
                if (!string.IsNullOrWhiteSpace(setting_grantEmailBody))
                {
                    emailBody_grant = setting_grantEmailBody;
                }

                //Requests
                var requests_grant = GuestPlannerService.GetGrantedRequestForEmail(gp.LoginConfirmationNum);

                foreach (var item in requests_grant)
                {
                    string perNight = "";
                    if (!string.IsNullOrWhiteSpace(item.PerNightCharge) && item.PerNightCharge.Equals("Y"))
                    {
                        perNight = "per night";
                    }
                    //textContext += string.Format("{0}, for ${1} {2}\n", item.UpgradedRoomType, (item.UpgradeCost ?? 0).ToString("#,##0.00"), string.IsNullOrWhiteSpace(item.PerNightDesc) ? "" : "per night");
                    textContext += string.Format("{0}, for {1} {2}\n", item.UpgradedRoomType, item.CurrencySymbol + (item.UpgradeCost ?? 0).ToString("#,##0.00"), perNight);
                }
                emailBody = emailBody_grant.Replace("[Content]", textContext);
            }
            else if (gp.Status == "Denied")
            {
                var setting_denialEmailBody = hotelSettingService.GetHotelSettingValue(gp.Hotel_Code, "UpgradeDenialEmailBody");
                if (!string.IsNullOrWhiteSpace(setting_denialEmailBody))
                {
                    emailBody_deny = setting_denialEmailBody;
                }

                //Requests
                var requests_deny = GuestPlannerService.GetDeniedRequestForEmail(gp.LoginConfirmationNum);

                foreach (var item in requests_deny)
                {
                    string perNight = "";
                    if (!string.IsNullOrWhiteSpace(item.PerNightCharge) && item.PerNightCharge.Equals("Y"))
                    {
                        perNight = "per night";
                    }
                    //textContext += string.Format("{0}, for ${1} {2}\n", item.UpgradedRoomType, (item.UpgradeCost ?? 0).ToString("#,##0.00"), string.IsNullOrWhiteSpace(item.PerNightCharge) ? "" : "per night");
                    textContext += string.Format("{0}, for {1} {2}\n", item.UpgradedRoomType, item.CurrencySymbol + (item.UpgradeCost ?? 0).ToString("#,##0.00"), perNight);
                }
                emailBody = emailBody_deny.Replace("[Content]", textContext);
            }

            return(emailBody);
        }