public Ogrenci(string OgrenciNo = null, string Sifre = null) { this.OgrenciNo = OgrenciNo; this.Sifre = Sifre; this.Donemler = new HashSet <Donem>(); if (!string.IsNullOrEmpty(OgrenciNo)) { ObisisMobileServiceClient client = new ObisisMobileServiceClient(); OgrenciResult or = client.OgrenciDonemGetir(OgrenciNo); DataTable dt = or.Data.Tables[0]; foreach (DataRow item in dt.Rows) { this.Donemler.Add(new Donem(this, item["DONEM_ADI"].ToString(), item["OGRETIM_YILI"].ToString(), Convert.ToInt32(item["OGRETIM_YILI_KODU"]), Convert.ToInt32(item["DONEM_NO"]))); } HtmlDocument document = new HtmlDocument(); document.LoadHtml(Function.GetHTML("http://obisis.erciyes.edu.tr/Default.aspx?tabInd=3&tabNo=5", OgrenciNo, Sifre)); HtmlNode node = document.DocumentNode; try { this.AdSoyad = Function.TidyText(node.SelectSingleNode("//span[@id='Banner1_Kullanici1_txtAdiSoyadi']").InnerText); this.Fakulte = Function.TidyText(node.SelectSingleNode("//span[@id='Banner1_Kullanici1_txtFakulteAdi']").InnerText); this.Bolum = Function.TidyText(node.SelectSingleNode("//span[@id='Banner1_Kullanici1_txtBolumAdi']").InnerText); string SinifGano = node.SelectSingleNode("//span[@id='Banner1_Kullanici1_txtSinifSeneGano']").InnerText; this.Sinif = Convert.ToInt32(SinifGano.Split('(')[1].Split('.')[0]); this.GANO = Convert.ToDouble(SinifGano.Split(':')[1]); } catch (Exception) { } } }
public Donem(Ogrenci ogrenci, int yil_kodu, int donem_no) { if (!string.IsNullOrEmpty(ogrenci.OgrenciNo)) { this.Dersler = new HashSet <Ders>(); this.No = donem_no; this.OgretimYiliKodu = yil_kodu; this.Ogrenci = ogrenci; ObisisMobileServiceClient client = new ObisisMobileServiceClient(); OgrenciResult or = client.OgrenciBilgiGetir(ogrenci.OgrenciNo, ogrenci.Sifre, yil_kodu, donem_no); DataTable dt = or.Data.Tables[0]; foreach (DataRow item in dt.Rows) { this.Dersler.Add(new Ders() { DersAdi = item["DERS_ADI_TR"].ToString(), Vize1 = string.IsNullOrEmpty(item["VIZE1"].ToString()) ? -1 : Convert.ToInt32(item["VIZE1"]), Vize2 = string.IsNullOrEmpty(item["VIZE2"].ToString()) ? -1 : Convert.ToInt32(item["VIZE2"]), Vize3 = string.IsNullOrEmpty(item["VIZE3"].ToString()) ? -1 : Convert.ToInt32(item["VIZE3"]), Final = string.IsNullOrEmpty(item["FINAL"].ToString()) ? -1 : Convert.ToInt32(item["FINAL"]), Butunleme = string.IsNullOrEmpty(item["BUTUNLEME"].ToString()) ? -1 : Convert.ToInt32(item["BUTUNLEME"]), Ortalama = string.IsNullOrEmpty(item["FINAL"].ToString()) ? 0 : Convert.ToDouble(item["ORTALAMA"]), HarfNotu = item["HARF_NOTU"].ToString(), Durum = item["GECTI_KALDI"].ToString(), Donem = this, Ogrenci = ogrenci }); } } }
public void Baglan(string OgrenciNo, string Sifre) { OgrenciResult ogrResult = null; try { ObisisMobileServiceClient client = new ObisisMobileServiceClient(); ogrResult = client.OgrenciBilgiGetir(OgrenciNo, Sifre, 0, 0); this.OgrenciNo = OgrenciNo; this.Sifre = Sifre; this.Durum = ogrResult.Message == "Başarılı"; this.Ogrenci = new Ogrenci(OgrenciNo, Sifre); this.Mesaj = this.Reference == "WP8" ? "Mobisis+ 1.1 sürümü Windows Phone Store'da.." : null; try { var path = System.Web.Hosting.HostingEnvironment.MapPath("~/LoginLog.txt"); TextWriter tw = new StreamWriter(path, true, Encoding.UTF8); tw.WriteLine(DateTime.Now + " - " + this.Reference + " - " + this.Ogrenci.AdSoyad + " - " + this.Ogrenci.Fakulte + " " + this.Ogrenci.Bolum + " " + this.Ogrenci.Sinif); tw.Close(); } catch (Exception) { } } catch (Exception) { this.Durum = false; this.Mesaj = ogrResult == null ? "Üniversite kaynaklı bir sorun oluştu!\n\nEn kısa sürede düzeltilecektir.." : null; } }
public Ogrenci(string ogrNo = null, string sifre = null) { this.OgrenciNo = ogrNo; this.Sifre = sifre; this.Donemler = new HashSet <Donem>(); this.Dersler = new HashSet <Ders>(); if (!string.IsNullOrEmpty(ogrNo)) { ObisisMobileServiceClient client = new ObisisMobileServiceClient(); OgrenciResult or = client.OgrenciDonemGetir(ogrNo); DataTable dt = or.Data.Tables[0]; foreach (DataRow item in dt.Rows) { this.Donemler.Add(new Donem(this, item["DONEM_ADI"].ToString(), item["OGRETIM_YILI"].ToString(), Convert.ToInt32(item["OGRETIM_YILI_KODU"]), Convert.ToInt32(item["DONEM_NO"]))); } foreach (Donem donem in this.Donemler) { foreach (Ders ders in donem.Dersler) { this.Dersler.Add(ders); } } HtmlDocument document = new HtmlDocument(); document.LoadHtml(GetHTML("http://obisis.erciyes.edu.tr/Default.aspx?tabInd=3&tabNo=5", ogrNo, sifre)); HtmlNode node = document.DocumentNode; try { this.AdSoyad = TidyText(node.SelectSingleNode("//span[@id='Banner1_Kullanici1_txtAdiSoyadi']").InnerText); this.Fakulte = TidyText(node.SelectSingleNode("//span[@id='Banner1_Kullanici1_txtFakulteAdi']").InnerText); this.Bolum = TidyText(node.SelectSingleNode("//span[@id='Banner1_Kullanici1_txtBolumAdi']").InnerText); string SinifGano = node.SelectSingleNode("//span[@id='Banner1_Kullanici1_txtSinifSeneGano']").InnerText; this.Sinif = Convert.ToInt32(SinifGano.Split('(')[1].Split('.')[0]); this.GANO = Convert.ToDouble(SinifGano.Split(':')[1]); this.GerekenGANO = Convert.ToDouble(node.SelectSingleNode("//table[@id='ctl00_dgMezuniyetDurum']/tr[2]/td[1]").InnerText.Replace("Ortalama en az", "").Replace("olmalı", "").Trim()); this.MezuniyetKredisi = Convert.ToDouble(node.SelectSingleNode("//table[@id='ctl00_dgMezuniyetDurum']/tr[7]/td[1]").InnerText.Replace("Mezuniyet kredisi", "").Replace("olmalı", "").Trim()) / 100; this.ToplamKredi = Convert.ToDouble(node.SelectSingleNode("//table[@id='ctl00_dgMezuniyetDurum']/tr[7]/td[2]").InnerText.Replace("Toplam krediniz", "").Trim()) / 100; this.StajDurum = node.SelectSingleNode("//table[@id='ctl00_dgMezuniyetDurum']/tr[6]/td[3]").InnerHtml == "<img src=\"/images/Valid.gif\">"; } catch (Exception) { } } }
public Donem(Ogrenci ogrenci, string donem_adi, string ogretim_yili, int yil_kodu, int donem_no) { if (!string.IsNullOrEmpty(ogrenci.OgrenciNo)) { this.Dersler = new HashSet <Ders>(); this.Adi = donem_adi; this.No = donem_no; this.OgretimYili = ogretim_yili; this.OgretimYiliKodu = yil_kodu; this.Ogrenci = ogrenci; ObisisMobileServiceClient client = new ObisisMobileServiceClient(); OgrenciResult or = client.OgrenciBilgiGetir(ogrenci.OgrenciNo, ogrenci.Sifre, yil_kodu, donem_no); DataTable dt = or.Data.Tables[0]; HtmlDocument document = new HtmlDocument(); try { document.LoadHtml(GetHTML("http://obisis.erciyes.edu.tr/Default.aspx?tabInd=4&tabNo=8", ogrenci.OgrenciNo, ogrenci.Sifre)); this.GANO = Convert.ToDouble(document.DocumentNode.SelectSingleNode("//*[contains(text(), '" + this.OgretimYili + " " + this.Adi + "')]").InnerText.Split(':')[1].Trim()); } catch (Exception) { try { document.LoadHtml(GetHTML("http://obisis.erciyes.edu.tr/Default.aspx?tabInd=5&tabNo=8", ogrenci.OgrenciNo, ogrenci.Sifre)); this.GANO = Convert.ToDouble(document.DocumentNode.SelectSingleNode("//*[contains(text(), '" + this.OgretimYili + " " + this.Adi + "')]").InnerText.Split(':')[1].Trim()); } catch (Exception) { document.LoadHtml(GetHTML("http://obisis.erciyes.edu.tr/Default.aspx?tabInd=6&tabNo=8", ogrenci.OgrenciNo, ogrenci.Sifre)); this.GANO = Convert.ToDouble(document.DocumentNode.SelectSingleNode("//*[contains(text(), '" + this.OgretimYili + " " + this.Adi + "')]").InnerText.Split(':')[1].Trim()); } } int i = 1; foreach (DataRow item in dt.Rows) { HtmlNode node = document.DocumentNode.SelectSingleNode("//tr[contains(td[1], '" + this.OgretimYili + " " + this.Adi + "')]/following-sibling::tr[" + i++ + "]"); string ads = node.SelectSingleNode("./td[2]").InnerText; double kredi = 0.0; int sinif = 1; bool ortalamayaEtki = true; double basariKatsayisi = 0.0; string kod = ""; string text = node.InnerText; if (node != null) { kod = node.SelectSingleNode("./td[1]").InnerText; kredi = Convert.ToDouble(node.SelectSingleNode("./td[6]").InnerText.Trim()); sinif = Convert.ToInt32(node.SelectSingleNode("./td[3]").InnerText); ortalamayaEtki = node.SelectSingleNode("./td[8]").InnerText != " " && node.SelectSingleNode("./td[9]").InnerText == " " ? false : true; basariKatsayisi = node.SelectSingleNode("./td[9]").InnerText == " " ? 0.0 : Convert.ToDouble(node.SelectSingleNode("./td[9]").InnerText.Trim()); } this.Dersler.Add(new Ders() { DersAdi = item["DERS_ADI_TR"].ToString(), Vize1 = string.IsNullOrEmpty(item["VIZE1"].ToString()) ? -1 : Convert.ToInt32(item["VIZE1"]), Vize2 = string.IsNullOrEmpty(item["VIZE2"].ToString()) ? -1 : Convert.ToInt32(item["VIZE2"]), Vize3 = string.IsNullOrEmpty(item["VIZE3"].ToString()) ? -1 : Convert.ToInt32(item["VIZE3"]), Final = string.IsNullOrEmpty(item["FINAL"].ToString()) ? -1 : Convert.ToInt32(item["FINAL"]), Butunleme = string.IsNullOrEmpty(item["BUTUNLEME"].ToString()) ? -1 : Convert.ToInt32(item["BUTUNLEME"]), Ortalama = string.IsNullOrEmpty(item["ORTALAMA"].ToString()) ? 0 : Convert.ToDouble(item["ORTALAMA"]), HarfNotu = item["HARF_NOTU"].ToString(), Durum = item["GECTI_KALDI"].ToString(), Kod = kod, Kredi = kredi, OrtalamayaEtki = ortalamayaEtki, BasariKatsayisi = basariKatsayisi, Sinif = sinif, Donem = this, Ogrenci = ogrenci }); } } }
public Ogrenci(string ogrNo = "", string sifre = "") { this.OgrenciNo = ogrNo; this.Sifre = sifre; this.Donemler = new HashSet <Donem>(); this.Dersler = new HashSet <Ders>(); if (!string.IsNullOrEmpty(ogrNo)) { ObisisMobileServiceClient client = new ObisisMobileServiceClient(); OgrenciResult or = client.OgrenciDonemGetir(ogrNo); DataTable dt = or.Data.Tables[0]; foreach (DataRow item in dt.Rows) { this.Donemler.Add(new Donem(this, Convert.ToInt32(item["OGRETIM_YILI_KODU"]), Convert.ToInt32(item["DONEM_NO"])) { Adi = item["DONEM_ADI"].ToString(), OgretimYili = item["OGRETIM_YILI"].ToString() }); } foreach (Donem donem in this.Donemler) { foreach (Ders ders in donem.Dersler) { this.Dersler.Add(ders); } } HttpWebRequest request = (HttpWebRequest)WebRequest.Create("http://obisis.erciyes.edu.tr"); HttpWebResponse response = (HttpWebResponse)request.GetResponse(); StreamReader reader = new StreamReader(response.GetResponseStream()); string strResponse = reader.ReadToEnd(); HtmlAgilityPack.HtmlDocument doc = new HtmlAgilityPack.HtmlDocument(); doc.LoadHtml(strResponse); HtmlNodeCollection collection = doc.DocumentNode.SelectNodes("//input"); string getUrl = "http://obisis.erciyes.edu.tr"; string postData = string.Format("__VIEWSTATE={0}&__EVENTVALIDATION={1}&ctl00$txtboxOgrenciNo={2}&ctl00$txtBoxSifre={3}&ctl00$btnLogin={4}", HttpUtility.UrlEncode(collection[1].Attributes["value"].Value), HttpUtility.UrlEncode(collection[2].Attributes["value"].Value), ogrNo, sifre, HttpUtility.UrlEncode("Giriş")); HttpWebRequest getRequest = (HttpWebRequest)WebRequest.Create(getUrl); getRequest.CookieContainer = new CookieContainer(); getRequest.Method = "POST"; getRequest.ContentType = "application/x-www-form-urlencoded"; byte[] byteArray = Encoding.ASCII.GetBytes(postData); getRequest.ContentLength = byteArray.Length; Stream newStream = getRequest.GetRequestStream(); //open connection newStream.Write(byteArray, 0, byteArray.Length); // Send the data. newStream.Close(); HttpWebResponse getResponse = (HttpWebResponse)getRequest.GetResponse(); StreamReader sr = new StreamReader(getResponse.GetResponseStream()); HtmlAgilityPack.HtmlDocument document = new HtmlAgilityPack.HtmlDocument(); document.LoadHtml(sr.ReadToEnd()); HtmlNode node = document.DocumentNode; this.AdSoyad = node.SelectSingleNode("//span[@id='Banner1_Kullanici1_txtAdiSoyadi']").InnerText; this.Fakulte = node.SelectSingleNode("//span[@id='Banner1_Kullanici1_txtFakulteAdi']").InnerText; this.Bolum = node.SelectSingleNode("//span[@id='Banner1_Kullanici1_txtBolumAdi']").InnerText; string SinifGano = node.SelectSingleNode("//span[@id='Banner1_Kullanici1_txtSinifSeneGano']").InnerText; this.Sinif = Convert.ToInt32(SinifGano.Split('(')[1].Split('.')[0]); this.GANO = Convert.ToDouble(SinifGano.Split(':')[1]); } }
public static List <Period> GetPeriods(string html) { List <Period> periods = new List <Period>(); HtmlDocument doc = new HtmlDocument(); doc.LoadHtml(html); HtmlNode node = doc.DocumentNode; HtmlNodeCollection col = node.SelectNodes("//table[@id='ctl00_gvDersDurum']//tr"); Period period = new Period(); ObisisMobileServiceClient client = new ObisisMobileServiceClient(); for (int i = 1; i < col.Count; i++) { HtmlNode item = col[i]; if (item.InnerText.Contains("ORTALAMASI")) { if (i != 1) { periods.Add(period); } period = new Period(); string text = item.InnerText.Replace("\r", "").Replace("\t", "").Replace("\n", ""); period.Name = Function.TidyText(text.Split(' ')[1]); period.Code = GetCode(period.Name); period.Year = text.Split(' ')[0]; period.YearCode = GetYearCode(period.Year); period.GANO = Convert.ToDouble(text.Split(':')[1].Replace(",", "").Replace(".", "").Trim()) / 100; period.Lessons = new List <Lesson>(); OgrenciResult result = client.OgrenciBilgiGetir(Data.StudentID.ToString(), Data.Password, period.YearCode, period.Code); DataTable dt = result.Data.Tables[0]; foreach (DataRow data in dt.Rows) { Lesson lesson = new Lesson() { Name = Function.TidyText(data["DERS_ADI_TR"].ToString()), FirstMidterm = new Exam() { Mark = string.IsNullOrEmpty(data["VIZE1"].ToString()) ? (int?)null : Convert.ToInt32(data["VIZE1"]) }, SecondMidterm = new Exam() { Mark = string.IsNullOrEmpty(data["VIZE2"].ToString()) ? (int?)null : Convert.ToInt32(data["VIZE2"]) }, ThirdMidterm = new Exam() { Mark = string.IsNullOrEmpty(data["VIZE3"].ToString()) ? (int?)null : Convert.ToInt32(data["VIZE3"]) }, Final = new Exam() { Mark = string.IsNullOrEmpty(data["FINAL"].ToString()) ? (int?)null : Convert.ToInt32(data["FINAL"]) }, Integration = new Exam() { Mark = string.IsNullOrEmpty(data["BUTUNLEME"].ToString()) ? (int?)null : Convert.ToInt32(data["BUTUNLEME"]) }, Average = string.IsNullOrEmpty(data["ORTALAMA"].ToString()) ? (int?)null : Convert.ToInt32(data["ORTALAMA"]), Grade = string.IsNullOrEmpty(data["HARF_NOTU"].ToString()) ? null : Lesson.GetGrade(data["HARF_NOTU"].ToString()), State = string.IsNullOrEmpty(data["GECTI_KALDI"].ToString()) ? (bool?)null : data["GECTI_KALDI"].ToString() == "GEÇTİ" }; period.Lessons.Add(lesson); } } else { string code = item.SelectSingleNode("./td[1]").InnerText; string name = Function.TidyText(item.SelectSingleNode("./td[2]").InnerText); double credit = Convert.ToDouble(item.SelectSingleNode("./td[6]").InnerText.Trim().Replace(",", ".")); int cls = Convert.ToInt32(item.SelectSingleNode("./td[3]").InnerText); bool ganoEffect = item.SelectSingleNode("./td[8]").InnerText != " " && item.SelectSingleNode("./td[9]").InnerText == " " ? false : true; double factor = item.SelectSingleNode("./td[9]").InnerText == " " ? 0.0 : Convert.ToDouble(item.SelectSingleNode("./td[9]").InnerText.Trim()); Lesson lesson = period.Lessons.SingleOrDefault(x => x.Name == name); if (lesson != null) { lesson.Code = code; lesson.Credit = credit; lesson.AverageEffect = ganoEffect; lesson.SuccessFactor = factor; lesson.Class = cls; } } if (i == col.Count - 1) { periods.Add(period); } } return(periods.OrderBy(x => x.YearCode).ThenBy(x => x.Code).ToList()); }