///<summary>
        ///Metodo que ejecuta el comando
        ///</summary>
        ///<returns>Lista de entidad</returns>
        public override List <Entidad> ejecutar()
        {
            DAORol         daoRol = (DAORol)FabricaDAO.instanciarDAORol();
            List <Entidad> test   = daoRol.consultarLosPermisosAsignados(_rol._idRol);

            return(test);
        }
예제 #2
0
        private void botonGuardar_Click(object sender, EventArgs e)
        {
            if (camposCompletos())
            {
                if (Equals(textPassword1.Text, textPassword2.Text))
                {
                    completarEstructuraUserNuevo();
                    if (!DAOUsuario.insertar(userNuevo))
                    {
                        MessageBox.Show("Alta de Usuario erronea");
                        return;
                    }

                    //Guarda los distintos Roles asignados al Usuario
                    foreach (var item in listRol.CheckedItems)
                    {
                        DAORol.insertarRolUsuario(item.ToString(), userNuevo.Usr);
                    }

                    //Guarda los distintos Hoteles asignados al Usuario
                    foreach (var item in listHotel.CheckedItems)
                    {
                        DAOUsuario.insertarHotelUsuario(userNuevo.Usr, item.ToString());
                    }

                    MessageBox.Show("Alta de Usuario correcta");
                    ((UsuarioBajaMod)Globals.VentanaAnterior).updateGrid();
                    this.Close();
                }
                else
                {
                    MessageBox.Show("Vuelva a ingresar el password", "Passwords no coinciden");
                }
            }
        }
예제 #3
0
        ///<summary>
        ///Metodo que ejecuta el comando
        ///</summary>
        ///<returns>String</returns>
        public override String ejecutar()
        {
            DAORol daoRol = (DAORol)FabricaDAO.instanciarDAORol();
            String test   = daoRol.quitarPermiso(_idRol, _idPermiso);

            return(test);
        }
예제 #4
0
        //ComboBox Roles
        private void comboBox_Roles_SelectedIndexChanged(object sender, EventArgs e)
        {
            estado = Convert.ToInt32(comboBox_Roles.SelectedValue);
            idRol  = DAORol.getId(comboBox_Roles.Text);


            //Tilda el check solo si está habilitado
            if (estado == 1)
            {
                checkBox1.Checked = true;
            }
            else
            {
                checkBox1.Checked = false;
            }

            textBox1.Text = comboBox_Roles.Text;

            DataTable funcionalidades = DAORol.getFuncionalidades(); //obtengo todas las funcionalidades que existen

            comboBox1.ValueMember   = "ID";
            comboBox1.DisplayMember = "Funcionalidad";
            comboBox1.DataSource    = funcionalidades;

            dataGridView_ListaFuncionalidades.DataSource = DAORol.getFuncionalidadesPorRol(idRol); //muestro solo las funcionalidades del rol
            dataGridView_ListaFuncionalidades.Columns[0].DisplayIndex = 2;
        }
예제 #5
0
 public List <VMRol> ObtenerRolesUsuario(string usuario, int?idSistema = null)
 {
     try
     {
         IDAORol     iDaoRol = new DAORol();
         RespuestaBD resp    = iDaoRol.ObtenerRolesUsuario(usuario, idSistema);
         if (resp.EXISTE_ERROR)
         {
             throw new Exception(resp.MENSAJE);
         }
         else
         {
             List <VMRol> lista = new List <VMRol>();
             if (resp.dataSet.Tables.Count > 0)
             {
                 DataTable datos = resp.dataSet.Tables[0];
                 lista = (from x in datos.AsEnumerable()
                          select new VMRol()
                 {
                     Pais = x.Field <string>("fc_pais"),
                     Descripcion = x.Field <string>("fc_descripcion"),
                     IdPais = x.Field <int>("fi_id_pais"),
                     IdRol = x.Field <int>("fi_id_Rol"),
                     Nombre = x.Field <string>("fc_nombre"),
                     Activo = x.Field <bool>("fl_activo")
                 }).ToList();
             }
             return(lista);
         }
     }
     catch (Exception ex)
     {
         throw new Exception(new Util().ObtenerMsjExcepcion(ex));
     }
 }
        ///<summary>
        ///Metodo que ejecuta el comando
        ///</summary>
        ///<returns>Lista de enteros</returns>
        public override List <int> ejecutar()
        {
            DAORol     daoRol = (DAORol)FabricaDAO.instanciarDAORol();
            List <int> test   = daoRol.consultarPermisosUsuario(idUsuario);

            return(test);
        }
