示例#1
0
        public bool Invite(Person organiser, Person user, Event ev)
        {
            var message = new MailMessage();
            message.To.Add(user.EmailAddress);
            message.From = new MailAddress("*****@*****.**");
            message.Subject = string.Format("You have been invited to a Geeks Dilemma event by {0}", DisplayName(organiser));
            message.Body = @"Your friend " + DisplayName(organiser) + @" is organising an event and you're invited. " +
                Environment.NewLine +
                Environment.NewLine +
                ev.Description +
                Environment.NewLine +
                Environment.NewLine +
                "To see the details including who else is invitee and to say whether or not you can go, click here:"+
                Environment.NewLine +
                Environment.NewLine +
                "http://localhost/geeks/home/event/" + ev.Id  + "/" + user.Id;
            var smtp = new SmtpClient();
            smtp.Send(message);

            return true;
        }
示例#2
0
 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);
 }
示例#3
0
 private Event SaveAndReload(EventModel model)
 {
     var @event = new Event(model) {Id = Guid.NewGuid().ToString()};
     Command(new SaveEventCommand
         {
             Event = @event,
             Emailer = _emailer
         });
     RavenSession.SaveChanges();
     return Query(new EventWithInvitationsAndPersons { EventId = @event.Id });
 }
示例#4
0
        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()
                };
        }
示例#5
0
 public bool UpdateInvitationResponse(Event ev, Person organiser, Person responder, InvitationResponse response)
 {
     var message = new MailMessage();
     message.To.Add(organiser.EmailAddress);
     message.From = new MailAddress("*****@*****.**");
     message.Subject = string.Format("{0} has responded to your event invitation", DisplayName(responder));
     message.Body = @"Your friend " + DisplayName(responder) + @" has " + (response == InvitationResponse.Yes ? "accepted":"declined") + @" your invitation to the following event:" +
         Environment.NewLine +
         Environment.NewLine +
         ev.Description +
         Environment.NewLine +
         Environment.NewLine +
         "To see how this may have affected the score for this event click the following link:" +
         Environment.NewLine +
         Environment.NewLine +
         "http://localhost/geeks/home/event/" + ev.Id;
     var smtp = new SmtpClient();
     smtp.Send(message);
     return true;
 }