public List <Company> GetCompaniesByEmployee(Employee employee)
        {
            if (employee == null)
            {
                throw new ArgumentNullException(nameof(employee));
            }

            return(ExecuteFaultHandledOperation(() =>
            {
                var companys = new List <Company>();
                var person = new PersonData()
                {
                    PersonKey = employee.PersonKey
                };

                var companys_data = _company_repo.GetAll(person);

                foreach (CompanyData company_data in companys_data)
                {
                    Company company = _comp_es.Map(company_data);
                    company.CompanyAttributes = _entity_attrib_be.GetAttributeByEntity(company.CompanyKey, QIQOEntityType.Company);
                    company.CompanyAddresses = _address_be.GetAddressesByCompany(company);
                    company.GLAccounts = _coa_be.GetChartOfAccountsByCompany(company);
                    companys.Add(company);
                }
                return companys;
            }));
        }
コード例 #2
0
        public Product GetProductByID(int product_key)
        {
            Log.Info("Accessing ProductBusinessEngine GetProductByID function");
            return(ExecuteFaultHandledOperation(() =>
            {
                var product_data = _product_repo.GetByID(product_key);
                Log.Info("ProductBusinessEngine GetByID function completed");

                if (product_data.ProductKey != 0)
                {
                    var product = Map(product_data);
                    product.ProductAttributes = _attrib_be.GetAttributeByEntity(product.ProductKey, QIQOEntityType.Product);
                    return product;
                }
                else
                {
                    NotFoundException ex = new NotFoundException(string.Format("Product with key {0} is not in database", product_key));
                    throw new FaultException <NotFoundException>(ex, ex.Message);
                }
            }));
        }
コード例 #3
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;
            }));
        }
コード例 #4
0
 private List <EntityAttribute> GetAttributes(int acct_key, QIQOEntityType type)
 {
     return(_entity_attribute_be.GetAttributeByEntity(acct_key, type));
 }