예제 #7
0
        public VMRol RegistrarRol(string nombre, string descripcion, int idPais, int idRol = 0)
        {
            try
            {
                IDAORol iDaoRol = new DAORol();

                VMRol       Rol  = new VMRol();
                RespuestaBD resp = iDaoRol.RegistrarEditarRol(idRol, descripcion, nombre, idPais, true);
                if (resp.EXISTE_ERROR)
                {
                    throw new Exception(resp.MENSAJE);
                }
                else
                {
                    Rol.Descripcion = descripcion;
                    Rol.Nombre      = nombre;
                    Rol.IdPais      = idPais;
                    Rol.IdRol       = Convert.ToInt32(resp.dataSet.Tables[0].Rows[0]["fi_id_Rol"].ToString());
                    Rol.Pais        = resp.dataSet.Tables[0].Rows[0]["fc_pais"].ToString();
                    return(Rol);
                }
            }
            catch (Exception ex)
            {
                throw new Exception(new Util().ObtenerMsjExcepcion(ex));
            }
        }
예제 #8
0
        ///<summary>
        ///Metodo que ejecuta el comando
        ///</summary>
        ///<returns>String</returns>
        public override String ejecutar()
        {
            DAORol daoRol = (DAORol)FabricaDAO.instanciarDAORol();
            String test   = daoRol.eliminarRol(_rol._idRol);

            return(test);
        }
예제 #9
0
        ///<summary>
        ///Metodo que ejecuta el comando
        ///</summary>
        ///<returns>Lista de enteros</returns>
        public override List <int> ejecutar()
        {
            DAORol     daoRol = (DAORol)FabricaDAO.instanciarDAORol();
            List <int> test   = daoRol.validacionRol(_idRol);

            return(test);
        }
예제 #10
0
        public ActionResult AgregarRol(Rol model)
        {
            string name    = TempData["username"].ToString();
            string nameRol = TempData["rol"].ToString();
            int    codUser = Int32.Parse(TempData["codUser"].ToString());

            ViewBag.name         = name;
            ViewBag.rol          = nameRol;
            TempData["username"] = name;
            TempData["rol"]      = nameRol;
            TempData["codUser"]  = codUser;

            DAOUsuario dataU  = DAOUsuario.getInstance();
            string     today  = DateTime.Now.ToString("dd/MM/yyyy HH:mm:ss tt");
            string     accion = "Registro Rol " + model.Nombre;

            dataU.insertarAccion(codUser, 1, today, accion);

            DAORol data = DAORol.getInstance();

            data.insertarRol(model.Nombre);
            List <Rol> Roles = data.obtenerRol();

            return(View("~/Views/Rol/IndexRol.cshtml", Roles));
        }
예제 #11
0
        public PartialViewResult RolDD()
        {
            DAORol     data  = DAORol.getInstance();
            List <Rol> roles = data.obtenerRol();

            return(PartialView("rolDropdown", roles));
        }
예제 #12
0
        private void botonGuardar_Click(object sender, EventArgs e)
        {
            rolSeleccionado.Nombre = textRol.Text;
            if ((string)comboEstado.SelectedItem == "Activo")
            {
                rolSeleccionado.Estado = true;
            }
            else
            {
                rolSeleccionado.Estado = false;
            }

            if (!DAORol.guardar(rolSeleccionado))
            {
                toolTip.Hide(textRol);
                toolTip.SetToolTip(textRol, "Entrada Invalida");
                toolTip.Show("Ingrese un nombre de Rol Válido.", textRol, 50, 10, 5000);
                return;
            }
            DAOFuncionalidad.updateFuncXRol(rolSeleccionado.Nombre, lista_alta, lista_baja);
            MessageBox.Show("Rol modificado satisfactoriamente.", "Modificar Rol",
                            MessageBoxButtons.OK);

            ((RolBajaMod)Globals.VentanaAnterior).updateGrid();
            this.Close();
        }
예제 #13
0
        ///<summary>
        ///Metodo que ejecuta el comando
        ///</summary>
        ///<returns>String</returns>
        public override String ejecutar()
        {
            DAORol daoRol = (DAORol)FabricaDAO.instanciarDAORol();
            String test   = daoRol.eliminarPermiso(_idEliminar);

            return(test);
        }
예제 #14
0
        //Modificando Rol
        public ActionResult ModificarRol(string id)
        {
            int    cod2          = Int32.Parse(id);
            DAORol data          = DAORol.getInstance();
            Rol    RolEncontrado = data.buscarRol(cod2);

            return(View(RolEncontrado));
        }
예제 #15
0
 public void After()
 {
     mockRol     = null;
     mockIdRol   = null;
     mockPermiso = null;
     daoRol      = null;
     controller  = null;
     nombreRol   = null;
 }
