Example #1
0
 public void InsertSeasonStadium(SeasonStadiumDomainModel _SeasonStadium)
 {
     using (CSBAAzureEntities context = new CSBAAzureEntities())
     {
         context.Database.ExecuteSqlCommand("sp_SeasonStadium_Insert {0}, {1}", _SeasonStadium.SeasonID, _SeasonStadium.StadiumID);
     }
 }
Example #2
0
 public void ClearSeason(SeasonDomainModel season)
 {
     using (CSBAAzureEntities context = new CSBAAzureEntities())
     {
         context.sp_Season_Clear(season.SeasonID);
     }
 }
Example #3
0
        public List <v_Team_Draft_RosterDomainModel> ListTeamRoster(int SeasonID, int TeamID)
        {
            //Create a return type Object
            List <v_Team_Draft_RosterDomainModel> list = new List <v_Team_Draft_RosterDomainModel>();

            //Create a Context object to Connect to the database
            using (CSBAAzureEntities context = new CSBAAzureEntities())
            {
                list = (from result in context.sp_Team_Roster_Select(SeasonID, TeamID)
                        select new v_Team_Draft_RosterDomainModel
                {
                    ActiveFlg = result.ActiveFlg,
                    PlayerImage = result.PlayerImage,
                    PlayerName = result.PlayerName,
                    Points = result.Points,
                    PlayerGuid = result.PlayerGUID,
                    PrimPos = result.PrimPos,
                    SeasonID = result.SeasonID,
                    SeasonName = result.SeasonName,
                    SecPos = result.SecPos,
                    TeamID = result.TeamID,
                    TeamName = result.TeamName,
                    PrimaryPositionID = result.PrimaryPositionID,
                    PositionTypeDescr = result.PositionTypeDescr,
                    PositionTypeID = result.PositionTypeID
                }).ToList();
            } // Guaranteed to close the Connection

            //return the list
            return(list);
        }
 public void DeletePlayerPosition(PlayerPositionDomainModel _playerPosition)
 {
     using (CSBAAzureEntities context = new CSBAAzureEntities())
     {
         context.Database.ExecuteSqlCommand("sp_PlayerPosition_Delete {0}", _playerPosition.PlayerGUID);
     }
 }
Example #5
0
        public List <sp_StadiumDraft_Select_Result_DomainModel> DraftStadiumList(int SeasonID, Guid?OwnerUserID)
        {
            List <sp_StadiumDraft_Select_Result_DomainModel> listStadiums = new List <sp_StadiumDraft_Select_Result_DomainModel>();

            using (CSBAAzureEntities context = new CSBAAzureEntities())
            {
                listStadiums = (from result in context.sp_StadiumDraft_Select(SeasonID, OwnerUserID)
                                select new sp_StadiumDraft_Select_Result_DomainModel
                {
                    ActiveFlg = result.ActiveFlg,
                    IsOwner = result.IsOwner,
                    OwnerUserID = result.OwnerUserID,
                    Points = result.Points,
                    SeasonID = result.SeasonID,
                    StadiumOrder = result.StadiumOrder,
                    StadiumID = result.StadiumID,
                    TeamID = result.TeamID,
                    TeamName = result.TeamName,
                    StadiumName = result.StadiumName,
                    StadiumImage = result.StadiumImage
                }).ToList();
            } // Guaranteed to close the Connection

            return(listStadiums);
        }
Example #6
0
 public void TradePlayer(SeasonTeamPlayerDomainModel STP, int NewTeamID, int Points)
 {
     using (CSBAAzureEntities context = new CSBAAzureEntities())
     {
         context.Database.ExecuteSqlCommand("sp_Team_Roster_Update {0}, {1}, {2}, {3}, {4}", STP.SeasonID, STP.PlayerGUID, STP.TeamID, NewTeamID, Points);
     }
 }
