public void EventIsOn(Event ev, Person organiser, List<Person> invitees) { var message = new MailMessage(); var score = ev.PercentageScore(); message.To.Add(organiser.EmailAddress); foreach (var invitee in invitees) { message.CC.Add(invitee.EmailAddress); } message.From = new MailAddress("*****@*****.**"); message.Subject = string.Format("Your Geek's Dilemma event has a green light with a score of {0}%", score); message.Body = @"The following event is looking good with a current score of "+ score +@"%." + Environment.NewLine + Environment.NewLine + ev.Description + Environment.NewLine + Environment.NewLine + "To look at the details of this event, rate friends or change your attendance, click the following link:" + Environment.NewLine + Environment.NewLine + "http://localhost/geeks/home/event/" + ev.Id; var smtp = new SmtpClient(); smtp.Send(message); }
private EventModel EventModelFromEvent(Event ev, Person currentPerson = null) { var organiser = RavenSession.Load<User>(ev.CreatedBy); var myInvitation = ev.Invitations.FirstOrDefault(invitation => invitation.PersonId == currentPerson.Id); return new EventModel { Id = ev.Id, CreatedByUserName = organiser.Username, CreatedBy = organiser.Id, ReadOnly = organiser.Id != GetCurrentUserId(), Date = ev.Date, Time = ev.Time, Description = ev.Description, Latitude = ev.Latitude, Longitude = ev.Longitude, Venue = ev.Venue, Score = ev.PercentageScore(), Zoom = ev.Zoom, MyResponse = myInvitation == null ? InvitationResponse.No : myInvitation.Response, Invitations = (from i in ev.Invitations let person = RavenSession.Load<Person>(i.PersonId) let friend = GetFriendFromPerson(currentPerson, i.PersonId) select new InvitationModel { IsCurrentUser = person.Id == currentPerson.Id, Email = person.EmailAddress, PersonId = person.Id, Rating = friend == null ? 0 : friend.Rating, EmailSent = i.EmailSent, Response = i.Response, EventId = ev.Id }).ToList() }; }