예제 #16
0
 private void botonInvitado_Click(object sender, EventArgs e)
 {
     Globals.infoSesion.User = DAOUsuario.obtener("GUEST");
     Globals.infoSesion.Rol  = DAORol.obtenerTodos(Globals.infoSesion.User.Usr)[0];
     new LoginRequisitos().Show();
     textContrasenia.Text = "";
     textUsuario.Text     = "";
     Globals.deshabilitarAnterior(this);
 }
 public CrearOModificarRol(Rol rol, DAORol dao, Boolean create)
     : this()
 {
     this.rol = rol;
     this.daoRol = dao;
     this.create = create;
     nombreRolTextBox.Text = rol.name;
     activoRolCheckBox.Checked = rol.activo == null || !(Boolean)rol.activo ? false : true;
 }
예제 #18
0
 public void Before()
 {
     mockRol     = new Rol("SuperAdmin");
     mockIdRol   = new Rol(1, "Administrador");
     mockPermiso = new Permiso("Permiso Prueba Unitaria", "url");
     daoRol      = new DAORol();
     controller  = new gestion_rolesController();
     nombreRol   = TestGestionRolesRand();
 }
예제 #19
0
        public BajaRol()
        {
            InitializeComponent();

            DataTable roles = DAORol.getRolesHabilitados();

            comboBox1.ValueMember   = "ROL_ESTADO";
            comboBox1.DisplayMember = "ROL_NOMBRE";
            comboBox1.DataSource    = roles;
        }
예제 #20
0
        private void AltaRol_Load(object sender, EventArgs e)
        {
            //mostrar lista funcionalidades
            DataTable funcionalidades = DAORol.getFuncionalidades();

            comboBox1.DataSource    = funcionalidades;
            comboBox1.ValueMember   = "ID";
            comboBox1.DisplayMember = "Funcionalidad";
            checkBox1.Checked       = true;
        }
예제 #21
0
        private void BajaRol(int p)
        {
            var    rta      = MessageBox.Show("¿Dar Baja al Rol?", "Baja de Rol", MessageBoxButtons.YesNo);
            string rolAbaja = (string)dataGridViewRol["nombreRol", p].Value;

            if (rta == DialogResult.Yes)
            {
                DAORol.deleteRol(rolAbaja);
            }
        }
예제 #22
0
        public ModificacionRol()
        {
            InitializeComponent();

            DataTable roles = DAORol.getRoles();

            comboBox_Roles.ValueMember   = "ROL_ESTADO";
            comboBox_Roles.DisplayMember = "ROL_NOMBRE";
            comboBox_Roles.DataSource    = roles;
        }
예제 #23
0
        public UsuarioBajaMod()
        {
            InitializeComponent();
            rolesPosibles = DAORol.traerTodosLosRolesPosibles();

            //Llena la lista con los checkbox de Roles
            foreach (Rol unRol in rolesPosibles)
            {
                comboListRol.Items.Add(unRol.Nombre);
            }
        }
예제 #24
0
 public List <E.VMItemModulo> ObtenerItemsDeRol(int idRol)
 {
     try
     {
         List <E.VMItemModulo> items = new DAORol(this.usuario, this.pass).ObtenerItemsRol(idRol);
         return(items);
     }
     catch (Exception ex)
     {
         throw new Exception(ex.Message);
     }
 }
예제 #25
0
 public List <E.VMRol> ObtenerRolesUsuario(string usu, int?idSistema)
 {
     try
     {
         List <E.VMRol> roles = new DAORol(this.usuario, this.pass).ObtenerRolesUsuario(usu, idSistema);
         return(roles);
     }
     catch (Exception ex)
     {
         throw new Exception(ex.Message);
     }
 }
예제 #26
0
 //Cargo y genero un nuevo rol a la lista de funcionalidades
 private void button1_Click(object sender, EventArgs e)
 {
     try
     {
         DAORol.AgregarRol(GenerarRol());
         MessageBox.Show("Rol agregado correctamente.");
     }
     catch (Exception ex)
     {
         MessageBox.Show("Hubo un error." + ex.Message);
     }
 }
