private Action DanhSachMonHoc2() { string link = LinkVnu.GetLink(LinkVnu.LinkListCredit, LoginType); HttpRequest request = CreateRequest(link, Method.POST, PostType.form, null); HttpResponse result = ExcuteRequest(request); request.Dispose(); if (result == null) { return(Login()); } return(DangkyMonHoc()); }
private bool XacNhanDangKi() { HttpRequest request2 = CreateRequest(LinkVnu.GetLink(LinkVnu.LinkConfirmCredit, LoginType), Method.POST, PostType.form); HttpResponse result2 = ExcuteRequest(request2); if (result2 == null) { return(false); } if (result2.BodyStr.Contains("Đăng ký thành công")) { return(true); } return(false); }
public Action Login() { try { string html = QuickGetRequest(LinkVnu.GetLink(LinkVnu.LinkLogin)); if (html == null) { return(Login()); } string token = Regex.Match(html, @"__RequestVerificationToken.*ue=""(.*?)""").Groups[1].Value; if (string.IsNullOrEmpty(token)) { return(Login()); } Dictionary <string, string> dic = new Dictionary <string, string>(); dic.Add("__RequestVerificationToken", token); dic.Add("LoginName", User); dic.Add("Password", Pass); HttpRequest request = CreateRequest(LinkVnu.GetLink(LinkVnu.LinkLogin), Method.POST, PostType.form, dic); HttpResponse result = ExcuteRequest(request); request.Dispose(); if (result == null) { return(Login()); } string htmlResult = WebUtility.HtmlDecode(result.BodyStr); request.Dispose(); dic.Clear(); if (htmlResult.Contains("Chào mừng")) { return(DanhSachMonHoc2()); //string str = http.QuickGetStr($"http://{Host}/dang-ky-mon-hoc-nganh-1"); //str = WebUtility.HtmlDecode(str); //if (str.Contains("Ghi nhận")) // return Done(); //else return Exit(); } return(Exit()); } catch { return(Login()); } }
private bool Dangky(string DataRowIndex) { HttpRequest request = CreateRequest(LinkVnu.GetChooseCredit(DataRowIndex), Method.POST, PostType.form); HttpResponse result = ExcuteRequest(request); request.Dispose(); if (result == null) { return(false); } if (result.BodyStr.Contains("true")) { request.Dispose(); result.Dispose(); XacNhanDangKi(); return(true); } request.Dispose(); result.Dispose(); return(false); }
private Action Login() { string html = QuickGetRequest(LinkVnu.GetLink(LinkVnu.LinkLogin)); if (html == null) { return(Login()); } string token = Regex.Match(html, @"__RequestVerificationToken.*ue=""(.*?)""").Groups[1].Value; if (string.IsNullOrEmpty(token)) { return(Login()); } Dictionary <string, string> dic = new Dictionary <string, string>(); dic.Add("__RequestVerificationToken", token); dic.Add("LoginName", User); dic.Add("Password", Pass); HttpRequest request = CreateRequest(LinkVnu.GetLink(LinkVnu.LinkLogin), Method.POST, PostType.form, dic); HttpResponse result = ExcuteRequest(request); request.Dispose(); if (result == null) { return(Login()); } string htmlResult = WebUtility.HtmlDecode(result.BodyStr); request.Dispose(); dic.Clear(); //dic.TrimExcess(); if (htmlResult.Contains("Chào mừng")) { return(DanhSachMonHoc()); } return(Exit()); }