protected void btnCrearTorneo_Click(object sender, EventArgs e)
        {
            Page.Validate();

            if (Page.IsValid)
            {
                try
                {
                    torneo tor = new torneo();

                    tor.nombre = txtNombre.Text;

                    if (radBtnLstEstado.SelectedValue == "True")
                    {
                        tor.flag_activo = true;
                    }
                    else if (radBtnLstEstado.SelectedValue == "False")
                    {
                        tor.flag_activo = false;
                    }

                    tor.provincia_id = funCom.StringToInt(ucProvLoc.DdlProvincia.SelectedValue);
                    tor.localidad_id = funCom.StringToInt(ucProvLoc.DdlLocalidad.SelectedValue);

                    funTorn.Insertar_Torneo(base_futbol, tor);

                    this.Page.Response.Write("<script language='JavaScript'>window.alert('Torneo registrado exitosamente');window.location.href = './RegistrarTorneo.aspx';</script>");
                }
                catch (Exception ex)
                {
                    throw new Exception(ex.Message);
                }
            }
        }
Exemple #2
0
        protected void btnEliminar_Click(object sender, EventArgs e)
        {
            Page.Validate();

            if (Page.IsValid)
            {
                if (ddlTorneo.SelectedItem.Value != "0")
                {
                    int seltorneo = funCom.StringToInt(ddlTorneo.SelectedItem.Value);

                    torneo elitorneo = funTorn.Recuperar_Torneo_Busqueda(base_futbol, seltorneo);

                    //Levanto todos los equipos asociados al torneo, y les seteo torneo = NULL
                    var selEquipo = funTorn.Recuperar_Torneo_Equipo(base_futbol, seltorneo);

                    foreach (var eq in selEquipo)
                    {
                        eq.torneo_id = null;
                    }

                    funEqui.Actualizar_Equipo(base_futbol);

                    //Elimino el torneo seleccionado
                    funTorn.Eliminar_Torneo(base_futbol, elitorneo);

                    CargarTorneo();

                    this.Page.Response.Write("<script language='JavaScript'>window.alert('Se ha eliminado exitosamente el torneo');window.location.href = './EliminarTorneo.aspx';</script>");
                }
            }
        }
 public void Eliminar_Torneo(futbolEntities ctx, torneo to)
 {
     try
     {
         ctx.torneo.Remove(to);
         ctx.SaveChanges();
     }
     catch (Exception ex)
     {
         throw new Exception(ex.Message);
     }
 }
 public void Insertar_Torneo(futbolEntities ctx, torneo to)
 {
     try
     {
         ctx.torneo.Add(to);
         ctx.SaveChanges();
     }
     catch (Exception ex)
     {
         throw new Exception(ex.Message);
     }
 }
Exemple #5
0
        protected void btnSiguiente_Click(object sender, EventArgs e)
        {
            int seltorneo = funCom.StringToInt(ddlTorneo.SelectedItem.Value);

            txtNombre.Text = ddlTorneo.SelectedItem.Text;

            torneo elitorneo = funTorn.Recuperar_Torneo_Busqueda(base_futbol, seltorneo);

            if (elitorneo.flag_activo == true)
            {
                radBtnLstEstado.SelectedValue = "True";
            }
            else
            {
                radBtnLstEstado.SelectedValue = "False";
            }

            ucProvLoc.DdlProvincia.SelectedIndex = elitorneo.provincia.id;
            ucProvLoc.CargarLocalidadMod(elitorneo.localidad);
        }
Exemple #6
0
        protected void btnModificarTorneo_Click(object sender, EventArgs e)
        {
            Page.Validate();

            if (Page.IsValid)
            {
                try
                {
                    int seltorneo = funCom.StringToInt(ddlTorneo.SelectedItem.Value);

                    torneo tor = funTorn.Recuperar_Torneo_Busqueda(base_futbol, seltorneo);

                    tor.nombre       = txtNombre.Text;
                    tor.provincia_id = funCom.StringToInt(ucProvLoc.DdlProvincia.SelectedValue);
                    tor.localidad_id = funCom.StringToInt(ucProvLoc.DdlLocalidad.SelectedValue);

                    if (radBtnLstEstado.SelectedValue == "True")
                    {
                        tor.flag_activo = true;
                    }
                    else
                    {
                        tor.flag_activo = false;
                    }

                    funTorn.Actualizar_Torneo(base_futbol);

                    divBuscar.Visible    = false;
                    divModificar.Visible = true;

                    this.Page.Response.Write("<script language='JavaScript'>window.alert('Torneo modificado exitosamente');window.location.href = './ModificarTorneo.aspx';</script>");
                }
                catch (Exception ex)
                {
                    throw new Exception(ex.Message);
                }
            }
        }