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

            MyErrorProvider.Clear();

            if (string.IsNullOrWhiteSpace(EstudiantecomboBox.Text))
            {
                MyErrorProvider.SetError(EstudiantecomboBox, "Tiene que haber Estudiante");
                EstudiantecomboBox.Focus();
                paso = false;
            }

            if (CostoCreditosnumericUpDown.Value == 0)
            {
                MyErrorProvider.SetError(CostoCreditosnumericUpDown, "No puede estar en 0");
                CostoCreditosnumericUpDown.Focus();
                paso = false;
            }

            if (FechadateTimePicker.Value > DateTime.Now)
            {
                MyErrorProvider.SetError(FechadateTimePicker, "La fecha no puede ser despues de hoy");
                FechadateTimePicker.Focus();
                paso = false;
            }

            if (Detalle.Count == 0)
            {
                MyErrorProvider.SetError(AsignaturacomboBox, "Agregue al Grid");
                AsignaturacomboBox.Focus();
                paso = false;
            }
            return(paso);
        }
예제 #2
0
        private bool Validar()
        {
            bool realizado = true;

            errorProvider.Clear();

            if (string.IsNullOrWhiteSpace(IDnumericUpDown.Text))
            {
                errorProvider.SetError(IDnumericUpDown, "EL CAMPO ID NO PUEDE ESTAR VACIO");
                IDnumericUpDown.Focus();
                realizado = false;
            }

            if (string.IsNullOrWhiteSpace(CantidadtextBox.Text))
            {
                errorProvider.SetError(IDnumericUpDown, "EL CAMPO CANTIDAD NO PUEDE ESTAR VACIO");
                CantidadtextBox.Focus();
                realizado = false;
            }

            if (this.DetalleEstudiantes.Count == 0)
            {
                errorProvider.SetError(dataGridView, "Debe agregar algun estudiante");
                EstudiantecomboBox.Focus();
                realizado = false;
            }

            return(realizado);
        }
        private void AgregarAsistenciabutton_Click(object sender, EventArgs e)
        {
            if (AsistenciasdataGridView.DataSource != null)
            {
                this.Detalle = (List <EstudiantesDetalle>)AsistenciasdataGridView.DataSource;
            }

            if (!ValidarCamposDetalle())
            {
                return;
            }

            this.Detalle.Add(
                new EstudiantesDetalle(
                    EstudianteId: 0,
                    Nombre: EstudiantecomboBox.Text,
                    Presente: PresentecheckBox.Checked,
                    AsistenciaId: (int)AsistenciaIdnumericUpDown.Value
                    )
                );

            CantidadtextBox.Text = Convert.ToString(Convert.ToInt32(CantidadtextBox.Text) + 1);

            CargarGrid();
            EstudiantecomboBox.Text  = string.Empty;
            PresentecheckBox.Checked = false;
            EstudiantecomboBox.Focus();
        }
예제 #4
0
        private bool Validar()
        {
            bool paso = true;

            MyerrorProvider.Clear();

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

            if (MontoCreditosnumericUpDown.Value == 0)
            {
                MyerrorProvider.SetError(MontoCreditosnumericUpDown, "El Monto de los creditos no puede estar ser 0");
                MontoCreditosnumericUpDown.Focus();
                paso = false;
            }

            if (Detalle.Count == 0)
            {
                MyerrorProvider.SetError(AsignaturacomboBox, "La inscripcion por lo menos debe tener una asignatura");
                AsignaturacomboBox.Focus();
                paso = false;
            }
            return(paso);
        }
예제 #5
0
        private bool ValidoAgregar()
        {
            bool paso = true;

            MyError.Clear();

            if (EstudiantecomboBox.SelectedIndex == -1)
            {
                MyError.SetError(EstudiantecomboBox, "Debe elegir al menos un estudiante");
                EstudiantecomboBox.Focus();
                paso = false;
            }
            if (EstudiantecomboBox.Text == string.Empty)
            {
                MyError.SetError(EstudiantecomboBox, "Debe elegir al menos un estudiante");
                EstudiantecomboBox.Focus();
                paso = false;
            }

            if (paso)
            {
                foreach (var objeto in this.Detalles)
                {
                    if (objeto.EstudianteID == (int)(EstudiantecomboBox.SelectedValue))
                    {
                        MyError.SetError(EstudiantecomboBox, "Ya existe un estudiante");
                        EstudiantecomboBox.Focus();
                        return(paso = false);
                    }
                }
            }

            return(paso);
        }
