public void combo_encargado()
        {
            List<Usuario> lista = new NUsuario().N_listar_usuarios();

            var filtro = from c_Usuario in lista where c_Usuario.Tipo == "administrador" || c_Usuario.Tipo == "encargado" select c_Usuario;

            this.combo_encar.DataSource = filtro.ToList<Usuario>();
        }
 public void listar_voluntarios()
 {
     this.grilla_listado.DataSource = null;
     List<Usuario> lista = new NUsuario().N_listar_soloVoluntarios();
     this.grilla_listado.DataSource = lista;
     //   this.grilla_listado.Columns[3].Visible = false;
        // this.grilla_listado.Columns[4].Visible = false;
 }
 public void escribir_buscar()
 {
     List<Usuario> lista = new NUsuario().N_listar_soloVoluntarios();
     var filtro = from Usuario in lista
                  where Usuario.Serie.ToString().ToUpper().Contains(text_buscar.Text.ToUpper()) || Usuario.Codigo.ToString().ToUpper().Contains(text_buscar.Text.ToUpper()) ||
                  Usuario.Nombres.ToUpper().Contains(text_buscar.Text.ToUpper()) || Usuario.Apellidos.ToUpper().Contains(text_buscar.Text.ToUpper()) ||
                  Usuario.Tipo.ToUpper().Contains(text_buscar.Text.ToUpper()) || Usuario.Sexo.ToUpper().Contains(text_buscar.Text.ToUpper()) || Usuario.Dni.ToString().ToUpper().Contains(text_buscar.Text.ToUpper()) ||
                  Usuario.Direccion.ToUpper().Contains(text_buscar.Text.ToUpper()) || Usuario.Referencia.ToUpper().Contains(text_buscar.Text.ToUpper()) || Usuario.Movistar.ToString().ToUpper().Contains(text_buscar.Text.ToUpper()) ||
                  Usuario.Claro.ToString().ToUpper().Contains(text_buscar.Text.ToUpper()) || Usuario.Nextel.ToString().ToUpper().Contains(text_buscar.Text.ToUpper()) || Usuario.Telefono.ToString().ToUpper().Contains(text_buscar.Text.ToUpper()) ||
                  Usuario.Email.ToUpper().Contains(text_buscar.Text.ToUpper()) || Usuario.Facebook.ToUpper().Contains(text_buscar.Text.ToUpper()) || Usuario.Ocupacion.ToUpper().Contains(text_buscar.Text.ToUpper()) || Usuario.Estado.ToUpper().Contains(text_buscar.Text.ToUpper())
                  select Usuario;
     this.grilla_listado.DataSource = filtro.ToList<Usuario>();
 }
        private void btn_cambiar_Click(object sender, EventArgs e)
        {
            String actual = text_actual.Text;
            String nueva = text_nueva.Text;
            String confirmar = text_confirma.Text;
            if (F_Login.perfil.Contrasena.Equals(actual))
            {
                if (nueva.Equals(confirmar))
                {
                    int band = new NUsuario().N_cambiar_contra_usuario(F_Login.perfil.Serie, nueva);
                    if (band == 0)
                    {
                        MessageBox.Show("Error Por favor intente nuevamente");
                    }
                    else
                    {
                        MessageBox.Show("Guardado Correctamente");
                        int ser = F_Login.perfil.Serie;
                        F_Login.perfil = new NUsuario().N_ver_Usuarioxserie(ser);
                        this.Dispose();
                    }
                    //cambio realizado

                }
                else
                {

                    MessageBox.Show("Contraseñas No Coinciden");

                }
            }
            else
            {

                MessageBox.Show("Contraseña Actual Incorrecta");
            }
        }
