/// <summary> /// Athlete list for add and edit athlete in test /// </summary> /// <param name="auFlag">Operation flag</param> /// <param name="testId"></param> /// <returns>Athlete list</returns> public List <GetTestAthlete> GetAthleteListForAddNUpdate(string auFlag, long testId) { List <GetTestAthlete> lstGetTestAthlete = new List <GetTestAthlete>(); using (SqlConnection connection = new SqlConnection(this.conn)) { string sql = "GetAthleteListForAddNUpdate"; using (SqlCommand command = new SqlCommand(sql, connection)) { command.CommandType = CommandType.StoredProcedure; command.Parameters.Add("@AUFlag", SqlDbType.NVarChar).Value = auFlag; command.Parameters.Add("@TestId", SqlDbType.BigInt).Value = testId; connection.Open(); SqlDataReader reader = command.ExecuteReader(); while (reader.Read()) { GetTestAthlete getTestAthlete = new GetTestAthlete(); getTestAthlete.UserId = long.Parse((reader["UserId"].ToString())); getTestAthlete.FirstName = reader["FirstName"].ToString(); getTestAthlete.LastName = reader["LastName"].ToString(); getTestAthlete.Score = decimal.Parse(reader["Score"].ToString()); lstGetTestAthlete.Add(getTestAthlete); } connection.Close(); } } return(lstGetTestAthlete); }
/// <summary> /// Get athlete list for particular test /// </summary> /// <param name="testId"></param> /// <returns>Athlete list</returns> public List <GetTestAthlete> GetTestAthlete(long testId) { try { List <GetTestAthlete> lstGetTestAthlete = new List <GetTestAthlete>(); using (SqlConnection connection = new SqlConnection(this.conn)) { string sql = "GetTestAthlete"; using (SqlCommand command = new SqlCommand(sql, connection)) { command.CommandType = CommandType.StoredProcedure; command.Parameters.Add("@TestId", SqlDbType.BigInt).Value = testId; connection.Open(); SqlDataReader reader = command.ExecuteReader(); while (reader.Read()) { GetTestAthlete getTestAthlete = new GetTestAthlete(); getTestAthlete.UserId = long.Parse(reader["UserId"].ToString()); getTestAthlete.UserTestId = long.Parse(reader["UserTestId"].ToString()); getTestAthlete.TestId = long.Parse(reader["TestId"].ToString()); getTestAthlete.TestMasterId = Int16.Parse(reader["TestMasterId"].ToString()); getTestAthlete.FirstName = reader["FirstName"].ToString(); getTestAthlete.LastName = reader["LastName"].ToString(); getTestAthlete.Score = decimal.Parse(reader["Score"].ToString()); lstGetTestAthlete.Add(getTestAthlete); } connection.Close(); } } return(lstGetTestAthlete); } catch (Exception ex) { return(null); } }