Example #1
0
        private void showBtn_Click(object sender, EventArgs e)
        {
            this.Hide();
            DIsplay display = new DIsplay();

            display.ShowDialog();
            this.Close();
        }
Example #2
0
        private void yesBtn_Click(object sender, EventArgs e)
        {
            int    num      = int.Parse(this.numerText.Text);
            string name     = this.nameText.Text;
            int    age      = int.Parse(this.ageText.Text);
            string sex      = this.sexText.Text;
            string major    = this.majorText.Text;
            string place    = this.placeText.Text;
            string interest = this.interestText.Text;

            //Data.addSimulation(new StudentData(num,name,sex,age,major,place,interest));
            //Data.insertFromDb(num, name, age, sex, place, sex, interest);
            this.Hide();
            DIsplay dis = new DIsplay();

            dis.ShowDialog();
            this.Close();
        }
Example #3
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("账号密码错误或账号类型错误");
         }
         
     }      
 }