Example #1
0
File: Form1.cs Project: bibubu/-
 private void Button1_Click(object sender, EventArgs e)
 {
     if (RegiLogin.Login(textBox1.Text, textBox2.Text))
     {
         //判断用户身份
         string         sqlcommand = "select permission from AccountOwner where account='" + textBox1.Text + "'";
         DataSet        ds         = new DataSet();
         SqlDataAdapter da         = SqlTool.DataAdapter(User.Student.sqlConStr, sqlcommand);
         da.Fill(ds);
         string permission = ds.Tables[0].Rows[0][0].ToString();
         //隐藏登录界面
         this.Hide();
         //显示用户界面
         if (String.Equals(permission, "学生"))//学生用户
         {
             Form3 f3 = new Form3(textBox1.Text);
             this.textBox1.Text = "";
             this.textBox2.Text = "";
             f3.form1           = this;
             f3.Show();
         }
         else//教师用户
         {
             Form2 f2 = new Form2(textBox1.Text);
             this.textBox1.Text = "";
             this.textBox2.Text = "";
             f2.form1           = this;
             f2.Show();
         }
     }
     else
     {
         MessageBox.Show("登录失败!");
     }
 }
Example #2
0
File: Form2.cs Project: bibubu/-
 /// <summary>
 /// 修改密码
 /// </summary>
 /// <param name="sender"></param>
 /// <param name="e"></param>
 private void Button3_Click(object sender, EventArgs e)
 {
     if (textBox1.Text != "" && textBox2.Text != "" && textBox3.Text != "")
     {
         if (string.Equals(textBox2.Text, textBox3.Text))
         {
             if (RegiLogin.Login(toolStripStatusLabel2.Text, textBox1.Text))
             {
                 string sqlCommand = "Update AccountOwner set password='******' where account='" + toolStripStatusLabel2.Text + "'";
                 if (SqlTool.ExecuteNonQuery(User.Student.sqlConStr, sqlCommand) == 1)
                 {
                     MessageBox.Show("修改成功,请重新登录!");
                     form1.Show();
                     this.Close();
                 }
                 else
                 {
                     MessageBox.Show("修改失败!");
                 }
             }
             else
             {
                 MessageBox.Show("原密码错误!");
             }
         }
         else
         {
             MessageBox.Show("两次密码不一致!");
         }
     }
     else
     {
         MessageBox.Show("请将信息填写完整!");
     }
 }
Example #3
0
File: 注册.cs Project: bibubu/-
 private void Button2_Click(object sender, EventArgs e)
 {
     if (textBox1.Text != "" && textBox2.Text != "" && textBox3.Text != "" && textBox4.Text != "") //注册信息不为空
     {
         if (String.Equals(textBox2.Text, textBox3.Text))                                          //两次注册密码一致
         {
             if (checkBox1.Checked == true)                                                        //学生注册
             {
                 if (RegiLogin.Regi(textBox1.Text, textBox2.Text, checkBox1.Text, textBox4.Text))
                 {
                     MessageBox.Show("注册成功!");
                     //跳转到登录页面
                     form1.Show();
                     this.Close();
                 }
                 else
                 {
                     MessageBox.Show("账号名已存在!");
                 }
             }
             else if (checkBox2.Checked == true)//教师注册
             {
                 if (RegiLogin.Regi(textBox1.Text, textBox2.Text, checkBox2.Text, textBox4.Text))
                 {
                     MessageBox.Show("注册成功!");
                     //跳转到登录页面
                     form1.Show();
                     this.Close();
                 }
                 else
                 {
                     MessageBox.Show("账号名已存在!");
                 }
             }
             else
             {
                 MessageBox.Show("请选择用户身份!");
             }
         }
         else
         {
             MessageBox.Show("两次输入的密码不一致!");
         }
     }
     else
     {
         MessageBox.Show("请完善注册信息!");
     }
 }