private void btn_registroUsuarios_Click(object sender, RoutedEventArgs e)
        {
            UsuariosRegistrados ventanaUsuariosRegistrados = new UsuariosRegistrados(nombre);

            ventanaUsuariosRegistrados.Show();
            this.Close();
        }
예제 #2
0
        private void btn_regresar_Click(object sender, RoutedEventArgs e)
        {
            UsuariosRegistrados ventanaUsuariosRegistrados = new UsuariosRegistrados(usuarioConectado);

            ventanaUsuariosRegistrados.Show();
            this.Close();
        }
예제 #3
0
 protected void Boton_Regresar(object sender, EventArgs e)
 {
     //Pasamos los items seleccionados de listbox1 a listbox2
     while (UsuariosRegistrados.GetSelectedIndices().Length > 0)
     {
         UsuariosTotales.Items.Add(UsuariosRegistrados.SelectedItem);
         UsuariosRegistrados.Items.Remove(UsuariosRegistrados.SelectedItem);
     }
 }
예제 #4
0
        private void btn_confirmarRegistro_Click(object sender, RoutedEventArgs e)
        {
            String nombreUsuario    = tbx_nombreUsuario.Text;
            String nombre           = tbx_nombreRegistro.Text;
            String apellidoPaterno  = tbx_aPaternoRegistro.Text;
            String apellidoMaterno  = tbx_aMaternoRegistro.Text;
            String contraseña       = pbx_contraseña.Password;
            String tipoUsuario      = cmb_tipoUsuario.Text;
            String nombreDelegacion = cmb_delegacion.Text;
            int    idDelegacion     = DelegacionDAO.cargarIdDelecacion(nombreDelegacion);

            if (isNuevo == true)
            {
                if (pbx_contraseña.Password.Equals(pbx_confirmarPass.Password))
                {
                    String nombreUsuarioViejo  = usuarioEditar.NombreUsuario;
                    int    resultadoActualizar = UsuarioDAOcs.actualizarInformacionUsuario(nombre, apellidoPaterno, apellidoMaterno, nombreUsuario, contraseña,
                                                                                           idDelegacion, tipoUsuario, nombreUsuarioViejo);

                    if (resultadoActualizar == 1)
                    {
                        MessageBox.Show("Información actualizada correctamente");
                        UsuariosRegistrados ventanaUsuariosRegistrados = new UsuariosRegistrados(usuarioConectado);
                        ventanaUsuariosRegistrados.Show();
                        this.Close();
                    }
                    else
                    {
                        MessageBox.Show("Error al actualizar la información, inténtelo de nuevo más tarde");
                    }
                }
            }
            else
            {
                int seRegistro;
                if (pbx_contraseña.Password.Equals(pbx_confirmarPass.Password))
                {
                    if (tbx_nombreUsuario.Text == "" || tbx_nombreRegistro.Text == "" || tbx_aPaternoRegistro.Text == "" || tbx_aMaternoRegistro.Text == "" ||
                        pbx_contraseña.Password == "" || cmb_tipoUsuario.Text == "")
                    {
                        MessageBox.Show("Campos faltantes");
                    }
                    else
                    {
                        if (UsuarioDAOcs.comprobarExistencia(nombreUsuario) == false)
                        {
                            seRegistro = UsuarioDAOcs.RegistrarUsuario(nombre, apellidoPaterno, apellidoMaterno, nombreUsuario, contraseña, idDelegacion, tipoUsuario);
                            if (seRegistro == 1)
                            {
                                MessageBox.Show("Usuario registrado correctamente");
                                UsuariosRegistrados ventanaUsuariosRegistrados = new UsuariosRegistrados(usuarioConectado);
                                ventanaUsuariosRegistrados.Show();
                                this.Close();
                            }
                            else
                            {
                                MessageBox.Show("El nombre de usuario que inténtas registrar ya existe dentro del sistema");
                            }
                        }
                        else
                        {
                            MessageBox.Show("El nombre de usuario que inténtas registrar ya existe dentro del sistema");
                        }
                    }
                }
                else
                {
                    lbl_passValidador.Visibility = Visibility.Visible;
                    pbx_contraseña.Foreground    = Brushes.Red;
                    pbx_confirmarPass.Foreground = Brushes.Red;
                }
            }
        }