예제 #1
0
        private void DoPageLoad()
        {
            Stopwatch lcStopWatch = new Stopwatch(); lcStopWatch.Reset(); lcStopWatch.Start();
            tcGridViewType lcGridViewType = new tcGridViewType(teGridViewType.eePlayerListPage, teSubPageType.eeSubPageNone);
            
            lcGridViewType.meSub = GetGridTypeFromDropDownState();
            string lpanQuery = GetQueryFromDropDownState();

            tcMySqlDataSource lcMySqlDataSource = new tcMySqlDataSource(lpanQuery);

            DataTable lcDataTable = lcMySqlDataSource.GetDataTable();
            
            //If the course has records
            if (lcDataTable != null)
            {
                tcGridView lcGridView = GridViewFactory.Create(lcDataTable, lcGridViewType);

                Panel4.Controls.AddAt(0, lcGridView);
            }

            tcLinkPanel.AddLinkPanel(this);

            Page.DataBind();
            lcStopWatch.Stop(); gcPageLoad.Text = lcStopWatch.ElapsedMilliseconds.ToString();
        }
예제 #2
0
        private void DoPageLoad()
        {
            Stopwatch lcStopWatch = new Stopwatch(); lcStopWatch.Reset(); lcStopWatch.Start();
            tcGridViewType lcGridViewType = new tcGridViewType(teGridViewType.eeWrPage, teSubPageType.eeSubPageNone);

            string lpanQuery = GetQueryFromDropDownState();
            lcGridViewType.meSub = GetGridTypeFromDropDownState();

            tcMySqlDataSource lcMySqlDataSource = new tcMySqlDataSource(lpanQuery);

            DataTable lcDataTable = lcMySqlDataSource.GetDataTable();

            if (lcDataTable != null && lcDataTable.Rows.Count > 0)
            {
                tcGridView lcGridView = GridViewFactory.Create(lcDataTable, lcGridViewType);
                Panel4.Controls.AddAt(0, lcGridView);
            }

            tcLinkPanel.AddLinkPanel(this);

            //Refresh all the gridviews with data contents
            Page.DataBind();
            Page.MaintainScrollPositionOnPostBack = true;

            lcStopWatch.Stop(); gcPageLoad.Text = lcStopWatch.ElapsedMilliseconds.ToString();
        }
예제 #3
0
        public tcGridView(tcGridViewType acType)
        {
            this.Sorting           += new GridViewSortEventHandler(this.mpfSorting);
            this.RowDataBound      += new GridViewRowEventHandler(this.mpfRowDataBound);
            this.PageIndexChanging += new GridViewPageEventHandler(this.mpfPageIndexChanging);

            mcType = acType;
        }
예제 #4
0
        public tcGridView()
        {
            this.Sorting           += new GridViewSortEventHandler(this.mpfSorting);
            this.RowDataBound      += new GridViewRowEventHandler(this.mpfRowDataBound);
            this.PageIndexChanging += new GridViewPageEventHandler(this.mpfPageIndexChanging);

            mcType = new tcGridViewType(teGridViewType.eeNone, teSubPageType.eeSubPageNone);
        }
예제 #5
0
        public tcGridView(tcGridViewType acType)
        {
            this.Sorting += new GridViewSortEventHandler(this.mpfSorting);
            this.RowDataBound += new GridViewRowEventHandler(this.mpfRowDataBound);
            this.PageIndexChanging += new GridViewPageEventHandler(this.mpfPageIndexChanging);

            mcType = acType;
        }
예제 #6
0
        public tcGridView()
        {
            this.Sorting += new GridViewSortEventHandler(this.mpfSorting);
            this.RowDataBound += new GridViewRowEventHandler(this.mpfRowDataBound);
            this.PageIndexChanging += new GridViewPageEventHandler(this.mpfPageIndexChanging);

            mcType = new tcGridViewType(teGridViewType.eeNone, teSubPageType.eeSubPageNone);
        }
