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); }
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); } } }
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); } }
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); }