Пример #1
0
        private void btnEliminar_Click(object sender, EventArgs e)
        {
            //eliminar cliente

            try
            {
                string txtCodigo = this.txtCod.Text;


                if (this.txtCod.Text == string.Empty)
                {
                    mensajeError("Error seleccione un CLIENTE a eliminar");
                }

                else
                {
                    Cusuario eliminar01 = new Cusuario();
                    eliminar01.eliminarUsuario(Convert.ToInt32(txtCod.Text));


                    mensajeOK("DATO ELIMINADO CORRECTAMENTE!");
                    listarUsuarios();
                }
            }
            catch (Exception ev)
            {
                MessageBox.Show(ev.Message);
            }
        }
Пример #2
0
 private void btnBuscar_Click(object sender, EventArgs e)
 {
     try
     {
         if (txtCod.Text == string.Empty)
         {
             Cusuario buscar01 = new Cusuario();
             tblUsuario.DataSource = buscar01.buscarUsuario(txtBuscar.Text);
         }
     }
     catch (Exception ev)
     {
         MessageBox.Show(ev.Message);
     }
 }
Пример #3
0
        private void btnGuardar_Click(object sender, EventArgs e)
        {
            //validacion del checkbox

            if (rbtnMasculino.Checked || rbtnFemenino.Checked)
            {
                if (rbtnMasculino.Checked)
                {
                    sexo = "M";
                }
                if (rbtnFemenino.Checked)
                {
                    sexo = "F";
                }



                //validacion de campos vacios

                if (txtDocumento.Text == string.Empty || txtDireccion.Text == string.Empty || txtApellidos.Text == string.Empty ||
                    txtEmail.Text == string.Empty || txtNombres.Text == string.Empty || txtPassword.Text == string.Empty ||
                    txtTelefono.Text == string.Empty)
                {
                    mensajeError("Todos los campos deben ser completados");
                }
                else
                {
                    //Agrega un usuario

                    Cusuario agregar01 = new Cusuario();
                    agregar01.insertarUsuario(txtNombres.Text, txtApellidos.Text, sexo, txtDocumento.Text, txtDireccion.Text, txtTelefono.Text, txtEmail.Text, txtPassword.Text);
                    mensajeOK("DATOS AGREGADOS CORRECTAMENTE!");
                    listarUsuarios();
                    limpiarCampos();
                }
            }
            else
            {
                mensajeError("Seleccione el SEXO");
            }
        }
Пример #4
0
        private void btnActualizar_Click(object sender, EventArgs e)
        {
            //validacion del checkbox

            if (rbtnMasculino.Checked || rbtnFemenino.Checked)
            {
                if (rbtnMasculino.Checked)
                {
                    sexo = "M";
                }
                if (rbtnFemenino.Checked)
                {
                    sexo = "F";
                }



                //validacion de campos vacios

                if (txtDocumento.Text == string.Empty || txtDireccion.Text == string.Empty || txtApellidos.Text == string.Empty ||
                    txtEmail.Text == string.Empty || txtNombres.Text == string.Empty || txtPassword.Text == string.Empty ||
                    txtTelefono.Text == string.Empty || txtCod.Text == string.Empty)
                {
                    mensajeError("No seleccionaste una fila");
                }
                else
                {
                    //Actualizar un usuario

                    Cusuario actualizar01 = new Cusuario();
                    actualizar01.actualizarUsuario(txtNombres.Text, txtApellidos.Text, sexo, txtDocumento.Text, txtDireccion.Text, txtTelefono.Text, txtEmail.Text, txtPassword.Text, Convert.ToInt32(txtCod.Text));
                    mensajeOK("DATOS ACTUALIZADOS CORRECTAMENTE!");
                    listarUsuarios();
                    limpiarCampos();
                }
            }
            else
            {
                mensajeError("Seleccione el SEXO");
            }
        }
Пример #5
0
        public void listarUsuarios()
        {
            Cusuario listar01 = new Cusuario();

            tblUsuario.DataSource = listar01.listarUsuarios();
        }