Esempio n. 1
0
 private void register_Click(object sender, EventArgs e)
 {
     string account = this.accoundText.Text;
     string password = this.passwordText.Text;
     //输入不能为空
     if (!(accound.Equals("") && password.Equals("")))
     {
         if (Student.Checked)
         {
             int res = LoginValidater.Register(account, password, Const.STUDENT);
             reShowBox(res);
             this.accoundText.Clear();
             this.passwordText.Clear();
         }
         else if (Teacher.Checked)
         {
             LoginValidater.Register(account, password, Const.TEACHER);
             this.accoundText.Clear();
             this.passwordText.Clear();
         }
         else
         {
             LoginValidater.Register(account, password, Const.ADMINISTRATOR);
             this.accoundText.Clear();
             this.passwordText.Clear();
         }
     }
 }
Esempio n. 2
0
 private void login_Click(object sender, EventArgs e)
 {
     string account = this.accoundText.Text;
     string password = this.passwordText.Text;
     //判断登录类型,并且记得给memory赋权限
     if(Student.Checked==true)
     {
         bool  res = LoginValidater.Login(account,password,Const.STUDENT);
         if (res)
         {
             //控制权限
             MemoryData.Level = Const.STUDENT;
             MemoryData.account = account;
             MemoryData.password = password;
             this.Hide();
             DIsplay display = new DIsplay();
             display.ShowDialog();
             this.Close();
         }
         else
         {
             this.accoundText.Clear();
             this.passwordText.Clear();
             MessageBox.Show("账号密码错误或账号类型错误");
         }
     }
     else if(Teacher.Checked==true)
     {
         bool res = LoginValidater.Login(account, password,Const.TEACHER);
         if (res)
         {
             MemoryData.Level = Const.TEACHER;
             MemoryData.account = account;
             MemoryData.password = password;
             this.Hide();
             DIsplay display = new DIsplay();
             display.ShowDialog();
             this.Close();
         }
         else
         {
             this.accoundText.Clear();
             this.passwordText.Clear();
             MessageBox.Show("账号密码错误或账号类型错误");
         }
     }
     else
     {
         //控制权限
         bool res = LoginValidater.Login(account, password, Const.ADMINISTRATOR);
         if (res)
         {
             MemoryData.Level = Const.ADMINISTRATOR;
             MemoryData.account = account;
             MemoryData.password = password;
             this.Hide();
             DIsplay display = new DIsplay();
             display.ShowDialog();
             this.Close();
         }
         else
         {
             this.accoundText.Clear();
             this.passwordText.Clear();
             MessageBox.Show("账号密码错误或账号类型错误");
         }
         
     }      
 }