private bool Validar()
        {
            bool paso = true;

            MyErrorProvider.Clear();

            if (string.IsNullOrWhiteSpace(NombreTextBox.Text))
            {
                MyErrorProvider.SetError(NombreTextBox, "El campo Nombre no puede estar vacio");
                NombreTextBox.Focus();
                paso = false;
            }

            if (string.IsNullOrWhiteSpace(ApellidoTextBox.Text))
            {
                MyErrorProvider.SetError(ApellidoTextBox, "El campo Apellido no puede estar vacio");
                ApellidoTextBox.Focus();
                paso = false;
            }

            if (string.IsNullOrWhiteSpace(CedulaMaskedTextBox.Text))
            {
                MyErrorProvider.SetError(CedulaMaskedTextBox, "El campo Cedula no puede estar vacio");
                CedulaMaskedTextBox.Focus();
                paso = false;
            }

            if (string.IsNullOrWhiteSpace(MatriculaMaskedTextBox.Text))
            {
                MyErrorProvider.SetError(MatriculaMaskedTextBox, "El campo Matricula no puede estar vacio");
                MatriculaMaskedTextBox.Focus();
                paso = false;
            }

            if (string.IsNullOrWhiteSpace(TelefonoMaskedTextBox.Text))
            {
                MyErrorProvider.SetError(TelefonoMaskedTextBox, "El campo Telefono no puede estar vacio");
                TelefonoMaskedTextBox.Focus();
                paso = false;
            }

            if (string.IsNullOrWhiteSpace(CelularMaskedTextBox.Text))
            {
                MyErrorProvider.SetError(CelularMaskedTextBox, "El campo Celular no puede estar vacio");
                CelularMaskedTextBox.Focus();
                paso = false;
            }

            if (string.IsNullOrWhiteSpace(SexoComboBox.Text))
            {
                MyErrorProvider.SetError(SexoComboBox, "El campo Sexo no puede estar vacio");
                SexoComboBox.Focus();
                paso = false;
            }


            return(paso);
        }
Beispiel #2
0
        private bool Validar()
        {
            bool paso = true;

            if (string.IsNullOrWhiteSpace(NombreTextBox.Text))
            {
                MyErrorProvider.SetError(NombreTextBox, "El campo Nombres no puede estar vacio.");
                NombreTextBox.Focus();
                paso = false;
            }

            if (string.IsNullOrWhiteSpace(ApellidoTextBox.Text))
            {
                MyErrorProvider.SetError(ApellidoTextBox, "El campo Apellidos no puede estar vacio.");
                ApellidoTextBox.Focus();
                paso = false;
            }

            if (string.IsNullOrWhiteSpace(TelefonoMaskedTextBox.Text.Replace("-", "")))
            {
                MyErrorProvider.SetError(TelefonoMaskedTextBox, "El campo Telefono no puede estar vacio.");
                TelefonoMaskedTextBox.Focus();
                paso = false;
            }

            if (string.IsNullOrWhiteSpace(CelularMaskedTextBox.Text.Replace("-", "")))
            {
                MyErrorProvider.SetError(CelularMaskedTextBox, "El campo Celular no puede estar vacio.");
                CelularMaskedTextBox.Focus();
                paso = false;
            }

            if (string.IsNullOrWhiteSpace(RncTextBox.Text))
            {
                MyErrorProvider.SetError(RncTextBox, "El campo Rnc no puede estar vacio.");
                RncTextBox.Focus();
                paso = false;
            }

            if (string.IsNullOrWhiteSpace(EmailTextBox.Text))
            {
                MyErrorProvider.SetError(EmailTextBox, "El campo Email no puede estar vacio.");
                EmailTextBox.Focus();
                paso = false;
            }

            if (string.IsNullOrWhiteSpace(DireccionTextBox.Text))
            {
                MyErrorProvider.SetError(DireccionTextBox, "El campo Direccion no puede estar vacio.");
                DireccionTextBox.Focus();
                paso = false;
            }

            return(paso);
        }
