Beispiel #1
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);
        }
Beispiel #2
0
        private void AgregarButtton_Click_1(object sender, EventArgs e)
        {
            if (Validar())
            {
                MessageBox.Show("Favor revisar todos los campos!!", "Validación!!",
                                MessageBoxButtons.OK, MessageBoxIcon.Error);
                SuperErrorProvider.Clear();
                return;
            }
            else
            {
                if (PrestamoDetalleDataGridView.DataSource != null)
                {
                    Detalle = (List <PrestamoDetalle>)PrestamoDetalleDataGridView.DataSource;
                }

                this.Detalle.Add(
                    new PrestamoDetalle(
                        id: 0,
                        prestamoid: (int)prestamoidnumericUpDown.Value,
                        matricula: (int)Convert.ToInt32(MatriculatextBox.Text.Replace("-", "")),
                        libroId: (int)LibrocomboBox.SelectedValue,
                        lectorid: (int)LectorcomboBox.SelectedValue
                        // fecha: FechadateTimePicker.Value

                        ));
                CargarGrid();
                LibrocomboBox.SelectAll();

                /* if (this.Detalle.Count == 0)
                 * {
                 *   SuperErrorProvider.SetError(PrestamoDetalleDataGridView,
                 *       "Debe Agregar los libros ");
                 *   LibrocomboBox.Focus();
                 *   // Validar = true;
                 * }*/
                int ejemplo = 0, error = 0;
                if (error == 1 && int.TryParse(LibrocomboBox.Text, out ejemplo) == false)
                {
                    SuperErrorProvider.SetError(LibrocomboBox, "Debe de ser un numero");
                }
            }
        }
Beispiel #3
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);
        }
Beispiel #4
0
        private void AñadirButton_Click(object sender, EventArgs e)
        {
            if (MydataGridView.DataSource != null)
            {
                this.Detalles = (List <PrestamosDetalle>)MydataGridView.DataSource;
            }

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

            this.Detalles.Add(
                new PrestamosDetalle(
                    detalleId: 0,
                    libroId: Convert.ToInt32(LibrocomboBox.SelectedValue),
                    nombreLibro: nombres,
                    fechaDevolucion: FechaDevoluciondateTimePicker.Value

                    )
                );
            this.Reporte = ((List <PrestamosDetalle>)MydataGridView.DataSource);
            CargarGrid();
            LibrocomboBox.SelectAll();
        }