Пример #1
0
 private void ClickRegisterOKButton(object sender, EventArgs e)
 {
     _userId       = _userIdTextBox.Text;
     _userPwd      = _userPwdTextBox.Text;
     _userIdentity = _userComboBox.Text;
     if (_userId != "" && _userId != null && _userPwd != "" && _userPwd != null && _userIdentity != null && _userIdentity != "")
     {
         try
         {
             if (_pmodel.CreateUser(_userId, _userPwd, _userIdentity) == true)
             {
                 MessageBox.Show(this, "已存在的使用者Id!!", "錯誤", MessageBoxButtons.OK, MessageBoxIcon.Warning);
             }
             else
             {
                 MessageBox.Show(this, "註冊成功!!", "成功", MessageBoxButtons.OK, MessageBoxIcon.Warning);
                 this.Close();
                 _success = true;
             }
         }
         catch (Exception ex)
         {
             Console.WriteLine(ex);
         }
     }
     else
     {
         MessageBox.Show(this, "使用者Id、密碼或使用者身分不得為空!!", "錯誤", MessageBoxButtons.OK, MessageBoxIcon.Warning);
     }
 }
Пример #2
0
        public void CreateUserTest()
        {
            string testUserId = "101590320";
            string testPwd = "0000";
            string testIdentity = "Student";
            bool   fail = true, status;

            status = _testPModel.CreateUser(testUserId, testPwd, testIdentity);
            Assert.AreEqual(status, fail);
        }
Пример #3
0
        public void CheckSuccessOrNotTest()
        {
            presentationModel _pmodel       = new presentationModel(new Model(), new Course_Model(), new Professor_Model());
            string            _userId       = "101590320";
            string            _userPwd      = "0000";
            string            _userIdentity = "Student";
            bool _success;

            _success = _pmodel.CreateUser(_userId, _userPwd, _userIdentity);
            Assert.AreEqual(_success, true);
        }