private void DoPageLoad() { Stopwatch lcStopWatch = new Stopwatch(); lcStopWatch.Reset(); lcStopWatch.Start(); tcGridViewType lcGridViewType = new tcGridViewType(teGridViewType.eePlayerPage, teSubPageType.eePlayerPageNocheck); string lpanSteamId = Request.QueryString["id"]; lpanSteamId = StaticMethods.CheckSqlReqValidity(lpanSteamId, "STEAM_0:1:5134837"); gcLabelSteamId.Text = lpanSteamId.Replace("%3a", ":"); lcGridViewType.meSub = GetGridTypeFromDropDownState(); switch (lcGridViewType.meSub) { case teSubPageType.eePlayerPageStats: ProcessStatsPage(lpanSteamId); break; case teSubPageType.eePlayerPageTag: try { ProcessTagPage(lpanSteamId); } catch (Exception e) { Debug.WriteLine("ProcessTagPage: " + e.Message); } break; default: string lpanQuery = GetQueryFromDropDownState(lpanSteamId); ProcessRecordsPage(lpanQuery, lcGridViewType); break; } tcLinkPanel.AddLinkPanel(this); Panel4.DataBind(); lcStopWatch.Stop(); gcPageLoad.Text = lcStopWatch.ElapsedMilliseconds.ToString(); }
protected void Page_Load(object sender, EventArgs e) { string lpanMapName = Request.QueryString["id"]; lpanMapName = StaticMethods.CheckSqlReqValidity(lpanMapName, "kz_bhop_ocean"); Panel4.EnableViewState = false; if (Page.IsPostBack == false) { SetUpDropDown(); } if (HttpContext.Current.Request.UserAgent.Contains("Chrome") == true || HttpContext.Current.Request.UserAgent.Contains("Firefox") == true) { gcBody.Attributes.Add("style", tcBgStyler.Instance.GetBgImageStyle()); } DoPageLoad(); }
protected void Page_Load(object sender, EventArgs e) { string lpanSteamId = Request.QueryString["id"]; lpanSteamId = StaticMethods.CheckSqlReqValidity(lpanSteamId, "STEAM_0:1:5134837"); gcLabelSteamId.Text = lpanSteamId.Replace("%3a", ":"); if (Page.IsPostBack == false) { SetUpDropDown(lpanSteamId); } SetNameLabel(lpanSteamId); if (HttpContext.Current.Request.UserAgent.Contains("Chrome") == true || HttpContext.Current.Request.UserAgent.Contains("Firefox") == true) { gcBody.Attributes.Add("style", tcBgStyler.Instance.GetBgImageStyle()); } DoPageLoad(); }
private int GetCourseId() { int lnCourseId; string lpanCourseId = Request.QueryString["id"]; lpanCourseId = StaticMethods.CheckSqlReqValidity(lpanCourseId, "1"); try { lnCourseId = Convert.ToInt32(lpanCourseId); if (lnCourseId < 1 || lnCourseId > 2048) { lnCourseId = 1; } } catch { lnCourseId = 1; } return(lnCourseId); }
private void DoPageLoad() { Stopwatch lcStopWatch = new Stopwatch(); lcStopWatch.Reset(); lcStopWatch.Start(); tcGridViewType lcGridViewType = new tcGridViewType(teGridViewType.eeMapPage, teSubPageType.eeSubPageNone); HyperLink lcCourseName; string lpanMapName = Request.QueryString["id"]; lpanMapName = StaticMethods.CheckSqlReqValidity(lpanMapName, "kz_bhop_ocean"); gcLabelMapName.Text = lpanMapName; tcMySqlCommand lcMySqlCommand = new tcMySqlCommand(@"SELECT id,name FROM kzs_courses WHERE map = (SELECT id FROM kzs_maps WHERE name = ?map LIMIT 1) ORDER BY id ASC;"); lcMySqlCommand.mcMySqlCommand.Parameters.Add("?map", lpanMapName); MySqlDataReader lcMySqlReader = lcMySqlCommand.mcMySqlCommand.ExecuteReader(); int lnIndex = 0; int lnCourseId = 0; //Loop over courses to add labels and records while (lcMySqlReader.HasRows && !lcMySqlReader.IsClosed && lcMySqlReader.Read()) { Debug.WriteLine(lcMySqlReader.GetString(0) + " " + lcMySqlReader.GetString(1)); lnCourseId = lcMySqlReader.GetInt32(0); if (lnCourseId < 1) { lnCourseId = 1; } //Set properties for the hyperlink to the course page lcCourseName = GetCourseHyperLink(lcMySqlReader.GetString(1), "~/course.aspx?id=" + lnCourseId); //Indent course hyperlink and add to the panel Panel4.Controls.AddAt(lnIndex++, new LiteralControl(" ")); Panel4.Controls.AddAt(lnIndex++, lcCourseName); Panel4.Controls.AddAt(lnIndex++, new LiteralControl(" ")); Label lcWr = GetWrLabel(lnCourseId); Panel4.Controls.AddAt(lnIndex++, lcWr); string lpanCp = Request.QueryString["cp"]; //Handle requests for checkpoints that are not postbacks from dropdown state change if (Page.IsPostBack == false && lpanCp != null && lpanCp.Equals("1")) { gcDropDown.SelectedValue = "cp"; } string lpanQuery = GetQueryFromDropDownState(lnCourseId); lcGridViewType.meSub = GetGridTypeFromDropDownState(); tcMySqlDataSource lcMySqlDataSource = new tcMySqlDataSource(lpanQuery); DataTable lcDataTable = lcMySqlDataSource.GetDataTable(); //If the course has records if (lcDataTable != null && lcDataTable.Rows.Count > 0) { tcGridView lcGridView = GridViewFactory.Create(lcDataTable, lcGridViewType); Panel4.Controls.AddAt(lnIndex++, new LiteralControl("<br>")); Panel4.Controls.AddAt(lnIndex++, lcGridView); Panel4.Controls.AddAt(lnIndex++, new LiteralControl("<br>")); } else //Else the course has no records { Label lcNoRecords = new Label(); lcNoRecords.Text = " - No records!"; Panel4.Controls.AddAt(lnIndex++, lcNoRecords); Panel4.Controls.AddAt(lnIndex++, new LiteralControl("<br><br>")); } } lcMySqlCommand.Close(); tcLinkPanel.AddLinkPanel(this); //Refresh all the gridviews with data contents Page.DataBind(); Page.MaintainScrollPositionOnPostBack = true; lcStopWatch.Stop(); gcPageLoad.Text = lcStopWatch.ElapsedMilliseconds.ToString(); }