protected void Page_Load(object sender, System.EventArgs e) { if (!this.IsPostBack) { panelReport.Visible = false; panelReportParams.Visible = true; pagTitle.InnerText = ResourceManager.GetString("pagTitle"); BusinessServices.Organisation objOrg = new BusinessServices.Organisation(); DataTable dtCoursesExist = objOrg.GetCourseAccessList(UserContext.UserData.OrgID); int rowCount = 0; DataRow[] drCoursesExist = dtCoursesExist.Select("Granted = 1"); foreach (DataRow dr in drCoursesExist) { rowCount++; } if (rowCount == 0) { lblError.Text = ResourceManager.GetString("lblError.NoCourse"); panCourse.Visible = false; } else { DataTable dtCourses = BusinessServices.CourseLicensing.GetCoursesWithPeriod(UserContext.UserData.OrgID); rptList.DataSource = dtCourses; rptList.DataBind(); if (dtCourses.Rows.Count == 0) { lblError.Text = ResourceManager.GetString("lblError.NoCoursePeriod"); //"No courses exist with periods in this organisation."; //ResourceManager.GetString("msgNoCoursesExistInThisOrganisation"); panCourse.Visible = false; } } } }
} // LoadData /// <summary> /// Loads the course list that is assigned to this organisation. /// </summary> private void GetCourseList() { // Get the organisation BusinessServices.Organisation objOrganisation = new BusinessServices.Organisation(); DataTable dtbCourses = objOrganisation.GetCourseAccessList(UserContext.UserData.OrgID); if (dtbCourses.Rows.Count > 0) { this.dtgCourse.DataKeyField = "CourseID"; this.dtgCourse.DataSource = dtbCourses; this.dtgCourse.DataBind(); this.btnSave.Visible = true; } else { this.btnSave.Visible = false; this.lblMessage.Text = ResourceManager.GetString("lblMessage.NoCourse");//"No courses were found"; this.lblMessage.CssClass = "FeedbackMessage"; } } // GetCourseList
} // SaveData #endregion private void UpdateProfilePoints() { // Initialise parameters to be passed string ProfilePointsType; ProfilePointsType = "M"; double Points = 0.0; int Active = 1; BusinessServices.Organisation objOrganisation = new BusinessServices.Organisation(); DataTable dtCourses = objOrganisation.GetCourseAccessList(UserContext.UserData.OrgID); foreach (DataRow drCourse in dtCourses.Rows) { int intCourseID = int.Parse(drCourse["CourseID"].ToString()); BusinessServices.Module objModule = new BusinessServices.Module(); DataTable dtModules = objModule.GetModuleListByCourse(intCourseID, UserContext.UserData.OrgID); foreach (DataRow drModule in dtModules.Rows) { int intModuleID = int.Parse(drModule["ModuleID"].ToString()); BusinessServices.Profile objProfile = new BusinessServices.Profile(); DataTable dtProfiles = objProfile.GetProfilesForCurrentOrg(UserContext.UserData.OrgID); foreach (DataRow drProfile in dtProfiles.Rows) { int intProfileID = int.Parse(drProfile["ProfileID"].ToString()); int intProfilePeriodID = objProfile.GetProfilePeriodID(intProfileID); // Check if record already exists in tblProfilePoints - if not then add record if (!objProfile.CheckProfilePointsExist(intProfilePeriodID, intModuleID) && intProfilePeriodID != -1) { objProfile.AddProfilePoints(ProfilePointsType, intModuleID, intProfilePeriodID, Points, Active, UserContext.UserData.OrgID); } } } } }