Ejemplo n.º 1
0
        /// <summary>
        /// Send request to Schedule url and returns raw HTML page
        /// </summary>
        /// <returns> HTML page </returns>
        public string GetHtmlPage()
        {
            HttpRequestService httpRequestService = new HttpRequestService();

            rawHtml = httpRequestService.Send(url, cookieContainer);
            return(rawHtml);
        }
Ejemplo n.º 2
0
        /// <summary>
        /// Login user, set and return login cookies
        /// </summary>
        /// <param name="credentials"></param>
        /// <returns> Login cookies </returns>
        public CookieContainer Authorize(Credential credentials)
        {
            string response = "";

            try
            {
                HttpRequestService httpRequestService = new HttpRequestService();
                response = httpRequestService.Send(url, cookieContainer, credentials, false).Substring(48, 30);
            }
            catch
            {
                new LogService().Add("Wrong URL~");
                throw new Exception("Wrong URL~");
            }


            if (response == "Bakalari - login to the system")
            {
                new LogService().Add("Wrong credentials!");
                throw new Exception("Wrong credentials!");
            }

            return(cookieContainer);
        }