Beispiel #1
0
        /// <summary>
        /// Gets a list of LectureNotes
        /// </summary>
        /// <param name="cid">A unique course ID.</param>
        /// <returns>List of LectureNotes</returns>
        public static LectureNoteList GetItem(string courseID)
        {
            LectureNoteList myLectureNoteList = null;

            using (SqlConnection myConnection = new SqlConnection(AppSettings.ConnectionString))
            {
                SqlCommand myCommand = new SqlCommand("spGetLectureNoteByCourse", myConnection);
                myCommand.CommandType = CommandType.StoredProcedure;
                myCommand.Parameters.AddWithValue("@courseID", courseID);
                myConnection.Open();
                using (SqlDataReader myDataReader = myCommand.ExecuteReader())
                {
                    if (myDataReader.HasRows)
                    {
                        myLectureNoteList = new LectureNoteList();
                        while (myDataReader.Read())
                        {
                            myLectureNoteList.Add(FillRecord(myDataReader));
                        }
                    }
                    myDataReader.Close();
                }
                myConnection.Close();
            }
            return(myLectureNoteList);
        }
Beispiel #2
0
 /// <summary>
 /// Gets a list of LectureNotes
 /// </summary>
 /// <param name="cid">A unique course ID.</param>
 /// <returns>List of LectureNotes</returns>
 public static LectureNoteList GetItem(string courseID)
 {
     LectureNoteList myLectureNoteList = null;
     using (SqlConnection myConnection = new SqlConnection(AppSettings.ConnectionString))
     {
         SqlCommand myCommand = new SqlCommand("spGetLectureNoteByCourse", myConnection);
         myCommand.CommandType = CommandType.StoredProcedure;
         myCommand.Parameters.AddWithValue("@courseID", courseID);
         myConnection.Open();
         using (SqlDataReader myDataReader = myCommand.ExecuteReader())
         {
             if (myDataReader.HasRows)
             {
                 myLectureNoteList = new LectureNoteList();
                 while (myDataReader.Read())
                 {
                     myLectureNoteList.Add(FillRecord(myDataReader));
                 }
             }
             myDataReader.Close();
         }
         myConnection.Close();
     }
     return myLectureNoteList;
 }