Example #7
0
        public List <sp_SeasonTeamDraft_Select_ResultDomainModel> DraftTeamList(int SeasonID)
        {
            List <sp_SeasonTeamDraft_Select_ResultDomainModel> listTeams = new List <sp_SeasonTeamDraft_Select_ResultDomainModel>();

            using (CSBAAzureEntities context = new CSBAAzureEntities())
            {
                listTeams = (from result in context.sp_SeasonTeamDraft_Select(SeasonID)
                             select new sp_SeasonTeamDraft_Select_ResultDomainModel
                {
                    CountHitter = result.CountHitter,
                    CountPlayers = result.CountPlayers,
                    MaxBid = result.MaxBid,
                    MinBid = result.MinBid,
                    OwnerEmail = result.OwnerEmail,
                    OwnerName = result.OwnerName,
                    OwnerUserID = result.OwnerUserID,
                    PitcherCount = result.PitcherCount,
                    SeasonID = result.SeasonID,
                    StartPoints = result.StartPoints,
                    SumPoints = result.SumPoints,
                    TeamID = result.TeamID,
                    TeamName = result.TeamName
                }).ToList();
            } // Guaranteed to close the Connection

            return(listTeams);
        }
Example #8
0
        public List <SeasonTeamPlayerPositionDomainModel> STPP_Detail(SeasonDomainModel season, TeamDomainModel team)
        {
            List <SeasonTeamPlayerPositionDomainModel> STPP = new List <SeasonTeamPlayerPositionDomainModel>();

            using (CSBAAzureEntities context = new CSBAAzureEntities())
            {
                STPP = (from result in context.v_SeasonTeamPlayerPosition
                        orderby result.PositionSortOrder, result.Points
                        where result.SeasonID == season.SeasonID
                        where result.TeamID == team.TeamID
                        select new SeasonTeamPlayerPositionDomainModel
                {
                    PlayerGUID = result.PlayerGUID,
                    PlayerName = result.PlayerName,
                    Points = result.Points,
                    PositionName = result.PositionName,
                    PositionNameLong = result.PositionNameLong,
                    SeasonID = result.SeasonID,
                    TeamID = result.TeamID,
                    TeamName = result.TeamName
                }).ToList();
            } // Guaranteed to close the Connection

            return(STPP);
        }
Example #9
0
 public void SelectCurrentSeason(SeasonDomainModel season)
 {
     using (CSBAAzureEntities context = new CSBAAzureEntities())
     {
         context.sp_Season_Current(season.SeasonID);
     }
 }
Example #10
0
 public void DeleteSeasonRecyclePlayerAll(SeasonPlayerDomainModel _SeasonPlayer)
 {
     using (CSBAAzureEntities context = new CSBAAzureEntities())
     {
         context.Database.ExecuteSqlCommand("sp_SeasonPlayerRecycle_deleteAll {0}", _SeasonPlayer.SeasonID);
     }
 }
Example #11
0
 public void DeleteSeasonStadiumAll(SeasonStadiumDomainModel _SeasonStadium)
 {
     using (CSBAAzureEntities context = new CSBAAzureEntities())
     {
         context.Database.ExecuteSqlCommand("sp_SeasonStadium_DeleteAll {0}", _SeasonStadium.SeasonID);
     }
 }
Example #12
0
 public void InsertSeasonPlayer(SeasonPlayerDomainModel _SeasonPlayer)
 {
     using (CSBAAzureEntities context = new CSBAAzureEntities())
     {
         context.Database.ExecuteSqlCommand("sp_SeasonPlayer_Insert {0}, {1}", _SeasonPlayer.SeasonID, _SeasonPlayer.PlayerGUID);
     }
 }
Example #13
0
 public void DeleteSeasonPlayerAll(SeasonPlayerDomainModel _SeasonPlayer, PositionDomainModel _Position)
 {
     using (CSBAAzureEntities context = new CSBAAzureEntities())
     {
         context.Database.ExecuteSqlCommand("sp_SeasonPlayer_deleteAll {0}, {1}", _SeasonPlayer.SeasonID, _Position.PositionID);
     }
 }
