//呼叫service 利用authoID查詢autho資料
        public AuthorizationPresentationModel SearchDataByAuthoID()
        {
            AuthorizationPresentationModel authoPresentModel = new AuthorizationPresentationModel();

            if (this._authoModel.GetAuthoID() == null || this._authoModel.GetAuthoID() == "")
                MessageBox.Show("請輸入權限ID");
            else
            {
                //MessageBox.Show("yes");
                _authoService = new AuthorizationService(this._authoModel);
                _authoModel = _authoService.searchByAuthoID();

                authoPresentModel.SetAuthoID(_authoModel.GetAuthoID());
                authoPresentModel.SetAuthoName(_authoModel.GetAuthoName());
                authoPresentModel.SetAuthoValue(_authoModel.GetAuthoValue());

                if(_authoModel.GetAuthoName() == null || _authoModel.GetAuthoName() == "")
                {
                    MessageBox.Show("此權限ID不存在!");
                    //MessageBox.Show(_authoModel.GetAuthoID());
                    authoPresentModel.SetAuthoID(null);
                }
            }
            return authoPresentModel;
        }
 // 建構子
 public AuthorizationController(AuthorizationPresentationModel authoPresentationModel)
 {
     _authoModel.SetAuthoID(authoPresentationModel.GetAuthoID());
     _authoModel.SetAuthoName(authoPresentationModel.GetAuthoName());
     _authoModel.SetAuthoValue(authoPresentationModel.GetAuthoValue());
 }
Beispiel #3
0
        // 按下查詢權限按鈕
        private void ClickSearchAuthoButtom(object sender, EventArgs e)
        {
            String authoID = _editAuthoIDTB.Text;
            _authoPresentationModel.SetAuthoID(authoID);

            _authoController = new AuthorizationController(_authoPresentationModel);
            _authoPresentationModel = _authoController.SearchDataByAuthoID();

            if (_authoPresentationModel.GetAuthoID() == null || _authoPresentationModel.GetAuthoID() == "")
                return;

            this.SetAllAuthoEditToEnable();
            this.ResetSearchEditAuthoUI();
        }