コード例 #1
0
        private bool Validar()
        {
            bool paso = true;

            if (string.IsNullOrEmpty(UsuarioIdTextBox.Text))
            {
                paso = false;
                UsuarioIdTextBox.Focus();
            }

            if (string.IsNullOrEmpty(TotalTextBox.Text))
            {
                paso = false;
                TotalTextBox.Focus();
            }

            if (string.IsNullOrEmpty(SubTotalTextBox.Text))
            {
                paso = false;
                SubTotalTextBox.Focus();
            }


            if (string.IsNullOrEmpty(DescuentoTextBox.Text))
            {
                paso = false;
                DescuentoTextBox.Focus();
            }

            if (string.IsNullOrEmpty(ITBISTextBox.Text))
            {
                paso = false;
                ITBISTextBox.Focus();
            }

            if (string.IsNullOrEmpty(SubTotalTextBox.Text))
            {
                paso = false;
                SubTotalTextBox.Focus();
            }

            if (string.IsNullOrEmpty(FechaDeCompraTimePicker.Text))
            {
                paso = false;
                FechaDeCompraTimePicker.Focus();
            }


            if (string.IsNullOrEmpty(SuplidorIdTextbox.Text))
            {
                paso = false;
                SuplidorIdTextbox.Focus();
            }

            if (string.IsNullOrEmpty(CompraIDTextBox.Text))
            {
                paso = false;
                CompraIDTextBox.Focus();
            }

            if (this.Detalle.Count == 0)
            {
                MessageBox.Show("La Compra debe tener un producto", "Error", MessageBoxButton.OK, MessageBoxImage.Error);
                paso = false;
            }
            return(paso);
        }
コード例 #2
0
        private bool Validar()
        {
            bool paso = true;

            MyErrorProvider.Clear();
            if (string.IsNullOrWhiteSpace(PacienteComboBox.Text))
            {
                MyErrorProvider.SetError(PacienteComboBox, "El campo Paciente no puede estar vacio");
                PacienteComboBox.Focus();
                paso = false;
            }
            if (string.IsNullOrWhiteSpace(OdontologoComboBox.Text))
            {
                MyErrorProvider.SetError(OdontologoComboBox, "El campo Odontologo no puede estar vacio");
                OdontologoComboBox.Focus();
                paso = false;
            }
            if (FechaConsultaProximaDateTimePicker.Value < FechaActualDateTimePicker.Value)
            {
                MyErrorProvider.SetError(FechaConsultaProximaDateTimePicker, "El campo FechaConsultaProxima no puede tener una fecha anterior a fecha actual");
                FechaConsultaProximaDateTimePicker.Focus();
                paso = false;
            }
            if (SubTotalTextBox.Text == string.Empty)
            {
                MyErrorProvider.SetError(SubTotalTextBox, "El Subtotal no puede estar vacio");
                SubTotalTextBox.Focus();
                paso = false;
            }
            if (ItibisTextBox.Text == string.Empty)
            {
                MyErrorProvider.SetError(ItibisTextBox, "El Itbis no puede estar vacio");
                ItibisTextBox.Focus();
                paso = false;
            }
            if (TotalTextBox.Text == string.Empty)
            {
                MyErrorProvider.SetError(TotalTextBox, "El Total no puede estar vacio");
                TotalTextBox.Focus();
                paso = false;
            }
            if (string.IsNullOrWhiteSpace(DiagnosticoTextBox.Text))
            {
                MyErrorProvider.SetError(DiagnosticoTextBox, "El Diagnostico no puede estar vacio");
                TotalTextBox.Focus();
                paso = false;
            }
            if (string.IsNullOrWhiteSpace(ObservacionTextBox.Text))
            {
                MyErrorProvider.SetError(ObservacionTextBox, "La Observacion no puede estar vacio");
                ObservacionTextBox.Focus();
                paso = false;
            }
            if (string.IsNullOrWhiteSpace(TratamientoTextBox.Text))
            {
                MyErrorProvider.SetError(TratamientoTextBox, "El Tratamiento no puede estar vacio");
                TratamientoTextBox.Focus();
                paso = false;
            }
            return(paso);
        }