Example #14
0
 public void DeleteSeasonTeamAll(int SeasonID)
 {
     using (CSBAAzureEntities context = new CSBAAzureEntities())
     {
         context.Database.ExecuteSqlCommand("sp_SeasonTeam_DeleteAll {0}", SeasonID);
     }
 }
Example #15
0
        public List <SeasonDomainModel> ListSeasonView()
        {
            //Create a return type Object
            List <SeasonDomainModel> list = new List <SeasonDomainModel>();

            //Create a Context object to Connect to the database
            using (CSBAAzureEntities context = new CSBAAzureEntities())
            {
                list = (from result in context.v_SeasonView
                        select new SeasonDomainModel
                {
                    PlayersDrafted = result.PlayersDrafted,
                    SeasonID = result.SeasonID,
                    SeasonName = result.SeasonName,
                    StartPoints = result.StartPoints,
                    MinBid = (int)result.MinBid,
                    DraftDate = result.DraftDate,
                    Active = result.Active,
                    CurrentSeason = (bool)result.CurrentSeason
                }).ToList();
            } // Guaranteed to close the Connection

            //return the list
            return(list);
        }
Example #16
0
 public void DeleteAllStatsForPlayer(SeasonPlayerPositionStatDomainModel statvalue)
 {
     using (CSBAAzureEntities context = new CSBAAzureEntities())
     {
         context.Database.ExecuteSqlCommand("sp_SeasonPlayerPositionStat_DeleteAll {0}, {1}", statvalue.SeasonID, statvalue.PlayerGUID);
     }
 }
Example #17
0
 public void DeletePlayer(PlayerDomainModel player)
 {
     using (CSBAAzureEntities context = new CSBAAzureEntities())
     {
         var cPlayer = (from n in context.Players where n.PlayerGUID == player.PlayerGUID select n).FirstOrDefault();
         context.Players.Remove(cPlayer);
         context.SaveChanges();
     }
 }
Example #18
0
 public void DeletePositionType(PositionTypeDomanModel positionType)
 {
     using (CSBAAzureEntities context = new CSBAAzureEntities())
     {
         var cPositionType = (from n in context.PositionTypes where n.PositionTypeID == positionType.PositionTypeID select n).FirstOrDefault();
         context.PositionTypes.Remove(cPositionType);
         context.SaveChanges();
     }
 }
Example #19
0
 public void DeleteSeason(SeasonDomainModel season)
 {
     using (CSBAAzureEntities context = new CSBAAzureEntities())
     {
         var cSeason = (from n in context.Seasons where n.SeasonID == season.SeasonID select n).FirstOrDefault();
         context.Seasons.Remove(cSeason);
         context.SaveChanges();
     }
 }
Example #20
0
 public void DeleteStadium(StadiumDomainModel stadium)
 {
     using (CSBAAzureEntities context = new CSBAAzureEntities())
     {
         var cStadium = (from n in context.Stadia where n.StadiumID == stadium.StadiumID select n).FirstOrDefault();
         context.Stadia.Remove(cStadium);
         context.SaveChanges();
     }
 }
Example #21
0
 public void DeletePosition(PositionDomainModel position)
 {
     using (CSBAAzureEntities context = new CSBAAzureEntities())
     {
         var cPosition = (from n in context.Positions where n.PositionID == position.PositionID select n).FirstOrDefault();
         context.Positions.Remove(cPosition);
         context.SaveChanges();
     }
 }
Example #22
0
 public void UpdatePositionType(PositionTypeDomanModel positionType)
 {
     using (CSBAAzureEntities context = new CSBAAzureEntities())
     {
         var _cpositionType = context.PositionTypes.Find(positionType.PositionTypeID);
         if (_cpositionType != null)
         {
             _cpositionType.PositionTypeDescr = positionType.PositionTypeDescr;
             context.SaveChanges();
         }
     }
 }
Example #23
0
 public void UpdatePlayer(PlayerDomainModel player)
 {
     using (CSBAAzureEntities context = new CSBAAzureEntities())
     {
         var cPlayer = context.Players.Find(player.PlayerGUID);
         if (cPlayer != null)
         {
             cPlayer.PlayerName  = player.PlayerName;
             cPlayer.PlayerImage = player.PlayerImage;
             context.SaveChanges();
         }
     }
 }
