Example #1
0
        public String getLichHoc()
        {
            // TKB cac ky
            String str = str = POST.sendPOST("http://www.aao.hcmut.edu.vn/stinfo/lichthi/ajax_lichhoc", _token, cookieSession);

            return(str); // JSON
        }
Example #2
0
        public MyBKStInfo()
        {
            // Log in
            StreamReader sr      = new StreamReader(MyBK.Lib.Data.PathData.config);
            String       logined = sr.ReadLine();

            if (logined == null)
            {
                sr.Close();
                return;
            }
            String user = sr.ReadLine();
            String pass = sr.ReadLine();

            sr.Close();
            CookieContainer cc = POST.Login(user, pass);

            _token = null;
            if (cc != null)
            {
                HttpWebResponse res;
                try {
                    res = GET.getResponse("http://www.aao.hcmut.edu.vn/stinfo/", cc);
                } catch (Exception e) {
                    throw new Exception("Không thể truy cập http://www.aao.hcmut.edu.vn");
                    return;
                }
                // Get cookie
                String strCookie = res.Headers.Get("Set-Cookie");

                String uri = "http://aao.hcmut.edu.vn/stinfo/";

                String[]        listCookie = strCookie.Split(',');
                CookieContainer allCookie  = new CookieContainer();

                String[] temp = listCookie[0].Split(';')[0].Split('=');
                Cookie   ck   = new Cookie(temp[0], temp[1]);
                cc.Add(new Uri(uri), ck);
                temp = listCookie[2].Split(';')[0].Split('=');
                ck   = new Cookie(temp[0], temp[1]);
                cc.Add(new Uri(uri), ck);
                cookieSession = cc;

                // Get _token
                Stream       dataStream         = res.GetResponseStream();
                StreamReader reader             = new StreamReader(dataStream);
                string       responseFromServer = reader.ReadToEnd();
                HtmlDocument doc = new HtmlDocument();
                doc.LoadHtml(responseFromServer);
                HtmlNodeCollection list      = doc.DocumentNode.SelectNodes("/html/head//meta");
                String             str_token = list[3].OuterHtml;
                str_token = str_token.Substring(str_token.IndexOf("content=") + 9, 40);
                _token    = "_token=" + str_token;
                reader.Close();
                dataStream.Close();
                res.Close();
            }
        }
Example #3
0
        public MyBKDKMH()
        {
            StreamReader sr      = new StreamReader(MyBK.Lib.Data.PathData.config);
            String       logined = sr.ReadLine();

            if (logined == null)
            {
                sr.Close();
                return;
            }
            String user = sr.ReadLine();
            String pass = sr.ReadLine();

            sr.Close();
            cookieSession = POST.Login(user, pass);
        }
Example #4
0
        public static CookieContainer Login(String user, String pass, out String token)
        {
            CookieContainer cc = POST.Login(user, pass);

            token = null;
            if (cc != null)
            {
                HttpWebResponse res = GET.getResponse("http://www.aao.hcmut.edu.vn/stinfo/", cc);

                // Get cookie
                String strCookie = res.Headers.Get("Set-Cookie");

                String uri = "http://aao.hcmut.edu.vn/stinfo/";

                String[]        listCookie = strCookie.Split(',');
                CookieContainer allCookie  = new CookieContainer();

                String[] temp = listCookie[0].Split(';')[0].Split('=');
                Cookie   ck   = new Cookie(temp[0], temp[1]);
                cc.Add(new Uri(uri), ck);
                temp = listCookie[2].Split(';')[0].Split('=');
                ck   = new Cookie(temp[0], temp[1]);
                cc.Add(new Uri(uri), ck);


                // Get _token
                Stream       dataStream         = res.GetResponseStream();
                StreamReader reader             = new StreamReader(dataStream);
                string       responseFromServer = reader.ReadToEnd();
                HtmlDocument doc = new HtmlDocument();
                doc.LoadHtml(responseFromServer);
                HtmlNodeCollection list      = doc.DocumentNode.SelectNodes("/html/head//meta");
                String             str_token = list[3].OuterHtml;
                str_token = str_token.Substring(str_token.IndexOf("content=") + 9, 40);
                token     = "_token=" + str_token;
                reader.Close();
                dataStream.Close();
                res.Close();
            }
            return(cc);
        }
Example #5
0
 public String getThongTinNhomLopMonHoc(String monHocId)
 {
     return(POST.sendPOST("http://mybk.hcmut.edu.vn/dkmh/getThongTinNhomLopMonHoc.action",
                          "monHocId=" + monHocId,
                          cookieSession));
 }
Example #6
0
 public String searchMonHocDangKy(String msmh)
 {
     return(POST.sendPOST("http://mybk.hcmut.edu.vn/dkmh/searchMonHocDangKy.action",
                          "msmh=" + msmh,
                          cookieSession));
 }
Example #7
0
 public String getKetQuaDangKy()
 {
     return(POST.sendPOST("http://mybk.hcmut.edu.vn/dkmh/getKetQuaDangKy.action", "", cookieSession));
 }
Example #8
0
 public String getDanhSachMonHocDangKy(String dotDKId)
 {
     return(POST.sendPOST("http://mybk.hcmut.edu.vn/dkmh/getDanhSachMonHocDangKy.action",
                          "dotDKId=" + dotDKId,
                          cookieSession));
 }
Example #9
0
 public String getLichDangKy(String dotDKId, String DKHocVienID)
 {
     return(POST.sendPOST("http://mybk.hcmut.edu.vn/dkmh/getLichDangKy.action",
                          "dotDKId=" + dotDKId + "&dotDKHocVienId=" + DKHocVienID,
                          cookieSession));
 }
Example #10
0
 public String getDanhSachDotDK(String hocKyId)
 {
     return(POST.sendPOST("http://mybk.hcmut.edu.vn/dkmh/getDanhSachDotDK.action", "hocKyId=" + hocKyId, cookieSession));
 }
Example #11
0
 public MyBKDKMH(String user, String pass)
 {
     cookieSession = POST.Login(user, pass);
 }
Example #12
0
        public String getTienDoHocTap()
        {
            String str = str = POST.sendPOST("http://www.aao.hcmut.edu.vn/stinfo/ctdt/ajax_ctdt", _token, cookieSession);

            return(str); // JSON
        }
Example #13
0
        public String getBangDiem()
        {
            String str = str = POST.sendPOST("http://www.aao.hcmut.edu.vn/stinfo/grade/ajax_grade", _token, cookieSession);

            return(str); // JSON
        }