예제 #1
0
        //呼叫service 利用positionID查詢position資料
        public PositionPresentationModel SearchDataByPositionID()
        {
            PositionPresentationModel positionPresentationModel = new PositionPresentationModel();

            if (this._positionModel.GetId() == null || this._positionModel.GetId() == "")
            {
                MessageBox.Show("請輸入職位ID");
            }
            else
            {
                //MessageBox.Show("yes");
                _positionService = new PositionService(this._positionModel);
                _positionModel   = _positionService.searchByPositionID();

                positionPresentationModel.SetPositionID(_positionModel.GetId());
                positionPresentationModel.SetPositionName(_positionModel.GetName());
                positionPresentationModel.SetPositionBasicSalary(_positionModel.GetBasicSalary());
                positionPresentationModel.SetPositionAuthoID(_positionModel.GetAuthoId());

                if (positionPresentationModel.GetPositionName() == null || positionPresentationModel.GetPositionName() == "")
                {
                    MessageBox.Show("此職位ID不存在!");
                    //MessageBox.Show(_authoModel.GetAuthoID());
                    positionPresentationModel.SetPositionID(null);
                }
            }
            return(positionPresentationModel);
        }
예제 #2
0
        // 判斷帳號密碼是否符合資料庫中的資料
        public int judgeAccountAndPassword(String account, String password)
        {
            if (account == "" && password == "")
            {
                MessageBox.Show("請輸入員工ID與密碼!");
                return(-1);
            }
            else if (account == "")
            {
                MessageBox.Show("請輸入員工ID!");
                return(-1);
            }
            else if (password == "")
            {
                MessageBox.Show("請輸入密碼!");
                return(-1);
            }

            _accountService = new AccountService(account, password);
            _loginModel     = _accountService.searchByAccount();
            if (account == _loginModel.GetAccount() && password == _loginModel.GetPassword())
            {
                EmployeeModel emplModel = new EmployeeModel();
                emplModel.SetEmplID(account);
                EmployeeService emplService = new EmployeeService(emplModel);
                emplModel = emplService.searchByEmplID();

                if (!(emplModel.GetPositionID() == null || emplModel.GetPositionID() == ""))
                {
                    PositionModel positionModel = new PositionModel();
                    positionModel.SetId(emplModel.GetPositionID());
                    PositionService positionService = new PositionService(positionModel);

                    positionModel = positionService.searchByPositionID();

                    if (!(positionModel.GetAuthoId() == null || positionModel.GetAuthoId() == ""))
                    {
                        AuthorizationModel authoModel = new AuthorizationModel();
                        authoModel.SetAuthoID(positionModel.GetAuthoId());
                        AuthorizationService authoService = new AuthorizationService(authoModel);

                        authoModel = authoService.searchByAuthoID();

                        // > 0 管理介面
                        // = 0 員工介面
                        if (!(authoModel.GetAuthoName() == null || authoModel.GetAuthoName() == ""))
                        {
                            return(System.Convert.ToInt32(authoModel.GetAuthoValue()));
                        }
                        else
                        {
                            return(-1);
                        }
                    }
                    else
                    {
                        return(-1);
                    }
                }
                else
                {
                    return(-1);
                }
            }
            else
            {
                MessageBox.Show("帳號密碼錯誤!");
                return(-1);
            }
        }
예제 #3
0
 public void TestAuthoId()
 {
     _position.SetAuthoId("testAuthoID");
     Assert.AreEqual("testAuthoID", _position.GetAuthoId());
 }