示例#1
0
        public bool DeleteUserTeamSeason(int userTeamId, SqlConnection db)
        {
            try
            {
                bool rowsDeleted    = false;
                var  userTeamSeason = new UserTeamSeason();

                userTeamSeason = db.Get <UserTeamSeason>(userTeamId);
                rowsDeleted    = db.Delete(new UserTeamSeason()
                {
                    userteamid = userTeamId
                });

                if (rowsDeleted == true)
                {
                    Logger.Out("UserTeamSeason: " + userTeamSeason.season_name + " (" + Convert.ToString(userTeamId) + ") - deleted");
                    return(true);
                }
                return(false);
            }
            catch (Exception ex)
            {
                Logger.Error("UserTeamSeason Repository (DeleteUserTeamSeason) error: " + ex.Message);
                throw ex;
            }
        }
        public bool DeleteUserTeamSeason(int userTeamId, SqlConnection db)
        {
            try
            {
                bool rowsDeleted    = false;
                var  userTeamSeason = new UserTeamSeason();

                //using (IDbConnection db = new SqlConnection(ConfigurationManager.ConnectionStrings["FantasyPremierLeagueUserTeam"].ConnectionString))
                //{
                userTeamSeason = db.Get <UserTeamSeason>(userTeamId);
                rowsDeleted    = db.Delete(new UserTeamSeason()
                {
                    userteamid = userTeamId
                });
                //}

                if (rowsDeleted == true)
                {
                    Logger.Out("UserTeamSeason: " + userTeamSeason.season_name + " (" + Convert.ToString(userTeamId) + ") - deleted");
                    return(true);
                }
                return(false);
            }
            catch (Exception ex)
            {
                Logger.Error("UserTeamSeason Repository (DeleteUserTeamSeason) error: " + ex.Message);
                throw ex;
            }
        }
示例#3
0
        //public bool InsertUserTeamSeason(UserTeamSeasons userTeamSeasonsInsert, SqlConnection db)
        //{
        //    try
        //    {
        //        long rowsAffected = 0;

        //        //using (IDbConnection db = new SqlConnection(ConfigurationManager.ConnectionStrings["FantasyPremierLeagueUserTeam"].ConnectionString))
        //        //{
        //            rowsAffected = db.Insert(userTeamSeasonsInsert, commandTimeout: 0);
        //        //}

        //        //if (rowsAffected > 0)
        //        //{
        //        //    Logger.Out("UserTeamSeason: " + userTeamSeason.season_name + " - inserted");
        //        //    return true;
        //        //}
        //        return false;
        //    }
        //    catch (Exception ex)
        //    {
        //        Logger.Error("UserTeamSeason Repository (insert) error: " + ex.Message);
        //        throw ex;
        //    }
        //}

        public bool UpdateUserTeamSeason(UserTeamSeason userTeamSeason, SqlConnection db)
        {
            try
            {
                bool rowsUpdated = false;

                rowsUpdated = db.Update(userTeamSeason, commandTimeout: 0);

                if (rowsUpdated == true)
                {
                    Logger.Out("UserTeamSeason: " + userTeamSeason.season_name + " - updated");
                    return(true);
                }
                return(false);
            }
            catch (Exception ex)
            {
                Logger.Error("UserTeamSeason Repository (update) error: " + ex.Message);
                throw ex;
            }
        }
        //public bool InsertUserTeamSeason(UserTeamSeasons userTeamSeasonsInsert, SqlConnection db)
        //{
        //    try
        //    {
        //        long rowsAffected = 0;

        //        //using (IDbConnection db = new SqlConnection(ConfigurationManager.ConnectionStrings["FantasyPremierLeagueUserTeam"].ConnectionString))
        //        //{
        //            rowsAffected = db.Insert(userTeamSeasonsInsert, commandTimeout: 300);
        //        //}

        //        //if (rowsAffected > 0)
        //        //{
        //        //    Logger.Out("UserTeamSeason: " + userTeamSeason.season_name + " - inserted");
        //        //    return true;
        //        //}
        //        return false;
        //    }
        //    catch (Exception ex)
        //    {
        //        Logger.Error("UserTeamSeason Repository (insert) error: " + ex.Message);
        //        throw ex;
        //    }
        //}

        public bool UpdateUserTeamSeason(UserTeamSeason userTeamSeason, SqlConnection db)
        {
            try
            {
                bool rowsUpdated = false;

                //using (IDbConnection db = new SqlConnection(ConfigurationManager.ConnectionStrings["FantasyPremierLeagueUserTeam"].ConnectionString))
                //{
                rowsUpdated = db.Update(userTeamSeason, commandTimeout: 300);
                //}

                if (rowsUpdated == true)
                {
                    Logger.Out("UserTeamSeason: " + userTeamSeason.season_name + " - updated");
                    return(true);
                }
                return(false);
            }
            catch (Exception ex)
            {
                Logger.Error("UserTeamSeason Repository (update) error: " + ex.Message);
                throw ex;
            }
        }