예제 #1
0
        private bool Validar()
        {
            MyErrorProvider.Clear();
            bool paso = true;

            if (EstadoComboBox.SelectedIndex < 0)
            {
                MyErrorProvider.SetError(EstadoComboBox, "Debe seleccionar un estado");
                EstadoComboBox.Focus();
                paso = false;
            }
            if (TipoProcedimientoComboBox.SelectedIndex < 0)
            {
                MyErrorProvider.SetError(TipoProcedimientoComboBox, "Debe haber un procedimiento seleccionado");
                TipoProcedimientoComboBox.Focus();
                paso = false;
            }

            if (this.Detalle.Count == 0)
            {
                MyErrorProvider.SetError(DetalleDataGridView, "Debe agregar algun elemento al Detalle");
                AgregarButton.Focus();
                paso = false;
            }

            return(paso);
        }
        private bool ValidarDetalle()
        {
            bool paso = true;

            if (string.IsNullOrWhiteSpace(AgregarButton.Text))
            {
                MyErrorProvider.SetError(AgregarButton, "Tiene que agregar algo");
                AgregarButton.Focus();
                paso = false;
            }
            return(paso);
        }
예제 #3
0
        private bool Validar()
        {
            bool paso = true;

            if (OrdenId_Text.Text == string.Empty)
            {
                MessageBox.Show("OrdenId Vacio");
                OrdenId_Text.Focus();
                paso = false;
            }
            else if (ClienteId_Text.Text == string.Empty)
            {
                MessageBox.Show("ClienteId Vacio");
                ClienteId_Text.Focus();
                paso = false;
            }
            else if (NombreCliente_Text.Text == string.Empty)
            {
                MessageBox.Show("Nombre del Cliente Vacio");
                paso = false;
            }
            else if (Fecha_Text.Text == string.Empty)
            {
                MessageBox.Show("Fecha Vacia");
                Fecha_Text.Focus();
                paso = false;
            }
            else if (MontoTotal_Text.Text == "0")
            {
                MessageBox.Show("Debe Agregar un producto");
                ProductoId_Text.Focus();
                paso = false;
            }
            else if (OrdenDetalleDataGrid.DataContext == null)
            {
                MessageBox.Show("Debe Agregar una orden");
                AgregarButton.Focus();
                paso = false;
            }

            return(paso);
        }
        public bool validar() //validar los campos del registro
        {
            bool paso = true;

            if (this.detalle.Count == 0)
            {
                MyErrorProvider.SetError(AgregarButton, "Debe por lo menos agregar un estudiante");
                AgregarButton.Focus();
                paso = false;
            }

            if (string.IsNullOrWhiteSpace(AsignaturaComboBox.Text))
            {
                MyErrorProvider.SetError(AsignaturaButton, "Debe por lo menos agregar una asignatura");
                AsignaturaButton.Focus();
                paso = false;
            }

            return(paso);
        }