예제 #7
0
        private void DoPageLoad()
        {
            Stopwatch lcStopWatch = new Stopwatch(); lcStopWatch.Reset(); lcStopWatch.Start();
            tcGridViewType lcGridViewType = new tcGridViewType(teGridViewType.eeCoursePage, teSubPageType.eeSubPageNone);
            
            string lpanCheck = Request.QueryString["cp"];

            int lnCourseId = GetCourseId();
            
            //Set map and course labels
            tcMySqlCommand lcMySqlCommand = new tcMySqlCommand(@"SELECT M.name,C.name FROM kzs_courses AS C, kzs_maps AS M WHERE C.id = " + lnCourseId + @" AND M.id = (SELECT map FROM kzs_courses WHERE id =  " + lnCourseId + @" LIMIT 1)");
            MySqlDataReader lcMySqlReader = lcMySqlCommand.mcMySqlCommand.ExecuteReader();
            lcMySqlReader.Read();

            if (lcMySqlReader.HasRows)
            {
                gcMapLink.Text = lcMySqlReader.GetString(0);
                gcMapLink.NavigateUrl = "~/map.aspx?id=" + gcMapLink.Text + "&cp=" + lpanCheck;
                gcMapLink.Style.Value = "text-decoration:none"; //Remove underline

                gcCourseName.Text = lcMySqlReader.GetString(1);
            }

            lcMySqlCommand.Close();

            string lpanQuery = GetQueryFromDropDownState(lnCourseId);
            lcGridViewType.meSub = GetGridTypeFromDropDownState();

            //Set gridview data
            tcMySqlDataSource lcMySqlDataSource = new tcMySqlDataSource(lpanQuery);

            DataTable lcDataTable = lcMySqlDataSource.GetDataTable();

            //If the course has records
            if (lcDataTable != null)
            {
                tcGridView lcGridView = GridViewFactory.Create(lcDataTable, lcGridViewType);

                Panel4.Controls.AddAt(0, lcGridView);
            }

            tcLinkPanel.AddLinkPanel(this);
            Page.DataBind();
            lcStopWatch.Stop(); gcPageLoad.Text = lcStopWatch.ElapsedMilliseconds.ToString();
        }
예제 #8
0
        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();
        }
예제 #9
0
        private void ProcessRecordsPage(string apanQuery,tcGridViewType aeType)
        {
            Label lcNoRecords = new Label();
            tcMySqlDataSource lcMySqlDataSource = new tcMySqlDataSource(apanQuery);

            DataTable lcDataTable = lcMySqlDataSource.GetDataTable();

            if (lcDataTable != null && lcDataTable.Rows.Count > 0)
            {
                tcGridView lcGridView = GridViewFactory.Create(lcDataTable, aeType);
                Panel4.Controls.AddAt(0, lcGridView);
            }
            else
            {
                lcNoRecords.Text = "No records";
                lcNoRecords.ForeColor = teColors.eeRedText;
                lcNoRecords.Font.Name = "Arial";

                Panel4.Controls.AddAt(0, lcNoRecords);
            }
        }
예제 #10
0
        static public tcGridView Create(DataTable acDataTable, tcGridViewType aeType)
        {
            if (meInitialized == false)
            {
                DoInitialization();
                meInitialized = true;
            }

            tcGridView lcReturn = new tcGridView(aeType);

            lcReturn.BorderStyle = BorderStyle.None;
            lcReturn.GridLines   = GridLines.None;

            lcReturn.AllowSorting = false;
            lcReturn.AllowPaging  = false;

            switch (aeType.meType)
            {
            case teGridViewType.eeCoursePage:
                lcReturn = SetMapPageColumns(lcReturn, true, aeType.meSub);
                break;

            case teGridViewType.eeMapPage:
                lcReturn = SetMapPageColumns(lcReturn, false, aeType.meSub);
                break;

            case teGridViewType.eeMapListPage:
                lcReturn = SetMapListPageColumns(lcReturn, aeType.meSub);
                break;

            case teGridViewType.eePlayerPage:
                lcReturn = SetPlayerPageColumns(lcReturn, aeType.meSub);
                break;

            case teGridViewType.eePlayerListPage:
                lcReturn = SetPlayerListPageColumns(lcReturn, aeType.meSub);
                break;

            case teGridViewType.eeWrPage:
                lcReturn = SetWrPageColumns(lcReturn, aeType.meSub);
                break;

            default:
                Debug.WriteLine("Unexpected switch case");
                break;
            }

            lcReturn.DataSource = acDataTable;

            lcReturn.ShowHeader = true;

            lcReturn.HorizontalAlign = HorizontalAlign.Center;

            lcReturn.CellPadding = 1;
            lcReturn.CellSpacing = 1;
            lcReturn.Width       = 673;

            mcStyle.BackColor = teColors.eeRowBg;
            lcReturn.EditRowStyle.CopyFrom(mcStyle);
            lcReturn.AlternatingRowStyle.CopyFrom(mcStyle);

            mcStyle.BackColor = teColors.eeHeaderBg;
            lcReturn.HeaderStyle.CopyFrom(mcStyle);
            lcReturn.FooterStyle.CopyFrom(mcStyle);
            lcReturn.PagerStyle.CopyFrom(mcStyle);
            lcReturn.PagerStyle.HorizontalAlign = HorizontalAlign.Center;
            lcReturn.PagerStyle.Font.Name       = "Arial";
            lcReturn.PagerStyle.ForeColor       = teColors.eeText;

            mcStyle.BackColor = teColors.eeAltRowBg;
            lcReturn.RowStyle.CopyFrom(mcStyle);

            return(lcReturn);
        }
