public virtual List <OrganizationsStructuresBLL> GetByOrganizationIDWithhAllChilds(int OrganizationID) { try { List <OrganizationsStructuresBLL> AllOrgs = new OrganizationsStructuresBLL().GetOrganizationStructureWithFullName(); List <OrganizationsStructuresBLL> orgs = new List <OrganizationsStructuresBLL>(); OrganizationsStructuresBLL MainOrg = AllOrgs.FirstOrDefault(x => x.OrganizationID == OrganizationID); orgs.Add(MainOrg); AddChildren(AllOrgs, orgs, MainOrg.OrganizationID); return(orgs); } catch (Exception) { throw; } }
public virtual OrganizationsStructuresBLL GetCurrentManagerOfEmployee(int EmployeeCareerHistoryID) { try { BaseAssigningsBLL ActiveAssigning = new BaseAssigningsBLL().GetEmployeeActiveAssigning(EmployeeCareerHistoryID); if (ActiveAssigning != null) { return(((InternalAssigningBLL)ActiveAssigning).Organization); } else { string ManagerCodeNo = new EmployeesCareersHistoryBLL().GetByEmployeeCareerHistoryID(EmployeeCareerHistoryID).EmployeeCode.EmployeeCodeNo; List <OrganizationsStructuresBLL> AllOrganizationsForManager = new OrganizationsStructuresBLL().GetAllOrganizationsForManagerByManagerCodeNo(ManagerCodeNo); return(AllOrganizationsForManager.FirstOrDefault().ParentOrganization); } } catch (Exception ex) { throw ex; } }