public async Task SendRemindersAsync(List <string> emailList, Occurrence occurrence) { Opportunity opportunity = occurrence.Opportunity; // string messageText = "Hey There! This is a reminder for your upcoming volunteer gig. " + // "Please reply to this email if you can no longer make the event."; string messageText = "Volunteers: " + String.Join("\n", emailList); SendGridMessage sendGridMessage = new SendGridMessage() { From = new EmailAddress(FromEmail, "Volly Team"), Subject = "Volly Reminder: " + opportunity.Name, TemplateId = "d-70aba37e40834a89b8afe3a1a9567bcd", HtmlContent = messageText, PlainTextContent = messageText }; DateTime startTime = VollyConstants.ConvertFromUtc(occurrence.StartTime); DateTime endTime = VollyConstants.ConvertFromUtc(occurrence.EndTime); sendGridMessage.AddSubstitution(":start", startTime.ToShortDateString() + " " + startTime.ToShortTimeString()); sendGridMessage.AddSubstitution(":end", endTime.ToShortDateString() + " " + endTime.ToShortTimeString()); sendGridMessage.AddSubstitution(":description", opportunity.Description); sendGridMessage.AddSubstitution(":address", opportunity.Address); sendGridMessage.AddSubstitution(":name", opportunity.Name); sendGridMessage.AddSubstitution(":image", opportunity.ImageUrl); var client = new SendGridClient(SendgridApiKey); sendGridMessage.AddTo(VollyConstants.AliceEmail); Response response = await client.SendEmailAsync(sendGridMessage); }
public static Func <Occurrence, Occurrence> ConvertFromUtc() { return(delegate(Occurrence occurrence) { occurrence.StartTime = VollyConstants.ConvertFromUtc(occurrence.StartTime); occurrence.EndTime = VollyConstants.ConvertFromUtc(occurrence.EndTime); occurrence.ApplicationDeadline = VollyConstants.ConvertFromUtc(occurrence.ApplicationDeadline); return occurrence; }); }
public static OccurrenceView FromOccurrence(Occurrence occurrence) { return(new OccurrenceView { Id = occurrence.Id, StartTime = VollyConstants.ConvertFromUtc(occurrence.StartTime), EndTime = VollyConstants.ConvertFromUtc(occurrence.EndTime), ApplicationDeadline = VollyConstants.ConvertFromUtc(occurrence.ApplicationDeadline), Openings = occurrence.Openings - occurrence.Applications.Count }); }
public static VolunteerHoursModel FromVolunteerHours(VolunteerHours volunteerHours) { return(new VolunteerHoursModel() { Id = volunteerHours.Id, User = volunteerHours.User.Email, UserId = volunteerHours.User.Id, DateTime = VollyConstants.ConvertFromUtc(volunteerHours.DateTime), Hours = volunteerHours.Hours, OrganizationName = volunteerHours.OrganizationName, OpportunityName = volunteerHours.OpportunityName }); }
public static VolunteerHoursCSVModel FromVolunteerHours(VolunteerHours volunteerHours) { return(new VolunteerHoursCSVModel() { Company = volunteerHours.User?.Company?.Name, CompanyCode = volunteerHours.User?.Company?.CompanyCode, User = volunteerHours.User.Email, OrganizationName = volunteerHours.OrganizationName, OpportunityName = volunteerHours.OpportunityName, DateTime = VollyConstants.ConvertFromUtc(volunteerHours.DateTime), Hours = volunteerHours.Hours }); }
public static ApplicationView FromApplication(Application application) { List <OccurrenceView> occurrenceViews = application.Occurrences .Select(ao => ao.Occurrence) .Select(OccurrenceView.FromOccurrence) .ToList(); return(new ApplicationView() { Id = application.Id, OpportunityId = application.Opportunity.Id, OpportunityName = application.Opportunity.Name, OpportunityImageUrl = application.Opportunity.ImageUrl, OpportunityAddress = application.Opportunity.Address, OpportunityDescription = application.Opportunity.Description, Name = application.Name, Email = application.Email, PhoneNumber = application.PhoneNumber, Message = application.Message, DateTime = VollyConstants.ConvertFromUtc(application.DateTime), OccurrenceViews = occurrenceViews, UserName = application.User?.UserName }); }