Ejemplo n.º 1
0
        private void GuardarSorteo(PlanPremios planPremios)
        {
            Sorteo sorteo = new Sorteo()
            {
                IdSorteo           = sorteoEditando.IdSorteo,
                NumeroSorteo       = sorteoEditando.NumeroSorteo,
                TipoSorteo         = sorteoEditando.TipoSorteo,
                Fecha              = sorteoEditando.Fecha,
                CantidadFracciones = Convert.ToInt32(nudFracciones.Value),
                PrecioFraccion     = Convert.ToInt32(nudCostoFraccion.Value),
                LeyendaBillete     = tbLeyenda.Text.Equals("") ? "Sin leyenda" : tbLeyenda.Text,
                Estado             = false,
                PlanPremios        = planPremios
            };

            sorteoEditando = sorteo;
            ModificarSorteo(sorteoEditando);
        }
Ejemplo n.º 2
0
        private void BtCrear_Click(object sender, EventArgs e)
        {
            DateTime fecha      = dtFecha.Value;
            string   tipoSorteo = (rbChances.Checked)? "Chances" : "Lotería";

            if (ValidarFecha(tipoSorteo, fecha) &&
                FraccionesCostoValido())
            {
                PlanPremios planPremios = new PlanPremios();
                if (cbConPlan.Checked)
                {
                    planPremios.Premios = ObtenerPlanPremios(tipoSorteo);
                    if (planPremios.Premios.Count > 0)
                    {
                        InicializarSorteoParaCrear(ObtenerNumeroSorteo(tipoSorteo), tipoSorteo, fecha, planPremios);
                    }
                }
                else
                {
                    InicializarSorteoParaCrear(ObtenerNumeroSorteo(tipoSorteo), tipoSorteo, fecha, planPremios);
                }
            }
        }
Ejemplo n.º 3
0
 private void BtGuardar_Click(object sender, EventArgs e)
 {
     if (nudFracciones.Value > 0 && nudCostoFraccion.Value > 0)
     {
         PlanPremios planPremios = new PlanPremios();
         if (cbConPlan.Checked)
         {
             planPremios.Premios = ObtenerPlanPremios(sorteoEditando.TipoSorteo);
             if (planPremios.Premios.Count > 0)
             {
                 GuardarSorteo(planPremios);
             }
         }
         else
         {
             GuardarSorteo(planPremios);
         }
     }
     else
     {
         MessageBox.Show("La cantidad de fracciones y el costo deben ser mayor a 0", "Modificar sorteo",
                         MessageBoxButtons.OK, MessageBoxIcon.Warning);
     }
 }
Ejemplo n.º 4
0
        private void InicializarSorteoParaCrear(int numeroSorteo, string tipoSorteo, DateTime fecha, PlanPremios planPremios)
        {
            Sorteo sorteo = new Sorteo()
            {
                IdSorteo           = 1,
                NumeroSorteo       = numeroSorteo,
                TipoSorteo         = tipoSorteo,
                Fecha              = fecha,
                CantidadFracciones = Convert.ToInt32(nudFracciones.Value),
                PrecioFraccion     = Convert.ToInt32(nudCostoFraccion.Value),
                LeyendaBillete     = tbLeyenda.Text.Equals("") ? "Sin leyenda" : tbLeyenda.Text,
                Estado             = false,
                PlanPremios        = planPremios
            };

            CrearSorteo(sorteo);
        }