예제 #1
0
        public Connection GetStudent(int studentID, string password)
        {
            try
            {
                Data.StudentID = studentID;
                Data.Password  = password;
                Student student = new Student();
                string  html    = Function.GetHTML("http://obisis.erciyes.edu.tr", studentID, password);
                Data.GetURLs(html);
                HtmlDocument doc = new HtmlDocument();
                doc.LoadHtml(html);
                HtmlNode node = doc.DocumentNode;
                student.ID              = studentID;
                student.Password        = password;
                student.Name            = Function.TidyText(node.SelectSingleNode("//span[@id='Banner1_Kullanici1_txtAdiSoyadi']").InnerText);
                student.Programs        = Program.GetPrograms(html);
                student.GraduationState = Graduation.GetGraduationState(Function.GetHTML(Data.GraduationURL, studentID, password));
                student.Documents       = Document.GetDocuments(Function.GetHTML(Data.DocumentsURL, studentID, password));

                this.State      = true;
                this.Message    = "Merhaba " + student.Name;
                this.DataObject = student;
            }
            catch (Exception)
            {
                this.State      = false;
                this.Message    = "Giriş başarısız!";
                this.DataObject = null;
            }
            return(this);
        }
예제 #2
0
        public static List <Graduation> GetGraduationState(string html)
        {
            List <Graduation> list = new List <Graduation>();
            HtmlDocument      doc  = new HtmlDocument();

            doc.LoadHtml(html);
            HtmlNode           node = doc.DocumentNode;
            HtmlNodeCollection col  = node.SelectNodes("//table[@id='ctl00_dgMezuniyetDurum']//tr");

            for (int i = 1; i < col.Count; i++)
            {
                HtmlNode item = col[i];
                if (!string.IsNullOrEmpty(item.InnerText.Replace("&nbsp;", "").Trim()) && !item.InnerText.Contains("SONUÇ"))
                {
                    Graduation grade = new Graduation();
                    grade.Condition   = Function.TidyText(item.SelectSingleNode("./td[1]").InnerText);
                    grade.State       = Function.TidyText(item.SelectSingleNode("./td[2]").InnerText);
                    grade.Value       = !item.SelectSingleNode("./td[3]").InnerText.Contains("InValid");
                    grade.Description = Function.TidyText(item.SelectSingleNode("./td[4]").InnerText);
                    list.Add(grade);
                }
            }
            return(list);
        }