예제 #6
0
        private bool Validar()
        {
            bool paso = true;

            MyErrorProvider.Clear();

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

            if (MontonumericUpDown.Value == 0)
            {
                MyErrorProvider.SetError(MontonumericUpDown, "Este campo no puede estar vacio");
                MontonumericUpDown.Focus();
                paso = false;
            }

            if (Detalle.Count == 0)
            {
                MyErrorProvider.SetError(AsignaturacomboBox, "Este campo no puede estar vacio");
                AsignaturacomboBox.Focus();
                paso = false;
            }
            return(paso);
        }
        private bool ValidarCamposDetalle()
        {
            bool paso = true;

            if (EstudiantecomboBox.Text == string.Empty)
            {
                MyerrorProvider.SetError(EstudiantecomboBox, "Debe seleccionar un estudiante");
                EstudiantecomboBox.Focus();
                paso = false;
            }

            return(paso);
        }
예제 #8
0
        private bool validar()
        {
            bool paso = true;

            if (string.IsNullOrWhiteSpace(IdnumericUpDown1.Text))
            {
                MyerrorProvider.SetError(IdnumericUpDown1, "El campo no debe estar vacio");
                IdnumericUpDown1.Focus();
                paso = false;
            }
            if (string.IsNullOrWhiteSpace(PrestamoIdnumericUpDown1.Text))
            {
                MyerrorProvider.SetError(PrestamoIdnumericUpDown1, "Tiene que buscar el id del prestamo donde se encuentra el libro");
                PrestamoIdnumericUpDown1.Focus();
                paso = false;
            }
            if (string.IsNullOrWhiteSpace(EstudiantecomboBox.Text))
            {
                MyerrorProvider.SetError(EstudiantecomboBox, "Seleccione un estudiante que devolvera el libro");
                EstudiantecomboBox.Focus();
                paso = false;
            }
            if (string.IsNullOrWhiteSpace(LibrocomboBox.Text))
            {
                MyerrorProvider.SetError(LibrocomboBox, "Seleccione el libro a devolver");
                LibrocomboBox.Focus();
                paso = false;
            }
            if (!DisponiblecheckBox.Checked)
            {
                MyerrorProvider.SetError(DisponiblecheckBox, "Marque el libro como disponible");
                DisponiblecheckBox.Focus();
                paso = false;
            }
            if (this.Detalles.Count == 0)
            {
                MyerrorProvider.SetError(MydataGridView, "Debe Agregar alguna devolucion");
                EstudiantecomboBox.Focus();
                EstudiantecomboBox.Focus();
                paso = false;
            }



            return(paso);
        }
예제 #9
0
        private bool Validar()
        {
            bool paso = true;

            MyError.Clear();

            if (AsignaturacomboBox.SelectedIndex == -1)
            {
                MyError.SetError(AsignaturacomboBox, "Debe elegir una asignatura");
                AsignaturacomboBox.Focus();
                paso = false;
            }

            if (AsignaturacomboBox.Text == string.Empty)
            {
                MyError.SetError(AsignaturacomboBox, "Debe elegir una asignatura");
                AsignaturacomboBox.Focus();
                paso = false;
            }

            if (EstudiantecomboBox.SelectedIndex == -1)
            {
                MyError.SetError(EstudiantecomboBox, "Debe elegir un estudiante");
                EstudiantecomboBox.Focus();
                paso = false;
            }

            if (EstudiantecomboBox.Text == string.Empty)
            {
                MyError.SetError(EstudiantecomboBox, "Debe elegir un estudiante");
                EstudiantecomboBox.Focus();
                paso = false;
            }

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

            return(paso);
        }