Beispiel #3
0
        public bool Validar()
        {
            MyErrorProvider.Clear();
            bool paso = true;

            if (string.IsNullOrWhiteSpace(NombreTextBox.Text))
            {
                MyErrorProvider.SetError(NombreTextBox, "El campo nombre no puede estar vacio");
                NombreTextBox.Focus();
                paso = false;
            }

            if (string.IsNullOrWhiteSpace(ApellidoTextBox.Text))
            {
                MyErrorProvider.SetError(ApellidoTextBox, "El campo apellido no puede estar vacio");
                ApellidoTextBox.Focus();
                paso = false;
            }

            if (string.IsNullOrWhiteSpace(CedulaMaskedTextBox.Text))
            {
                MyErrorProvider.SetError(CedulaMaskedTextBox, "El campo cedula no puede estar vacio");
                CedulaMaskedTextBox.Focus();
                paso = false;
            }

            if (string.IsNullOrWhiteSpace(DireccionTextBox.Text))
            {
                MyErrorProvider.SetError(DireccionTextBox, "El campo direccion no puede estar vacio");
                DireccionTextBox.Focus();
                paso = false;
            }

            if (string.IsNullOrWhiteSpace(TelefonoMaskedTextBox.Text))
            {
                MyErrorProvider.SetError(TelefonoMaskedTextBox, "El campo telefono no puede estar vacio");
                TelefonoMaskedTextBox.Focus();
                paso = false;
            }
            return(paso);
        }
