Exemplo n.º 1
0
 private void EmployeeForm_FormClosing(object sender, FormClosingEventArgs e)
 {
     EmployeeEventArgs eventArgs = new EmployeeEventArgs();
     EventUtility.fireEvent(CloseEmployeeFormEvent, this, eventArgs);
 }
Exemplo n.º 2
0
 void employeeController_CompletedEditEmployeeEvent(object sender, EmployeeEventArgs e)
 {
     this.Enabled = true;
     bdsEmployeeSource[e.SelectedEmployee] = e.EmployeeInfo;
     this.Focus();
 }
Exemplo n.º 3
0
 private void btnSave_Click(object sender, EventArgs e)
 {
     FormToModel();
     EmployeeEventArgs eventArgs = new EmployeeEventArgs();
     eventArgs.EmployeeInfo = EmployeeController.EmployeeInfoModel;
     eventArgs.SelectedEmployee = ObjectConverter.Convert<Int32>(txtHiddenSelectedEmployeeId.Text);
     EventUtility.fireEvent(SaveEmployeeEvent,this,eventArgs);
     if(!eventArgs.HasErrors)
     {
         MessageBox.Show("Lưu nhân viên thành công");
     }
     if(Status == ViewStatus.OPENDIALOG)
     {
         Close();
     }
     btnReset_Click(null,null);
 }
Exemplo n.º 4
0
 void employeeController_CompletedAddEmployeeEvent(object sender, EmployeeEventArgs e)
 {
     this.Enabled = true;
     this.Focus();
     bdsEmployeeSource.Add(e.EmployeeInfo);
     txtEmployeesNumber.Text = bdsEmployeeSource.List.Count.ToString();
 }
Exemplo n.º 5
0
 void employeeController_CompletedCloseEmployeeFormEvent(object sender, EmployeeEventArgs e)
 {
     this.Enabled = true;
     this.Focus();
 }
Exemplo n.º 6
0
        private void btnAdd_Click(object sender, EventArgs e)
        {
            FormToModel();
            EmployeeEventArgs eventArgs = new EmployeeEventArgs();

            EmployeeInfo employeeInfo = new EmployeeInfo();

            Employee employee = new Employee();
            employee.Department = SalePointController.DepartmentModel;
            //employee.DepartmentId = SalePointController.DepartmentModel.DepartmentId;
            employee.EmployeeInfo = employeeInfo;

            employeeInfo.Employee = employee;
            //employeeInfo.DepartmentId = (int)SalePointController.DepartmentModel.DepartmentId;

            EmployeePK employeePK = new EmployeePK();
            employeePK.DepartmentId = SalePointController.DepartmentModel.DepartmentId;
            employeeInfo.EmployeePK = employeePK;
            employee.EmployeePK = employeePK;

            eventArgs.EmployeeInfo = employeeInfo;
            eventArgs.SelectedEmployee = -1;
            this.Enabled = false;

            EventUtility.fireEvent(AddEmployeeEvent,this,eventArgs);
            if(eventArgs.AddedEmployee!=null)
            {
                bdsEmployeeSource.Add(eventArgs.AddedEmployee);
                bdsEmployeeSource.EndEdit();
                dgvEmployees.Refresh();
                dgvEmployees.Invalidate();
            }
            this.Enabled = true;
            employeeController.EmployeeInfoModel = null;
        }
Exemplo n.º 7
0
        private void btnEdit_Click(object sender, EventArgs e)
        {
            FormToModel();
            EmployeeEventArgs eventArgs = new EmployeeEventArgs();

            int selectedIndex = dgvEmployees.SelectedRows[0].Index;
            EmployeeInfo employeeInfo = bdsEmployeeSource[selectedIndex] as EmployeeInfo;

            eventArgs.EmployeeInfo = employeeInfo;
            eventArgs.SelectedEmployee = selectedIndex;
            this.Enabled = false;
            EventUtility.fireEvent(EditEmployeeEvent, this, eventArgs);
            if(eventArgs.EditedEmployee!=null)
            {
                bdsEmployeeSource[selectedIndex] = eventArgs.EditedEmployee;
                bdsEmployeeSource.EndEdit();
                dgvEmployees.Refresh();
                dgvEmployees.Invalidate();
            }
            this.Enabled = true;
            employeeController.EmployeeInfoModel = null;
        }
