public CreateUsuarioForm(MainUsuarioForm abmUsuarios) { InitializeComponent(); var materialSkinManager = MaterialSkinManager.Instance; materialSkinManager.AddFormToManage(this); materialSkinManager.Theme = MaterialSkinManager.Themes.LIGHT; materialSkinManager.ColorScheme = new ColorScheme(Primary.BlueGrey800, Primary.BlueGrey900, Primary.BlueGrey500, Accent.LightBlue200, TextShade.WHITE); formUsuario = abmUsuarios; clbRoles.DisplayMember = "Descripcion"; clbRoles.ValueMember = "Id"; List <Rol> roles = rolController.GetAll(); foreach (Rol rol in roles) { clbRoles.Items.Add(rol, CheckState.Unchecked); } }
public EditUsuarioForm(Usuario usuario, MainUsuarioForm abmUsuarios) { InitializeComponent(); var materialSkinManager = MaterialSkinManager.Instance; materialSkinManager.AddFormToManage(this); materialSkinManager.Theme = MaterialSkinManager.Themes.LIGHT; materialSkinManager.ColorScheme = new ColorScheme(Primary.BlueGrey800, Primary.BlueGrey900, Primary.BlueGrey500, Accent.LightBlue200, TextShade.WHITE); formUsuario = abmUsuarios; clbRoles.DisplayMember = "Descripcion"; clbRoles.ValueMember = "Id"; if (usuario != null) { this.usuario = usuario; tbUsername.Text = this.usuario.Nick; tbPassword.Text = this.usuario.Password; tbNombre.Text = this.usuario.Nombre; tbApellido.Text = this.usuario.Apellido; } List <Rol> roles = rolController.GetAll(); foreach (Rol rol in roles) { if (this.usuario != null && this.usuario.Roles.Contains(rol)) { clbRoles.Items.Add(rol, CheckState.Checked); } else { clbRoles.Items.Add(rol, CheckState.Unchecked); } } }