Example #1
0
    public static void Update(string idFixture, string idEquipo, string idJugador,
                              string tipo, string descripcion, string fecha, string hora, int id)
    {
        FixtureNoticiaDSTableAdapters.tbl_fixtureNoticiaTableAdapter adapter =
            new FixtureNoticiaDSTableAdapters.tbl_fixtureNoticiaTableAdapter();
        FixtureNoticias objfixture = FixtureNoticiaBLL.SelectById(Convert.ToInt32(id));
        string          tipoActual = objfixture.Tipo;

        if (tipoActual == "Gol" && tipo != "Gol" && Convert.ToInt32(idJugador) == objfixture.IdJugador)
        {
            int goles = GolesBLL.SelectByJugador(objfixture.IdJugador).Gol - 1;
            GolesBLL.UpdateGoles(goles, Convert.ToInt32(objfixture.IdJugador));
        }
        else if (tipoActual != "Gol" && tipo == "Gol" && Convert.ToInt32(idJugador) == objfixture.IdJugador)
        {
            int goles = GolesBLL.SelectByJugador(objfixture.IdJugador).Gol + 1;
            GolesBLL.UpdateGoles(goles, Convert.ToInt32(objfixture.IdJugador));
        }
        else if (tipoActual != "Gol" && tipo == "Gol" && Convert.ToInt32(idJugador) != objfixture.IdJugador)
        {
            int goles = GolesBLL.SelectByJugador(Convert.ToInt32(idJugador)).Gol + 1;
            GolesBLL.UpdateGoles(goles, Convert.ToInt32(Convert.ToInt32(idJugador)));
            int gols = GolesBLL.SelectByJugador(Convert.ToInt32(objfixture.IdJugador)).Gol - 1;
            GolesBLL.UpdateGoles(goles, Convert.ToInt32(Convert.ToInt32(objfixture.IdJugador)));
        }
        else if (tipoActual == "Gol" && tipo != "Gol" && Convert.ToInt32(idJugador) == objfixture.IdJugador)
        {
            int goles = GolesBLL.SelectByJugador(Convert.ToInt32(idJugador)).Gol - 1;
            GolesBLL.UpdateGoles(goles, Convert.ToInt32(Convert.ToInt32(idJugador)));
            int gols = GolesBLL.SelectByJugador(Convert.ToInt32(objfixture.IdJugador)).Gol + 1;
            GolesBLL.UpdateGoles(goles, Convert.ToInt32(Convert.ToInt32(objfixture.IdJugador)));
        }
        adapter.UpdateRow(Convert.ToInt32(idFixture), Convert.ToInt32(idEquipo), Convert.ToInt32(idJugador),
                          tipo, descripcion, fecha, hora, 0, id);
    }
Example #2
0
 public static int EliminarNoticia(string idNoticia)
 {
     try
     {
         FixtureNoticiaBLL.Delete(Convert.ToInt32(idNoticia));
         FixtureNoticias objFixtureNoticia = FixtureNoticiaBLL.SelectById(Convert.ToInt32(idNoticia));
         string          tipo = objFixtureNoticia.Tipo;
         if (tipo == "Gol")
         {
             Fixture objFixture  = FixtureBLL.SelectById(objFixtureNoticia.IdFixture);
             int     scoreEquipo = 0;
             int     scoreRival  = 0;
             if (objFixture.ScoreEquipo > 0)
             {
                 scoreEquipo = objFixture.ScoreEquipo - 1;
             }
             if (objFixture.ScoreRival > 0)
             {
                 scoreRival = objFixture.ScoreRival - 1;
             }
             FixtureBLL.UpdateScoreEquipo(scoreEquipo, Convert.ToString(objFixtureNoticia.IdFixture));
             FixtureBLL.UpdateScoreRival(scoreRival, Convert.ToString(objFixtureNoticia.IdFixture));
         }
         return(Convert.ToInt32(idNoticia));
     }
     catch (Exception)
     {
         return(-1);
     }
 }
Example #3
0
    public static FixtureNoticias ActualizarNoticia(string idFixture, string idEquipo, string idJugador,
                                                    string tipo, string descripcion, string fecha, string hora, string id)
    {
        FixtureNoticiaBLL.Update(idFixture, idEquipo, idJugador, tipo, descripcion, fecha, hora, Convert.ToInt32(id));
        FixtureNoticias objFixtureNoticia = FixtureNoticiaBLL.SelectById(Convert.ToInt32(id));
        Fixture         objFixture        = FixtureBLL.SelectById(Convert.ToInt32(idFixture));

        return(objFixtureNoticia);
    }
Example #4
0
    public static void Delete(int id)
    {
        FixtureNoticiaDSTableAdapters.tbl_fixtureNoticiaTableAdapter adapter =
            new FixtureNoticiaDSTableAdapters.tbl_fixtureNoticiaTableAdapter();
        FixtureNoticias objFix = FixtureNoticiaBLL.SelectById(id);
        int             goles  = GolesBLL.SelectByJugador(objFix.IdJugador).Gol - 1;

        if (objFix.Tipo == "Gol")
        {
            Goles objGol = GolesBLL.SelectByJugador(objFix.IdJugador);
            GolesBLL.UpdateGoles(goles, Convert.ToInt32(objFix.IdJugador));
        }
        adapter.DeleteState(id);
    }
Example #5
0
    private static FixtureNoticias RowToDto(FixtureNoticiaDS.tbl_fixtureNoticiaRow row)
    {
        FixtureNoticias objFixtureNoticias = new FixtureNoticias();

        objFixtureNoticias.Id          = row.id;
        objFixtureNoticias.IdFixture   = row.idFixture;
        objFixtureNoticias.IdEquipo    = row.idEquipo;
        objFixtureNoticias.IdJugador   = row.idJugador;
        objFixtureNoticias.Tipo        = row.tipo;
        objFixtureNoticias.Descripcion = row.descripcion;
        objFixtureNoticias.Fecha       = row.fecha;
        objFixtureNoticias.Hora        = row.hora;
        objFixtureNoticias.Eliminado   = row.eliminado;
        return(objFixtureNoticias);
    }
Example #6
0
    public static FixtureNoticias InsertarNoticia(string idFixture, string idEquipo, string idJugador,
                                                  string tipo, string descripcion, string fecha, string hora)
    {
        FixtureNoticias objFixtureNoticia = FixtureNoticiaBLL.InsertWithReturn(
            idFixture, idEquipo, idJugador, tipo, descripcion, fecha, hora);

        if (tipo == "Gol")
        {
            Fixture objFixture = FixtureBLL.SelectById(Convert.ToInt32(idFixture));
            if (idEquipo == objFixture.IdEquipo.ToString())
            {
                int gol = objFixture.ScoreEquipo + 1;
                FixtureBLL.UpdateScoreEquipo(gol, idFixture);
            }
            else
            {
                int gol = objFixture.ScoreRival + 1;
                FixtureBLL.UpdateScoreRival(gol, idFixture);
            }
        }
        return(objFixtureNoticia);
    }
Example #7
0
    public static FixtureNoticias TraerNoticia(string idNoticia)
    {
        FixtureNoticias objEvento = FixtureNoticiaBLL.SelectById(Convert.ToInt32(idNoticia));

        return(objEvento);
    }