Ejemplo n.º 1
0
        private void Window_Loaded(object sender, RoutedEventArgs e)
        {
            Information INFor = new SystemOfTest.Information();

            INFor.Class           = StaticInform.Class;
            INFor.Name            = StaticInform.Name;
            INFor.Num             = StaticInform.Num;
            textClass.DataContext = INFor;
            textName.DataContext  = INFor;
            textNum.DataContext   = INFor;
        }
Ejemplo n.º 2
0
 private void button_Click(object sender, RoutedEventArgs e)
 {
     if (textNum.Text.Trim() == string.Empty)
     {
         MessageBox.Show("请输入学号");
     }
     else
     {
         Information  InFor      = new SystemOfTest.Information();
         string       cmdText    = "select T_StuClass,T_StuName,T_StuNum from T_Students where T_StuNum=@Num";
         SqlParameter parameters = new SqlParameter("@Num", textNum.Text);
         DataSet      dataset    = new DataSet();
         dataset = SqlHelper.ExcuteDataSet(cmdText, parameters);
         DataTable         table = dataset.Tables[0];
         DataRowCollection rows  = table.Rows;
         for (int i = 0; i < rows.Count; i++)
         {
             DataRow row = rows[i];
             InFor.Class = (string)row["T_StuClass"];
             InFor.Name  = (string)row["T_StuName"];
             InFor.Num   = (string)row["T_StuNum"];
         }
         LoGing_Grid.DataContext = InFor;
         //textName.DataContext = InFor;
         if (Convert.ToString(textNum.Text) != InFor.Num)
         {
             MessageBox.Show("没有该考生信息,请重新输入!");
         }
         else
         {
             if (System.Windows.MessageBox.Show("信息核对完毕?",
                                                "信息核对",
                                                MessageBoxButton.YesNo,
                                                MessageBoxImage.Question,
                                                MessageBoxResult.Yes) == MessageBoxResult.Yes)
             {
                 StaticInform.Class  = InFor.Class;
                 StaticInform.Name   = InFor.Name;
                 StaticInform.Num    = InFor.Num;
                 btCheck.Visibility  = Visibility.Collapsed;
                 btLoging.Visibility = Visibility.Visible;
                 wp1.Visibility      = Visibility.Visible;
                 wp2.Visibility      = Visibility.Visible;
                 btLoging.Focus();
             }
         }
     }
     return;
 }
Ejemplo n.º 3
0
        private void btLoging_Click(object sender, RoutedEventArgs e)
        {
            string id  = ID.Text.Trim();
            string pas = PS.Password;

            Information InFor   = new SystemOfTest.Information();
            string      cmdText = "select * from T_TeachUser where Teach_UserName=@UserName and Teach_PassWord=@PassWord";

            SqlParameter[] parameters = new SqlParameter[]
            {
                new SqlParameter("@UserName", ID.Text),
                new SqlParameter("@PassWord", PS.Password)
            };
            DataSet dataset = new DataSet();

            dataset = SqlHelper.ExcuteDataSet(cmdText, parameters);
            DataTable         table = dataset.Tables[0];
            DataRowCollection rows  = table.Rows;

            for (int i = 0; i < rows.Count; i++)
            {
                DataRow row = rows[i];
                InFor.ID = (string)row["Teach_UserName"];
                InFor.PS = (string)row["Teach_PassWord"];
            }
            TL_Grid.DataContext = InFor;

            if (id == InFor.ID && pas == InFor.PS)
            {
                this.Close();
                SetQuestion SQ = new SystemOfTest.SetQuestion();
                SQ.Show();
            }
            if (id != string.Empty && pas != string.Empty)
            {
                if (ID.Text != InFor.ID || pas != InFor.PS)
                {
                    MessageBox.Show("用户名或密码错误!");
                    return;
                }
            }
            if (id == string.Empty || pas == string.Empty)
            {
                MessageBox.Show("请输入账号和密码!");
                return;
            }
        }