Changed db implementation and other minor fixes.

The database now stores the events with their values. Search and retrieve
operations are now much easier to carry out. Also, added a network check
for the Login and some other pages to prevent app crashing when no internet
is on.

Signed-off-by: nicholaslum444 <nicholaslum444@hotmail.com>