Example #1
0
        private void btnBuscar_Click(object sender, EventArgs e)
        {
            if (string.IsNullOrEmpty(txNombre.Text))
            {
                lbMsg.Text = ("Debe completar la informacion Usuario/RUT");
                txNombre.Focus();
                return;
            }

            try
            {
                ManUsuario man = new ManUsuario();
                DataTable  dt  = man.UnUsuario(txNombre.Text.Trim());
                dgvUsuario.DataSource = dt;
                if (dt == null)
                {
                    lbMsg.Text            = "Usuario No existe";
                    dgvUsuario.DataSource = "";
                    txNombre.Enabled      = true;
                }
                else
                {
                    if (dt.Rows.Count == 0)
                    {
                        return;
                    }
                    else
                    {
                        DataRow row = dt.Rows[0];
                        txNombre.Text    = row[0].ToString();
                        txNombre.Enabled = false;
                        lbMsg.Text       = "Usuario Encontrado";
                        txContra.Enabled = true;
                    }
                }
            }
            catch (Exception ex)
            {
                lbMsg.Text = "ERROR: " + ex;
            }
        }
Example #2
0
        private void rellenarGrilla()
        {
            ManUsuario man = new ManUsuario();

            dgvUsuario.DataSource = man.GetUsuariosActivos();
        }
Example #3
0
        private void btnEntrar_Click(object sender, EventArgs e)
        {
            Conectar conexion = new Conectar();

            conexion.Abrir();

            //TEMPORAL PARA PRUEBAS - BORRAR
            //txtUsuario.Text = "admin";
            //txtContra.Text= "admin";
            //TEMPORAL PARA PRUEBAS - BORRAR

            if (txtUsuario.Text.Trim() == "")
            {
                lbMsg.Text = "Asegúrese de ingresar Usuario";
                txtUsuario.Focus();
            }
            else if (txtContra.Text.Trim() == "")
            {
                lbMsg.Text = "Asegúrese de ingresar Contraseña";
                txtContra.Focus();
            }
            else
            {
                OracleCommand comando = new OracleCommand("SELECT NOMBRE_USUARIO, CONTRASENIA, TIPO_USUARIO_ID FROM USUARIO WHERE NOMBRE_USUARIO= :usuario AND CONTRASENIA= :contra ", conexion.con);
                //Obtener información de los txt
                comando.Parameters.Add(":usuario", txtUsuario.Text);
                comando.Parameters.Add(":contra", txtContra.Text);

                OracleDataReader lector = comando.ExecuteReader();

                if (lector.HasRows)
                {
                    while (lector.Read())
                    {
                        //:::NO CREO SEA NECESARIO::: CREAR UNA CLASE USUARIO..
                        String nombre = lector.GetString(0);
                        String clave  = lector.GetString(1);
                        int    tipo   = lector.GetInt32(2);

                        //registros de Usuario
                        ManUsuario man = new ManUsuario();
                        //List<string> listUsuario = man.traerUsuario(txtUsuario.Text);
                        //Console.Write(listUsuario[0] + listUsuario[1] + listUsuario[2] + listUsuario[3] + listUsuario[4]);
                        //USUARIO.IDUSUARIO, USUARIO.NOMBRE_USUARIO, USUARIO.CONTRASENIA, USUARIO.TIPO_USUARIO_ID, TIPO_USUARIO.DESCRIPCION
                        Global.usuarioKEY = man.traerUsuario(txtUsuario.Text);

                        if (tipo == 1)
                        {
                            this.Hide();
                            FormularioAdmin formulario = new FormularioAdmin();
                            formulario.ShowDialog();
                            this.Close();
                        }
                        else if (tipo == 4)
                        {
                            this.Hide();
                            FormularioEmpleado formulario = new FormularioEmpleado();
                            formulario.ShowDialog();
                            this.Close();
                        }
                        else
                        {
                            lbMsg.Text = "Usuario No habilitado, intente nuevamente.";
                        }
                    }
                }
                else
                {
                    Console.WriteLine("No rows found.");
                    lbMsg.Text = "Usuario/Contraseña Inválido, intente nuevamente.";
                }

                lector.Close();
            }
            conexion.Cerrar();
        }
Example #4
0
        private void btnActivos_Click(object sender, EventArgs e)
        {
            ManUsuario man = new ManUsuario();

            dgvUsuario.DataSource = man.GetUsuariosActivos();
        }
Example #5
0
        private void materialRaisedButton1_Click(object sender, EventArgs e)
        {
            if (metroComboBox1.SelectedIndex == 0)
            {
                MessageBox.Show("Seleccione un mantenimiento", "ERROR", MessageBoxButtons.OK, MessageBoxIcon.Error);
            }
            else if (metroComboBox1.SelectedItem.ToString() == "Aplicación")
            {
                this.Hide();
                ManAplicacion manappmenu = new ManAplicacion();
                manappmenu.ShowDialog();
                this.Show();
            }
            else if (metroComboBox1.SelectedItem.ToString() == "Asiento")
            {
                this.Hide();
                ManAsiento manfunmenu = new ManAsiento();
                manfunmenu.ShowDialog();
                this.Show();
            }
            else if (metroComboBox1.SelectedItem.ToString() == "Usuario")
            {
                this.Hide();
                ManUsuario manUsuario = new ManUsuario();
                manUsuario.ShowDialog();
                this.Show();
            }
            else if (metroComboBox1.SelectedItem.ToString() == "Función")
            {
                this.Hide();
                ManFuncion manFuncion = new ManFuncion();
                manFuncion.ShowDialog();
                this.Show();
            }
            else if (metroComboBox1.SelectedItem.ToString() == "Obra")
            {
                this.Hide();
                ManObra manObra = new ManObra();
                manObra.ShowDialog();
                this.Show();
            }

            else if (metroComboBox1.SelectedItem.ToString() == "Promoción")
            {
                this.Hide();
                ManPromocion manfaremenu = new ManPromocion();
                manfaremenu.ShowDialog();
                this.Show();
            }
            else if (metroComboBox1.SelectedItem.ToString() == "Zona")
            {
                this.Hide();
                ManZona manfaremenu = new ManZona();
                manfaremenu.ShowDialog();
                this.Show();
            }
            else if (metroComboBox1.SelectedItem.ToString() == "Empresa")
            {
                this.Hide();
                ManEmpresa manEmpresa = new ManEmpresa();
                manEmpresa.ShowDialog();
                this.Show();
            }
        }