public async Task AcceptOrDecline(string eventId, string action, string comment, bool send)
        {
            string uri = "events/" + eventId + '/' + action;

            var response = new InvitationResponse
            {
                Comment      = comment,
                SendResponse = send
            };

            await new HttpHelper().PostItemAsync(uri, response);
        }
Ejemplo n.º 2
0
		public Invitation (Group group, Person person, InvitationResponse response)
		{
			if (group == null)
				throw new ArgumentNullException ("group");
			if (person == null)
				throw new ArgumentNullException ("person");
			if (!Enum.IsDefined (typeof (InvitationResponse), response))
				throw new ArgumentException ("Invalid value for response", "response");

			Group = group;
			Person = person;
			Response = response;
		}
Ejemplo n.º 3
0
        public Invitation(Group group, Person person, InvitationResponse response)
        {
            if (group == null)
            {
                throw new ArgumentNullException("group");
            }
            if (person == null)
            {
                throw new ArgumentNullException("person");
            }
            if (!Enum.IsDefined(typeof(InvitationResponse), response))
            {
                throw new ArgumentException("Invalid value for response", "response");
            }

            Group    = group;
            Person   = person;
            Response = response;
        }
        public HttpResponseMessage Put(HttpRequestMessage request, int projectId, int bidPackageId, InvitationResponse rsvp)
        {
            int companyId = _service.GetUserProfile(_security.GetUserId(User.Identity.Name)).CompanyId;
            Invitation invite = _service.Get(bidPackageId, companyId);

            if (invite == null)
            {
                return request.CreateResponse(HttpStatusCode.NotFound, "Invitation not found");
            }

            switch (rsvp)
            {
                case InvitationResponse.accept:
                    invite.AcceptedDate = DateTime.Now;
                    invite.RejectedDate = default(DateTime?);
                    break;
                case InvitationResponse.decline:
                    invite.RejectedDate = DateTime.Now;
                    invite.AcceptedDate = default(DateTime?);
                    break;
                default:
                    return request.CreateResponse(HttpStatusCode.BadRequest);
            }

            if (_service.Update(invite))
            {
                _notice.SendInviteResponse(invite.BidPackageId);
                return request.CreateResponse(HttpStatusCode.OK,
                    new
                    {
                        date = invite.AcceptedDate.HasValue ?
                            invite.AcceptedDate.Value.ToShortDateString() :
                            invite.RejectedDate.Value.ToShortDateString()
                    });
            }
            else
            {
                return request.CreateResponse(HttpStatusCode.Conflict);
            }
        }
 public override void ReadPayload(ISerializationContext context, IValueReader reader)
 {
     GroupId  = reader.ReadInt32();
     Response = (InvitationResponse)reader.ReadByte();
 }
		public override void ReadPayload (ISerializationContext context, IValueReader reader)
		{
			GroupId = reader.ReadInt32();
			Response = (InvitationResponse)reader.ReadByte();
		}
Ejemplo n.º 7
0
        public virtual JsonNetResult RespondToInvite(string id, InvitationResponse response)
        {
            var @event = Query(new EventWithInvitationsAndPersons {EventId = id});

            Command(new RespondToInviteCommand
                {
                    Event = @event,
                    Response = response,
                    PersonId = GetCurrentPersonId(),
                    Emailer = _emailer
                });

            Command(new ScoreEventCommand
                {
                    Event = @event,
                    Emailer = _emailer
                });

            Command(new SaveEventCommand
            {
                Event = @event,
                Emailer = _emailer
            });

            return JsonNet(new {Score = @event.PercentageScore()});
        }
        public async Task AcceptOrDecline(string eventId, string action, string comment, bool send)
        {
            string uri = EventsFolder + eventId + '/' + action;

            var response = new InvitationResponse
            {
                Comment = comment,
                SendResponse = send
            };

            await GetHttpHelper().PostItemAsync(uri, response);
        }
Ejemplo n.º 9
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;
 }