Example #1
0
        // 查詢該員工資料並將資料填進UI中
        private void SetAllEmplDataToUI()
        {
            _employeeController = new EmployeeController(_employeePresentationModel);
            _employeePresentationModel = _employeeController.SearchDataByEmplID();

            try
            {
                _newEmplIDTB.Text = _employeePresentationModel.GetEmplID();
                _newEmplBirthDP.Value = _employeePresentationModel.GetBirth();
                _newEmplMarriedStatCB.SelectedItem = _employeePresentationModel.GetMarriedStatus();
                // 1 為未婚
                // 0 為已婚
                if (_newEmplMarriedStatCB.SelectedIndex == 1)
                {
                    _newEmplSpouseTB.Text = _employeePresentationModel.GetSpouse();
                }
                else if (_newEmplMarriedStatCB.SelectedIndex == 0)
                {
                    _newEmplSpouseTB.ReadOnly = true;
                    _newEmplSpouseTB.Text = null;
                }
                _newEmplJobStatCB.SelectedItem = _employeePresentationModel.GetJobStatus();
                _newEmplMilitaryStatCB.SelectedItem = _employeePresentationModel.GetMilitaryStatus();
                _newEmplBloodCB.SelectedItem = _employeePresentationModel.GetBlood();
                _newEmplSexCB.SelectedItem = _employeePresentationModel.GetSex();
                _newEmplNameTB.Text = _employeePresentationModel.GetName();
                _newEmpllSsnTB.Text = _employeePresentationModel.GetSsn(); ;
                _newEmplAddrTB.Text = _employeePresentationModel.GetAddress();
                _newEmplEmerPersonTB.Text = _employeePresentationModel.GetEmerPerson();
                _newEmplEmerPhoneTB.Text = _employeePresentationModel.GetEmerPhone();
                _newEmplBasicSalaryTB.Text = _employeePresentationModel.GetBasicSalary().ToString();
                _newEmplPhoneTB.Text = _employeePresentationModel.GetPhone();
                _newEmplDeptCB.SelectedValue = _employeePresentationModel.GetDeptID();
                _newEmplPositionCB.SelectedValue = _employeePresentationModel.GetPositionID();
                _addEmplLoginPWTB.Text = _employeePresentationModel.GetEmplLoginPassword();
            }
            catch(Exception ex) 
            {
                Console.WriteLine(ex.Message);
                MessageBox.Show("系統發生錯誤, 請稍後再嘗試!");
            }     
        }
Example #2
0
        // 按下查詢員工按鈕
        private void ClickSearchEmplButtom(object sender, EventArgs e)
        {
            String emplID = _editEmplIDTB.Text;
            _employeePresentationModel.SetEmplID(emplID);

            _employeeController = new EmployeeController(_employeePresentationModel);
            _employeePresentationModel = _employeeController.SearchDataByEmplID();

            if (_employeePresentationModel.GetEmplID() == null || _employeePresentationModel.GetEmplID() == "")
                return;

            this.SetAllEmplEditToEnable();
            this.ResetSearchEditEmplUI();
        }
Example #3
0
        // 按下修改員工資料按鈕
        private void ClickEditEmplButtom(object sender, EventArgs e)
        {
            this.SetAllEditEmplVariableToPM();

            _employeeController = new EmployeeController(_employeePresentationModel);
            if (_employeeController.EditEmployee())
            {
                this.SetAllEmplEditToNotEnable();
                this.ResetEditEmplUI();
            }
        }
Example #4
0
        // 按下新增員工按鈕
        private void ClickAddEmplButton(object sender, EventArgs e)
        {
            this.SetAllNewEmplVariableToPM();

            _employeeController = new EmployeeController(_employeePresentationModel);
            _employeeController.AddEmployee();
        }
Example #5
0
        // 根據選取職位 顯示職位底薪(edit)
        private void ChangedEditEmplPositionCBSelectedIndex(object sender, EventArgs e)
        {
            this.SetAllEditEmplVariableToPM();

            _employeeController = new EmployeeController(_employeePresentationModel);
            _editEmplBasicSalaryTB.Text = _employeeController.SearchBasicSalaryByPositionID();
        }
Example #6
0
        // reset all edit employee UI
        private void ResetEditEmplUI()
        {
            _editEmplJobStatCB.SelectedIndex = 0;
            _editEmplMarriedStatCB.SelectedIndex = 0;
            _editEmplMilitaryStatCB.SelectedIndex = 0;
            _editEmplBloodCB.SelectedIndex = 0;
            _editEmplSexCB.SelectedIndex = 0;
            _editEmplDeptCB.SelectedIndex = 0;
            _editEmplPositionCB.SelectedIndex = 0;
            _editEmplBirthDTP.Value = DateTime.Now;
            this.SetAllEditEmplVariableToPM();

            _employeeController = new EmployeeController(_employeePresentationModel);
            _editEmplBasicSalaryTB.Text = _employeeController.SearchBasicSalaryByPositionID();
        }
Example #7
0
        // reset all add employee UI 預設值
        private void ResetNewEmplUI() 
        {
            _newEmplJobStatCB.SelectedIndex = 0;
            _newEmplMarriedStatCB.SelectedIndex = 0;
            _newEmplMilitaryStatCB.SelectedIndex = 0;
            _newEmplBloodCB.SelectedIndex = 0;
            _newEmplSexCB.SelectedIndex = 0;
            this.SetAllNewEmplVariableToPM();

            _employeeController = new EmployeeController(_employeePresentationModel);
            _newEmplBasicSalaryTB.Text = _employeeController.SearchBasicSalaryByPositionID();
        }