Ejemplo n.º 1
0
        // 呼叫service 利用員工ID查詢員工資料
        public EmployeePresentationModel SearchDataByEmplID()
        {
            EmployeePresentationModel emplPresentationModel = new EmployeePresentationModel();

            if (this._employeeModel.GetEmplID() == null || this._employeeModel.GetEmplID() == "")
                MessageBox.Show("請輸入員工ID");
            else
            {
                _employeeService = new EmployeeService(this._employeeModel);
                _employeeModel = _employeeService.searchByEmplID();

                emplPresentationModel.SetEmplID(_employeeModel.GetEmplID());
                emplPresentationModel.SetName(_employeeModel.GetName());
                emplPresentationModel.SetSsn(_employeeModel.GetSsn());
                emplPresentationModel.SetSex(_employeeModel.GetSex());
                emplPresentationModel.SetPhone(_employeeModel.GetPhone());
                emplPresentationModel.SetAddress(_employeeModel.GetAddress());
                emplPresentationModel.SetBlood(_employeeModel.GetBlood());
                emplPresentationModel.SetBirth(_employeeModel.GetBirth());
                emplPresentationModel.SetEmerPerson(_employeeModel.GetEmerPerson());
                emplPresentationModel.SetEmerPhone(_employeeModel.GetEmerPhone());
                emplPresentationModel.SetMilitaryStatus(_employeeModel.GetMilitaryStatus());
                emplPresentationModel.SetJobStatus(_employeeModel.GetJobStatus());
                emplPresentationModel.SetMarriedStatus(_employeeModel.GetMarriedStatus());
                emplPresentationModel.SetSpouse(_employeeModel.GetSpouse());
                emplPresentationModel.SetDeptID(_employeeModel.GetDeptID());
                emplPresentationModel.SetPositoinID(_employeeModel.GetPositionID());
                emplPresentationModel.SetBasicSalary(_employeeModel.GetBasicSalary());

                if (_employeeModel.GetName() == null || _employeeModel.GetName() == "")
                {
                    MessageBox.Show("此員工ID不存在!");
                    emplPresentationModel.SetEmplID(null);
                }
            }        

            return emplPresentationModel;
        }