コード例 #1
0
        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;
            }
        }
コード例 #2
0
ファイル: Obisis.cs プロジェクト: oguzhankiyar/old-projects
 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
             });
         }
     }
 }
コード例 #3
0
 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 != "&nbsp;" && node.SelectSingleNode("./td[9]").InnerText == "&nbsp;" ? false : true;
                 basariKatsayisi = node.SelectSingleNode("./td[9]").InnerText == "&nbsp;" ? 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
             });
         }
     }
 }
コード例 #4
0
        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 != "&nbsp;" && item.SelectSingleNode("./td[9]").InnerText == "&nbsp;" ? false : true;
                    double factor     = item.SelectSingleNode("./td[9]").InnerText == "&nbsp;" ? 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());
        }