/// <summary> /// Login worker. /// Use this for testing log in /// </summary> /// <returns></returns> public bool auth() { if (!IsDigits(this.id_textbox.Text)) { throw new Exception("Make sure that your id contains only digits"); } if (!SqlWorker.CheckForInternetConnection()) { throw new Exception("There is no internet connection.\nPlease try again later."); } string f_id = this.id_textbox.Text.ToString(); string f_pwd = this.pwd_textbox.Text.ToString(); User usr = SqlWorker.GetUser(f_id); // check if we found it and if pwds much if (usr == null || usr.Pwd != f_pwd) { throw new Exception("User not found or Password is incorrect"); } // set session user Globals._session = usr; return(true); }