Example #1
0
        private void button1_Click(object sender, EventArgs e)
        {
            this.Hide();
            stuinfo f8 = new stuinfo();

            f8.usernamebb(bb);
            f8.Show();
        }
Example #2
0
File: login.cs Project: liyuhau/-
 private void button1_Click(object sender, EventArgs e)
 {
     if (String.IsNullOrEmpty(textBox1.Text) || String.IsNullOrEmpty(textBox2.Text))
     {
         MessageBox.Show("用户名或者密码不能为空!");
     }
     else
     {
         if (radioButton1.Checked == true)
         {
             Users   user1 = new Users();
             DataSet ds    = new DataSet();
             DAL     dall  = new DAL();   //实例化
             user1.userName   = textBox1.Text;
             user1.userPass   = textBox2.Text;
             user1.user_power = "1";
             ds = dall.login(user1);
             if (ds.Tables[0].Rows.Count > 0)
             {
                 this.Hide();
                 stumanage f2 = new stumanage();
                 f2.Show();
             }
             else
             {
                 MessageBox.Show("管理员中不存在此用户或者用户名密码输入错误,请重新输入");
             }
         }
         if (radioButton2.Checked == true)
         {
             Users   user1 = new Users();
             DataSet ds    = new DataSet();
             DAL     dall  = new DAL();
             user1.userName   = textBox1.Text;
             user1.userPass   = textBox2.Text;
             user1.user_power = "0";
             ds = dall.login(user1);
             if (ds.Tables[0].Rows.Count > 0)
             {
                 this.Hide();
                 stuinfo f8 = new stuinfo();
                 f8.usernamebb(textBox1.Text);
                 f8.Show();
             }
             else
             {
                 MessageBox.Show("学生中不存在此用户或者用户名密码输入错误,请重新输入");
             }
         }
     }
 }
Example #3
0
        public ActionResult Edit_Account(stuinfo inpt)
        {
            long id       = (long)Session["id"];
            var  stu_info = db.stu_info.Find(id);

            stu_info.emailaddress    = inpt.emailaddress;
            stu_info.gender          = inpt.gender;
            stu_info.major           = inpt.major;
            stu_info.name            = inpt.name;
            stu_info.pass            = inpt.pass;
            db.Entry(stu_info).State = EntityState.Modified;
            string res = "";

            try { db.SaveChanges(); }
            catch (DbEntityValidationException e) {
                res = tf.AnalyseError(e);
            }
            return(Content(res));
        }