public Models.Event GetEventDetails(Guid eventId)
 {
     Models.Event eventDetails;
     using (var uow = _db.GetTransaction())
     {
         eventDetails = _db.FirstOrDefault <Models.Event>("WHERE Id = @0", eventId);
         uow.Complete();
     }
     return(eventDetails);
 }
Esempio n. 2
0
        public IEnumerable <Models.MessageBoard> GetMessageBoards(Guid eventId)
        {
            IEnumerable <Models.MessageBoard> resultSet;

            using (var uow = _db.GetTransaction())
            {
                resultSet = _db.Query <Models.MessageBoard>("WHERE EventId = @0", eventId);
                uow.Complete();
            }
            return(resultSet);
        }
        public IEnumerable <Models.Rsvp> GetAll()
        {
            IEnumerable <Models.Rsvp> result;

            using (var uow = _db.GetTransaction())
            {
                result = _db.Query <Models.Rsvp>("");
                uow.Complete();
            }
            return(result);
        }
 public virtual void Create(IEnumerable <T> entity)
 {
     using (var uow = _db.GetTransaction())
     {
         foreach (var e in entity)
         {
             _db.Insert(e);
         }
         uow.Complete();
     }
 }
        public Invite GetInviteFromSecurityCode(string securityCode)
        {
            Invite invite;

            using (var uow = _db.GetTransaction())
            {
                invite = _db.FirstOrDefault <Invite>("WHERE SecurityCode = @0", securityCode);
                uow.Complete();
            }
            return(invite);
        }
Esempio n. 6
0
        public void Create(Message message)
        {
            using (var uow = _db.GetTransaction())
            {
                _db.Insert(message);

                foreach (var sig in message.Attributions)
                {
                    _db.Insert(new MessageAttribution(message.Id, sig.Id));
                }

                uow.Complete();
            }
        }
        private IEnumerable <Guid> GetUserEventIds(Guid userId)
        {
            IEnumerable <Guid> result;

            using (var uow = _db.GetTransaction())
            {
                result = _db.Query <Guid>(
                    @"SELECT e.EventId
                        FROM core.UserEventMapping AS e
                            INNER JOIN core.Users AS u
                               ON e.UserId = e.EventId
                        WHERE u.UserId = @0", userId);

                uow.Complete();
            }
            return(result);
        }
Esempio n. 8
0
 public void UpdateFailedLoginAttempts <T>(Guid Id)
 {
     using (var uow = _db.GetTransaction())
     {
         _db.Update <T>("SET LoginAttempts = LoginAttempts + 1" +
                        "WHERE Id = @0", Id);
         uow.Complete();
     }
 }
        public IEnumerable <Guid> GetEventIdsUserHasAccessTo(Guid userId)
        {
            IEnumerable <Guid> eventIds = new List <Guid>();

            using (var uow = _db.GetTransaction())
            {
                eventIds = _db.Query <Guid>(@"SELECT EventId 
                                             FROM core.UserEventMapping 
                                             WHERE UserId = @0", userId);
                uow.Complete();
            }
            return(eventIds);
        }
 public void Create(Models.Rsvp rsvp)
 {
     using (var uow = _db.GetTransaction())
     {
         _db.Insert(rsvp);
         foreach (var response in rsvp.Responses)
         {
             _db.Insert(response);
         }
         _db.Execute(@"UPDATE core.Guests 
                         SET HasSentRsvp = 1 
                         WHERE Id IN (@0)",
                     rsvp.Responses.Select(x => x.GuestId));
         uow.Complete();
     }
 }
Esempio n. 11
0
 public void Create(IEnumerable <T> events, Guid userId)
 {
     using (var uow = _db.GetTransaction())
     {
         foreach (var e in events)
         {
             _db.Insert(e);
             _db.Execute(@"INSERT INTO core.UserEventMapping (Id, UserId, EventId) VALUES
                          (@0, @1, @2)"
                         , Guid.NewGuid().ToString()
                         , userId.ToString()
                         , e.Id);
         }
         uow.Complete();
     }
 }