Esempio n. 1
0
        public Response <CompanyDetailsModel> GetCompanyByID(long companyID)
        {
            var companyResponse = new Response <CompanyDetailsModel>()
            {
                DataItems  = new List <CompanyDetailsModel>(),
                ResultCode = 0
            };

            var companyDetails = new CompanyDetailsModel();

            var company = _organizationStructureDataProvider.GetOrganizationStructureByID(companyID);

            if (company.ResultCode != 0)
            {
                companyResponse.ResultCode    = company.ResultCode;
                companyResponse.ResultMessage = company.ResultMessage;
                return(companyResponse);
            }
            else
            {
                companyDetails.Company = company.DataItems.FirstOrDefault();
            }

            var organizationIdentifiers = _organizationIdentifiersDataProvider.GetOrganizationIdentifiersByID(companyID, OrganizationType.Company.ToString());

            if (organizationIdentifiers.ResultCode != 0)
            {
                companyResponse.ResultCode    = organizationIdentifiers.ResultCode;
                companyResponse.ResultMessage = organizationIdentifiers.ResultMessage;
                return(companyResponse);
            }
            else
            {
                companyDetails.CompanyIdentifiers = organizationIdentifiers.DataItems;
            }

            var companyAddresses = _organizationStructureDataProvider.GetOrganizationAddressByID(companyID);

            if (companyAddresses.ResultCode != 0)
            {
                companyResponse.ResultCode    = companyAddresses.ResultCode;
                companyResponse.ResultMessage = companyAddresses.ResultMessage;
                return(companyResponse);
            }
            else
            {
                companyDetails.Addresses = companyAddresses.DataItems;
            }

            companyResponse.DataItems.Add(companyDetails);
            return(companyResponse);
        }
        /// <summary>
        /// Gets the program by identifier.
        /// </summary>
        /// <param name="programID">The program identifier.</param>
        /// <returns></returns>
        public Response <ProgramDetailsModel> GetProgramByID(long programID)
        {
            var programResponse = new Response <ProgramDetailsModel>()
            {
                DataItems  = new List <ProgramDetailsModel>(),
                ResultCode = 0
            };

            var programDetails = new ProgramDetailsModel();

            var program = _organizationStructureDataProvider.GetOrganizationStructureByID(programID);

            if (program.ResultCode != 0)
            {
                programResponse.ResultCode    = program.ResultCode;
                programResponse.ResultMessage = program.ResultMessage;
                return(programResponse);
            }
            else
            {
                programDetails.Program = program.DataItems.FirstOrDefault();
            }

            var programHierarchy = _organizationStructureDataProvider.GetOrganizationHierarchyByID(programID, OrganizationType.Program.ToString());

            if (programHierarchy.ResultCode != 0)
            {
                programResponse.ResultCode    = programHierarchy.ResultCode;
                programResponse.ResultMessage = programHierarchy.ResultMessage;
                return(programResponse);
            }
            else
            {
                programDetails.ProgramHierarchies = programHierarchy.DataItems;
            }

            var divisionHierarchy = _organizationStructureDataProvider.GetOrganizationHierarchyByID(programID, OrganizationType.ProgramUnit.ToString());

            if (divisionHierarchy.ResultCode != 0)
            {
                programResponse.ResultCode    = divisionHierarchy.ResultCode;
                programResponse.ResultMessage = divisionHierarchy.ResultMessage;
                return(programResponse);
            }
            else
            {
                programDetails.DivisionHierarchies = divisionHierarchy.DataItems;
            }

            programResponse.DataItems.Add(programDetails);
            return(programResponse);
        }
Esempio n. 3
0
        public Response <DivisionDetailsModel> GetDivisionByID(long divisionID)
        {
            var divisionResponse = new Response <DivisionDetailsModel>()
            {
                DataItems  = new List <DivisionDetailsModel>(),
                ResultCode = 0
            };

            var divisionDetails = new DivisionDetailsModel();

            var division = _organizationStructureDataProvider.GetOrganizationStructureByID(divisionID);

            if (division.ResultCode != 0)
            {
                divisionResponse.ResultCode    = division.ResultCode;
                divisionResponse.ResultMessage = division.ResultMessage;
                return(divisionResponse);
            }
            else
            {
                divisionDetails.Division = division.DataItems.FirstOrDefault();
            }

            var divisionHierarchies = _organizationStructureDataProvider.GetOrganizationHierarchyByID(divisionID, OrganizationType.Program.ToString());

            if (divisionHierarchies.ResultCode != 0)
            {
                divisionResponse.ResultCode    = divisionHierarchies.ResultCode;
                divisionResponse.ResultMessage = divisionHierarchies.ResultMessage;
                return(divisionResponse);
            }
            else
            {
                divisionDetails.DivisionHierarchies = divisionHierarchies.DataItems;
            }

            divisionResponse.DataItems.Add(divisionDetails);
            return(divisionResponse);
        }
 public IHttpActionResult GetOrganizationStructureByID(long detailID)
 {
     return(new HttpResult <Response <OrganizationDetailsModel> >(_organizationStructureDataProvider.GetOrganizationStructureByID(detailID), Request));
 }
