private void btnLogOut_Click(object sender, EventArgs e) { if (CustomMessageBox.Question("Are you sure to log-out?") == DialogResult.Yes) { m_login_password mlog = new m_login_password(); UserData.isOnline = mlog.LogIO(UserData.usercode, false); } }
/// <summary> /// Click button OK for login /// </summary> /// <param name="sender"></param> /// <param name="e"></param> private void btnOK_Click(object sender, EventArgs e) { try { if (!string.IsNullOrEmpty(txtUsername.Text)) { loginpass = loginpass.CheckLogIn(txtUsername.Text, txtpass.Text); if (loginpass.is_online) { if (CustomMessageBox.Question("This user is online." + Environment.NewLine + "Are you want re-login?") == DialogResult.No) { return; } } UserData.isOnline = loginpass.LogIO(txtUsername.Text, true); mesuser = mesuser.GetUser(loginpass.user_cd); UserData.onTime = 0; timerOnTimeSet.Enabled = true; UserData.dept = mesuser.dept_cd; UserData.usercode = mesuser.user_cd; UserData.username = mesuser.user_name; UserData.position = mesuser.user_position_cd; UserData.logintime = loginpass.last_login_time; UserData.role_permision = userrole.GetListRole(loginpass.user_cd); //Show main form MainForm main = new MainForm(); this.Hide(); txtpass.Clear(); main.ShowDialog(); loginpass.LogIO(txtUsername.Text, false); this.Show(); this.Focus(); } else { CustomMessageBox.Notice("Please fill user code!"); txtUsername.Focus(); } } catch (Exception ex) { CustomMessageBox.Error(ex.Message); txtpass.Clear(); } }