protected void Page_Load(object sender, EventArgs e) { if (IsLoggedIn) { //If the call is not post back load all data if (!IsPostBack) { //Get All Years thats sessions has been scheduled on ddlYears.DataSource = rs.GetAllSessionsPossibleYears(); ddlYears.DataBind(); //Add General empty Item in the top of the list ddlYears.Items.Insert(0, new ListItem("All", String.Empty)); ddlYears.SelectedIndex = 0; //Get All Years thats users has registered on ddlUsersYears.DataSource = rs.GetRegisteredUsersPossibleYears(); ddlUsersYears.DataBind(); //Add General empty Item in the top of the list ddlUsersYears.Items.Insert(0, new ListItem("All", String.Empty)); ddlUsersYears.SelectedIndex = 0; //Get All Years thats sessions has been scheduled on List <int> coursesYears = rs.GetTopCoursesPossibleYears(); ddlTopCoursesYears.DataSource = coursesYears; ddlTopCoursesYears.DataBind(); //Add General empty Item in the top of the list ddlTopCoursesYears.Items.Insert(0, new ListItem("All", String.Empty)); ddlTopCoursesYears.SelectedIndex = 0; ddlTopRatedCoursesYears.DataSource = coursesYears; ddlTopRatedCoursesYears.DataBind(); //Add General empty Item in the top of the list ddlTopRatedCoursesYears.Items.Insert(0, new ListItem("All", String.Empty)); ddlTopRatedCoursesYears.SelectedIndex = 0; //Object to hold report data Result <List <ReportModel> > result = null; //get all sessions statuses vs count result = rs.GetAllSessionsBreakDown(); if (result.isSuccess) { SessionsStatus = result.resultObject; //Fill the session chart FillSessionsChart(SessionsStatus); } //get all registered user count split by year of registration result = rs.GetAllRegisteredUsersCount(); if (result.isSuccess) { RegisteredUsersCount = result.resultObject; FillUsersChart(RegisteredUsersCount); } //Get list of top 10 courses based on number of registred students result = rs.GetTopCoursesOfAllTime(10); if (result.isSuccess) { TopCourses = result.resultObject; FillTopCoursesChart(TopCourses); } //Get list of top 10 rated courses based on session ratings result = rs.GetTopRatedCoursesOfAllTime(10); if (result.isSuccess) { TopRatedCourses = result.resultObject; FillTopRatedCoursesChart(TopRatedCourses); } } else //if the call it is not a PostBack reload all the graphs again { FillSessionsChart(SessionsStatus); FillUsersChart(RegisteredUsersCount); FillTopCoursesChart(TopCourses); FillTopRatedCoursesChart(TopRatedCourses); } } }