private session getSession(string hash, string ip, string useragent) { session returnme = null; String dbConnectionString = ConfigurationManager.ConnectionStrings["SchoolLogicDatabase"].ConnectionString; using (SqlConnection connection = new SqlConnection(dbConnectionString)) { returnme = session.loadThisSession(connection, hash, ip, useragent); } if (returnme != null) { if (returnme.getIP().Equals(ip)) { if (returnme.getUserAgent().Equals(useragent)) { if (returnme.getStart() < DateTime.Now) { if (returnme.getEnd() > DateTime.Now) { return(returnme); } } } } } return(null); }