示例#1
0
 public FrmClass(MyGlobal jumpinfo2)
 {
     this.jumpinfo = jumpinfo2;
     if (jumpinfo.user == "student")
     {
         MessageBox.Show("请用教师身份登录");
         this.Size = new Size(500, 0);
         return;
     }
     this.fk_teacherid = jumpinfo.teachId;
     InitializeComponent();
 }
示例#2
0
        private void btnLogin_Click(object sender, EventArgs e)
        {
            MyGlobal jumpinfo = new MyGlobal();
            string   userid   = this.txtUser.Text;
            string   pass     = this.txtPass.Text;

            if (this.rdoStudent.Checked)
            {
                //学生登录后查询学生信息且有学生权限
                User.power = "学生";
                SqlConnection conn = new SqlConnection("server=" + MyGlobal.ip + ";database=dormitory;UID=sa;PWD=zyh@197068;Integrated Security=False");
                conn.Open();
                string        sqlquery = @"select stuName from student where stuNum = '" + userid + "'";
                SqlCommand    sql      = new SqlCommand(sqlquery, conn);
                SqlDataReader reader   = sql.ExecuteReader();
                reader.Read();
                userid = reader[0].ToString();
                if (reader.HasRows == true)
                {
                    MessageBox.Show("欢迎学生" + userid + "登录");
                    jumpinfo.user  = "******";
                    jumpinfo.stuId = getstuId();
                    this.Hide();
                    FrmMain f = new FrmMain(jumpinfo);
                    //f.MdiParent = this;
                    f.Show();
                }
            }
            else
            {
                //教师登录后查询学生信息且有教师权限
                User.power = "教师";
                SqlConnection conn = new SqlConnection("server=" + MyGlobal.ip + ";database=dormitory;UID=sa;PWD=zyh@197068;Integrated Security=False");
                conn.Open();
                string        sqlquery = @"select teachName from teacher where teachUserName = '******'";
                SqlCommand    sql      = new SqlCommand(sqlquery, conn);
                SqlDataReader reader   = sql.ExecuteReader();
                reader.Read();
                userid = reader[0].ToString();
                if (reader.HasRows == true)
                {
                    MessageBox.Show("欢迎教师" + userid + "登录");
                    jumpinfo.user    = "******";
                    jumpinfo.teachId = getteachId();
                    this.Hide();
                    this.Hide();
                    FrmMain f = new FrmMain(jumpinfo);
                    //f.MdiParent = this;
                    f.Show();
                }
            }
        }
示例#3
0
 public FrmMain(MyGlobal jumpinfo1)
 {
     this.jumpinfo = jumpinfo1;
     InitializeComponent();
     //MessageBox.Show("我是"+jumpinfo.user+"id:" + jumpinfo.stuid);
 }
示例#4
0
 public FrmMain(MyGlobal jumpinfo2)
 {
     this.jumpinfo = jumpinfo2;
     InitializeComponent();
 }