Example #24
0
 public void UpdatePosition(PositionDomainModel position)
 {
     using (CSBAAzureEntities context = new CSBAAzureEntities())
     {
         var cPosition = context.Positions.Find(position.PositionID);
         if (cPosition != null)
         {
             cPosition.PositionName     = position.PositionName;
             cPosition.MaxCount         = position.MaxCount;
             cPosition.PositionNameLong = position.PositionNameLong;
             context.SaveChanges();
         }
     }
 }
 public void InsertPlayerPosition(PlayerPositionDomainModel _playerPosition)
 {
     using (CSBAAzureEntities context = new CSBAAzureEntities())
     {
         var _cPlayerPosition = new PlayerPosition
         {
             PlayerGUID          = _playerPosition.PlayerGUID,
             PrimaryPositionID   = Convert.ToInt32(_playerPosition.PrimaryPositionID),
             SecondaryPostiionID = _playerPosition.SecondaryPostiionID
         };
         context.PlayerPositions.Add(_cPlayerPosition);
         context.SaveChanges();
     }
 }
Example #26
0
 public void UpdateStadium(StadiumDomainModel stadium)
 {
     using (CSBAAzureEntities context = new CSBAAzureEntities())
     {
         var cstadium = context.Stadia.Find(stadium.StadiumID);
         if (cstadium != null)
         {
             cstadium.StadiumName  = stadium.StadiumName;
             cstadium.Active_Flg   = stadium.Active_Flg;
             cstadium.StadiumImage = stadium.StadiumImage;
             context.SaveChanges();
         }
     }
 }
Example #27
0
 public void InsertSeasonTeam(SeasonTeamDomainModel _SeasonTeam)
 {
     using (CSBAAzureEntities context = new CSBAAzureEntities())
     {
         var cSeasonTeam = new SeasonTeam
         {
             SeasonID     = _SeasonTeam.SeasonID,
             TeamID       = _SeasonTeam.TeamID,
             ActiveFlg    = _SeasonTeam.ActiveFlg,
             StadiumOrder = _SeasonTeam.StadiumOrder
         };
         context.SeasonTeams.Add(cSeasonTeam);
         context.SaveChanges();
     }
 }
Example #28
0
 public void DraftPlayer(SeasonTeamPlayerDomainModel STP)
 {
     using (CSBAAzureEntities context = new CSBAAzureEntities())
     {
         var _cSTP = new SeasonTeamPlayer
         {
             PlayerGUID = STP.PlayerGUID,
             SeasonID   = STP.SeasonID,
             TeamID     = STP.TeamID,
             Points     = STP.Points
         };
         context.SeasonTeamPlayers.Add(_cSTP);
         context.SaveChanges();
     }
 }
Example #29
0
 public void UpdateTeam(TeamDomainModel team)
 {
     using (CSBAAzureEntities context = new CSBAAzureEntities())
     {
         var cTeam = context.Teams.Find(team.TeamID);
         if (cTeam != null)
         {
             cTeam.OwnerEmail  = team.OwnerEmail;
             cTeam.OwnerName   = team.OwnerName;
             cTeam.OwnerUserID = team.OwnerUserID;
             cTeam.TeamName    = team.TeamName;
             cTeam.TeamImage   = team.TeamImage;
             context.SaveChanges();
         }
     }
 }
Example #30
0
 public void InsertStatValue(SeasonPlayerPositionStatDomainModel statvalue)
 {
     using (CSBAAzureEntities context = new CSBAAzureEntities())
     {
         var _cStatVal = new SeasonPlayerPositionStat
         {
             SeasonID   = statvalue.SeasonID,
             PlayerGUID = (Guid)statvalue.PlayerGUID,
             PositionID = statvalue.PositionID,
             StatID     = statvalue.StatID,
             StatValue  = statvalue.StatValue
         };
         context.SeasonPlayerPositionStats.Add(_cStatVal);
         context.SaveChanges();
     }
 }