Exemplo n.º 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();
        }
Exemplo n.º 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();
        }
Exemplo n.º 3
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();
        }
Exemplo n.º 4
0
        public GridViewFactory <TD> AddGridView <TD>(Action <GridViewFactory <TD> > panel = null)
        {
            var factory = new GridViewFactory <TD>()
            {
                Widget = new GridView()
                {
                    Name = "grid"
                }
            };

            factory.GridView.SetDefaultValues();
            Panel.Elementy.Add(factory.GridView);

            if (panel != null)
            {
                panel(factory);
            }
            return(factory);
        }
Exemplo n.º 5
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);
            }
        }
Exemplo n.º 6
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();
        }