Example #5
0
        private void btn_modiperfil_Click(object sender, EventArgs e)
        {
            if (btn_modiperfil.Text.Equals("Guardar"))
            {
                //ejecuta consulta ;

                Boolean band1 = false, band2 = false, band3 = false, band4 = false, band5 = false, band6 = false;
                String mensaje = "Por Favor Complete los campos obligatorios : \n";
                int serie = F_Login.perfil.Serie;
                String codigo = "";
                String usuario = "";
                String clave = "";
                String nombre = "";
                String apellidos = "";
                String dni = "";
                String direccion = "";
                String referencia = "";
                int movistar = 0;
                int claro = 0;
                int telefono = 0;
                int nextel = 0;
                String email = "";
                String facebook = "";
                String ocupacion = "";
                String estado = F_Login.perfil.Estado;
                String tipo = F_Login.perfil.Tipo;

                if (!String.IsNullOrEmpty(text_codigo.Text))
                {
                    codigo = text_codigo.Text;
                }
                else
                {
                    mensaje = mensaje + "\n - Casilla de Codigo ";
                    band1 = true;

                }

                if (!String.IsNullOrEmpty(text_usuario.Text))
                {
                    usuario = text_usuario.Text;
                }
                else
                {
                    mensaje = mensaje + "\n - Casilla de Usuario ";
                    band2 = true;
                }
                if (!String.IsNullOrEmpty(text_contrasena.Text))
                {
                    clave = text_contrasena.Text;
                }
                else
                {
                    mensaje = mensaje + "\n - Casilla de Contraseña \n";
                    band3 = true;
                }

                if (!String.IsNullOrEmpty(text_nombre.Text))
                {
                    nombre = text_nombre.Text;
                }
                else
                {
                    mensaje = mensaje + "\n - Casilla de Nombre ";
                    band4 = true;
                }

                if (!String.IsNullOrEmpty(text_apellido.Text))
                {
                    apellidos = text_apellido.Text;
                }
                else
                {
                    mensaje = mensaje + "\n - Casilla de Apellidos ";
                    band5 = true;
                }
                String combo = "Masculino";
                if (combo_sexo.SelectedIndex != 0)
                {
                    combo = "Femenino";
                }

                if (!String.IsNullOrEmpty(text_dni.Text))
                {
                    dni = text_dni.Text;
                }
                else
                {
                    mensaje = mensaje + "\n - Casilla de Dni ";
                    band6 = true;
                }

                if (!String.IsNullOrEmpty(text_direccion.Text))
                {
                    direccion = text_direccion.Text;
                }
                if (!String.IsNullOrEmpty(text_referencia.Text))
                {
                    referencia = text_referencia.Text;
                }
                if (!String.IsNullOrEmpty(text_movistar.Text))
                {
                    movistar = int.Parse(text_movistar.Text);
                }
                if (!String.IsNullOrEmpty(text_claro.Text))
                {
                    claro = int.Parse(text_claro.Text);
                }
                if (!String.IsNullOrEmpty(text_nextel.Text))
                {
                    nextel = int.Parse(text_nextel.Text);
                }
                if (!String.IsNullOrEmpty(text_telefono.Text))
                {
                    telefono = int.Parse(text_telefono.Text);
                }
                if (!String.IsNullOrEmpty(text_email.Text))
                {
                    email = text_email.Text;
                }
                if (!String.IsNullOrEmpty(text_facebook.Text))
                {
                    facebook = text_facebook.Text;
                }
                if (!String.IsNullOrEmpty(text_ocupacion.Text))
                {
                    ocupacion = text_ocupacion.Text;
                }
                if (band1 == true || band2 == true || band3 == true || band4 == true || band5 == true || band6 == true)
                {
                    MessageBox.Show(mensaje);
                }
                else
                {
                    int band = new NUsuario().N_Modificar_Usuario_perfil_admin(codigo, usuario, clave, nombre, apellidos, combo, dni, direccion, referencia, movistar, claro, nextel, telefono, email, facebook, ocupacion, tipo, estado,serie);
                    if (band == 0)
                    {
                        MessageBox.Show("Error Al Modificar Por favor intente nuevamente");
                    }
                    else
                    {
                        MessageBox.Show("Modificado Correctamente");
                        int ser = int.Parse(lb_serie.Text);
                        F_Login.perfil = new NUsuario().N_ver_Usuarioxserie(ser);
                        btn_modiperfil.Text = "Modificar Mi Perfil";
                        desactivar_cajas();
                        miperfil();

                    }
                }
                }
            else
            {
                activar_cajas();
                btn_modiperfil.Text = "Guardar";
            }
        }
