示例#1
0
        /// <summary>
        /// 教员登录
        /// </summary>
        private void istLogin()
        {
            if (istNumberTextBox.Text.Trim().Length > 0 && istPwdTextBox.Text.Trim().Length > 0)
            {
                string istNumber = istNumberTextBox.Text.Trim();
                string pwd       = Tool.getMd5Str(istPwdTextBox.Text.Trim());

                string        conStr = "server=localhost;database=training;integrated security=SSPI";
                SqlConnection con    = new SqlConnection(conStr);
                con.Open();
                string         sql     = "select * from instructors where istNumber='" + istNumber + "' and pwd='" + pwd + "'";
                SqlDataAdapter adapter = new SqlDataAdapter(sql, con);
                DataSet        ds      = new DataSet();
                adapter.Fill(ds, "instructors");
                int    rows  = ds.Tables["instructors"].Rows.Count;
                string istId = ds.Tables["instructors"].Rows[0]["id"].ToString();
                if (rows > 0)
                {
                    InstructorForm istFm = new InstructorForm(istId);
                    istFm.Show();
                    this.Hide();
                }
                else
                {
                    MessageBox.Show("教员编号或密码错误");
                }
            }
            else
            {
                MessageBox.Show("请正确输入教员编号和密码");
            }
        }
示例#2
0
        private void btnHome_Click(object sender, EventArgs e)
        {
            this.Hide();
            InstructorForm ob = new InstructorForm();

            ob.ShowDialog();
            this.Close();
        }