コード例 #1
0
 /// <summary>
 /// This method creates a new team in the eventregistration table. If the event is a single player, then it stores the ttid in the 
 /// table otherwise it is set to 0;
 /// </summary>
 /// <param name="e">An object of Event Class.</param>
 /// <param name="t">An object of Team Class.</param>
 /// <returns></returns>
 public static int CreateNewTeam(Event e, Team t)
 {
     sql = "INSERT INTO EventRegistrations(EventID,TTID,CurrentLevel) VALUES(@eventID,@ttID,@currentLevel)";
     Connect.ConnectEMS();
     string[] s = { "@eventID", "@ttID", "@currentLevel" };
     if (e.IsSinglePlayer)
         c = new Connect(sql, s, e.ID, t.Participants[0].TTID, 1);
     else
         c = new Connect(sql, s, e.ID, 0, 1);
     int teamID = -1;
     teamID = c.lastId;
     return teamID;
 }
コード例 #2
0
        public static Team GetTeam(int teamID)
        {
            DataTable teamDataTable = new DataTable();
            teamDataTable = TeamRepository.GetTeam(teamID);

            List<Participant> participants = new List<Participant>();
            foreach (DataRow row in teamDataTable.Rows)
            {
                participants.Add(new Participant { TTID = (int)row["TTID"] });
            }

            Team team = new Team
            {
                ID = teamID,
                Participants = participants
            };
            return team;
        }
コード例 #3
0
 /// <summary>
 /// This method inserts the team into the teams table of the EMS14 database.
 /// </summary>
 /// <param name="t">An object of Team class.</param>
 /// <returns>It returns true if the team is successfully inserted otherwise false.</returns>
 public static bool AddNewTeam(Team t)
 {
     sql = "INSERT INTO  Teams VALUES(@teamID,@ttID)";
     Connect.ConnectEMS();
     string[] s = { "@teamID", "@ttID" };
     foreach(Participant p in t.Participants)
     {
         try
         {
             c = new Connect(sql, s, t.ID, p.TTID);
         }
         catch(Exception ex)
         {
             return false;
         }
     }
     return true;
 }
コード例 #4
0
 public static int CreateNewTeam(Event e, Team t)
 {
     return EventRepository.CreateNewTeam(e, t);
 }
コード例 #5
0
 public static bool AddNewTeam(Team t)
 {
     return TeamRepository.AddNewTeam(t);
 }