コード例 #1
0
        private void Agregarbutton_Click(object sender, EventArgs e)
        {
            Inscripcion inscripcion          = new Inscripcion();
            RepositorioBase <Asignaturas> db = new RepositorioBase <Asignaturas>();
            Asignaturas asignatura           = db.Buscar((int)AsignaturacomboBox.SelectedValue);

            if (PrecioUpDown.Value == 0)
            {
                errorProvider.SetError(PrecioUpDown, "Digite el precio por cada Credito");
                PrecioUpDown.Focus();
            }
            else
            {
                if (detalleDataGridView.DataSource != null)
                {
                    this.Detalle = (List <InscripcionDetalle>)detalleDataGridView.DataSource;
                }



                this.Detalle.Add(new InscripcionDetalle()
                {
                    InscripcionId = (int)InscripcionIdnumericUpDown.Value,
                    AsignaturaId  = (int)AsignaturacomboBox.SelectedValue,
                    Id            = 0,
                    SubTotal      = (asignatura.Creditos * PrecioUpDown.Value)
                });
                CargarGrid();
            }
            SumarMonto();
        }
コード例 #2
0
        private bool Validar()
        {
            bool paso = true;

            errorProvider.Clear();


            if (PrecioUpDown.Value < 0)
            {
                errorProvider.SetError(PrecioUpDown, "Digite el precio por cada Credito");
                PrecioUpDown.Focus();
                paso = false;
            }
            if (FechadateTimePicker.Value > DateTime.Now)
            {
                errorProvider.SetError(FechadateTimePicker, "La fecha no puede ser Mayor que la de hoy");
                paso = false;
            }
            return(paso);
        }