예제 #1
0
        public List<User> GetList(UserFilter filter)
        {
            if (filter == null) throw new ArgumentNullException("filter");

            UserRepository repository = new UserRepository();
            return repository.Select(filter);
        }
예제 #2
0
        /// <summary>
        /// 
        /// </summary>
        /// <param name="user"></param>
        /// <returns></returns>
        /// <example>
        ///User user = UserComponent.Instance.GetByName(userName);
        ///user.InstitutionID = institutionID;
        ///user.FullName = fullName;
        ///user.RoleName = roleName;
        ///user.Telephone = telephone;
        ///user.Email = email;
        ///user.Comment = comment;
        ///user.IsApproved = isApproved;
        ///UserComponent.Instance.Save(user);
        /// </example>
        public User Save(User user)
        {
            if (user == null) throw new ArgumentNullException("user");

            UserRepository repository = new UserRepository();
            User original = repository.Select(user.UserName);

            if (original == null)
                throw new ApplicationException(String.Format("Uživatel '{0}' neexistuje.", user.UserName));

            //original.RoleName = user.RoleName;
            original.Email = user.Email;
            original.Comment = user.Comment;
            original.FullName = user.FullName;
            original.Telephone = user.Telephone;
            original.InstitutionID = user.InstitutionID;
            original.LastUpdate = DateTime.Now;
            original.IsApproved = user.IsApproved;

            return repository.Update(user);
        }
예제 #3
0
 public User GetByName(string userName)
 {
     UserRepository repository = new UserRepository();
     return repository.Select(userName);
 }
예제 #4
0
 public List<User> GetAll()
 {
     UserRepository repository = new UserRepository();
     return repository.Select();
 }