コード例 #1
0
 private void LoginMethod()
 {
     try
     {
         //if (this.chkInput())
         {
             StudentService     service     = new StudentService();
             ClientStudentModel selectModel = new ClientStudentModel
             {
                 Key           = "_3[#$%wd*",
                 Version       = "2.0.0",
                 StudentNumber = this.textBox1.Text.Trim(),
                 Pwd           = this.textBox2.Text.Trim(),
                 DataSource    = name
             };
             studentModel = service.Login(selectModel);
             MessageBox.Show(studentModel.ClassName.ToString() + studentModel.StudentName.ToString() + studentModel.DataSource.ToString() + studentModel.TeacherId.ToString() + studentModel.TeacherName.ToString());
             if (studentModel == null)
             {
                 MessageBox.Show("用户不存在");
                 base.Close();
             }
             else
             {
                 if (studentModel.IsSameVersion)
                 {
                     MessageBox.Show(studentModel.MessageInfo1);
                 }
                 if (studentModel.EnableLogin)
                 {
                     base.DialogResult = DialogResult.Yes;
                 }
                 else
                 {
                     base.Close();
                 }
             }
         }
     }
     catch (Exception exception)
     {
         if (exception.Message.Contains("服务器无法处理请求"))
         {
             MessageBox.Show("服务器正在维护");
             base.Close();
         }
         else
         {
             MessageBox.Show(exception.Message);
             base.Close();
         }
     }
 }
コード例 #2
0
ファイル: FakePack.cs プロジェクト: NEU-mathe/AMFairy
        static public bool Login(string subject, string stuNumber, string pwd)
        {
            StudentService     service     = new StudentService();
            ClientStudentModel selectModel = new ClientStudentModel
            {
                Key           = "_3[#$%wd*",
                Version       = "2.0.0",
                StudentNumber = stuNumber,
                Pwd           = pwd,
                DataSource    = subject
            };

            try
            {
                service.Login(selectModel);
            }
            catch (Exception)
            {
                MessageBox.Show("登录失败", "灾难性故障", MessageBoxButtons.OK, MessageBoxIcon.Error);
                return(false);
            }
            return(true);
        }