private void LoadActiveTeamScores() { string strWrite = ""; int intCount = 0; using (SqlConnection cn = new SqlConnection(clsSpeedo.SpeedoConnectionString)) { using (SqlCommand cmd = cn.CreateCommand()) { cmd.CommandText = "SELECT TeamID,(SELECT Name FROM Portal.Team WHERE ActivityID=@ActivityID AND TeamID=pet.TeamID) AS Name, Rank, Score FROM Portal.EventTeamScore AS pet WHERE EventID=@EventID ORDER BY TeamID"; cmd.Parameters.Add(new SqlParameter("@EventID", GetActiveEvent())); cmd.Parameters.Add(new SqlParameter("@ActivityID", SynergyCurrentID)); cn.Open(); SqlDataReader dr = cmd.ExecuteReader(); while (dr.Read()) { strWrite = strWrite + "<tr> " + "<td><a href='../Synergy/TeamDetails.aspx?teamid=" + dr["TeamID"].ToString() + "'>" + dr["Name"].ToString() + "</a></td>" + "<td style='text-align:center'>" + DALPortal.CountTotalWon(dr["TeamID"].ToString().ToInt(), GetActiveEvent().ToInt()).ToString() + "</td>" + "<td style='text-align:center'>" + DALPortal.CountTotalLost(dr["TeamID"].ToString().ToInt(), GetActiveEvent().ToInt()).ToString() + "</td>" + "</tr>"; } } } lblTeamLineUp.Text = GetActiveEventName() + " Team Standing"; litLineup.Text = strWrite; }
public static string GetStanding(int teamID, int eventID) { string standing = ""; int scoringType = 0; using (PortalDataContext pdc = new PortalDataContext()) { scoringType = (from ev in pdc.Events where ev.EventID == eventID select ev.ScoringTypeID).SingleOrDefault(); } if (scoringType == 1) { standing = "(" + DALPortal.CountTotalWon(teamID, eventID).ToString() + "-" + DALPortal.CountTotalDraw(teamID, eventID).ToString() + "-" + DALPortal.CountTotalLost(teamID, eventID).ToString() + ")"; } else if (scoringType == 2) { standing = "(" + DALPortal.GetScore(teamID, eventID).ToString() + ")"; } return(standing); }