Beispiel #4
0
        private bool Validar()
        {
            bool paso = true;

            MyErrorProvider.Clear();
            if (NombreTextBox.Text == string.Empty)
            {
                MyErrorProvider.SetError(NombreTextBox, "El campo \"Nombre\" no puede estar vacio");
                NombreTextBox.Focus();
                paso = false;
            }

            if (ApellidoTextBox.Text == string.Empty)
            {
                MyErrorProvider.SetError(ApellidoTextBox, "El campo \"Apellido\" no puede estar vacio");
                ApellidoTextBox.Focus();
                paso = false;
            }

            if (AdministradorRadioButton.Checked == false && SupervisorRadioButton.Checked == false && SoporteRadioButton.Checked == false && UsuarioRadioButton.Checked == false)
            {
                MyErrorProvider.SetError(NivelDeUsuarioGroupBox, "Debe elegir un tipo de usuario");
                NivelDeUsuarioGroupBox.Focus();
                paso = false;
            }

            if (string.IsNullOrWhiteSpace(UsuarioTextBox.Text))
            {
                MyErrorProvider.SetError(UsuarioTextBox, "El campo \"Usuario\" no puede estar vacio y/o tener espacio");
                UsuarioTextBox.Focus();
                paso = false;
            }

            if (string.IsNullOrWhiteSpace(ClaveTextBox.Text))
            {
                MyErrorProvider.SetError(ClaveTextBox, "El campo \"Clave\" no puede estar vacio y/o tener espacio");
                ClaveTextBox.Focus();
                paso = false;
            }
            return(paso);
        }
        private void GuardarButton_Click(object sender, RoutedEventArgs e)
        {
            bool paso = false;
            {
                if (!Validar())
                {
                    return;
                }
                if (ClienteIdTextBox.Text.Trim() == string.Empty)
                {
                    MessageBox.Show("El Campo (Cliente Id) está vacío.\n\nAsigne un Id al Cliente.", "Advertencia", MessageBoxButton.OK, MessageBoxImage.Warning);
                    ClienteIdTextBox.Text = "0";
                    ClienteIdTextBox.Focus();
                    ClienteIdTextBox.SelectAll();
                    return;
                }
                if (UsuarioIdComboBox.Text == string.Empty)
                {
                    MessageBox.Show("El Campo (Usuario Id) está vacío.\n\nPorfavor, Seleccione su Nombre de Usuario.", "Advertencia", MessageBoxButton.OK, MessageBoxImage.Warning);
                    UsuarioIdComboBox.IsDropDownOpen = true;
                    return;
                }
                if (NombresTextBox.Text.Trim() == string.Empty)
                {
                    MessageBox.Show("El Campo (Nombres) está vacío.\n\nAsigne un Nombre al Cliente.", "Advertencia", MessageBoxButton.OK, MessageBoxImage.Warning);
                    NombresTextBox.Clear();
                    NombresTextBox.Focus();
                    return;
                }

                if (ApellidoTextBox.Text.Trim() == string.Empty)
                {
                    MessageBox.Show("El Campo (Apellidos) está vacío.\n\nAsigne un Apellidos al Cliente.", "Advertencia", MessageBoxButton.OK, MessageBoxImage.Warning);
                    ApellidoTextBox.Clear();
                    ApellidoTextBox.Focus();
                    return;
                }

                if (CedulaTextBox.Text.Trim() == string.Empty)
                {
                    MessageBox.Show("El Campo (Cédula) está vacío.\n\nAsigne una Cedula al Cedula.", "Advertencia", MessageBoxButton.OK, MessageBoxImage.Warning);
                    CedulaTextBox.Text = "0";
                    CedulaTextBox.Focus();
                    CedulaTextBox.SelectAll();
                    return;
                }
                if (CedulaTextBox.Text.Length != 11)
                {
                    MessageBox.Show($"La Cédula ({CedulaTextBox.Text}) no es válida.\n\nLa cedula debe tener 11 dígitos (0-9).", "Advertencia", MessageBoxButton.OK, MessageBoxImage.Warning);
                    CedulaTextBox.Focus();
                    return;
                }

                if (FemeninoRadioButton.IsChecked.Value == false && MasculinoRadioButton.IsChecked.Value == false)
                {
                    MessageBox.Show("El Campo (Género) está vacío.\n\nAsigne un Genero al Cliente.", "Advertencia", MessageBoxButton.OK, MessageBoxImage.Warning);
                    FemeninoRadioButton.Focus();
                    return;
                }

                if (TelefonoTextBox.Text.Trim() == string.Empty)
                {
                    MessageBox.Show("El Campo (Teléfono) está vacío.\n\nAsigne un Teléfono al Cliente.", "Advertencia", MessageBoxButton.OK, MessageBoxImage.Warning);
                    TelefonoTextBox.Text = "0";
                    TelefonoTextBox.Focus();
                    TelefonoTextBox.SelectAll();
                    return;
                }
                if (TelefonoTextBox.Text.Length != 10)
                {
                    MessageBox.Show($"El Teféfono ({TelefonoTextBox.Text}) no es válido.\n\nEl Teléfono debe tener 10 dígitos (0-9).", "Advertencia", MessageBoxButton.OK, MessageBoxImage.Warning);
                    TelefonoTextBox.Focus();
                    return;
                }

                if (FechaDatePicker.Text.Trim() == string.Empty)
                {
                    MessageBox.Show("El Campo (Fecha Nacimiento) está vacío.\n\nAsigne una Fecha de Nacimiento al Nacimiento.", "Advertencia", MessageBoxButton.OK, MessageBoxImage.Warning);
                    FechaDatePicker.Focus();
                    return;
                }

                if (DireccionTextBox.Text.Trim() == string.Empty)
                {
                    MessageBox.Show("El Campo (Dirección) está vacío.\n\nAsigne una Dirección al Cliente.", "Advertencia", MessageBoxButton.OK, MessageBoxImage.Warning);
                    DireccionTextBox.Clear();
                    DireccionTextBox.Focus();
                    return;
                }
                if (CelularTextBox.Text.Trim() == string.Empty)
                {
                    MessageBox.Show("El Campo (Teléfono) está vacío.\n\nAsigne un Teléfono al Cliente.", "Advertencia", MessageBoxButton.OK, MessageBoxImage.Warning);
                    CelularTextBox.Text = "0";
                    CelularTextBox.Focus();
                    CelularTextBox.SelectAll();
                    return;
                }
                if (CelularTextBox.Text.Length != 10)
                {
                    MessageBox.Show($"El Celular ({CelularTextBox.Text}) no es válido.\n\nEl Celular debe tener 10 dígitos (0-9).", "Advertencia", MessageBoxButton.OK, MessageBoxImage.Warning);
                    CelularTextBox.Focus();
                    return;
                }

                if (EmailTextBox.Text.Trim() == string.Empty)
                {
                    MessageBox.Show("El Campo (Email) está vacío.\n\nAsigne una Correo al Cliente.", "Advertencia", MessageBoxButton.OK, MessageBoxImage.Warning);
                    EmailTextBox.Clear();
                    EmailTextBox.Focus();
                    return;
                }

                if (EstadoCivilTextBox.Text.Trim() == string.Empty)
                {
                    MessageBox.Show("El Campo (Estado Civil) está vacío.\n\nAsigne un Estado Civil al Cliente.", "Advertencia", MessageBoxButton.OK, MessageBoxImage.Warning);
                    EstadoCivilTextBox.Clear();
                    EstadoCivilTextBox.Focus();
                    return;
                }
                if (OcupacionTextBox.Text.Trim() == string.Empty)
                {
                    MessageBox.Show("El Campo (Nombres) está vacío.\n\nAsigne un Nombre al Cliente.", "Advertencia", MessageBoxButton.OK, MessageBoxImage.Warning);
                    OcupacionTextBox.Clear();
                    OcupacionTextBox.Focus();
                    return;
                }
                if (ReligionTextBox.Text.Trim() == string.Empty)
                {
                    MessageBox.Show("El Campo (Nombres) está vacío.\n\nAsigne un Nombre al Cliente.", "Advertencia", MessageBoxButton.OK, MessageBoxImage.Warning);
                    ReligionTextBox.Clear();
                    ReligionTextBox.Focus();
                    return;
                }



                if (!editando)
                {
                    paso = ClientesBLL.Guardar(clientes);
                }
                else
                {
                    paso = ClientesBLL.Modificar(clientes);
                }

                if (paso)
                {
                    Limpiar();
                    MessageBox.Show("Transacción Exitosa", "Éxito", MessageBoxButton.OK, MessageBoxImage.Information);
                }
                else
                {
                    MessageBox.Show("Transacción Fallida", "Error", MessageBoxButton.OK, MessageBoxImage.Error);
                }
            }
        }