예제 #10
0
        private bool Validar()
        {
            bool paso = true;

            AsistenciaerrorProvider.Clear();

            if (this.DetalleEstudiante.Count == 0)
            {
                AsistenciaerrorProvider.SetError(AsistenciadataGridView, "Debe Agregar algun Estudiante");
                EstudiantecomboBox.Focus();
                paso = false;
            }
            if (string.IsNullOrWhiteSpace(AsistenciaIdnumericUpDown.Text))
            {
                AsistenciaerrorProvider.SetError(AsistenciaIdnumericUpDown, "Agregue un ID");
                AsistenciaIdnumericUpDown.Focus();
                paso = false;
            }
            return(paso);
        }
예제 #11
0
        private bool Validar()
        {
            bool paso = true;

            if (string.IsNullOrWhiteSpace(PrestamoidnumericUpDown.Text))
            {
                MyerrorProvider.SetError(PrestamoidnumericUpDown, "El campo no debe estar vacio");
                PrestamoidnumericUpDown.Focus();
                paso = false;
            }
            if (string.IsNullOrWhiteSpace(EstudiantecomboBox.Text))
            {
                MyerrorProvider.SetError(EstudiantecomboBox, "Seleccione un estudiante de la lista");
                EstudiantecomboBox.Focus();
                paso = false;
            }
            if (string.IsNullOrWhiteSpace(LibrocomboBox.Text))
            {
                MyerrorProvider.SetError(EstudiantecomboBox, "Seleccione un libro de la lista");
                LibrocomboBox.Focus();
                paso = false;
            }


            if (FechaDevoluciondateTimePicker.Value <= FechaPrestamodateTimePicker.Value)
            {
                MyerrorProvider.SetError(FechaDevoluciondateTimePicker, "La fecha de devolucion no puede ser menor o igual a la Fecha de prestamo");
                FechaDevoluciondateTimePicker.Focus();
                paso = false;
            }
            if (this.Detalles.Count == 0)
            {
                MyerrorProvider.SetError(MydataGridView, "Debe Agregar algun prestamo");
                LibrocomboBox.Focus();

                paso = false;
            }

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

            errorProvider.Clear();

            if (string.IsNullOrWhiteSpace(EstudiantecomboBox.Text))
            {
                errorProvider.SetError(EstudiantecomboBox, "El campo Estudiante no puede estar vacio");
                EstudiantecomboBox.Focus();
                paso = false;
            }

            if (MontonumericUpDown.Value == 0)
            {
                errorProvider.SetError(MontonumericUpDown, "Debes elegir un monto de creditos");
                MontonumericUpDown.Focus();
                paso = false;
            }

            if (Detalle.Count == 0)
            {
                errorProvider.SetError(AsignaturacomboBox, "La inscripcion por lo menos debe tener una asignatura");
                AsignaturacomboBox.Focus();
                paso = false;
            }


            if (FechaInscripciondateTimePicker.Value > DateTime.Now)
            {
                errorProvider.SetError(FechaInscripciondateTimePicker, "La fecha no puede ser despues de hoy");
                FechaInscripciondateTimePicker.Focus();
                paso = false;
            }


            return(paso);
        }
예제 #13
0
        private void AñadirButton_Click(object sender, EventArgs e)
        {
            if (MydataGridView.DataSource != null)
            {
                this.Detalles = (List <DevolucionDetalles>)MydataGridView.DataSource;
            }

            string nombres = Book.Buscar(id: (int)LibrocomboBox.SelectedValue).NombreLibro;

            this.Detalles.Add(
                new DevolucionDetalles(
                    prestamoId: (int)PrestamoIdnumericUpDown1.Value,
                    libroId: (int)LibrocomboBox.SelectedValue,
                    nombreLibro: nombres,
                    fechaDevueltaLibro: FechaEntregadateTimePicker.Value

                    )
                );



            CargarGrid();
            EstudiantecomboBox.SelectAll();
        }