public void GetOnsiteCourseData() { // Initialize string query = @"SELECT TOP 1 * FROM OnsiteCourse"; // Execute SqlDataReader reader = _dbHelper.QueryDB(query); reader.Read(); OnsiteCourse retrieved = _dbHelper.GetOnsiteCourseData(reader); // Validate Assert.IsTrue(reader.HasRows); Assert.NotNull(retrieved); }
/// <summary> /// Converts row data retrieved from the DB into OnsiteCourse /// </summary> /// <param name="row">DB row data</param> /// <returns>OnsiteCourse data; null if conversion not possible</returns> public OnsiteCourse GetOnsiteCourseData(SqlDataReader row) { OnsiteCourse retrieved = null; try { retrieved = new OnsiteCourse { CourseID = row.GetInt32(0), Location = row.GetString(1), Days = row.GetString(2), Time = row.GetDateTime(3).ToString() }; } catch { retrieved = null; } return(retrieved); }
/// <summary> /// Create a new OnsiteCourse object. /// </summary> /// <param name="courseID">Initial value of CourseID.</param> /// <param name="location">Initial value of Location.</param> /// <param name="days">Initial value of Days.</param> /// <param name="time">Initial value of Time.</param> public static OnsiteCourse CreateOnsiteCourse(int courseID, string location, string days, global::System.DateTime time) { OnsiteCourse onsiteCourse = new OnsiteCourse(); onsiteCourse.CourseID = courseID; onsiteCourse.Location = location; onsiteCourse.Days = days; onsiteCourse.Time = time; return onsiteCourse; }
/// <summary> /// There are no comments for OnsiteCourse in the schema. /// </summary> public void AddToOnsiteCourse(OnsiteCourse onsiteCourse) { base.AddObject("OnsiteCourse", onsiteCourse); }