private void AdminForm_FormClosed(object sender, FormClosedEventArgs e) { Activity.LogoutTime = DateTime.Now.TimeOfDay; Activity.LogoutReason = e.CloseReason.ToString(); Activity.TimeSpentOnSystem = Activity.LogoutTime.Subtract(Activity.LoginTime); CurrentUser.TimeSpentOnSystem = CurrentUser.TimeSpentOnSystem.Add(Activity.LogoutTime.Subtract(Activity.LoginTime)); dbProcessor.AddUserActivity(Activity); dbProcessor.UpdateUserTimeInSystem(CurrentUser.TimeSpentOnSystem, CurrentUser.EmailAddress); if (e.CloseReason == CloseReason.WindowsShutDown) { dbProcessor.IncrementCrashes(CurrentUser.EmailAddress); } }