private void metroButton1_Click(object sender, EventArgs e)
        {
            Logglobals.logout = DateTime.Now;

            Role.UserLog log = new Role.UserLog(Logglobals.id, Logglobals.logout.ToString("yyyy-MM-dd HH:mm:ss"), Logglobals.detail);

            try
            {
                Database.updateLog(log);

                Userglobals.uid   = 0;
                Userglobals.uname = "";
                Userglobals.priv  = "";

                Logglobals.detail = "";
                Logglobals.ip     = "";
                Logglobals.login.ToLocalTime();
                Logglobals.logout.ToLocalTime();
                Logglobals.id = 0;

                Dashboard dash = new Dashboard();
                this.Hide();
                dash.ShowDialog();
                this.Close();
            }
            catch (Exception ex)
            {
                Console.WriteLine(ex.StackTrace);
            }
        }
Beispiel #2
0
 public static void updateLog(Role.UserLog log)
 {
     try
     {
         DBConnection.updateDB("update user_log set logged_out_dateTime='" + log.LoggedOutDateTime + "', detail='" + log.Detail + "' where log_id = '" + log.LogId + "';");
     }
     catch (Exception ex)
     {
         Console.WriteLine(ex);
         MessageBox.Show("Something went wrong!", "Logging out", MessageBoxButtons.OK, MessageBoxIcon.Error);
     }
 }
Beispiel #3
0
 public static void addLog(Role.UserLog log)
 {
     try
     {
         DBConnection.updateDB("insert into user_log (user_id, logged_in_dateTime, detail, ip) values " +
                               "(" + log.User.UserId + ",'" + log.LoggedInDateTime + "','" + log.Detail + "', '" + log.Ip + "')");
     }
     catch (Exception ex)
     {
         Console.WriteLine(ex);
         MessageBox.Show("Something went wrong!", "Logging in", MessageBoxButtons.OK, MessageBoxIcon.Error);
     }
 }