private void LoginUserLoaded(LoadOperation<User> result) { if (result.Error == null) { Login.LoginUser = null; foreach (User user in result.Entities) Login.LoginUser = user; if (Login.LoginUser != null) { SmartMap_DomainContext context = new SmartMap_DomainContext(); LoadOperation loadOp = context.Load(context.GetRolePermissionsQuery(Login.LoginUser.RoleID), PermissionsLoaded, null); } else { if (_loadingAnm != null) _loadingAnm.Visibility = Visibility.Collapsed; MessageBox.Show("Incorrect Username or password."); } } else { if (_loadingAnm != null) _loadingAnm.Visibility = Visibility.Collapsed; string msg = result.Error.Message; if (result.Error.InnerException != null) msg += ("Inner: \n" + result.Error.InnerException.Message); MessageBox.Show("Custom Error Handler:\n"+ msg); } }
private bool FilterUsers(User entity) { return (entity.RoleID == this.RoleID); }
private void DetachUsers(User entity) { entity.Role = null; }
private void AttachUsers(User entity) { entity.Role = this; }
/// <summary> /// Deprecated Method for adding a new object to the Users EntitySet. Consider using the .Add method of the associated ObjectSet<T> 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="username">Initial value of the Username property.</param> /// <param name="password">Initial value of the Password property.</param> /// <param name="roleID">Initial value of the RoleID property.</param> public static User CreateUser(global::System.Int32 userID, global::System.String username, global::System.String password, global::System.Int32 roleID) { User user = new User(); user.UserID = userID; user.Username = username; user.Password = password; user.RoleID = roleID; return user; }