Esempio n. 1
0
        private void CargarRoles()
        {
            string userName = HttpContext.Current.User.Identity.Name;

            gdvRoles.DataSource = rolCtrl.GetAll(userName);
            gdvRoles.DataBind();
        }
Esempio n. 2
0
        public void CargarRoles()
        {
            string userName = HttpContext.Current.User.Identity.Name;

            dpdRoles.DataValueField = "Id";
            dpdRoles.DataTextField  = "Name";
            dpdRoles.DataSource     = rolCtrl.GetAll(userName);
            dpdRoles.DataBind();
            dpdRoles.SelectedIndex = 1;
        }
Esempio n. 3
0
        private void CargarRoles()
        {
            dpdRoles.DataValueField = "Id";
            dpdRoles.DataTextField  = "Name";

            var roles = rolCtrl.GetAll(userName);

            dpdRoles.DataSource = roles;
            dpdRoles.DataBind();

            dpdRoles.SelectedValue = usuario.AspNetRoles.FirstOrDefault().Id;
        }
Esempio n. 4
0
        public void CargarRoles()
        {
            string userName = HttpContext.Current.User.Identity.Name;

            dpdRoles.DataValueField = "Id";
            dpdRoles.DataTextField  = "Name";
            dpdRoles.DataSource     = rolCtrl.GetAll(userName);
            dpdRoles.DataBind();

            if (persona.IdUser != null)
            {
                dpdRoles.SelectedValue = persona.AspNetUsers.AspNetRoles.FirstOrDefault().Id;
            }
            else
            {
                dpdRoles.SelectedIndex = 0;
            }
        }
Esempio n. 5
0
        protected void Page_Load(object sender, EventArgs e)
        {
            rolCtrl = new RolController();
            string userName = HttpContext.Current.User.Identity.Name;

            if (!IsPostBack)
            {
                if (!SitePrincipal.IsIntruso())
                {
                    dpdRoles.DataValueField = "Id";
                    dpdRoles.DataTextField  = "Name";
                    dpdRoles.DataSource     = rolCtrl.GetAll(userName);
                    dpdRoles.DataBind();
                }
                else
                {
                    Response.Redirect("~/Account/Login");
                }
            }
        }
        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);
                }
            }
        }