private void button2_Click(object sender, EventArgs e) { var pleaseWait = new frm_PleaseWait(); pleaseWait.Show(); Application.DoEvents(); Cursor.Current = Cursors.WaitCursor; var myForm = new frm_TransactionRecord(); myForm.Show(); pleaseWait.Hide(); this.Hide(); }
private void btnTransactionRecord_Click(object sender, EventArgs e) { if (frm_Login.stockman == "Stockman") { DialogResult confirm = MessageBox.Show("Are you sure, you want to logout?", "Fabula's Merchandise System", MessageBoxButtons.YesNo, MessageBoxIcon.Question); if (confirm == DialogResult.Yes) { Cursor.Current = Cursors.WaitCursor; frm_Login.time = DateTime.Now.ToShortTimeString(); try { MySqlConnection Conn = ConString.Connection; MySqlCommand cmd = new MySqlCommand("update tbl_loginhistory set time_out = '" + frm_Login.time + "', status = 'Offline' where login_id = '" + frm_Login.loginID + "'", Conn); MySqlDataReader myReader; myReader = cmd.ExecuteReader(); while (myReader.Read()) { } Conn.Close(); Cursor.Current = Cursors.AppStarting; var myForm = new frm_Login(); myForm.Show(); this.Hide(); } catch (Exception ex) { MessageBox.Show(ex.Message); } } else if (confirm == DialogResult.No) { } } else { var pleaseWait = new frm_PleaseWait(); pleaseWait.Show(); Application.DoEvents(); Cursor.Current = Cursors.WaitCursor; var myForm = new frm_TransactionRecord(); myForm.Show(); pleaseWait.Hide(); this.Hide(); } }