protected void Page_Load(object sender, EventArgs e) { if (Tile == null) return; if (!UserHasPermission(Base.Enums.Permission.Tile_ClassSummary)) { Tile.ParentContainer.Visible = false; } g = (Thinkgate.Services.Contracts.Groups.GroupDataContract)Tile.TileParms.GetParm("group"); groupID=g.ID; List<AsyncPageTask> taskList = new List<AsyncPageTask>(); taskList.Add(new AsyncPageTask(LoadRosterTable)); foreach (AsyncPageTask page in taskList) { PageAsyncTask newTask = new PageAsyncTask(page.OnBegin, page.OnEnd, page.OnTimeout, "GroupSummary", true); Page.RegisterAsyncTask(newTask); } taskList = null; Page.ExecuteRegisteredAsyncTasks(); rosterGrid.DataBind(); rosterGrid_GraphicView.DataBind(); }
private void WaitForAllStartedTasks(bool syncCaller, bool forceTimeout) { for (int i = 0; i < this._tasks.Count; i++) { PageAsyncTask task = (PageAsyncTask)this._tasks[i]; if (task.Started && !task.Completed) { if (!forceTimeout && !this.TimeoutEndReached) { DateTime utcNow = DateTime.UtcNow; if (utcNow < this._timeoutEnd) { WaitHandle asyncWaitHandle = task.AsyncResult.AsyncWaitHandle; if (((asyncWaitHandle != null) && asyncWaitHandle.WaitOne((TimeSpan)(this._timeoutEnd - utcNow), false)) && task.Completed) { continue; } } } bool flag2 = false; while (!task.Completed) { if (forceTimeout || (!flag2 && this.TimeoutEndReached)) { task.ForceTimeout(syncCaller); flag2 = true; } else { Thread.Sleep(50); } } } } }
protected void Button1_Click(object sender, EventArgs e) { PageAsyncTask task = new PageAsyncTask(new BeginEventHandler(BeginAsyncOperation), new EndEventHandler(EndAsyncOperation), new EndEventHandler(TimeoutAsyncOperation), null); RegisterAsyncTask(task); WritePress(); }
protected override void OnPreRender(EventArgs e) { /* Creates an instance of the PageAsyncTask object. The fourth parameter can be used to pass any arbitrary data to the second thread that is processing the asynchronus task. */ PageAsyncTask task1 = new PageAsyncTask(Task1Begin, Task1End, Task1Timeout, null); /* Register an asyncronous task on the current page. */ this.Page.RegisterAsyncTask(task1); }
private void ResumeTasksPossiblyUnderLock(bool waitUntilDone) { while (this.AnyTasksRemain) { bool flag = false; bool flag2 = false; bool flag3 = false; for (int i = 0; i < this._tasks.Count; i++) { PageAsyncTask task = (PageAsyncTask)this._tasks[i]; if (!task.Started && (!flag3 || task.ExecuteInParallel)) { flag = true; Interlocked.Increment(ref this._tasksStarted); task.Start(this, this._page, EventArgs.Empty); if (!task.CompletedSynchronously) { flag2 = true; if (!task.ExecuteInParallel) { break; } flag3 = true; } } } if (!flag) { return; } if ((!this.TimeoutEndReached && flag2) && !waitUntilDone) { this.StartTimerIfNeeeded(); return; } bool flag4 = true; try { try { } finally { Monitor.Exit(this._app); flag4 = false; } this.WaitForAllStartedTasks(true, false); continue; } finally { if (!flag4) { Monitor.Enter(this._app); } } } }
protected void startComet() { ChatMessage.MessageTask myMessageTask = new ChatMessage.MessageTask(this.Context); myMessageTask._chatNow = ChatNow; string uid = Request.Form["uid"]; Hashtable theUser = new Hashtable(); theUser["guid"] = Session["guid"]; theUser["niceName"] = Session["niceName"].ToString(); PageAsyncTask async = new PageAsyncTask(new BeginEventHandler(myMessageTask.OnBegin), new EndEventHandler(myMessageTask.OnEnd), new EndEventHandler(myMessageTask.OnTimeout), theUser); Page.RegisterAsyncTask(async); Page.ExecuteRegisteredAsyncTasks();//异步执行 }
protected void RegisterAsyncTask() { this.AsyncTimeout = new TimeSpan(0, 0, 30); //TODO: config PageAsyncTask task = new PageAsyncTask( new BeginEventHandler(BeginAsyncRequest), new EndEventHandler(EndAsyncRequest), new EndEventHandler(TimeoutAsyncRequest), null ); this.RegisterAsyncTask(task); }
protected override void OnInit(EventArgs e) { base.OnInit(e); if (IsPostBack) return; for (var i = 0; i < 100; i++) { var task = new PageAsyncTask(BeginRequest, EndRequest, null, null, true); RegisterAsyncTask(task); } }
protected override void OnPreRender(EventArgs e) { if (this.WebPartManager.DisplayMode.AllowPageDesign) { return; } if (string.IsNullOrEmpty(RssSourceUrl)) RssSourceUrl = "http://feeds.feedburner.com/AndrewConnell"; request = WebRequest.CreateDefault(new Uri(RssSourceUrl)); PageAsyncTask task1 = new PageAsyncTask(Task1Begin, Task1End, Task1Timeout, null); this.Page.AsyncTimeout = new TimeSpan(0, 0, 12); this.Page.RegisterAsyncTask(task1); }
protected void Page_Load(object sender, EventArgs e) { if ((comboAgeFrom.Items.Count < 2 || comboAgeTo.Items.Count < 2)) { PopulateAgeCombos(null); } if (!IsPostBack) { //var userSession = PageBase.GetCurrentUserSession(); //StringWriter sw = userSession.SessionPagesDic["Friends3.aspx"]; //string outputStr = sw != null ? sw.ToString() : null; //if (false && sw != null && outputStr.IsNotNullOrEmpty()) //{ // Response.Clear(); // Response.Write(outputStr); // sw.Flush(); // sw.Close(); // userSession.SessionPagesDic["Friends3.aspx"] = new StringWriter(); // Response.End(); //} //else PopulateGenderCombos(((PageBase)Page).CurrentUserSession); } MatchToFriend1.IsVisible = MatchmakerHelper.IsMatchmakerState; if (CurrentUserSession == null) Response.Redirect("LoginThroughFacebook.aspx?back_url=" + Server.UrlEncode(Request.Url.AbsoluteUri)); if (Config.Users.CompletedProfileRequiredToBrowseSearch && CurrentUserSession != null && !CurrentUserSession.HasProfile && !CurrentUserSession.IsAdmin()) Response.Redirect("ManageProfile.aspx?err=profnotcompl"); ControlsLogicalGroupsDic = new Dictionary<string, List<Control>> { {"SideMenuLinks", (new[] {lnkShowFavorites, lnkQuickFriendsSearch, lnkShowBlockedUsers, lnkShowOnlineFriends, lnkShowFavorites, lnkShowBlockedUsers}).ToList<Control>()}, {"HideBlockedUsersLink", (new[] {lnkQuickFriendsSearch, lnkShowOnlineFriends, lnkShowFavorites, lnkShowBlockedUsers}).ToList<Control>()} }; var task = new PageAsyncTask(AsyncWorkBeginMethod, AsyncWorkEndMethod, null, asyncFetchUsernamesState, true); RegisterAsyncTask(task); base.Page_Load(sender, e); }
protected void Page_Load(object sender, EventArgs e) { if (Tile == null) return; // Simulate IsPostBack. String postBackControlID = GetControlThatCausedPostBack(Parent.Page); _isPostBack = !String.IsNullOrEmpty(postBackControlID) && !postBackControlID.StartsWith("folder"); _level = (Base.Enums.EntityTypes)Tile.TileParms.GetParm("level"); _levelID = (Int32)Tile.TileParms.GetParm("levelID"); _userID = SessionObject.LoggedInUser.Page; List<AsyncPageTask> taskList = new List<AsyncPageTask>(); if (!_isPostBack) { taskList.Add(new AsyncPageTask(BuildStandardSets)); } taskList.Add(new AsyncPageTask(BuildStandards)); foreach (AsyncPageTask page in taskList) { PageAsyncTask newTask = new PageAsyncTask(page.OnBegin, page.OnEnd, page.OnTimeout, "StandardsSearch", true); Page.RegisterAsyncTask(newTask); } taskList = null; Page.ExecuteRegisteredAsyncTasks(); // Create the initial viewstate values. if (ViewState[_standardSetFilterKey] == null) { ViewState.Add(_standardSetFilterKey, "All"); ViewState.Add(_gradeFilterKey, "All"); ViewState.Add(_subjectFilterKey, "All"); } // Set the current filter visibility. SetFilterVisibility(); if (!_isPostBack) { BuildStandardSets(); BuildGrades(); BuildSubjects(); BuildStandards(); } }
//protected override void OnInitComplete(EventArgs e) //{ // base.OnInitComplete(e); //} //protected override void OnPreLoad(EventArgs e) //{ // base.OnPreLoad(e); //} protected void Page_Load(object sender, EventArgs e) { _itsContext = HttpContext.Current; WebPartManager2.SelectedWebPartChanged += WebPartManager2SelectedWebPartChanged; WebPartManager2.DisplayModeChanged += WebPartManager2DisplayModeChanged; this.AsyncPageBeginHandlersList = new List<BeginEventHandler> { AsyncWorkBeginMethod }; this.AsyncPageEndHandlersList = new List<EndEventHandler> { AsyncWorkEndMethod }; for (int idx = 0; idx < AsyncPageBeginHandlersList.Count; idx++) { var asyncTask = new PageAsyncTask(AsyncPageBeginHandlersList[idx], AsyncPageEndHandlersList[idx], null, new HomePageAsyncState(this), true); RegisterAsyncTask(asyncTask); } base.Page_Load(sender, e); }
protected void Page_Load(object sender, EventArgs e) { MatchToFriend1.IsVisible = MatchmakerHelper.IsMatchmakerState; if (CurrentUserSession == null) Response.Redirect("LoginThroughFacebook.aspx?back_url=" + Server.UrlEncode(Request.Url.AbsoluteUri)); if (Config.Users.CompletedProfileRequiredToBrowseSearch && CurrentUserSession != null && !CurrentUserSession.HasProfile && !CurrentUserSession.IsAdmin()) Response.Redirect("ManageProfile.aspx?err=profnotcompl"); ControlsLogicalGroupsDic = new Dictionary<string, List<Control>> { {"SideMenuLinks", (new[] {lnkShowFavorites, lnkQuickFriendsSearch, lnkShowBlockedUsers, lnkShowOnlineFriends, lnkShowFavorites, lnkShowBlockedUsers}).ToList<Control>()}, {"HideBlockedUsersLink", (new[] {lnkQuickFriendsSearch, lnkShowOnlineFriends, lnkShowFavorites, lnkShowBlockedUsers}).ToList<Control>()} }; var task = new PageAsyncTask(AsyncWorkBeginMethod, AsyncWorkEndMethod, null, asyncFetchUsernamesState, true); RegisterAsyncTask(task); }
protected void Page_Load(object sender, EventArgs e) { // Define the asynchronuous task. SlowTask slowTask1 = new SlowTask(); SlowTask slowTask2 = new SlowTask(); SlowTask slowTask3 = new SlowTask(); PageAsyncTask asyncTask1 = new PageAsyncTask(slowTask1.OnBegin, slowTask1.OnEnd, slowTask1.OnTimeout, "Async1", true); PageAsyncTask asyncTask2 = new PageAsyncTask(slowTask2.OnBegin, slowTask2.OnEnd, slowTask2.OnTimeout, "Async2", true); PageAsyncTask asyncTask3 = new PageAsyncTask(slowTask3.OnBegin, slowTask3.OnEnd, slowTask3.OnTimeout, "Async3", true); // Register the asynchronous task. Page.RegisterAsyncTask(asyncTask1); Page.RegisterAsyncTask(asyncTask2); Page.RegisterAsyncTask(asyncTask3); // Execute the register asynchronous task. Trace.Write("Registering async tasks"); Page.ExecuteRegisteredAsyncTasks(); Trace.Write("Executed async tasks"); TaskMessage.InnerHtml = slowTask1.GetAsyncTaskProgress() + "<br />" + slowTask2.GetAsyncTaskProgress() + "<br />" + slowTask3.GetAsyncTaskProgress(); }
protected void btnGo_click(object sender, EventArgs e) { switch(lstOperation.SelectedValue.ToUpperInvariant()) { case "PAGE": PageAsyncTask task = new PageAsyncTask( new BeginEventHandler(BeginPageRequest), new EndEventHandler(EndPageRequest), new EndEventHandler(TimeoutPageRequest), null); RegisterAsyncTask(task); break; case "WIKI": AddOnPreRenderCompleteAsync( new BeginEventHandler(BeginPagesListRequest), new EndEventHandler(EndPagesListRequest) ); break; case "TEXT": mlwImport.ActiveViewIndex = 3; ITranslator translator = new Translator(); txtTranslated.Text = translator.Translate(txtText.Text); break; } }
protected void Page_Load(object sender, EventArgs e) { if (!UserHasPermission(Base.Enums.Permission.Tile_SuspensionRates_School)) { Tile.ParentContainer.Visible = false; } _level = (Thinkgate.Base.Enums.EntityTypes)Tile.TileParms.GetParm("level"); _levelID = DataIntegrity.ConvertToInt(Tile.TileParms.GetParm("levelID")); List<AsyncPageTask> taskList = new List<AsyncPageTask>(); taskList.Add(new AsyncPageTask(GetSuspensionForSchool)); foreach (AsyncPageTask page in taskList) { PageAsyncTask newTask = new PageAsyncTask(page.OnBegin, page.OnEnd, page.OnTimeout, "SuspensionRates", true); Page.RegisterAsyncTask(newTask); } taskList = null; Page.ExecuteRegisteredAsyncTasks(); BuildChart(chartInSchool, data.Tables[0]); BuildChart(chartOutOfSchool, data.Tables[1]); radPageViewInSchool.Visible = tabInSchool.Visible = UserHasPermission(Base.Enums.Permission.Tab_InSchool_Suspension_School); radPageViewOutOfSchool.Visible = tabOutOfSchool.Visible = UserHasPermission(Base.Enums.Permission.Tab_OutofSchool_Suspension_School); foreach (RadTab radTab in RadTabStrip2.Tabs) { if (radTab.Visible) { // select first visible tab and page view radTab.Selected = true; radTab.PageView.Selected = true; break; } } }
private void LoadUsingAsync() { System.Diagnostics.Trace.WriteLine("Page_Load " + Thread.CurrentThread.ManagedThreadId); AsyncTimeout = GetTimeout(); _context = Session; var task = new PageAsyncTask( BeginLoadSlowContent, EndLoadSlowContent, FailedToLoadSlowContent, null, true ); RegisterAsyncTask(task); }
protected void Page_Load(object sender, EventArgs e) { /******************************************************************* * If user does not have Icon_Expanded_Staff permissions, then hide * the "Advanced Search" link via its surrounding div tag. * ****************************************************************/ _level = (Thinkgate.Base.Enums.EntityTypes)Tile.TileParms.GetParm("level"); _levelID = DataIntegrity.ConvertToInt(Tile.TileParms.GetParm("levelID")); List<AsyncPageTask> taskList = new List<AsyncPageTask>(); taskList.Add(new AsyncPageTask(GetAttendRateForSchool)); foreach (AsyncPageTask page in taskList) { PageAsyncTask newTask = new PageAsyncTask(page.OnBegin, page.OnEnd, page.OnTimeout, "SchoolAttendance", true); Page.RegisterAsyncTask(newTask); } taskList = null; Page.ExecuteRegisteredAsyncTasks(); // Handle Legend Labels teacherCountChart.Series.Clear(); var nSeries = new ChartSeries(); var nSeries2 = new ChartSeries(); nSeries.Name = "School %"; nSeries2.Name = "District %"; //double minval = 100; //double maxval = 0; ChartAxisItemsCollection caic = new ChartAxisItemsCollection(); var year_list = new List<String>(); foreach (DataRow dr in countData.Rows) { var myItem = new ChartSeriesItem(DataIntegrity.ConvertToDouble(dr["AttendanceRate"]), dr["LevelLabel"].ToString()) { Name = dr["SchoolYear"].ToString() }; if (String.IsNullOrEmpty(dr["AttendanceRate"].ToString())) myItem.Appearance.Visible = false; // hide bar and text if the value is null (no data) if (dr["Level"].Equals("District")) { nSeries2.AddItem(myItem); } else { nSeries.AddItem(myItem); } year_list.Add(dr["SchoolYear"].ToString()); //if (minval > DataIntegrity.ConvertToDouble(dr["AttendanceRate"])) minval = DataIntegrity.ConvertToDouble(dr["AttendanceRate"]); //if (maxval < DataIntegrity.ConvertToDouble(dr["AttendanceRate"])) maxval = DataIntegrity.ConvertToDouble(dr["AttendanceRate"]); } foreach (var yl in year_list.Distinct()) { ChartAxisItem ai = new ChartAxisItem(); ai.TextBlock.Text = yl; caic.Add(ai); } teacherCountChart.PlotArea.XAxis.AddItem(caic); teacherCountChart.PlotArea.YAxis.MinValue = 0; teacherCountChart.PlotArea.YAxis.Step = 5; teacherCountChart.PlotArea.YAxis.MaxValue = 1; teacherCountChart.Series.Add(nSeries); teacherCountChart.Series.Add(nSeries2); teacherCountChart.ChartTitle.Visible = false; teacherCountChart.SetSkin("SchoolAttendanceRates"); }
private string DoCountdown(string id, string type) { uWiMP.TVServer.Streamer task = new uWiMP.TVServer.Streamer(); switch (type.ToLower()) { case "livetv": task.Media = uWiMP.TVServer.Streamer.MediaType.Tv; task.MediaID = id; break; case "radio": task.Media = uWiMP.TVServer.Streamer.MediaType.Radio; task.MediaID = id; break; case "rec": task.Media = uWiMP.TVServer.Streamer.MediaType.Recording; task.MediaID = id; break; case "tvseries": task.Media = uWiMP.TVServer.Streamer.MediaType.TvSeries; task.MediaID = HttpUtility.UrlDecode(id); break; } PageAsyncTask asyncTask = new PageAsyncTask(task.OnBegin, task.OnEnd, task.OnTimeout, "Stream", true); Page.RegisterAsyncTask(asyncTask); Page.ExecuteRegisteredAsyncTasks(); string markup = string.Empty; markup += "<div class=\"iMenu\">"; markup += string.Format("<h3>{0}</h3>", GetGlobalResourceObject("uWiMPStrings", "stream")); markup += "<div class=\"iBlock\">"; markup += string.Format("<div><p>{0}</p>", GetGlobalResourceObject("uWiMPStrings", "stream_start_wait")); markup += "<table class=\"center\"><tr>"; markup += "<td class=\"grid\" id=\"tvtimer\">-</td>"; markup += "</tr></table>"; markup += "</div>"; markup += "</div>"; markup += "</div>"; return markup; }
protected void Page_Load(object sender, EventArgs e) { if (Tile == null) return; _userID = SessionObject.LoggedInUser.Page; // Simulate IsPostBack. String postBackControlID = GetControlThatCausedPostBack(Parent.Page); _isPostBack = !String.IsNullOrEmpty(postBackControlID) && !postBackControlID.StartsWith("folder") && !postBackControlID.StartsWith("tileContainer"); // Create the initial viewstate values. if (ViewState[_currentViewIdxKey] == null) { ViewState.Add(_currentViewIdxKey, 0); ViewState.Add(_gradeFilterKey, "All"); ViewState.Add(_subjectFilterKey, "All"); ViewState.Add(_termFilterKey, "All"); ViewState.Add(_testTypeFilterKey, "All"); SetViewstateForStatusFilter(); } BtnAdd.Attributes["testCategory"] = _category; switch (_level) { case EntityTypes.Class: BtnAdd.Attributes["level"] = "Class"; break; case EntityTypes.Teacher: BtnAdd.Attributes["level"] = "Teacher"; break; case EntityTypes.School: BtnAdd.Attributes["level"] = "School"; break; case EntityTypes.District: BtnAdd.Attributes["level"] = "District"; break; } BtnAdd.Visible = (_category == AssessmentCategories.District.ToString() && UserHasPermission(Permission.Create_AssessmentDistrict)) || (_category == AssessmentCategories.Classroom.ToString() && UserHasPermission(Permission.Create_AssessmentClassroom)) || (_category == AssessmentCategories.State.ToString() && UserHasPermission(Permission.Create_AssessmentState)); btnScheduler.Attributes["yID"] = Encryption.EncryptString(_category); switch (_level) { case EntityTypes.Class: btnScheduler.Attributes["xID"] = Encryption.EncryptString(AssessmentScheduleLevels.Class.ToString()); break; case EntityTypes.Teacher: btnScheduler.Attributes["xID"] = Encryption.EncryptString(AssessmentScheduleLevels.Class.ToString()); break; case EntityTypes.School: btnScheduler.Attributes["xID"] = Encryption.EncryptString(AssessmentScheduleLevels.School.ToString()); break; case EntityTypes.District: btnScheduler.Attributes["xID"] = Encryption.EncryptString(AssessmentScheduleLevels.District.ToString()); break; } btnScheduler.Visible = (_category == AssessmentCategories.District.ToString() && UserHasPermission(Permission.Icon_AssessmentSchedules_District)) || (_category == AssessmentCategories.Classroom.ToString() && DistrictParms.LoadDistrictParms().AssessmentSchedulerClassroomAssessments && UserHasPermission(Permission.Icon_AssessmentSchedules_Classroom)) || (_category == AssessmentCategories.State.ToString() && UserHasPermission(Permission.Icon_AssessmentSchedules_State)); // Set the current filter visibility. SetFilterVisibility(); // Set the current view. SetView(); List<AsyncPageTask> taskList = new List<AsyncPageTask>(); taskList.Add(new AsyncPageTask(LoadGrades)); taskList.Add(new AsyncPageTask(LoadSubjects)); taskList.Add(new AsyncPageTask(LoadTerms)); taskList.Add(new AsyncPageTask(LoadTestTypes)); foreach (AsyncPageTask page in taskList) { PageAsyncTask newTask = new PageAsyncTask(page.OnBegin, page.OnEnd, page.OnTimeout, "ViewAssessments", true); Page.RegisterAsyncTask(newTask); } taskList = null; Page.ExecuteRegisteredAsyncTasks(); if (!_isPostBack) { BuildGrades(); BuildSubjects(); BuildTerms(); BuildTestTypes(); BuildStatuses(); } LoadAssessments(); }
public void RegisterAsyncTask(PageAsyncTask task) { }
protected void LoadPieCharts() { if (_levelID <= 0) return; var taskList = new List<AsyncPageTask> { new AsyncPageTask(GetStudentCounts), new AsyncPageTask(LoadDistrictParms) }; foreach (AsyncPageTask page in taskList) { PageAsyncTask newTask = new PageAsyncTask(page.OnBegin, page.OnEnd, page.OnTimeout, "StudentSearch", true); Page.RegisterAsyncTask(newTask); } taskList = null; Page.ExecuteRegisteredAsyncTasks(); studentCountChart.DataSource = countData; studentCountChart.ChartTitle.Visible = false; studentCountChart.DataBind(); //studentPieChartXmlHttpPanel.Value = ""; Don't need this particularly at the moment //Handle Legend Labels studentCountChart.Series.Clear(); var nSeries = new ChartSeries(); studentCountChart.PlotArea.Appearance.FillStyle.MainColor = System.Drawing.ColorTranslator.FromHtml("#FFFFFF"); studentCountChart.PlotArea.Appearance.FillStyle.FillType = Telerik.Charting.Styles.FillType.Solid; studentCountChart.PlotArea.Appearance.Border.Color = System.Drawing.ColorTranslator.FromHtml("#FFFFFF"); studentCountChart.PlotArea.XAxis.Appearance.TextAppearance.TextProperties.Font = new System.Drawing.Font("Arial", 6); studentCountChart.PlotArea.YAxis.Appearance.TextAppearance.TextProperties.Font = new System.Drawing.Font("Arial", 6); studentCountChart.PlotArea.XAxis.Appearance.LabelAppearance.Position.AlignedPosition = Telerik.Charting.Styles.AlignedPositions.TopRight; nSeries.Appearance.TextAppearance.TextProperties.Color = System.Drawing.Color.Black; nSeries.Appearance.TextAppearance.TextProperties.Font = new System.Drawing.Font("Arial", 6); nSeries.Appearance.LegendDisplayMode = ChartSeriesLegendDisplayMode.ItemLabels; var count = 0; //change to foreach for easier reading var gradeList = new List<string>(); foreach (DataRow dr in countData.Rows) { var value = DataIntegrity.ConvertToDouble(dr["StudentCount"]); var xValue = 0; switch (_level) { case EntityTypes.Teacher: xValue = dr.Table.Columns.Contains("ClassID") ? DataIntegrity.ConvertToInt(dr["ClassID"]) : 0; break; case EntityTypes.School: gradeList.Add(dr.Table.Columns.Contains("GradeNumber") ? dr["GradeNumber"].ToString() : string.Empty); xValue = gradeList.Count - 1; break; } var myItem = new ChartSeriesItem(value) { Name = dr["Grade"].ToString(), XValue = xValue }; myItem.Appearance.FillStyle.MainColor = System.Drawing.ColorTranslator.FromHtml(StyleController.GetPieChartColor(dr["Grade"].ToString(), count++)); ; myItem.Appearance.FillStyle.FillType = Telerik.Charting.Styles.FillType.Solid; if (value <= 0) myItem.Label.Visible = false; nSeries.Type = ChartSeriesType.Pie; nSeries.AddItem(myItem); studentCountChart.Series.Add(nSeries); } }
protected void Page_Load(object sender, EventArgs e) { /**************************************************************** * if user does not have Tab_Search_Staff permissions, then hide * the search tab and the radPageView associated with it. * *************************************************************/ if (!UserHasPermission(Permission.Tab_Search_Staff)) { radPageViewTeacherSearch.Visible = false; foreach (Telerik.Web.UI.RadTab tab in RadTabStrip2.Tabs) { if (tab.Text == "Search") { tab.Visible = false; break; } } } /******************************************************************* * If user does not have Icon_Expanded_Staff permissions, then hide * the "Advanced Search" link via its surrounding div tag. * ****************************************************************/ TeacherSearch_DivAdvancedSearch.Visible = (UserHasPermission(Permission.Icon_ExpandedSearch_Staff)); _level = (Thinkgate.Base.Enums.EntityTypes)Tile.TileParms.GetParm("level"); _levelID = DataIntegrity.ConvertToInt(Tile.TileParms.GetParm("levelID")); _levelType = Tile.TileParms.GetParm("levelType") != null ? Tile.TileParms.GetParm("levelType").ToString() : String.Empty; teacherSearch_HiddenLevel.Value = _level.ToString(); teacherSearch_HiddenLevelID.Value = Standpoint.Core.Classes.Encryption.EncryptInt(_levelID); teacherPieChartXmlHttpPanel.Value = string.Empty; List<AsyncPageTask> taskList = new List<AsyncPageTask>(); taskList.Add(new AsyncPageTask(LoadTeacherCounts)); taskList.Add(new AsyncPageTask(LoadDistrictParmsForPie)); foreach (AsyncPageTask page in taskList) { PageAsyncTask newTask = new PageAsyncTask(page.OnBegin, page.OnEnd, page.OnTimeout, "TeacherSearch", true); Page.RegisterAsyncTask(newTask); } taskList = null; Page.ExecuteRegisteredAsyncTasks(); LoadPieChart(); if (IsPostBack) { // Reloads previous search results if session object search text has a value if (teachersSearchText_smallTile.Value == "Search by last name..." && !string.IsNullOrEmpty(SessionObject.TeacherSearchTxtPostBack_smallTile) && SessionObject.TeacherSearchTxtPostBack_smallTile.Length > 0) { SearchTeachersByLastName_Click(null, null); } return; } teacherSearchMoreLink.Visible = false; teachersSearchTileGrid.Visible = false; addNewStaff.Visible = UserHasPermission(Base.Enums.Permission.Create_Staff); }
protected void Page_Load(object sender, EventArgs e) { if (_levelID <= 0) return; List<AsyncPageTask> taskList = new List<AsyncPageTask>(); taskList.Add(new AsyncPageTask(GetStudentCounts)); taskList.Add(new AsyncPageTask(LoadDistrictParms)); foreach (AsyncPageTask page in taskList) { PageAsyncTask newTask = new PageAsyncTask(page.OnBegin, page.OnEnd, page.OnTimeout, "StudentSearch", true); Page.RegisterAsyncTask(newTask); } taskList = null; Page.ExecuteRegisteredAsyncTasks(); studentCountChart.DataSource = countData; studentCountChart.ChartTitle.Visible = false; studentCountChart.DataBind(); studentPieChartXmlHttpPanel.Value = ""; //Handle Legend Labels studentCountChart.Series.Clear(); var nSeries = new ChartSeries(); studentCountChart.PlotArea.Appearance.FillStyle.MainColor = System.Drawing.ColorTranslator.FromHtml("#FFFFFF"); studentCountChart.PlotArea.Appearance.FillStyle.FillType = FillType.Solid; studentCountChart.PlotArea.Appearance.Border.Color = System.Drawing.ColorTranslator.FromHtml("#FFFFFF"); studentCountChart.PlotArea.XAxis.Appearance.TextAppearance.TextProperties.Font = new System.Drawing.Font("Arial", 8); studentCountChart.PlotArea.YAxis.Appearance.TextAppearance.TextProperties.Font = new System.Drawing.Font("Arial", 8); studentCountChart.PlotArea.XAxis.Appearance.LabelAppearance.Position.AlignedPosition = AlignedPositions.TopRight; nSeries.Appearance.TextAppearance.TextProperties.Color = System.Drawing.Color.Black; nSeries.Appearance.TextAppearance.TextProperties.Font = new System.Drawing.Font("Arial", 8); nSeries.Appearance.LegendDisplayMode = ChartSeriesLegendDisplayMode.ItemLabels; var count = 0; //change to foreach for easier reading var gradeList = new List<string>(); foreach (DataRow dr in countData.Rows) { var value = DataIntegrity.ConvertToDouble(dr["StudentCount"]); var xValue = 0; switch (_level) { case EntityTypes.Teacher: xValue = dr.Table.Columns.Contains("ClassID") ? DataIntegrity.ConvertToInt(dr["ClassID"]) : 0; break; case EntityTypes.School: gradeList.Add(dr.Table.Columns.Contains("GradeNumber") ? dr["GradeNumber"].ToString() : string.Empty); xValue = gradeList.Count - 1; break; } var myItem = new ChartSeriesItem(value) { Name = dr["Grade"].ToString(), XValue = xValue }; myItem.Appearance.FillStyle.MainColor = System.Drawing.ColorTranslator.FromHtml(StyleController.GetPieChartColor(dr["Grade"].ToString(), count++)); ; myItem.Appearance.FillStyle.FillType = Telerik.Charting.Styles.FillType.Solid; if (value <= 0) myItem.Label.Visible = false; nSeries.Type = ChartSeriesType.Pie; nSeries.AddItem(myItem); /* var classIDValue = DataIntegrity.ConvertToDouble(dr["ClassID"]); var classItem = new ChartSeriesItem(classIDValue) { XValue = DataIntegrity.ConvertToDouble(dr["ClassID"]) }; classItem.Label.Visible = false;*/ /**************************************************************** * if user does not have Tab_Search_Staff permissions, then hide * the search tab and the radPageView associated with it. * *************************************************************/ if (!UserHasPermission(Permission.Tab_Search_Students)) { RadPageView2.Visible = false; foreach (Telerik.Web.UI.RadTab tab in RadTabStrip2.Tabs) { if (tab.Text == "Search") { tab.Visible = false; break; } } } /******************************************************************* * If user does not have Icon_ExpandedSearch_Students permissions, * then hide the "Advanced Search" link via its surrounding div tag. * ****************************************************************/ StudentSearch_DivAdvancedSearch.Visible = (UserHasPermission(Permission.Icon_ExpandedSearch_Students)); } SessionObject.StudentSearchParms.AddParm("GradeListFilter", gradeList); studentCountChart.Series.Add(nSeries); if (IsPostBack) { //Reloads previous search results if session object search text has a value if (studentsSearchText_smallTile.Value == "Search by last name..." && SessionObject.StudentSearchTxtPostBack_smallTile != null && SessionObject.StudentSearchTxtPostBack_smallTile.Length > 0) SearchStudentsByLastName_Click(null, null); return; } studentSearchMoreLink.Visible = false; studentsSearchTileGrid.Visible = false; enrollStudent.Visible = UserHasPermission(Base.Enums.Permission.Enroll_Student); addNewStudent.Visible = UserHasPermission(Base.Enums.Permission.Create_Student); }
protected void Page_Load(object sender, EventArgs e) { // Simulate IsPostBack. String postBackControlID = GetControlThatCausedPostBack(Parent.Page); _isPostBack = !String.IsNullOrEmpty(postBackControlID) && !postBackControlID.StartsWith("folder") && !postBackControlID.StartsWith("tileContainer"); // Create the initial viewstate values. // ViewState.Add(_typeFilterKey, _type == "Unit Plans" ? "Unit Plans" : "All"); // Set the current filter visibility. // SetFilterVisibility(); PortalName = SessionObject.CurrentPortal.ToString(); if (UserHasPermission(Permission.Icon_Assign_InstructionMaterial)) btnAddIM.Visible = true; else btnAddIM.Visible = false; List<AsyncPageTask> taskList = new List<AsyncPageTask>(); SetResourceTypesToShow(); if (!_isPostBack) { PopulateInstructionAssignmentTile(); taskList.Add(new AsyncPageTask(BindFilterType)); taskList.Add(new AsyncPageTask(BindFilterGroup)); taskList.Add(new AsyncPageTask(BindFilterStudent)); foreach (AsyncPageTask page in taskList) { PageAsyncTask newTask = new PageAsyncTask(page.OnBegin, page.OnEnd, page.OnTimeout, "InstructionAssignment", true); Page.RegisterAsyncTask(newTask); } taskList = null; Page.ExecuteRegisteredAsyncTasks(); } }
internal void AddTask(PageAsyncTask task) { this._tasks.Add(task); }
protected void Page_Load(object sender, EventArgs e) { if (Tile == null) return; if(!UserHasPermission(Base.Enums.Permission.Tile_ClassSummary)) { Tile.ParentContainer.Visible = false; } /******************************************************* * Determine whether we have permission to display tabs * ****************************************************/ rosterRadTab.Visible = UserHasPermission(Base.Enums.Permission.Tab_Roster_ClassSummary); teachersRadTab.Visible = UserHasPermission(Base.Enums.Permission.Tab_Teachers_ClassSummary); identificationRadTab.Visible = UserHasPermission(Base.Enums.Permission.Tab_Identification_ClassSummary); c = (Thinkgate.Base.Classes.Class)Tile.TileParms.GetParm("class"); List<AsyncPageTask> taskList = new List<AsyncPageTask>(); taskList.Add(new AsyncPageTask(LoadTeacherTable)); taskList.Add(new AsyncPageTask(LoadRosterTable)); foreach (AsyncPageTask page in taskList) { PageAsyncTask newTask = new PageAsyncTask(page.OnBegin, page.OnEnd, page.OnTimeout, "ClassSummary", true); Page.RegisterAsyncTask(newTask); } taskList = null; Page.ExecuteRegisteredAsyncTasks(); //Set tab attributes for toggle view classSummaryRadTabStrip.Attributes["toggleViewIndexList"] = "0,1"; classSummaryRadTabStrip.Attributes["containerDivID"] = GetContainerDivID(this.ClientID); //load graphic view teachersGrid.DataBind(); teachersGrid_GraphicalView.DataBind(); rosterGrid.DataBind(); rosterGrid_GraphicView.DataBind(); PopulateProfileLabels(c); }
public void RegisterAsyncTask(PageAsyncTask task) { if (task == null) { throw new ArgumentNullException("task"); } if (this._asyncTaskManager == null) { this._asyncTaskManager = new PageAsyncTaskManager(this); } this._asyncTaskManager.AddTask(task); }
public void RegisterAsyncTask (PageAsyncTask task) { }
protected void Page_Load(object sender, EventArgs e) { if (Tile == null) return; // Simulate IsPostBack. String postBackControlID = GetControlThatCausedPostBack(Parent.Page); _isPostBack = !String.IsNullOrEmpty(postBackControlID) && !postBackControlID.StartsWith("folder") && !postBackControlID.StartsWith("tileContainer"); // Create the initial viewstate values. if (ViewState[_gradeFilterKey] == null) { ViewState.Add(_gradeFilterKey, "All"); ViewState.Add(_subjectFilterKey, "All"); ViewState.Add(_courseFilterKey, "All"); ViewState.Add(_typeFilterKey, _type == "Unit Plans" ? "Unit Plans" : "All"); ViewState.Add(_categoryFilterKey, "All"); ViewState.Add(_subtypeFilterKey, "All"); ViewState.Add(_standardFilterKey, "All"); } // Set the current filter visibility. SetFilterVisibility(); if (_UseResourcesTileFilterToDisplay.Split(',').Count() > 4) lbxResources.Height = 160; List<AsyncPageTask> taskList = new List<AsyncPageTask>(); if (!_isPostBack) { taskList.Add(new AsyncPageTask(GetGrades)); taskList.Add(new AsyncPageTask(GetSubjects)); taskList.Add(new AsyncPageTask(BuildCourses)); taskList.Add(new AsyncPageTask(GetCategories)); taskList.Add(new AsyncPageTask(GetStandards)); } taskList.Add(new AsyncPageTask(GetResources)); foreach (AsyncPageTask page in taskList) { PageAsyncTask newTask = new PageAsyncTask(page.OnBegin, page.OnEnd, page.OnTimeout, "Resources", true); Page.RegisterAsyncTask(newTask); } taskList = null; Page.ExecuteRegisteredAsyncTasks(); if (!_isPostBack) { BuildGrades(); BuildSubjects(); BuildCategories(); BuildTypes(); BuildCourses(); BuildSubtypes(); BuildStandards(); } SearchResources(); var addButtonVisible = false; var addButtonXParm = string.Empty; var addButtonCategoryParm = string.Empty; if (_type == "Unit Plans" && UserHasPermission(Permission.Icon_Add_UnitPlan)) { addButtonVisible = true; addButtonXParm = "Unit Plan"; addButtonCategoryParm = "Instructional"; } else if (_type == "Lesson Plans" && UserHasPermission(Permission.Icon_Add_LessonPlans)) { addButtonVisible = true; addButtonXParm = "Lesson Plan"; addButtonCategoryParm = "Instructional"; } else if (_type == "Pacing Documents" && UserHasPermission(Permission.Icon_Add_PacingDocuments)) { addButtonVisible = true; addButtonXParm = "Pacing Document"; addButtonCategoryParm = "Instructional"; } else if (_type == "Resources" && UserHasPermission(Permission.Icon_Add_Resource)) { addButtonVisible = true; addButtonXParm = "Resource"; } btnAdd.Visible = addButtonVisible; if (addButtonVisible) { btnAdd.Attributes["onclick"] = "window.open('" + ResolveUrl("~/SessionBridge.aspx?ReturnURL=") + "' + escape('fastsql_v2_direct.asp?ID=7266|search_documents_add&??x=" + addButtonXParm + "&??action=add&appName=E3&??category=" + addButtonCategoryParm + "'));"; } }
protected void Page_Load(object sender, EventArgs e) { PageAsyncTask asynctask = new PageAsyncTask(PageLoadAsync); Page.RegisterAsyncTask(asynctask); }
public void RegisterAsyncTask (PageAsyncTask task) { if (task == null) throw new ArgumentNullException ("task"); if (task.ExecuteInParallel) ParallelTasks.Add (task); else SerialTasks.Add (task); }
protected override void OnPreRender(EventArgs e) { PageAsyncTask task1 = new PageAsyncTask(Task1Begin, Task1End, Task1Timeout, null); this.Page.RegisterAsyncTask(task1); }