public RoleViewModel(IDataAccessService dataService, RoleView view, Permissions appUserPermissions, Role role, List <Permission> appPermissions, List <Permission> rolePermissions, List <User> appUsers, List <User> roleUsers) : base() { this.view = view; this.das = dataService; this.title = "Редактирование группы \"" + role.Description + "\""; this.appUserPermissions = appUserPermissions; this.role = role; this.rolePermissions = DataTablesHelper.CreatePermissionsTable(); DataTablesHelper.FillPermissionsTable(this.rolePermissions, appPermissions, rolePermissions); this.roleUsers = DataTablesHelper.CreateUsersTable(); DataTablesHelper.FillRoleUsersTable(this.roleUsers, appUsers, roleUsers); this.roleUsers.ColumnChanging += RoleUsers_ColumnChanging; this.rolePermissions.ColumnChanged += RolePermissions_ColumnChanged; }
public UserViewModel(IDataAccessService dataService, UserView view, ManageUserAction action, Permissions appUserPermissions, List <Role> appRoles, List <Permission> appPermissions, List <RolePermission> rolesPermissions, User user = null, List <Role> userRoles = null) : base() { this.view = view; this.das = dataService; this.action = action; this.appUserPermissions = appUserPermissions; if (action == ManageUserAction.Add) { this.title = "Создание пользователя"; } else if (action == ManageUserAction.Modify) { this.title = "Редактирование пользователя"; } if (user == null) { this.user = new User(); } else { this.user = user; this.oldUser = user.Clone(); this.user.PropertyChanged += User_PropertyChanged; } this.rolesPermissions = rolesPermissions; this.userRoles = DataTablesHelper.CreateRolesTable(); DataTablesHelper.FillUserRolesTable(this.userRoles, appRoles, userRoles); this.userPermissions = DataTablesHelper.CreatePermissionsTable(); DataTablesHelper.FillPermissionsTable(this.userPermissions, appPermissions); this.updateUserPermissions(); this.UserChanged = false; //this.userRoles.RowChanging += UserRoles_RowChanging; //this.userRoles.ColumnChanging += UserRoles_ColumnChanging; this.userRoles.ColumnChanged += UserRoles_ColumnChanged; }