public CousollerandClientDetail EndChatSessionMsg(string ACEAppointmentId) { CousollerandClientDetail EndChatSession = new CousollerandClientDetail(); using (IDbConnection con = new SqlConnection(ConnectionString)) { if (con.State == ConnectionState.Closed) { con.Open(); } DynamicParameters parameters = new DynamicParameters(); parameters.Add("@ACEAppointmentId", ACEAppointmentId); EndChatSession = con.Query <CousollerandClientDetail>("EAPEndChatSessionMsg", parameters, commandType: CommandType.StoredProcedure).FirstOrDefault(); } return(EndChatSession); }
public async Task SendEmailappointmentsurvey(CousollerandClientDetail users) { var body = new StringBuilder(); if (users.IsForFamilyMember) { body.AppendFormat("Hi " + users.FMFirstName + ",<br /><br />"); } else { body.AppendFormat("Hi " + users.ClientName + ",<br /><br />"); } string emailLink = $"<a href={_surveylink}>here</a>"; body.AppendLine($"Thank you for using our AccessChat service. As a new service at AccessEAP, we would appreciate hearing from you about your experience using instant messaging for your counselling session.You’re invited to complete our short survey {emailLink}. Your responses will be anonymous and used to improve the service. Thank you for your time in sharing your thoughts with us. <br /><br />"); body.AppendLine($"{regards}<br />"); body.AppendLine($"{footerlink}"); //body.AppendLine($"<img src='C:\\Users\\aspire\\Desktop\IMGBIN_android-google-play-iphone-app-store-png_6dzJ0xzB.png' alt='Girl in a jacket' width='500' height='600'>"); var apiKey = _config.GetSection("EmailSendGridKey").Value; var client = new SendGridClient(apiKey); var msg = new SendGridMessage() { From = new EmailAddress(_fromEmail, _fromName), //Subject = ",you’re invited to share your thoughts about AccessChat", PlainTextContent = "", HtmlContent = body.ToString(), }; if (users.IsForFamilyMember) { msg.Subject = users.FMFirstName + ", you’re invited to share your thoughts about AccessChat"; msg.AddTo(new EmailAddress(users.FMEmail)); } else { msg.Subject = users.ClientName + ", you’re invited to share your thoughts about AccessChat"; msg.AddTo(new EmailAddress(users.ClientEmailId)); } var response = await client.SendEmailAsync(msg); }
public CousollerandClientDetail InsertAppointment(Appointment model) { CousollerandClientDetail ServiceTypesList = new CousollerandClientDetail(); using (IDbConnection con = new SqlConnection(ConnectionString)) { if (con.State == ConnectionState.Closed) { con.Open(); } DynamicParameters parameters = new DynamicParameters(); parameters.Add("@ACEAppointmentId", model.id); parameters.Add("@StartDate", model.dateTimeStart); parameters.Add("@EndDate", model.dateTimeEnd); parameters.Add("@ActivityTypeId", model.activityTypeId); parameters.Add("@ACEProfessinalId", model.professionalId); parameters.Add("@UserId", model.UserId); parameters.Add("@IsForFamilyMember", model.IsForFamilyMember); parameters.Add("@FMFirstName", model.FMFirstName); parameters.Add("@FMLastName", model.FMLastName); parameters.Add("@FMEmail", model.FMEmail); if (model.FMBirthDate == System.DateTime.MinValue) { parameters.Add("@FMBirthDate", null); } else { parameters.Add("@FMBirthDate", model.FMBirthDate); } parameters.Add("@FMPhone", model.FMPhone); parameters.Add("@ReservationId", model.ReservationId); parameters.Add("@Location", model.resourceOfficeName); parameters.Add("@LocalDateTimeStart", model.localDateTimeStart); parameters.Add("@LocalDateTimeEnd", model.localDateTimeEnd); ServiceTypesList = con.Query <CousollerandClientDetail>("ACECreateAppointment", parameters, commandType: CommandType.StoredProcedure).FirstOrDefault(); } return(ServiceTypesList); }
public async Task SendMailReminder(CousollerandClientDetail users) { var body = new StringBuilder(); body.AppendFormat(users.ClientName + ", this is a friendly reminder of your upcoming appointment today.<br /><br />"); //body.AppendLine("<a href=\'"+ _forgetpasswordurl + HttpUtility.UrlEncode(EncryptedUserId) + "\">Change Password</a>"); if (users.ActivityType == "Scheduled Chat") { string emailLink = $"<a href={ _chatdUrl + users.ACEAppointmentId }>click here</a>"; body.AppendLine($"Your appointment is booked at " + users.StartTime + " with " + users.CounsollerName + " via AccessChat.<br /><br />"); body.AppendLine($"Please note, if your appointment is via Video or AccessChat, you will need to log into our portal {emailLink} to join your session. <br /><br />"); body.AppendLine($"If you are unable to attend this appointment, please login to the booking portal and cancel your appointment. As this is less than 24 hours before your appointment, this session will be deducted from your session allowance. We appreciate you letting us know as a courtesy to your counsellor.<br /><br />"); } if (users.ActivityType == "Video") { string emailLink = $"<a href={ _vediochatdUrl + users.ACEAppointmentId }>click here</a>"; body.AppendLine($"Your appointment is booked at " + users.StartTime + " with " + users.CounsollerName + " via Video.<br /><br />"); body.AppendLine($"Please note, if your appointment is via Video or AccessChat, you will need to log into our portal {emailLink} to join your session. <br /><br />"); body.AppendLine($"If you are unable to attend this appointment, please login to the booking portal and cancel your appointment. As this is less than 24 hours before your appointment, this session will be deducted from your session allowance. We appreciate you letting us know as a courtesy to your counsellor.<br /><br />"); } if (users.ActivityType == "Telephone") { body.AppendLine($"Your appointment is booked at " + users.StartTime + " with " + users.CounsollerName + " via Telephone.<br /><br />"); body.AppendLine($"Please note, For Telephone bookings, the Counsellor will call you at the appointment time. We recommend ensuring that your phone is charged and you are in a quiet place where you can speak freely. <br /><br />"); body.AppendLine($"If you are unable to attend this appointment, please login to the booking portal and cancel your appointment. As this is less than 24 hours before your appointment, this session will be deducted from your session allowance. We appreciate you letting us know as a courtesy to your counsellor.<br /><br />"); } if (users.ActivityType == "Face to Face") { body.AppendLine($"Your appointment is booked at " + users.StartTime + " with " + users.CounsollerName + ". The location of your appointment is " + users.Location + ".<br /><br />"); body.AppendLine($"If you are unable to attend this appointment, please login to the booking portal and cancel your appointment. As this is less than 24 hours before your appointment, this session will be deducted from your session allowance. We appreciate you letting us know as a courtesy to your counsellor.<br /><br />"); } body.AppendLine($"{regards}<br />"); body.AppendLine($"{footerlink}"); var body1 = new StringBuilder(); body1.AppendFormat("Hi " + users.CounsollerName + ",<br /><br />"); if (users.IsForFamilyMember) { body1.AppendLine($"Gentle reminder for Your " + users.ActivityType + " appointment is scheduled for " + users.startDateInString + " " + users.StartTime + " with " + users.FMFirstName + ".<br /><br />"); } else { body1.AppendLine($"Your " + users.ActivityType + " appointment is scheduled for " + users.startDateInString + " " + users.StartTime + " with " + users.ClientName + ".<br /><br />"); } if (users.ActivityType == "Scheduled Chat") { string emailLink = $"<a href={ _chatdConUrl + users.ACEAppointmentId }>click here</a>"; body1.AppendLine($"Please {emailLink} to chat.<br /><br />"); } if (users.ActivityType == "Video") { string emailLink = $"<a href={ _vediochatdConUrl + users.ACEAppointmentId }>click here</a>"; body1.AppendLine($"Please {emailLink} to video chat.<br /><br />"); } //body.AppendLine("<a href=\'"+ _forgetpasswordurl + HttpUtility.UrlEncode(EncryptedUserId) + "\">Change Password</a>"); body1.AppendLine($"{regards}<br />"); body1.AppendLine($"{footerlink}"); var body2 = new StringBuilder(); body2.AppendFormat(users.FMFirstName + ", this is a friendly reminder of your upcoming appointment today.<br /><br />"); string EncryptedUserId = EncryptionDecryptionHelper.EncryptString(Convert.ToString(users.UserId)); string EncodedURL = WebUtility.UrlEncode(EncryptedUserId.Replace("+", "œ").Replace("=", "Ž").Replace("/", "ô")); string EncriptedAppointmentId = EncryptionDecryptionHelper.EncryptString(Convert.ToString(users.AppointmentId)); string EncodedAppointmentIdURL = WebUtility.UrlEncode(EncriptedAppointmentId.Replace("+", "œ").Replace("=", "Ž").Replace("/", "ô")); if (!users.IsConsentFormFilled) { string emailLink1 = $"<a href={ _consentFormUrl + EncodedURL + '/' + EncodedAppointmentIdURL + '/' + users.FMFullName.Replace(" ", "%20") }>click on</a>"; body2.AppendLine($"Please {emailLink1} to complete your consent form before your appointment date.<br /><br />"); } //body2.AppendLine($"Gentle reminder for Your " + users.ActivityType + " appointment is scheduled for " + users.startDateInString + " " + users.StartTime + " with " + users.CounsollerName + ".<br /><br />"); if (users.ActivityType == "Scheduled Chat") { string emailLink = $"<a href={ _familychaturl + users.ACEAppointmentId }>click here</a>"; body2.AppendLine($"Your appointment is booked at " + users.StartTime + " with " + users.CounsollerName + " via AccessChat.<br /><br />"); body2.AppendLine($"Please note, if your appointment is via Video or AccessChat, you will need to log into our portal {emailLink} to join your session. <br /><br />"); body2.AppendLine($"If you are unable to attend this appointment, please login to the booking portal and cancel your appointment.<br /><br />"); } if (users.ActivityType == "Video") { string emailLink = $"<a href={ _familyvediochaturl + users.ACEAppointmentId }>click here</a>"; body2.AppendLine($"Your appointment is booked at " + users.StartTime + " with " + users.CounsollerName + " via Video.<br /><br />"); body2.AppendLine($"Please note, if your appointment is via Video or AccessChat, you will need to log into our portal {emailLink} to join your session. <br /><br />"); body2.AppendLine($"If you are unable to attend this appointment, please login to the booking portal and cancel your appointment.<br /><br />"); } if (users.ActivityType == "Telephone") { body2.AppendLine($"Your appointment is booked at " + users.StartTime + " with " + users.CounsollerName + " via Telephone.<br /><br />"); body2.AppendLine($"Please note, For Telephone bookings, the Counsellor will call you at the appointment time. We recommend ensuring that your phone is charged and you are in a quiet place where you can speak freely. <br /><br />"); body2.AppendLine($"If you are unable to attend this appointment, please login to the booking portal and cancel your appointment.<br /><br />"); } if (users.ActivityType == "Face to Face") { body2.AppendLine($"Your appointment is booked at " + users.StartTime + " with " + users.CounsollerName + ". The location of your appointment is " + users.Location + ".<br /><br />"); body2.AppendLine($"If you are unable to attend this appointment, please login to the booking portal and cancel your appointment. As this is less than 24 hours before your appointment, this session will be deducted from your session allowance. We appreciate you letting us know as a courtesy to your counsellor.<br /><br />"); } body2.AppendLine($"{regards}<br />"); body2.AppendLine($"{footerlink}"); var apiKey = _config.GetSection("EmailSendGridKey").Value; var client = new SendGridClient(apiKey); if (!users.IsForFamilyMember) { var msg = new SendGridMessage() { From = new EmailAddress(_fromEmail, _fromName), Subject = users.ClientName + ", reminder of your AccessEAP appointment", PlainTextContent = "", HtmlContent = body.ToString(), }; msg.AddTo(new EmailAddress(users.ClientEmailId)); var response = await client.SendEmailAsync(msg); } var msg1 = new SendGridMessage() { From = new EmailAddress(_fromEmail, _fromName), Subject = users.CounsollerName + ", reminder of your AccessEAP appointment", PlainTextContent = "", HtmlContent = body1.ToString(), }; msg1.AddTo(new EmailAddress(users.CounsollerEmailId)); if (users.IsForFamilyMember) { var msg2 = new SendGridMessage() { From = new EmailAddress(_fromEmail, _fromName), Subject = users.FMFirstName + ", reminder of your AccessEAP appointment", PlainTextContent = "", HtmlContent = body2.ToString(), }; msg2.AddTo(new EmailAddress(users.FMEmail)); var response2 = await client.SendEmailAsync(msg2); } var response1 = await client.SendEmailAsync(msg1); }
public async Task SendMailCancelAppointmentBooking(CousollerandClientDetail users) { var body = new StringBuilder(); //client body.AppendFormat("Hi " + users.ClientName + ",<br /><br />"); body.AppendLine($"Your " + users.ActivityType + " appointment is cancelled for " + users.startDateInString + " " + users.StartTime + " with " + users.CounsollerName + ".<br /><br />"); //body.AppendLine("<a href=\'"+ _forgetpasswordurl + HttpUtility.UrlEncode(EncryptedUserId) + "\">Change Password</a>"); body.AppendLine($"{regards}<br />"); body.AppendLine($"{footerlink}"); var body1 = new StringBuilder(); body1.AppendFormat("Hi " + users.CounsollerName + ",<br /><br />"); if (users.IsForFamilyMember) { body1.AppendLine($"Your " + users.ActivityType + " appointment is cancelled for " + users.startDateInString + " " + users.StartTime + " with " + users.FMFirstName + ".<br /><br />"); } else { body1.AppendLine($"Your " + users.ActivityType + " appointment is cancelled for " + users.startDateInString + " " + users.StartTime + " with " + users.ClientName + ".<br /><br />"); } //body.AppendLine("<a href=\'"+ _forgetpasswordurl + HttpUtility.UrlEncode(EncryptedUserId) + "\">Change Password</a>"); body1.AppendLine($"{regards}<br />"); body1.AppendLine($"{footerlink}"); var body2 = new StringBuilder(); if (users.IsForFamilyMember) { body2.AppendFormat("Hi " + users.FMFirstName + ",<br /><br />"); body2.AppendLine($"Your " + users.ActivityType + " appointment is cancelled for " + users.startDateInString + " " + users.StartTime + " with " + users.CounsollerName + ".<br /><br />"); //body.AppendLine("<a href=\'"+ _forgetpasswordurl + HttpUtility.UrlEncode(EncryptedUserId) + "\">Change Password</a>"); body2.AppendLine($"{regards}<br />"); body2.AppendLine($"{footerlink}"); } var apiKey = _config.GetSection("EmailSendGridKey").Value; var client = new SendGridClient(apiKey); if (!users.IsForFamilyMember) { var msg = new SendGridMessage() { From = new EmailAddress(_fromEmail, _fromName), Subject = "Appointment Cancelled", PlainTextContent = "", HtmlContent = body.ToString(), }; msg.AddTo(new EmailAddress(users.ClientEmailId)); var response = await client.SendEmailAsync(msg); } var msg1 = new SendGridMessage() { From = new EmailAddress(_fromEmail, _fromName), Subject = "Appointment Cancelled", PlainTextContent = "", HtmlContent = body1.ToString(), }; msg1.AddTo(new EmailAddress(users.CounsollerEmailId)); if (users.IsForFamilyMember) { var msg2 = new SendGridMessage() { From = new EmailAddress(_fromEmail, _fromName), Subject = "Appointment Cancelled", PlainTextContent = "", HtmlContent = body2.ToString(), }; msg2.AddTo(new EmailAddress(users.FMEmail)); var response2 = await client.SendEmailAsync(msg2); } var response1 = await client.SendEmailAsync(msg1); }
public async Task SendMailAppointmentBooking(CousollerandClientDetail users) { var body = new StringBuilder(); //Client// body.AppendFormat("Dear " + users.ClientName + ",<br /><br />"); body.AppendFormat($"Thank you for booking an appointment with us. This email confirms the details of your counselling session.<br />"); // body.AppendLine($"Your "+users.ActivityType+" appointment is scheduled for " + users.startDateInString + " " + users.StartTime + " with " +users.CounsollerName+".<br /><br />"); //body.AppendLine("<a href=\'"+ _forgetpasswordurl + HttpUtility.UrlEncode(EncryptedUserId) + "\">Change Password</a>"); string logiPortal = $"<a href={_loginUrl}>click here</a>"; if (users.ActivityType == "Scheduled Chat") { string emailLink = $"<a href={ _chatdUrl + users.ACEAppointmentId }>click here</a>"; body.AppendLine($"Date: " + users.startDateInString + "<br />"); body.AppendLine($"Time: " + users.StartTime + "<br />"); body.AppendLine($"Modality: AccessChat<br />"); body.AppendLine($"Counsellor: " + users.CounsollerName + "<br />"); body.AppendLine($"Please note, if your appointment is via Video or AccessChat, you will need to log into our portal here {emailLink} to join your session.<br />If you need to re-schedule or cancel your appointment/s please do so with at least 24 hours’ notice(business days), otherwise your session will count towards your session allowance.Counselling is a very personal experience and the counsellor plays an important role.If you would prefer to talk to a different counsellor, you are welcome to search for someone more suitable to your needs for your next appointment. <br />"); body.AppendLine($"If you are unable to attend this appointment, please login to the booking portal here {logiPortal} and cancel your appointment.<br /><br />"); } if (users.ActivityType == "Video") { string emailLink = $"<a href={ _vediochatdUrl + users.ACEAppointmentId }>click here</a>"; body.AppendLine($"Date: " + users.startDateInString + "<br />"); body.AppendLine($"Time: " + users.StartTime + "<br />"); body.AppendLine($"Modality: " + users.ActivityType + "<br />"); body.AppendLine($"Counsellor: " + users.CounsollerName + "<br />"); body.AppendLine($"Please note, if your appointment is via Video or AccessChat, you will need to log into our portal here {emailLink} to join your session. <br />If you need to re-schedule or cancel your appointment/s please do so with at least 24 hours’ notice(business days), otherwise your session will count towards your session allowance.Counselling is a very personal experience and the counsellor plays an important role.If you would prefer to talk to a different counsellor, you are welcome to search for someone more suitable to your needs for your next appointment.<br />"); body.AppendLine($"If you are unable to attend this appointment, please login to the booking portal here {logiPortal} and cancel your appointment.<br /><br />"); } if (users.ActivityType == "Face to Face") { body.AppendLine($"Date: " + users.startDateInString + "<br />"); body.AppendLine($"Time: " + users.StartTime + "<br />"); body.AppendLine($"Location: " + users.Location + "<br />"); body.AppendLine($"Counsellor: " + users.CounsollerName + "<br />"); body.AppendLine($"If you need to re-schedule or cancel your appointment/s please do so with at least 24 hours’ notice (business days), otherwise your session will count towards your session allowance. Counselling is a very personal experience and the counsellor plays an important role. If you would prefer to talk to a different counsellor, you are welcome to search for someone more suitable to your needs for your next appointment.<br /><br />"); } if (users.ActivityType == "Telephone") { body.AppendLine($"Date: " + users.startDateInString + "<br />"); body.AppendLine($"Time: " + users.StartTime + "<br />"); body.AppendLine($"Modality: " + users.ActivityType + "<br />"); body.AppendLine($"Counsellor: " + users.CounsollerName + "<br />"); body.AppendLine($"Please note, For Telephone bookings, the Counsellor will call you at the appointment time-we recommend ensuring that your phone is charged and you are in a quiet place where you can speak freely.<br />If you need to re-schedule or cancel your appointment/s please do so with at least 24 hours’ notice(business days), otherwise your session will count towards your session allowance.Counselling is a very personal experience and the counsellor plays an important role.If you would prefer to talk to a different counsellor, you are welcome to search for someone more suitable to your needs for your next appointment.<br />"); body.AppendLine($"If you are unable to attend this appointment, please login to the booking portal here {logiPortal} and cancel your appointment.<br /><br />"); } body.AppendLine($"{regards}<br />"); body.AppendLine($"{footerlink}"); var body1 = new StringBuilder(); body1.AppendFormat("Dear " + users.CounsollerName + ",<br /><br />"); //body1.AppendFormat($"Thank you for booking an appointment with us. This email confirms the details of your client session."); if (users.IsForFamilyMember) { body1.AppendLine($"Your " + users.ActivityType + " appointment is scheduled for " + users.startDateInString + " " + users.StartTime + " with " + users.FMFirstName + ".<br /><br />"); } else { body1.AppendLine($"Your " + users.ActivityType + " appointment is scheduled for " + users.startDateInString + " " + users.StartTime + " with " + users.ClientName + ".<br /><br />"); } if (users.ActivityType == "Scheduled Chat") { string emailLink = $"<a href={ _chatdConUrl + users.ACEAppointmentId }>click here</a>"; body1.AppendLine($"Date: " + users.startDateInString + "<br />"); body1.AppendLine($"Time: " + users.StartTime + "<br />"); body1.AppendLine($"Modality: AccessChat<br /><br />"); body1.AppendLine($"Please {emailLink} to chat.<br /><br />"); } if (users.ActivityType == "Video") { string emailLink = $"<a href={ _vediochatdConUrl + users.ACEAppointmentId }>click here</a>"; body1.AppendLine($"Date: " + users.startDateInString + "<br />"); body1.AppendLine($"Time: " + users.StartTime + "<br />"); body1.AppendLine($"Modality: " + users.ActivityType + "<br /><br />"); body1.AppendLine($"Please {emailLink} to video chat.<br /><br />"); } if (users.ActivityType == "Face to Face") { body1.AppendLine($"Date: " + users.startDateInString + "<br />"); body1.AppendLine($"Time: " + users.StartTime + "<br />"); body1.AppendLine($"Location: " + users.Location + "<br />"); if (users.IsForFamilyMember) { body1.AppendLine($"Client: " + users.FMFirstName + "<br /><br />"); } else { body1.AppendLine($"Client: " + users.ClientName + "<br /><br />"); } // body1.AppendLine($"If you need to re-schedule or cancel your appointment/s please do so with at least 24 hours’ notice (business days), otherwise your session will count towards your session allowance. Counselling is a very personal experience and the counsellor plays an important role. If you would prefer to talk to a different counsellor, you are welcome to search for someone more suitable to your needs for your next appointment.<br /><br />"); } //body.AppendLine("<a href=\'"+ _forgetpasswordurl + HttpUtility.UrlEncode(EncryptedUserId) + "\">Change Password</a>"); body1.AppendLine($"{regards}<br />"); body1.AppendLine($"{footerlink}"); var body2 = new StringBuilder(); if (users.IsForFamilyMember) { body2.AppendFormat("Dear " + users.FMFirstName + ",<br /><br />"); body2.AppendLine($"Thank you for booking an appointment with us. This email confirms the details of your counselling session.<br />"); string EncryptedUserId = EncryptionDecryptionHelper.EncryptString(Convert.ToString(users.UserId)); string EncodedURL = WebUtility.UrlEncode(EncryptedUserId.Replace("+", "œ").Replace("=", "Ž").Replace("/", "ô")); string EncriptedAppointmentId = EncryptionDecryptionHelper.EncryptString(Convert.ToString(users.AppointmentId)); string EncodedAppointmentIdURL = WebUtility.UrlEncode(EncriptedAppointmentId.Replace("+", "œ").Replace("=", "Ž").Replace("/", "ô")); string emailLink1 = $"<a href={ _consentFormUrl + EncodedURL + '/' + EncodedAppointmentIdURL + '/' + users.FMFullName.Replace(" ", "%20")}>click on</a>"; if (users.ActivityType == "Scheduled Chat") { string emailLink = $"<a href={ _familychaturl + users.ACEAppointmentId }>click here</a>"; body2.AppendLine($"Date: " + users.startDateInString + "<br />"); body2.AppendLine($"Time: " + users.StartTime + "<br />"); body2.AppendLine($"Modality: AccessChat<br />"); body2.AppendLine($"Counsellor: " + users.CounsollerName + "<br />"); body2.AppendLine($"Please {emailLink1} to complete your consent form before your appointment date. <br /> "); body2.AppendLine($"Please note, if your appointment is via Video or AccessChat, you will need to log into our portal here {emailLink} to join your session.<br />If you need to re-schedule or cancel your appointment/s please do so with at least 24 hours’ notice(business days), otherwise your session will count towards your session allowance.Counselling is a very personal experience and the counsellor plays an important role.If you would prefer to talk to a different counsellor, you are welcome to search for someone more suitable to your needs for your next appointment.<br />"); body2.AppendLine($"If you are unable to attend this appointment, please login to the booking portal here {logiPortal} and cancel your appointment.<br /><br />"); } if (users.ActivityType == "Video") { string emailLink = $"<a href={ _familyvediochaturl + users.ACEAppointmentId }>click here</a>"; body2.AppendLine($"Date: " + users.startDateInString + "<br />"); body2.AppendLine($"Time: " + users.StartTime + "<br />"); body2.AppendLine($"Modality: " + users.ActivityType + "<br />"); body2.AppendLine($"Counsellor: " + users.CounsollerName + "<br />"); body2.AppendLine($"Please {emailLink1} to complete your consent form before your appointment date.<br />"); body2.AppendLine($"Please note, if your appointment is via Video or AccessChat, you will need to log into our portal here {emailLink} to join your session. <br />If you need to re-schedule or cancel your appointment/s please do so with at least 24 hours’ notice(business days), otherwise your session will count towards your session allowance.Counselling is a very personal experience and the counsellor plays an important role.If you would prefer to talk to a different counsellor, you are welcome to search for someone more suitable to your needs for your next appointment.<br />"); body2.AppendLine($"If you are unable to attend this appointment, please login to the booking portal here {logiPortal} and cancel your appointment.<br /><br />"); } if (users.ActivityType == "Face to Face") { body2.AppendLine($"Date: " + users.startDateInString + "<br />"); body2.AppendLine($"Time: " + users.StartTime + "<br />"); body2.AppendLine($"Location: " + users.Location + "<br />"); body2.AppendLine($"Counsellor: " + users.CounsollerName + "<br />"); body2.AppendLine($"Please {emailLink1} to complete your consent form before your appointment date.<br />"); body2.AppendLine($"If you need to re-schedule or cancel your appointment/s please do so with at least 24 hours’ notice (business days), otherwise your session will count towards your session allowance. Counselling is a very personal experience and the counsellor plays an important role. If you would prefer to talk to a different counsellor, you are welcome to search for someone more suitable to your needs for your next appointment.<br /><br />"); } if (users.ActivityType == "Telephone") { body2.AppendLine($"Date: " + users.startDateInString + "<br />"); body2.AppendLine($"Time: " + users.StartTime + "<br />"); body2.AppendLine($"Modality: " + users.ActivityType + "<br />"); body2.AppendLine($"Counsellor: " + users.CounsollerName + "<br />"); body2.AppendLine($"Please {emailLink1} to complete your consent form before your appointment date.<br />"); body2.AppendLine($"Please note, For Telephone bookings, the Counsellor will call you at the appointment time-we recommend ensuring that your phone is charged and you are in a quiet place where you can speak freely.<br />If you need to re-schedule or cancel your appointment/s please do so with at least 24 hours’ notice(business days), otherwise your session will count towards your session allowance.Counselling is a very personal experience and the counsellor plays an important role.If you would prefer to talk to a different counsellor, you are welcome to search for someone more suitable to your needs for your next appointment.<br />"); body2.AppendLine($"If you are unable to attend this appointment, please login to the booking portal here {logiPortal} and cancel your appointment.<br /><br />"); } //body2.AppendLine("<a href=\'" + _consentFormUrl + HttpUtility.UrlEncode(EncryptedUserId) +"/"+ HttpUtility.UrlEncode(EncodedAppointmentIdURL) + "\">click here to fill Consent Form.</a>"); body2.AppendLine($"{regards}<br />"); body2.AppendLine($"{footerlink}"); } var apiKey = _config.GetSection("EmailSendGridKey").Value; var client = new SendGridClient(apiKey); if (!users.IsForFamilyMember) { var msg = new SendGridMessage() { From = new EmailAddress(_fromEmail, _fromName), Subject = users.ClientName + ", " + "confirmation of your AccessEAP appointment", PlainTextContent = "", HtmlContent = body.ToString(), }; msg.AddTo(new EmailAddress(users.ClientEmailId)); var response = await client.SendEmailAsync(msg); } var msg1 = new SendGridMessage() { From = new EmailAddress(_fromEmail, _fromName), Subject = users.CounsollerName + " " + "confirmation of your AccessEAP appointment", PlainTextContent = "", HtmlContent = body1.ToString(), }; msg1.AddTo(new EmailAddress(users.CounsollerEmailId)); if (users.IsForFamilyMember) { var msg2 = new SendGridMessage() { From = new EmailAddress(_fromEmail, _fromName), Subject = users.FMFirstName + ", " + "confirmation of your AccessEAP appointment", PlainTextContent = "", HtmlContent = body2.ToString(), }; msg2.AddTo(new EmailAddress(users.FMEmail)); var response2 = await client.SendEmailAsync(msg2); } var response1 = await client.SendEmailAsync(msg1); }