예제 #27
0
        private void botonGuardar_Click(object sender, EventArgs e)
        {
            if (camposCompletos())
            {
                if (Equals(textPassword1.Text, textPassword2.Text))
                {
                    completarEstructuraUserMod();

                    DAOUsuario.actualizar(usuarioMod);

                    //Guarda los distintos Roles asignados al Usuario
                    for (int index = 0; index < listRol.Items.Count; index++)
                    {
                        if (listRol.GetItemChecked(index))
                        {
                            //Agrego Rol a Usuario en tabla ROLES_X_USUARIO
                            DAORol.insertarRolUsuario(listRol.Items[index].ToString(), usuarioMod.Usr);
                        }
                        else
                        {
                            DAORol.borrarRolUsuario(listRol.Items[index].ToString(), usuarioMod.Usr);
                        }
                    }
                    //Guarda los distintos Hoteles asignados al Usuario
                    for (int index = 0; index < listHotel.Items.Count; index++)
                    {
                        if (listHotel.GetItemChecked(index))
                        {
                            //Agrego Rol a Usuario en tabla ROLES_X_USUARIO
                            DAOUsuario.insertarHotelUsuario(usuarioMod.Usr, listHotel.Items[index].ToString());
                        }
                        else
                        {
                            DAOUsuario.borrarHotelUsuario(usuarioMod.Usr, listHotel.Items[index].ToString());
                        }
                    }

                    //Fin de Update de Usuario
                    MessageBox.Show("Update de Usuario correcta");
                    ((UsuarioBajaMod)Globals.VentanaAnterior).updateGrid();
                    this.Close();
                }
                else
                {
                    MessageBox.Show("Vuelva a ingresar el password", "Error:Password no identicos");
                }
            }
            else
            {
                MessageBox.Show("Asegurese de ingresar los campos obligatorios", "Error:campos incompletos");
            }
        }
예제 #28
0
        public E.VMRol RegistrarRol(string nombre, string descripcion, int idPais)
        {
            try
            {
                E.VMRol rol = new DAORol(this.usuario, this.pass).RegistrarRol(nombre, descripcion, idPais);

                return(rol);
            }
            catch (Exception ex)
            {
                throw new Exception(ex.Message);
            }
        }
예제 #29
0
        public RolMod(string nombreRol)
        {
            InitializeComponent();
            rolSeleccionado    = DAORol.obtener(nombreRol);
            funcionalidadesRol = DAOFuncionalidad.obtenerPorRol(nombreRol);
            funcionalidades    = DAOFuncionalidad.obtenerTodas();
            if (rolSeleccionado == null && funcionalidades == null && funcionalidadesRol == null)
            {
                MessageBox.Show("Error al conectarse a la DB", "Error", MessageBoxButtons.OK, MessageBoxIcon.Error);
                this.Dispose();
            }

            cargarDatos();
        }
예제 #30
0
        public UsuarioMod(string usuario)
        {
            InitializeComponent();

            usuarioPedido = usuario;

            usuarioMod   = DAOUsuario.obtener(usuarioPedido);
            rolesUsuario = DAORol.obtenerTodos(usuario);

            ////Se carga el listRol tildando las opciones que el usuario ya tiene
            int item = 0;

            rolesPosibles = DAORol.traerTodosLosRolesPosibles();
            foreach (Rol rol in rolesPosibles)
            {
                listRol.Items.Add(rol.Nombre);
                if (rolesUsuario.Any(x => x.Nombre == rol.Nombre))
                {
                    listRol.SetItemChecked(item, true);
                }
                item++;
            }

            // Carga de listHotel, mismo rezonamiento de arriba
            item            = 0;
            hotelesPosibles = DAOHotel.obtenerTodos();
            hotelesUsuario  = DAOHotel.obtenerTodos(usuario);
            foreach (Hotel hotel in hotelesPosibles)
            {
                listHotel.Items.Add(hotel.Nombre);
                if (hotelesUsuario.Any(x => x.Nombre == hotel.Nombre))
                {
                    listHotel.SetItemChecked(item, true);
                }
                item++;
            }

            //Seteo check de Baja
            if (usuarioMod.CampoBaja)
            {
                checkBoxBajaUsr.Checked = true;
            }
            else
            {
                checkBoxBajaUsr.Checked = false;
            }

            //Llena el resto de los campos con la info que el usuario tiene
            cargarDatos();
        }
예제 #31
0
 private void botonGuardar_Click(object sender, EventArgs e)
 {
     rolSeleccionado.Nombre = (string)textRol.Text;
     if ((string)comboEstado.SelectedItem == "Activo")
     {
         rolSeleccionado.Estado = true;
     }
     else
     {
         rolSeleccionado.Estado = false;
     }
     DAORol.updateRol(rolSeleccionado);
     DAOFuncionalidad.updateFuncXRol(rolSeleccionado.Nombre, lista_alta, lista_baja);
     this.Dispose();
 }
예제 #32
0
 public ABMRol()
 {
     InitializeComponent();
     rolList = new List<Rol>();
     daoRol = new DAORol();
 }