Beispiel #1
0
 public int AddUser(User user)
 {
     try
     {
         return this.userDao.AddUser(user);
     }
     catch (Exception ex)
     {
         LoggerService.Log(LogLevel.Error, "An error ocurred while adding a user.", ex);
         throw;
     }
 }
Beispiel #2
0
        public void ModifyUser(User user)
        {
            using (var entities = this.EntityContext)
            {
                var oldUser = (from e in entities.Users
                               where e.userId == user.userId
                               select e).FirstOrDefault();

                oldUser.entityId = user.entityId;
                oldUser.password = user.password;
                oldUser.name = user.name;
                oldUser.roleId = user.roleId;
                oldUser.admin = user.admin;
                oldUser.comment = user.comment;
                oldUser.email = user.email;

                entities.SaveChanges();
            }
        }
Beispiel #3
0
        public int AddUser(User user)
        {
            try
            {
                using (var entities = this.EntityContext)
                {
                    user.active = true;
                    entities.AddToUsers(user);

                    entities.SaveChanges();

                    return user.userId;
                }
            }
            catch (Exception ex)
            {
                throw this.HandleException(ex);
            }
        }
Beispiel #4
0
 public void AddUser(User user)
 {
     user.creationDate = DateTime.Now;
     this.usersRepository.AddUser(user);
 }
Beispiel #5
0
 public void ModifyUser(User user)
 {
     this.usersRepository.ModifyUser(user);
 }
 /// <summary>
 /// Deprecated Method for adding a new object to the Users EntitySet. Consider using the .Add method of the associated ObjectSet&lt;T&gt; property instead.
 /// </summary>
 public void AddToUsers(User user)
 {
     base.AddObject("Users", user);
 }
 /// <summary>
 /// Create a new User object.
 /// </summary>
 /// <param name="userId">Initial value of the userId property.</param>
 /// <param name="password">Initial value of the password property.</param>
 /// <param name="roleId">Initial value of the roleId property.</param>
 /// <param name="admin">Initial value of the admin property.</param>
 /// <param name="active">Initial value of the active property.</param>
 public static User CreateUser(global::System.Int32 userId, global::System.String password, global::System.Int32 roleId, global::System.Boolean admin, global::System.Boolean active)
 {
     User user = new User();
     user.userId = userId;
     user.password = password;
     user.roleId = roleId;
     user.admin = admin;
     user.active = active;
     return user;
 }
Beispiel #8
0
 public void ModifyUser(User user)
 {
     try
     {
         this.userDao.ModifyUser(user);
     }
     catch (Exception ex)
     {
         LoggerService.Log(LogLevel.Error, "An error ocurred while modifying a user.", ex);
         throw;
     }
 }