Exemplo n.º 1
0
        public List<EmpFormEntity> getFormEmpEntityList(EmpSearchTerm filter, EmpFormEntityMask mask)
        {
            try
            {
                List<Employee> empList = this.getEmpByMultiFilter(filter);
                List<EmpFormEntity> formEmpEntityList = new List<EmpFormEntity>();
                foreach(Employee emp in empList)
                {
                    // employee
                    EmpFormEntity formEmpEntity = new EmpFormEntity();
                    formEmpEntity.Employee = emp;

                    // emptype
                    if ((mask & EmpFormEntityMask.EmpType) == EmpFormEntityMask.EmpType)
                    {
                        EmpType empType = this.getEmpTypeByEmpTypeID(emp.EmpTypeID);
                        formEmpEntity.EmpType = empType;
                    }

                    // empdept
                    if ((mask & EmpFormEntityMask.EmpDept) == EmpFormEntityMask.EmpDept)
                    {
                        List<EmpDept> deptList = empDAO.searchDeptByEmpID(emp.EmpID);
                        formEmpEntity.EmpDept = (EmpDept[])deptList.ToArray();
                    }

                    // monthfix
                    if ((mask & EmpFormEntityMask.MonFix) == EmpFormEntityMask.MonFix)
                    {
                        List<FixedAmountItem> mfs = empDAO.getEmpFixedAmountItem(emp.EmpID, false);
                        formEmpEntity.MonthFixItem = (FixedAmountItem[])mfs.ToArray();

                    }

                    // bonusfix
                    if ((mask & EmpFormEntityMask.BonusFix) == EmpFormEntityMask.BonusFix)
                    {
                        List<FixedAmountItem> bfs = empDAO.getEmpFixedAmountItem(emp.EmpID, true);
                        formEmpEntity.BonusFixItem = (FixedAmountItem[])bfs.ToArray();
                    }

                    formEmpEntityList.Add(formEmpEntity);
                }

                return formEmpEntityList;
            }
            catch (DAOException)
            {
                throw;
            }
        }
Exemplo n.º 2
0
        public EmpFormEntity getFormEmpEntity(string empId, EmpFormEntityMask mask)
        {
            EmpFormEntity formEmpEntity = new EmpFormEntity();

            Employee emp = this.getEmployee(empId);
            if (null == emp)
            {
                return null;
            }
            formEmpEntity.Employee = emp;

            try
            {
                if ((mask & EmpFormEntityMask.EmpType) == EmpFormEntityMask.EmpType)
                {
                EmpType empType = this.getEmpTypeByEmpTypeID(emp.EmpTypeID);
                formEmpEntity.EmpType = empType;
                }

                if ((mask & EmpFormEntityMask.EmpDept) == EmpFormEntityMask.EmpDept)
                {
                List<EmpDept> deptList = empDAO.searchDeptByEmpID(empId);
                formEmpEntity.EmpDept = (EmpDept[])deptList.ToArray();
                }

                if ((mask & EmpFormEntityMask.MonFix) == EmpFormEntityMask.MonFix)
                {
                List<FixedAmountItem> mfs = empDAO.getEmpFixedAmountItem(empId, false);
                formEmpEntity.MonthFixItem = (FixedAmountItem[])mfs.ToArray();
                }

                if ((mask & EmpFormEntityMask.BonusFix) == EmpFormEntityMask.BonusFix)
                {
                List<FixedAmountItem> bfs = empDAO.getEmpFixedAmountItem(empId, true);
                formEmpEntity.BonusFixItem = (FixedAmountItem[])bfs.ToArray();
                }
            }
            catch (DAOException)
            {
                throw;
            }

            return formEmpEntity;
        }