Пример #1
0
        public void RemoveContact(Guid usrId, Guid friendId)
        {
            if (usrId == new Guid("99999999-9999-9999-9999-999999999999") || usrId == new Guid())
            {
                throw new InvalidUserIdException(usrId);
            }

            if (friendId == new Guid("99999999-9999-9999-9999-999999999999") || friendId == new Guid())
            {
                throw new InvalidUserIdException(friendId);
            }

            try
            {
                UsrRepository.RemoveContact(usrId, friendId);
            }
            catch (Exception ex)
            {
                Logger.Instance.Log = new ExceptionDTO()
                {
                    FaultClass = "UserFacade", FaultMethod = "RemoveContract", Exception = ex
                };
                throw;
            }
        }
Пример #2
0
        public IUser FindUser(Guid userId)
        {
            if (userId == new Guid("99999999-9999-9999-9999-999999999999") || userId == new Guid())
            {
                throw new InvalidUserIdException(userId);
            }

            try
            {
                var userList = UsrRepository.Find(user => user.ID == userId);

                foreach (IUser usr in userList)
                {
                    return(usr);
                }
                return(null);
            }
            catch (Exception ex)
            {
                Logger.Instance.Log = new ExceptionDTO()
                {
                    FaultClass = "UserFacade", FaultMethod = "FindUser", Exception = ex
                };
                throw;
            }
        }
Пример #3
0
        public void UpdateUser(IUser user)
        {
            try
            {
                if (!ValidateUserRequiredFieldsAreFilled(user, false))
                {
                    throw new UserException("Invalid IUser object passed to the CreateUser method ");
                }

                UsrRepository.Update(user);
            }
            catch (Exception ex)
            {
                Logger.Instance.Log = new ExceptionDTO()
                {
                    FaultClass = "UserFacade", FaultMethod = "UpdateUser", Exception = ex
                };
                throw;
            }
        }
Пример #4
0
        public IEnumerable <IEvent> RetrieveEventsByAttendanceStatus(Guid usrId, EventAttendantsStatus status)
        {
            if (usrId == new Guid("99999999-9999-9999-9999-999999999999") || usrId == new Guid())
            {
                throw new InvalidUserIdException(usrId);
            }

            try
            {
                IEnumerable <IEvent> evtList = UsrRepository.RetrieveAllEventsByStatus(usrId, status);
                return(evtList);
            }
            catch (Exception ex)
            {
                Logger.Instance.Log = new ExceptionDTO()
                {
                    FaultClass = "UserFacade", FaultMethod = "RetrieveContacts", Exception = ex
                };
                throw;
            }
        }
Пример #5
0
        public IEnumerable <IUser> RetrieveContacts(Guid userId)
        {
            if (userId == new Guid("99999999-9999-9999-9999-999999999999") || userId == new Guid())
            {
                throw new InvalidUserIdException(userId);
            }

            try
            {
                IEnumerable <IUser> userList = UsrRepository.RetrieveContacts(userId);
                return(userList);
            }
            catch (Exception ex)
            {
                Logger.Instance.Log = new ExceptionDTO()
                {
                    FaultClass = "UserFacade", FaultMethod = "RetrieveContacts", Exception = ex
                };
                throw;
            }
        }
Пример #6
0
        public Guid CreateUser(IUser user)
        {
            if (!ValidateUserRequiredFieldsAreFilled(user, true))
            {
                throw new UserException("Invalid IUser object passed to the CreateUser method ");
            }

            try
            {
                ((User)user).ID = Guid.NewGuid();
                UsrRepository.Add(user);
                registerNewUserWithRTF(user);
                return(user.ID);
            }
            catch (Exception ex)
            {
                Logger.Instance.Log = new ExceptionDTO()
                {
                    FaultClass = "UserFacade", FaultMethod = "CreateUser", Exception = ex
                };
                throw;
            }
        }