public void RetrievingPresentAndFutureDescriptions() { using (OdsRepository ods = new OdsRepository()) { ICourseID courseID = CourseID.FromString("ECON&201"); IList <CourseDescription> descs = ods.GetCourseDescription(courseID, YearQuarter.FromString("B234")); Assert.IsNotNull(descs); foreach (CourseDescription desc in descs) { Console.Out.WriteLine("[{0}] {1}", desc.YearQuarterBegin, desc.Description); } Assert.IsTrue(descs.Count > 1, "ECON& 201 should have 2 descriptions, but only has {0}", descs.Count); } }
protected override void Fill() { lblMessage.Visible = false; FillCourses(); if (CourseID > 0) { trSlideHeader.Visible = true; ddlCourse.SelectedIndex = -1; ddlCourse.Items.FindByValue(CourseID.ToString()).Selected = true; if (IsTrngAdmin || TrngCourseAdmin.IsAdmin(CourseID, CurrentUser.ID)) { trSlideHeader.Visible = true; GetSlides(CourseID); } else { lblMessage.Visible = true; trSlideHeader.Visible = false; lblMessage.Text = "<br> You must be a course administrator for the selected course to modify."; } } }
public void GetSections_VerifyInstructor() { using (OdsRepository repository = new OdsRepository()) { IList <Section> sections = repository.GetSections(CourseID.FromString("ENGL", "101")); ISection sec = sections.Where(s => s.Offered != null && s.Offered.Where(o => !string.IsNullOrWhiteSpace(o.InstructorID) && !string.IsNullOrWhiteSpace(o.InstructorName) ) .Count() > 0) .Take(1).Single(); OfferedItem item = sec.Offered.Where(o => !string.IsNullOrWhiteSpace(o.InstructorID) && !string.IsNullOrWhiteSpace(o.InstructorName) ) .Take(1).Single(); string expected = _dataVerifier.GetInstructorName(item.InstructorID); Assert.AreEqual(expected, item.InstructorName); } }
private void AddCourse(object obj) { if (CourseName == null || CourseName.Length == 0) { Output = "Please enter course name"; return; } if (CourseID == null || CourseID.Length == 0) { Output = "Please enter course ID"; return; } foreach (char c in CourseID.Trim()) { if (c < '0' || c > '9') { Output = "courseID can only contain numbers, invalid character '" + c + "'"; return; } } if (MaxPart == null || MaxPart.Length == 0) { Output = "Please enter max number of participants"; return; } try { Dal.AddCourse(CourseID, CourseName, int.Parse(MaxPart)); Output = "Course added"; } catch (Exception e) { HandleException(e); } }
protected override void Fill() { ddlOrgGroup.Enabled = false; tdCourseCompletions.Visible = false; tdCourseSummary.Visible = false; FillCourses(); FillOrgGroups(); if (CourseID > 0) { ddlOrgGroup.Enabled = true; tdLookup.Visible = true; tdItem.Visible = false; ddlCourse.SelectedIndex = -1; ddlCourse.Items.FindByValue(CourseID.ToString()).Selected = true; tdCourseCompletions.Visible = true; tdCourseSummary.Visible = true; if (OrgGroupID == 0) { ddlOrgGroup.SelectedIndex = 0; GetCourseMetrics(CourseID); GetCourseSummary(CourseID); } else { ddlOrgGroup.SelectedIndex = -1; ddlOrgGroup.Items.FindByValue(OrgGroupID.ToString()).Selected = true; GetCourseMetrics(CourseID, OrgGroupID); GetCourseSummary(CourseID, OrgGroupID); } if (UserID > 0) { LookupUser(); } } }
public string[] ListCourses() { var rad = new string[] { CourseID.ToString(), HP.ToString(), Name }; return(rad); }
public void saveUsers() { //connect to db objConn.Open(); //set up and run the sql if (CourseID == 0) { objCmd = new SqlCommand("INSERT INTO Courses (StudentName, CourseName, CourseTime) VALUES ('" + StudentName + "', '" + CourseName + "', '" + CourseTime + "')", objConn); } else { objCmd = new SqlCommand("UPDATE Courses SET CompanyName = '" + StudentName + "','" + CourseName + "', '" + CourseTime + "' WHERE CourseD = " + CourseID.ToString(), objConn); } objCmd.ExecuteNonQuery(); //clean up objCmd.Dispose(); objConn.Close(); }
public static string SubjectWithCommonCourseFlag(CourseID course) { return SubjectWithCommonCourseFlag(course.Subject, course.IsCommonCourse); }
public void CourseDescription_CourseIDLookup_Success() { using (OdsRepository repository = new OdsRepository()) { IEnumerable <CourseDescription> courseDescriptions = repository.GetCourseDescription(CourseID.FromString("art 101")); Assert.IsNotNull(courseDescriptions, "Method returned null"); int allCoursesCount = courseDescriptions.Count(); Assert.IsTrue(allCoursesCount > 0, "{0} descriptions were returned", allCoursesCount); int filteredCourseCount = courseDescriptions.Where(c => Regex.IsMatch(c.CourseID.ToUpper(), @"ART\s+101")).Count(); Assert.AreEqual(allCoursesCount, filteredCourseCount); } }
public override string ToString() { return(CourseID.ToString() + " " + TeeID.ToString()); }