示例#1
0
 public static StudentShowForm GetForm()
 {
     if (form.IsDisposed)
     {
         form = new StudentShowForm();
     }
     return(form);
 }
示例#2
0
        /// <summary>
        /// 点击登录按钮
        /// </summary>
        /// <param name="sender"></param>
        /// <param name="e"></param>
        private void BtnLogin_Click(object sender, EventArgs e)
        {
            if (string.IsNullOrEmpty(unInput.Text.Trim()) || string.IsNullOrEmpty(upInput.Text))
            {
                MessageBox.Show("用户名或密码不能为空");
                return;
            }
            string id  = unInput.Text.Trim();
            string pwd = upInput.Text;
            string message;

            if (rbStu.Checked)
            {
                if (CheckLogin(1, id, pwd, out message))  // 如果登录成功
                {
                    this.Hide();
                    StudentShowForm.GetForm().stuId = unInput.Text.Trim();
                    StudentShowForm.GetForm().Show(this);
                    MessageBox.Show("学生登录成功");
                }
                MessageBox.Show(message);
            }
            else if (rbTea.Checked)
            {
                if (CheckLogin(2, id, pwd, out message))  // 如果登录成功
                {
                    MessageBox.Show("老师登录成功");
                    return;
                }
                MessageBox.Show(message);
            }
            else
            {
                if (CheckLogin(3, id, pwd, out message))  // 如果登录成功
                {
                    this.Hide();
                    AdminShowForm.GetForm().Show(this);
                }
                MessageBox.Show(message);
            }
        }