Beispiel #6
0
        private bool Validar()
        {
            bool paso = true;

            MyerrorProvider.Clear();

            if (string.IsNullOrWhiteSpace(MatriculamaskedTextBox.Text.Replace("-", "")))
            {
                MyerrorProvider.SetError(MatriculamaskedTextBox, "El campo Matricula no puede estar vacio");
                MatriculamaskedTextBox.Focus();
                paso = false;
            }

            if (string.IsNullOrWhiteSpace(NombreTextBox.Text))
            {
                MyerrorProvider.SetError(NombreTextBox, "El campo Nombre no puede estar vacio");
                NombreTextBox.Focus();
                paso = false;
            }

            if (string.IsNullOrWhiteSpace(ApellidoTextBox.Text))
            {
                MyerrorProvider.SetError(ApellidoTextBox, "El campo Apellido no puede estar vacio");
                ApellidoTextBox.Focus();
                paso = false;
            }

            if (string.IsNullOrWhiteSpace(CedulamaskedTextBox.Text.Replace("-", "")))
            {
                MyerrorProvider.SetError(CedulamaskedTextBox, "El campo Cedula no puede estar vacio");
                CedulamaskedTextBox.Focus();
                paso = false;
            }

            if (string.IsNullOrWhiteSpace(TelefonomaskedTextBox.Text.Replace("-", "")))
            {
                MyerrorProvider.SetError(TelefonomaskedTextBox, "El campo Telefono no puede estar vacio");
                TelefonomaskedTextBox.Focus();
                paso = false;
            }

            if (string.IsNullOrWhiteSpace(CelularmaskedTextBox.Text.Replace("-", "")))
            {
                MyerrorProvider.SetError(CelularmaskedTextBox, "El campo Celular no puede estar vacio");
                CelularmaskedTextBox.Focus();
                paso = false;
            }

            if (string.IsNullOrWhiteSpace(EmailTextBox.Text))
            {
                MyerrorProvider.SetError(EmailTextBox, "El campo Email no puede estar vacio");
                EmailTextBox.Focus();
                paso = false;
            }

            if (string.IsNullOrWhiteSpace(FechaNacimientoDateTimePicker.Text))
            {
                MyerrorProvider.SetError(FechaNacimientoDateTimePicker, "El campo Fecha de nacimiento no puede estar vacio");
                FechaNacimientoDateTimePicker.Focus();
                paso = false;
            }

            if (string.IsNullOrWhiteSpace(SexoComboBox.Text))
            {
                MyerrorProvider.SetError(SexoComboBox, "El campo Sexo no puede estar vacio");
                SexoComboBox.Focus();
                paso = false;
            }

            return(paso);
        }