private void btnLogin_Click(object sender, EventArgs e) { progress.Visible = true; string username = Helper.strIsEmpty(tbUsername.Text, true) ? "" : tbUsername.Text; string password = Helper.strIsEmpty(tbPassword.Text,true) ? "" : tbPassword.Text ; if ((username != "" && password != "")) { User user = new User(); if (user.Login(username, password)) { user.getUserData(); userID = user.userID; Selected("home"); } else MessageBox.Show("Invalid username or password", "", MessageBoxButtons.OK, MessageBoxIcon.Exclamation); } progress.Visible = false; }
private void showMenu() { frmMetroMainMenu f = new frmMetroMainMenu(new MsgHandler(showSelected) ); f.Width = this.Width; f.Height = this.Height - ( fileToolStripMenuItem.Height + toolStrip1.Height ); f.ControlBox = false; f.MdiParent = this; f.Show(); // validate user type User s = new User(loginForm.userID); f.user_type = s.userData["userDept"]; f.validateUserType(); // set user details this.btnUser.Text = s.userData["fullname"]; this.btnUser.Width += s.userData["fullname"].Length; this.lbDept.Text = s.userData["userDept"]; f.mtlUser.Text = s.userData["fullname"]; f.WindowState = FormWindowState.Maximized; }