Exemplo n.º 8
0
 void salePointView_AddEmployeeEvent(object sender, EmployeeEventArgs e)
 {
     /*EmployeeForm form = GlobalUtility.GetOnlyChildFormObject <EmployeeForm>(GlobalCache.Instance().MainForm,
                                            FormConstants.EMPLOYEE_FORM);*/
     EmployeeForm form = GlobalUtility.GetFormObject<EmployeeForm>(FormConstants.EMPLOYEE_FORM);
     EmployeeInfoModel = e.EmployeeInfo;
     form.txtDepartmentName.Text = EmployeeInfoModel.Employee.Department.DepartmentName;
     form.ShowDialog(((Form) sender));
     //GlobalUtility.ShowForm(form);
     e.AddedEmployee = EmployeeInfoModel;
 }
Exemplo n.º 9
0
 void salePointView_EditEmployeeEvent(object sender, EmployeeEventArgs e)
 {
 }
Exemplo n.º 10
0
 void employeeView_ResetEmployeeEvent(object sender, EmployeeEventArgs e)
 {
     EventUtility.fireEvent(CompletedResetEmployeeEvent, this, ResultEventArgs);
 }
Exemplo n.º 11
0
        void employeeView_SaveEmployeeEvent(object sender, EmployeeEventArgs e)
        {
            ResultEventArgs = e;
            ResultEventArgs.EmployeeInfo = EmployeeInfoModel;
            int selectedEmployee = e.SelectedEmployee;
            ResultEventArgs.SelectedEmployee = selectedEmployee;

            EmployeeDetailLogic.Add(e.EmployeeInfo);

            /*if (selectedEmployee == -1)
            {
                EventUtility.fireEvent(CompletedAddEmployeeEvent, this, ResultEventArgs);
            }
            else
            {
                EventUtility.fireEvent(CompletedEditEmployeeEvent, this, ResultEventArgs);
            }*/
        }
Exemplo n.º 12
0
 void employeeView_CloseEmployeeFormEvent(object sender, EmployeeEventArgs e)
 {
     EventUtility.fireEvent(CompletedCloseEmployeeFormEvent,this,ResultEventArgs);
 }
Exemplo n.º 13
0
 void employeeListView_LoadEmployeesEvent(object sender, EmployeeEventArgs e)
 {
     IList list = EmployeeDetailLogic.FindAll(null);
     e.EmployeeList = list;
 }
Exemplo n.º 14
0
 void employeeListView_EditEmployeeEvent(object sender, EmployeeEventArgs e)
 {
     EmployeeForm form = GlobalUtility.GetFormObject<EmployeeForm>(FormConstants.EMPLOYEE_FORM);
     EmployeeInfoModel = e.EmployeeInfo;
     form.ModelToForm();
     form.txtHiddenSelectedEmployeeId.Text = e.SelectedEmployee.ToString();
     form.Status = ViewStatus.OPENDIALOG;
     form.ShowDialog((Form)sender);
     e.EditedEmployee = EmployeeInfoModel;
 }
Exemplo n.º 15
0
        private void RefreshEmployeeList()
        {
            empInfoList.Clear();
            EmployeeEventArgs eventArgs = new EmployeeEventArgs();
            EventUtility.fireEvent(LoadEmployeesEvent, this, eventArgs);

            if (eventArgs.EmployeeList != null && eventArgs.EmployeeList.Count > 0)
            {
                foreach (EmployeeInfo employeeInfo in eventArgs.EmployeeList)
                {
                    empInfoList.Add(employeeInfo);
                }
                bdsEmployee.EndEdit();
                dgvEmployee.Refresh();
                dgvEmployee.Invalidate();
            }
        }
Exemplo n.º 16
0
        private void dgvEmployee_CellContentClick(object sender, DataGridViewCellEventArgs e)
        {
            if (dgvEmployee.CurrentCell == null)
            {
                return;
            }
            int selectedIndex = dgvEmployee.CurrentCell.RowIndex;

            EmployeeEventArgs eventArgs = new EmployeeEventArgs();
            eventArgs.EmployeeInfo = empInfoList[selectedIndex];
            eventArgs.SelectedEmployee = selectedIndex;
            EventUtility.fireEvent(EditEmployeeEvent, this, eventArgs);
            RefreshEmployeeList();
        }