///---------------
 private void limpiarErroresProvider()
 {
     BuscarerrorProvider1.Clear();
     NombreerrorProvider2.Clear();
     CedulamaskedTextBox.Clear();
     SexoerrorProvider1.Clear();
     CiudaderrorProvider7.Clear();
     DirrecionerrorProvider8.Clear();
     TelefonoerrorProvider9.Clear();
     CelularerrorProvider10.Clear();
 }
 private bool validarId(string message)
 {
     if (string.IsNullOrEmpty(UsuarioIdtextBox.Text))
     {
         BuscarerrorProvider1.SetError(UsuarioIdtextBox, "Por Favor Ingresar Id");
         MessageBox.Show(message);
         return(false);
     }
     else
     {
         return(true);
     }
 }
        private bool validar()
        {
            UtilidadesInt ut = new UtilidadesInt();

            if (FiltrarcomboBox.SelectedIndex == 4)
            {
                if (DesdeDateTimePicke.Value == HastadateTimePicker.Value)
                {
                    MessageBox.Show("Favor definir un intervalo diferente entre las dos fechas");
                    return(false);
                }
                else
                {
                    return(true);
                }
            }
            if (string.IsNullOrEmpty(FiltrotextBox.Text))
            {
                BuscarerrorProvider1.SetError(FiltrotextBox, "Ingresar el campo que desea filtar");
                return(false);
            }


            if (FiltrarcomboBox.SelectedIndex == 1 && ClientesBLL.GetListaNombreCliente(FiltrotextBox.Text).Count == 0)
            {
                MessageBox.Show("No hay registros que coincidan con este campo de filtro..." + "\n" + "\n" + "Intente con otro campo");
                return(false);
            }
            if (FiltrarcomboBox.SelectedIndex == 2 && ClientesBLL.GetListaCedula(FiltrotextBox.Text).Count == 0)
            {
                MessageBox.Show("No hay registros que coincidan con este campo de filtro..." + "\n" + "\n" + "Intente con otro campo");
                return(false);
            }
            if (FiltrarcomboBox.SelectedIndex == 3 && ClientesBLL.GetListaSexo(FiltrotextBox.Text).Count == 0)
            {
                MessageBox.Show("No hay registros que coincidan con este campo de filtro..." + "\n" + "\n" + "Intente con otro campo");
                return(false);
            }

            if (FiltrarcomboBox.SelectedIndex == 0 && ClientesBLL.GetLista(ut.StringInt(FiltrotextBox.Text)).Count == 0)
            {
                MessageBox.Show("No hay registros que coincidan con este campo de filtro..." + "\n" + "\n" + "Intente con otro campo");
                return(false);
            }

            BuscarerrorProvider1.Clear();


            return(true);
        }
        private void Guardarbutton_Click(object sender, EventArgs e)
        {
            Clientes cliente = new Clientes();

            BuscarerrorProvider1.Clear();
            LlenarClase(cliente);
            if (ValidarTextbox() && ValidarExiste(CedulamaskedTextBox.Text))
            {
                ClientesBLL.Insertar(cliente);
                Limpiar();
                limpiarErroresProvider();
                MessageBox.Show("-_-Guardado Con Exito-_-");
            }
        }
        //--
        //Botton De Guardar Usuario
        private void Guardarbutton_Click(object sender, EventArgs e)
        {
            Usuarios usuario = new Usuarios();

            BuscarerrorProvider1.Clear();
            LlenarClase(usuario);
            CargarConboBox();
            if (ValidarTextbox() && ValidarExiste(NombreUsuariostextBox.Text))
            {
                UsuariosBLL.Insertar(usuario);
                Limpiar();
                MessageBox.Show("Guardado con exito");
            }
        }