Example #1
0
        public void PersonRemove(int personID)
        {
            Person person = new Person();

            try
            {
                using (NetballEntities context = new NetballEntities())
                {
                    person = context.People
                             .Where(p => p.PersonID == personID)
                             .FirstOrDefault();

                    if (person != null)
                    {
                        context.Entry(person).State = EntityState.Deleted;
                        context.SaveChanges();
                    }
                    else
                    {
                        throw new Exception("Person could not be found for personID " + personID.ToString());
                    }
                }
            }
            catch (Exception ex)
            {
                throw ex;
            }
        }
Example #2
0
 /// <summary>
 /// Deletes a given Division object.
 /// </summary>
 /// <param name="Division"></param>
 public void DivisionRemove(Division division)
 {
     try
     {
         using (NetballEntities context = new NetballEntities())
         {
             context.Entry(division).State = EntityState.Deleted; context.SaveChanges();
         }
     }
     catch (Exception ex)
     {
         throw ex;
     }
 }
Example #3
0
 /// <summary>          /// Deletes a given Game object.
 /// </summary>
 /// <param name="Game"></param>
 public void GameRemove(Game game)
 {
     try
     {
         using (NetballEntities context = new NetballEntities())
         {
             context.Entry(game).State = EntityState.Deleted; context.SaveChanges();
         }
     }
     catch (Exception ex)
     {
         throw ex;
     }
 }
Example #4
0
        /// <summary>
        /// Deletes a given Court object.
        /// </summary>
        /// <param name="Court"></param>

        public void CourtRemove(Court court)
        {
            try
            {
                using (NetballEntities context = new NetballEntities())
                {
                    context.Entry(court).State = EntityState.Deleted; context.SaveChanges();
                }
            }
            catch (Exception ex)
            {
                throw ex;
            }
        }
Example #5
0
        /// <summary>
        /// Deletes a given Team object.
        /// </summary>
        /// <param name="Team"></param>

        public void TeamRemove(Team team)
        {
            try
            {
                using (NetballEntities context = new NetballEntities())
                {
                    context.Entry(team).State = EntityState.Deleted;
                    context.SaveChanges();
                }
            }
            catch (Exception ex)
            {
                throw ex;
            }
        }
Example #6
0
 public void TeamPlayerInsert(TeamPlayer teamPlayer)
 {
     try
     {
         using (NetballEntities context = new NetballEntities())
         {
             context.Entry(teamPlayer).State = EntityState.Added;
             context.SaveChanges();
         }
     }
     catch (Exception ex)
     {
         throw ex;
     }
 }
Example #7
0
 public void AwardDeleteTransaction(Award award)
 {
     try
     {
         using (NetballEntities context = new NetballEntities())
         {
             context.Entry(award).State = EntityState.Deleted;
             context.SaveChanges();
         }
     }
     catch (Exception ex)
     {
         throw ex;
     }
 }
Example #8
0
        /// <summary>
        /// Deletes a given QuarterType object.
        /// </summary>
        /// <param name="QuarterType"></param>

        public void QuarterTypeRemove(QuarterType quartertype)
        {
            try
            {
                using (NetballEntities context = new NetballEntities())
                {
                    context.Entry(quartertype).State = EntityState.Deleted;
                    context.SaveChanges();
                }
            }
            catch (Exception ex)
            {
                throw ex;
            }
        }
Example #9
0
        public int?GamePlayerUpdateTransaction(GamePlayer gameplayer)
        {
            int?gameplayerID = null;

            try
            {
                using (NetballEntities context = new NetballEntities())
                {
                    context.Entry(gameplayer).State = EntityState.Modified;
                    context.SaveChanges();
                    gameplayerID = gameplayer.GamePlayerID;
                }
            }
            catch (Exception ex)
            {
                throw ex;
            }
            return(gameplayerID);
        }
Example #10
0
        /// <summary>
        /// Insert a Game object in Game table returning GameID if successful.
        /// GameID = null if failed.
        /// </summary>
        /// <param name="Game"></param>
        /// <returns></returns>
        public int?GameAdd(Game game)
        {
            int?gameID = null;

            try
            {
                using (NetballEntities context = new NetballEntities())
                {
                    context.Entry(game).State = EntityState.Added;
                    context.SaveChanges();
                    gameID = game.GameID;
                }
            }
            catch (Exception ex)
            {
                throw ex;
            }
            return(gameID);
        }
