Ejemplo n.º 1
0
        public void ShowResults(int pid)
        {
            var url = "Checkin2/Classes/" + pid + Program.QueryString;
            if (ShowAllClasses)
                url += "&noagecheck=true";
            x = this.GetDocument(url);

            time = DateTime.Now;

            points = 14F;

            Verdana = "Verdana";
            FamilyId = x.Root.Attribute("fid").Value.ToInt();
            PeopleId = x.Root.Attribute("pid").Value.ToInt();

            if (x.Descendants("class").Count() == 0)
            {
                ClearControls();
                var lab = new Label();
                lab.Font = new Font(Verdana, points, FontStyle.Regular, GraphicsUnit.Point, ((byte)(0)));
                lab.Location = new Point(15, 200);
                lab.AutoSize = true;
                lab.Text = "Sorry, no classes found";
                this.Controls.Add(lab);
                controls.Add(lab);
                GoBackButton.Text = "Go Back";
                return;
            }
            list = new List<ClassInfo>();
            foreach (var e in x.Descendants("class"))
            {
                var hr = DateTime.Today;
                DateTime.TryParse(e.Attribute("hour").Value, out hr);

                var ci = new ClassInfo
                {
                    display = e.Attribute("display").Value,
                    oid = e.Attribute("orgid").Value.ToInt(),
                    pid = PeopleId,
                    nlabels = e.Attribute("nlabels").Value.ToInt(),
                    hour = hr
                };

                var leadhours = double.Parse(e.Attribute("leadtime").Value); 
                if (ci.oid == 0 || Program.TooEarlyOrLate(leadhours))
                    continue;

                list.Add(new ClassInfo
                {
                    display = e.Attribute("display").Value,
                    oid = e.Attribute("orgid").Value.ToInt(),
                    pid = PeopleId,
                    nlabels = e.Attribute("nlabels").Value.ToInt(),
                    hour = hr
                });
            }
            ShowPage(1);
        }
Ejemplo n.º 2
0
        public void ShowResults(int pid)
        {
            var url = "Checkin2/Classes/" + pid + Program.QueryString;

            if (ShowAllClasses)
            {
                url += "&noagecheck=true";
            }
            x = this.GetDocument(url);

            time = DateTime.Now;

            points = 14F;

            Verdana  = "Verdana";
            FamilyId = x.Root.Attribute("fid").Value.ToInt();
            PeopleId = x.Root.Attribute("pid").Value.ToInt();

            if (x.Descendants("class").Count() == 0)
            {
                ClearControls();
                var lab = new Label();
                lab.Font     = new Font(Verdana, points, FontStyle.Regular, GraphicsUnit.Point, ((byte)(0)));
                lab.Location = new Point(15, 200);
                lab.AutoSize = true;
                lab.Text     = "Sorry, no classes found";
                this.Controls.Add(lab);
                controls.Add(lab);
                GoBackButton.Text = "Go Back";
                return;
            }
            list = new List <ClassInfo>();
            foreach (var e in x.Descendants("class"))
            {
                var hr = DateTime.Today;
                DateTime.TryParse(e.Attribute("hour").Value, out hr);

                var ci = new ClassInfo
                {
                    display = e.Attribute("display").Value,
                    oid     = e.Attribute("orgid").Value.ToInt(),
                    pid     = PeopleId,
                    nlabels = e.Attribute("nlabels").Value.ToInt(),
                    hour    = hr
                };

                var leadhours = double.Parse(e.Attribute("leadtime").Value);
                if (ci.oid == 0 || Program.TooEarlyOrLate(leadhours))
                {
                    continue;
                }

                list.Add(new ClassInfo
                {
                    display = e.Attribute("display").Value,
                    oid     = e.Attribute("orgid").Value.ToInt(),
                    pid     = PeopleId,
                    nlabels = e.Attribute("nlabels").Value.ToInt(),
                    hour    = hr
                });
            }
            ShowPage(1);
        }