public List <AccountPerson> GetEmployeeListByAccount(Account account)
        {
            if (account == null)
            {
                throw new ArgumentNullException(nameof(account));
            }

            return(ExecuteFaultHandledOperation(() =>
            {
                var employees = new List <AccountPerson>();
                var acct = new AccountData()
                {
                    AccountKey = account.AccountKey
                };

                var emps_data = _entity_person_repo.GetAll(acct);

                foreach (EntityPersonData emp_data in emps_data)
                {
                    Log.Debug("EntityPersonKey {0}", emp_data.EntityPersonKey);
                    AccountPerson employee = _acct_es.Map(emp_data);
                    //employee.PersonAttributes = entity_attrib_be.GetAttributeByEntity(employee.PersonKey, QIQOEntityType.Person);
                    //employee.Addresses = address_be.GetAddressesByEntityID(employee.PersonKey, QIQOEntityType.Person);

                    PersonData ent_per = _person_repo.GetByID(employee.PersonKey);
                    _pers_es.InitPersonData(employee, ent_per);

                    Log.Info($"Employee: {employee.PersonLastName}; Role: {employee.RoleInCompany}; Type: {employee.CompanyRoleType}; EntityPersonKey {employee.EntityPersonKey}");

                    employees.Add(employee);
                }
                return employees;
            }));
        }
Beispiel #2
0
        public List <Employee> GetEmployeesByCompany(Company company)
        {
            if (company == null)
            {
                throw new ArgumentNullException(nameof(company));
            }

            return(ExecuteFaultHandledOperation(() =>
            {
                var employees = new List <Employee>();
                var comp = new CompanyData()
                {
                    CompanyKey = company.CompanyKey
                };

                var emps_data = _entity_person_repo.GetAll(comp);

                foreach (EntityPersonData emp_data in emps_data)
                {
                    Employee employee = _pers_es.Map(emp_data);
                    employee.PersonAttributes = _entity_attrib_be.GetAttributeByEntity(employee.PersonKey, QIQOEntityType.Person);
                    employee.Addresses = _address_be.GetAddressesByEntityID(employee.PersonKey, QIQOEntityType.Person);

                    //employee.Companies = compHelper.GetCompaniesByEmployee(employee); // CAUSES Stack Overflow - of sorts HERE

                    PersonData ent_per = _person_repo.GetByID(employee.PersonKey);

                    //GetEmployeeSupervisor(employee);
                    _pers_es.InitPersonData(employee, ent_per);

                    //Log.Info("Employee: {0}; Role: {1}; Type: {2}; EntityPersonKey {3}", employee.PersonLastName,
                    //    employee.RoleInCompany, employee.CompanyRoleType, employee.EntityPersonKey);

                    employees.Add(employee);
                }
                return employees;
            }));
        }