Example #6
0
        public void boton_aceptar()
        {
            int serie = int.Parse(lb_serie.Text);
            Boolean band1 = false, band2 = false, band3 = false, band4 = false, band5 = false, band6 = false;
            String mensaje = "Por Favor Complete los campos obligatorios : \n";
            String codigo = "";
            String usuario = "";
            String clave = "";
            String nombre = "";
            String apellidos = "";
            String dni = "";
            String direccion = "";
            String referencia = "";
            int movistar = 0;
            int claro =0;
            int telefono = 0;
            int nextel = 0;
            String email = "";
            String facebook = "";
            String ocupacion = "";
            String estado = "activo";
            String tipo = "administrador";

            if (!String.IsNullOrEmpty(text_codigo.Text))
            {
                codigo = text_codigo.Text;
            }
            else
            {
                mensaje = mensaje + "\n - Casilla de Codigo ";
                band1 = true;

            }

            if (!String.IsNullOrEmpty(text_usuario.Text))
            {
                usuario = text_usuario.Text;
            }
            else
            {
                mensaje = mensaje + "\n - Casilla de Usuario ";
                band2 = true;
            }
            if (!String.IsNullOrEmpty(text_contrasena.Text))
            {
                clave = text_contrasena.Text;
            }
            else
            {
                mensaje = mensaje + "\n - Casilla de Contraseña \n";
                band3 = true;
            }

            if (!String.IsNullOrEmpty(text_nombre.Text))
            {
                nombre = text_nombre.Text;
            }
            else
            {
                mensaje = mensaje + "\n - Casilla de Nombre ";
                band4 = true;
            }

            if (!String.IsNullOrEmpty(text_apellido.Text))
            {
                apellidos = text_apellido.Text;
            }
            else
            {
                mensaje = mensaje + "\n - Casilla de Apellidos ";
                band5 = true;
            }
            String combo = "Masculino";
            if (combo_sexo.SelectedIndex != 0)
            {
                combo = "Femenino";
            }

            if (!String.IsNullOrEmpty(text_dni.Text))
            {
                dni = text_dni.Text;
            }
            else
            {
                mensaje = mensaje + "\n - Casilla de Dni ";
                band6 = true;
            }

            if (!String.IsNullOrEmpty(text_direccion.Text))
            {
                direccion = text_direccion.Text;
            }
            if (!String.IsNullOrEmpty(text_referencia.Text))
            {
                referencia = text_referencia.Text;
            }
            if (!String.IsNullOrEmpty(text_movistar.Text))
            {
                movistar = int.Parse(text_movistar.Text);
            }
            if (!String.IsNullOrEmpty(text_claro.Text))
            {
                claro = int.Parse(text_claro.Text);
            }
            if (!String.IsNullOrEmpty(text_nextel.Text))
            {
                nextel = int.Parse(text_nextel.Text);
            }
            if (!String.IsNullOrEmpty(text_telefono.Text))
            {
                telefono = int.Parse(text_telefono.Text);
            }
            if (!String.IsNullOrEmpty(text_email.Text))
            {
                email = text_email.Text;
            }
            if (!String.IsNullOrEmpty(text_facebook.Text))
            {
                facebook = text_facebook.Text;
            }
            if (!String.IsNullOrEmpty(text_ocupacion.Text))
            {
                ocupacion = text_ocupacion.Text;
            }
            if (band1 == true || band2 == true || band3 == true || band4 == true || band5 == true || band6 == true)
            {
                MessageBox.Show(mensaje);
            }
            else
            {
                int band = new NUsuario().N_Registrar_Usuario_admin(serie,codigo, usuario, clave, nombre, apellidos, combo, dni, direccion, referencia, movistar, claro, nextel, telefono, email, facebook, ocupacion, tipo, estado);
                if (band == 0)
                {
                    MessageBox.Show("Error Al Registrar Por favor intente nuevamente");
                }
                else
                {
                    MessageBox.Show("Registrado Correctamente");

                    F_Login login = new F_Login();
                    login.Show();
                    this.Hide();
                }
            }
        }
        private void boton_eliminar_Click(object sender, EventArgs e)
        {
            int serie = int.Parse(lb_serie.Text);
            if(MessageBox.Show("Seguro que dese Eliminar?", "Salir", MessageBoxButtons.YesNo) == DialogResult.Yes)
            {
                int band = new NUsuario().N_eliminar_usuario_voluntario(serie);
                if (band == 0)
                {
                    MessageBox.Show("Error Al Eliminar Por favor intente nuevamente");
                }
                else
                {
                    MessageBox.Show("Eliminado Correctamente");

                    combo_encargado();
                    restablecer_cajas();
                    Ver_serie();
                }
                listar_usuarios();
                combo_encargado();
            }
        }
        public void Registrar()
        {
            int serie = int.Parse(lb_serie.Text);
            Boolean band1 = false, band2 = false, band3 = false, band4 = false, band5 = false, band6 = false;
            String mensaje = "Por Favor Complete los campos obligatorios : \n";
            String codigo = "";
            String usuario = "";
            String clave = "";
            String nombre = "";
            String apellidos = "";
            String dni = "";
            String direccion = "";
            String referencia = "";
            int movistar = 0;
            int claro = 0;
            int telefono = 0;
            int nextel = 0;
            String email = "";
            String facebook = "";
            String ocupacion = "";

            if (!String.IsNullOrEmpty(text_codigo.Text))
            {
                codigo = text_codigo.Text;
            }
            else
            {
                mensaje = mensaje + "\n - Casilla de Codigo ";
                band1 = true;

            }
            if (radioacceso_afirma.Checked == true)
            {

                if (!String.IsNullOrEmpty(text_usuario.Text))
                {
                    usuario = text_usuario.Text;
                }
                else
                {
                    mensaje = mensaje + "\n - Casilla de Usuario ";
                    band2 = true;
                }

                if (!String.IsNullOrEmpty(text_contrasena.Text))
                {
                    clave = text_contrasena.Text;
                }
                else
                {
                    mensaje = mensaje + "\n - Casilla de Contraseña \n";
                    band3 = true;
                }

            }

            if (!String.IsNullOrEmpty(text_nombre.Text))
            {
                nombre = text_nombre.Text;
            }
            else
            {
                mensaje = mensaje + "\n - Casilla de Nombre ";
                band4 = true;
            }

            if (!String.IsNullOrEmpty(text_apellido.Text))
            {
                apellidos = text_apellido.Text;
            }
            else
            {
                mensaje = mensaje + "\n - Casilla de Apellidos ";
                band5 = true;
            }
            String sexo = combo_sexo.SelectedItem.ToString();

            String tipo = combo_tipo.SelectedItem.ToString();
            String estado = combo_estado.SelectedItem.ToString();

            Usuario encargo;
            if (radio_afirmativo.Checked == true)
            {
                encargo = (Usuario)combo_encar.SelectedItem;
            }
            else
            {
                encargo = null;
            }

            if (!String.IsNullOrEmpty(text_dni.Text))
            {
                dni = text_dni.Text;
            }
            else
            {
                mensaje = mensaje + "\n - Casilla de Dni ";
                band6 = true;
            }

            if (!String.IsNullOrEmpty(text_direccion.Text))
            {
                direccion = text_direccion.Text;
            }
            if (!String.IsNullOrEmpty(text_referencia.Text))
            {
                referencia = text_referencia.Text;
            }
            if (!String.IsNullOrEmpty(text_movistar.Text))
            {
                movistar = int.Parse(text_movistar.Text);
            }
            if (!String.IsNullOrEmpty(text_claro.Text))
            {
                claro = int.Parse(text_claro.Text);
            }
            if (!String.IsNullOrEmpty(text_nextel.Text))
            {
                nextel = int.Parse(text_nextel.Text);
            }
            if (!String.IsNullOrEmpty(text_telefono.Text))
            {
                telefono = int.Parse(text_telefono.Text);
            }
            if (!String.IsNullOrEmpty(text_email.Text))
            {
                email = text_email.Text;
            }
            if (!String.IsNullOrEmpty(text_facebook.Text))
            {
                facebook = text_facebook.Text;
            }
            if (!String.IsNullOrEmpty(text_ocupacion.Text))
            {
                ocupacion = text_ocupacion.Text;
            }
            //aqui
            if (band1 == true || band2 == true || band3 == true || band4 == true || band5 == true || band6 == true)
            {
                MessageBox.Show(mensaje);
            }
            else
            {
                if (radioacceso_afirma.Checked == true)
                {
                    int confir1 = new NUsuario().N_Registrar_Usuario_conacceso(serie,codigo, usuario, clave, nombre, apellidos, sexo, dni, direccion, referencia, movistar, claro, nextel, telefono, email, facebook, ocupacion, tipo, estado, encargo);
                    if (confir1 == 0)
                    {
                        MessageBox.Show("Error Al Registrar Por favor intente nuevamente");

                    }
                    else
                    {
                        MessageBox.Show("Registrado Correctamente");
                        Ver_serie();
                        combo_encargado();
                        restablecer_cajas();

                    }
                }
                else
                {
                    int confir2 = new NUsuario().N_Registrar_Usuario_sinacceso(serie,codigo, nombre, apellidos, sexo, dni, direccion, referencia, movistar, claro, nextel, telefono, email, facebook, ocupacion, tipo, estado, encargo);
                    if (confir2 == 0)
                    {
                        MessageBox.Show("Error Al Registrar Por favor intente nuevamente");

                    }
                    else
                    {
                        MessageBox.Show("Registrado Correctamente");
                        Ver_serie();
                        combo_encargado();
                        restablecer_cajas();

                    }
                }
                listar_usuarios();
                combo_encargado();
            }
        }
 public void listar_usuarios()
 {
     List<Usuario> lista = new NUsuario().N_listar_usuarios();
     grilla_usuarios.DataSource = lista;
     this.grilla_usuarios.Columns[4].Visible = false;
 }
Example #10
0
        private void btn_buscar_Click(object sender, EventArgs e)
        {
            text_nombre_rescatista.Clear();
            lb_id_usuario.Text = "";
            if (!String.IsNullOrEmpty(text_codigo.Text))
            {
                String cod = text_codigo.Text;
                Usuario u = new NUsuario().N_ver_Usuarioxcodigo(cod);
                if (u == null)
                {
                    MessageBox.Show("No se Encontro el Rescatista");
                    text_nombre_rescatista.Text = "";

                }
                else
                {
                    text_nombre_rescatista.Text = u.Nombres + " " + u.Apellidos;
                    lb_id_usuario.Text = "" + u.Serie;
                    MessageBox.Show("Busqueda Satisfatoria");
                }
            }
            else
            {
                MessageBox.Show("Por favor Ingrese el Codigo");
            }
        }