/// <summary> /// 登陆 /// </summary> /// <param name="sender"></param> /// <param name="e"></param> private void labLogin_Click(object sender, EventArgs e) { if (txtUserID.Text == "" || txtUserPwd.Text == "") { MessageBox.Show("请输入用户或密码!"); } else { UserInfo User = new UserInfo(txtUserID.Text, txtUserPwd.Text); try { if (UserBll.UserISNO(User) == 1) { frmStudentExam fse = new frmStudentExam(User); User.UserName = UserBll.GetUserName(txtUserID.Text); fse.Show(); } else if (UserBll.UserISNO(User) == 2 || UserBll.UserISNO(User) == 3) { User.RoleId = UserBll.UserISNO(User); User.UserName = UserBll.GetUserName(txtUserID.Text); frmMainManage fmm = new frmMainManage(User); fmm.Show(); } else { MessageBox.Show("密码或用户名错误!"); i -= 1; } } catch (Exception ee) { MessageBox.Show(ee.Message); throw; } } if (i == 0) { this.Close(); } }
/// <summary> /// 登陆 /// </summary> /// <param name="sender"></param> /// <param name="e"></param> private void labLogin_Click(object sender, EventArgs e) { if (txtUserID.Text==""||txtUserPwd.Text=="") { MessageBox.Show("请输入用户或密码!"); } else { UserInfo User = new UserInfo(txtUserID.Text, txtUserPwd.Text); try { if (UserBll.UserISNO(User) == 1) { frmStudentExam fse = new frmStudentExam(User); User.UserName = UserBll.GetUserName(txtUserID.Text); fse.Show(); } else if (UserBll.UserISNO(User) == 2||UserBll.UserISNO(User)==3) { User.RoleId = UserBll.UserISNO(User); User.UserName = UserBll.GetUserName(txtUserID.Text); frmMainManage fmm = new frmMainManage(User); fmm.Show(); } else { MessageBox.Show("密码或用户名错误!"); i -= 1; } } catch (Exception ee) { MessageBox.Show(ee.Message); throw; } } if (i==0) { this.Close(); } }