Esempio n. 5
0
        /// <summary>
        /// Gets the program unit by identifier.
        /// </summary>
        /// <param name="programUnitID">The program unit identifier.</param>
        /// <returns></returns>
        public Response <ProgramUnitDetailsModel> GetProgramUnitByID(long programUnitID)
        {
            var programUnitResponse = new Response <ProgramUnitDetailsModel>()
            {
                DataItems  = new List <ProgramUnitDetailsModel>(),
                ResultCode = 0
            };

            var programUnitDetails = new ProgramUnitDetailsModel();

            var programUnit = _organizationStructureDataProvider.GetOrganizationStructureByID(programUnitID);

            if (programUnit.ResultCode != 0)
            {
                programUnitResponse.ResultCode    = programUnit.ResultCode;
                programUnitResponse.ResultMessage = programUnit.ResultMessage;
                return(programUnitResponse);
            }
            else
            {
                programUnitDetails.ProgramUnit = programUnit.DataItems.FirstOrDefault();
            }

            var reportingUnit = _organizationIdentifiersDataProvider.GetOrganizationIdentifiersByID(programUnitID, OrganizationType.ProgramUnit.ToString());

            if (reportingUnit.ResultCode != 0)
            {
                programUnitResponse.ResultCode    = reportingUnit.ResultCode;
                programUnitResponse.ResultMessage = reportingUnit.ResultMessage;
                return(programUnitResponse);
            }
            else
            {
                programUnitDetails.ReportingUnit = reportingUnit.DataItems.FirstOrDefault();
            }

            var programUnitAddresses = _organizationStructureDataProvider.GetOrganizationAddressByID(programUnitID);

            if (programUnitAddresses.ResultCode != 0)
            {
                programUnitResponse.ResultCode    = programUnitAddresses.ResultCode;
                programUnitResponse.ResultMessage = programUnitAddresses.ResultMessage;
                return(programUnitResponse);
            }
            else
            {
                programUnitDetails.Addresses = programUnitAddresses.DataItems;
            }

            var programUnitHierarchy = _organizationStructureDataProvider.GetOrganizationHierarchyByID(programUnitID, OrganizationType.ProgramUnit.ToString());

            if (programUnitHierarchy.ResultCode != 0)
            {
                programUnitResponse.ResultCode    = programUnitHierarchy.ResultCode;
                programUnitResponse.ResultMessage = programUnitHierarchy.ResultMessage;
                return(programUnitResponse);
            }
            else
            {
                programUnitDetails.ProgramUnitHierarchies = programUnitHierarchy.DataItems;
            }

            var programUnitServices = _organizationStructureDataProvider.GetServiceOrganizationDetailsByID(programUnitID);

            if (programUnitServices.ResultCode != 0)
            {
                programUnitResponse.ResultCode    = programUnitServices.ResultCode;
                programUnitResponse.ResultMessage = programUnitServices.ResultMessage;
                return(programUnitResponse);
            }
            else
            {
                programUnitDetails.ProgramUnitServices = programUnitServices.DataItems;
            }

            var programUnitServiceWorkflows = _organizationStructureDataProvider.GetOrganizationDetailsModuleComponentByDetailID(programUnitID);

            if (programUnitServiceWorkflows.ResultCode != 0)
            {
                programUnitResponse.ResultCode    = programUnitServiceWorkflows.ResultCode;
                programUnitResponse.ResultMessage = programUnitServiceWorkflows.ResultMessage;
                return(programUnitResponse);
            }
            else
            {
                programUnitDetails.ProgramUnitServiceWorkflows = programUnitServiceWorkflows.DataItems;
            }

            programUnitResponse.DataItems.Add(programUnitDetails);
            return(programUnitResponse);
        }