コード例 #1
0
        public string GetGlobalEmailBody(string hotelCode, string loginConfirmationNum, string confirmationNum)
        {
            var textContext = "";

            var emailBody = "Please see below for the status of your upgrade request(s): \r\n\r\n[Content]";

            var setting_globalEmailBody = hotelSettingService.GetHotelSettingValue(hotelCode, "UpgradeGlobalEmailBody");

            if (!string.IsNullOrWhiteSpace(setting_globalEmailBody))
            {
                setting_globalEmailBody = setting_globalEmailBody.Replace("[Content]", "\r\n\r\n[Content]");
                emailBody = setting_globalEmailBody;
            }

            //Requests are confirmaed
            var requests_grant = GuestPlannerService.GetGrantedRequestForEmail(loginConfirmationNum);

            if (null != requests_grant && requests_grant.Count > 0)
            {
                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} (Confirmed)\n", item.UpgradedRoomType, item.CurrencySymbol + (item.UpgradeCost ?? 0).ToString("#,##0.00"), perNight);
                }
            }

            //Requests are confirmaed
            var requests_deny = GuestPlannerService.GetDeniedRequestForEmail(loginConfirmationNum);

            if (null != requests_deny && requests_deny.Count > 0)
            {
                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} (Denied)\n", item.UpgradedRoomType, item.CurrencySymbol + (item.UpgradeCost ?? 0).ToString("#,##0.00"), perNight);
                }
            }

            textContext += "\r\nReservation Number: " + confirmationNum;

            emailBody = emailBody.Replace("[Content]", textContext);
            return(emailBody);
        }
コード例 #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);
        }