예제 #11
0
        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("&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;"));
                Panel4.Controls.AddAt(lnIndex++, lcCourseName);
                
                Panel4.Controls.AddAt(lnIndex++, new LiteralControl("&nbsp;"));
                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();
        }
예제 #12
0
        static public tcGridView Create(DataTable acDataTable, tcGridViewType aeType)
        {
            if (meInitialized == false)
            {
                DoInitialization();
                meInitialized = true;
            }

            tcGridView lcReturn = new tcGridView(aeType);

            lcReturn.BorderStyle = BorderStyle.None;
            lcReturn.GridLines = GridLines.None;

            lcReturn.AllowSorting = false;
            lcReturn.AllowPaging = false;

            switch(aeType.meType)
            {
                case teGridViewType.eeCoursePage:
                    lcReturn = SetMapPageColumns(lcReturn, true, aeType.meSub);
                    break;
                case teGridViewType.eeMapPage:
                    lcReturn = SetMapPageColumns(lcReturn, false, aeType.meSub);
                    break;
                case teGridViewType.eeMapListPage:
                    lcReturn = SetMapListPageColumns(lcReturn, aeType.meSub);
                    break;
                case teGridViewType.eePlayerPage:
                    lcReturn = SetPlayerPageColumns(lcReturn, aeType.meSub);
                    break;
                case teGridViewType.eePlayerListPage:
                    lcReturn = SetPlayerListPageColumns(lcReturn, aeType.meSub);
                    break;
                case teGridViewType.eeWrPage:
                    lcReturn = SetWrPageColumns(lcReturn, aeType.meSub);
                    break;
                default:
                    Debug.WriteLine("Unexpected switch case");
                    break;
            }

            lcReturn.DataSource = acDataTable;

            lcReturn.ShowHeader = true;

            lcReturn.HorizontalAlign = HorizontalAlign.Center;

            lcReturn.CellPadding = 1;
            lcReturn.CellSpacing = 1;
            lcReturn.Width = 673;

            mcStyle.BackColor = teColors.eeRowBg;
            lcReturn.EditRowStyle.CopyFrom(mcStyle);
            lcReturn.AlternatingRowStyle.CopyFrom(mcStyle);

            mcStyle.BackColor = teColors.eeHeaderBg;
            lcReturn.HeaderStyle.CopyFrom(mcStyle);
            lcReturn.FooterStyle.CopyFrom(mcStyle);
            lcReturn.PagerStyle.CopyFrom(mcStyle);
            lcReturn.PagerStyle.HorizontalAlign = HorizontalAlign.Center;
            lcReturn.PagerStyle.Font.Name = "Arial";
            lcReturn.PagerStyle.ForeColor = teColors.eeText;

            mcStyle.BackColor = teColors.eeAltRowBg;
            lcReturn.RowStyle.CopyFrom(mcStyle);
            
            return lcReturn;
        }