Example #11
0
        public int?TeamPlayersUpdateTransaction(TeamPlayer teamPlayer)
        {
            int?TeamPlayersID = null;

            try
            {
                using (NetballEntities context = new NetballEntities())
                {
                    context.Entry(teamPlayer).State = EntityState.Modified;
                    context.SaveChanges();
                    TeamPlayersID = teamPlayer.TeamPlayerID;
                }
            }
            catch (Exception ex)
            {
                throw ex;
            }
            return(TeamPlayersID);
        }
Example #12
0
        public int?TournamentUpdateTransaction(Tournament tournament)
        {
            int?tournamentID = null;

            try
            {
                using (NetballEntities context = new NetballEntities())
                {
                    context.Entry(tournament).State = EntityState.Modified;
                    context.SaveChanges();
                    tournamentID = tournament.TournamentID;
                }
            }
            catch (Exception ex)
            {
                throw ex;
            }
            return(tournamentID);
        }
Example #13
0
        /// <summary>
        /// Insert a coach object in Coach table returning coachID if successful.
        /// CoachID = null if failed.
        /// </summary>
        /// <param name="coach"></param>
        /// <returns></returns>
        public int?CoachAdd(Coach coach)
        {
            int?coachID = null;

            try
            {
                using (NetballEntities context = new NetballEntities())
                {
                    context.Entry(coach).State = EntityState.Added;
                    context.SaveChanges();
                    coachID = coach.CoachID;
                }
            }
            catch (Exception ex)
            {
                throw ex;
            }
            return(coachID);
        }
Example #14
0
        public int?DivisionUpdateTransaction(Division division)
        {
            int?divisionID = null;

            try
            {
                using (NetballEntities context = new NetballEntities())
                {
                    context.Entry(division).State = EntityState.Modified;
                    context.SaveChanges();
                    divisionID = division.DivisionID;
                }
            }
            catch (Exception ex)
            {
                throw ex;
            }
            return(divisionID);
        }
Example #15
0
        public int?QuarterTypeUpdateTransaction(QuarterType quartertype)
        {
            int?quartertypeID = null;

            try
            {
                using (NetballEntities context = new NetballEntities())
                {
                    context.Entry(quartertype).State = EntityState.Modified;
                    context.SaveChanges();
                    quartertypeID = quartertype.QuarterTypeID;
                }
            }
            catch (Exception ex)
            {
                throw ex;
            }
            return(quartertypeID);
        }
Example #16
0
        public int?CourtUpdateTransaction(Court court)
        {
            int?courtID = null;

            try
            {
                using (NetballEntities context = new NetballEntities())
                {
                    context.Entry(court).State = EntityState.Modified;
                    context.SaveChanges();
                    courtID = court.CourtID;
                }
            }
            catch (Exception ex)
            {
                throw ex;
            }
            return(courtID);
        }
Example #17
0
        /// <summary>
        /// Insert a Team object in Team table returning TeamID if successful.
        /// TeamID = null if failed.
        /// </summary>
        /// <param name="Team"></param>
        /// <returns></returns>
        public int?TeamAdd(Team team)
        {
            int?teamID = null;

            try
            {
                using (NetballEntities context = new NetballEntities())
                {
                    context.Entry(team).State = EntityState.Added;
                    context.SaveChanges();
                    teamID = team.TeamID;
                }
            }
            catch (Exception ex)
            {
                throw ex;
            }
            return(teamID);
        }
Example #18
0
        public int?PersonUpdateTransaction(Person person)
        {
            int?personID = null;

            try
            {
                using (NetballEntities context = new NetballEntities())
                {
                    context.Entry(person).State = EntityState.Modified;
                    context.SaveChanges();
                    personID = person.PersonID;
                }
            }
            catch (Exception ex)
            {
                throw ex;
            }
            return(personID);
        }
Example #19
0
        public int?AwardAdd(Award award)
        {
            int?awardID = null;

            try
            {
                using (NetballEntities context = new NetballEntities())
                {
                    context.Entry(award).State = EntityState.Added;
                    context.SaveChanges();
                    awardID = award.AwardID;
                }
            }
            catch (Exception ex)
            {
                throw ex;
            }
            return(awardID);
        }