コード例 #1
0
        private static void UpdateCommunityOrganisationalEntity(RecruitersDataContext dc, Organisation organisation)
        {
            var entity = GetCommunityOrganisationalUnitEntity(dc, organisation.Id);

            // If there is no entity then just add it.

            if (entity == null)
            {
                if (organisation.AffiliateId != null)
                {
                    dc.CommunityOrganisationalUnitEntities.InsertOnSubmit(Mappings.MapCommunityOrganisation(organisation.Id, organisation.AffiliateId.Value));
                }
            }
            else
            {
                DeleteAssociations(dc, entity);
                if (organisation.AffiliateId == null)
                {
                    dc.CommunityOrganisationalUnitEntities.DeleteOnSubmit(entity);
                }
                else
                {
                    organisation.MapTo(entity);
                }
            }
        }
コード例 #2
0
        private static void UpdateOrganisationalEntity(RecruitersDataContext dc, Organisation organisation, OrganisationEntity entity)
        {
            if (organisation.IsVerified)
            {
                // Make sure there is an organisational unit.

                var verifiedOrganisation = (VerifiedOrganisation)organisation;
                if (entity.OrganisationalUnitEntity == null)
                {
                    entity.OrganisationalUnitEntity = verifiedOrganisation.Map();
                }
                else
                {
                    dc.CheckDeleteContactDetails(verifiedOrganisation, entity.OrganisationalUnitEntity);
                    verifiedOrganisation.MapTo(entity.OrganisationalUnitEntity);
                }
            }
            else
            {
                // Not verified, make sure there is no organisational unit.

                if (entity.OrganisationalUnitEntity != null)
                {
                    if (entity.OrganisationalUnitEntity.ContactDetailsEntity != null)
                    {
                        dc.ContactDetailsEntities.DeleteOnSubmit(entity.OrganisationalUnitEntity.ContactDetailsEntity);
                        entity.OrganisationalUnitEntity.ContactDetailsEntity = null;
                    }

                    dc.OrganisationalUnitEntities.DeleteOnSubmit(entity.OrganisationalUnitEntity);
                    entity.OrganisationalUnitEntity = null;
                }
            }
        }
コード例 #3
0
 private static void DeleteAssociations(RecruitersDataContext dc, CommunityOrganisationalUnitEntity entity)
 {
     if (entity.CommunityAssociationEntities != null && entity.CommunityAssociationEntities.Count > 0)
     {
         dc.CommunityAssociationEntities.DeleteAllOnSubmit(entity.CommunityAssociationEntities);
         entity.CommunityAssociationEntities.Clear();
     }
 }
コード例 #4
0
 private OrganisationHierarchy CreateOrganisationHierarchy(RecruitersDataContext dc, Guid organisationId)
 {
     return(new OrganisationHierarchy
     {
         Organisation = GetOrganisation(dc, organisationId),
         ChildOrganisationHierarchies = new List <OrganisationHierarchy>(),
     });
 }
コード例 #5
0
 private static ContactDetails GetEffectiveContactDetails(RecruitersDataContext dc, Guid organisationId)
 {
     dc.LoadOptions = OrganisationLoadOptions;
     return(GetEffectiveContactDetailsQuery(dc, organisationId));
 }
コード例 #6
0
 private IEnumerable <Tuple <Guid, Organisation> > GetRecruiterOrganisations(RecruitersDataContext dc, IEnumerable <Guid> recruiterIds, IEnumerable <Guid> organisationIds)
 {
     dc.LoadOptions = OrganisationLoadOptions;
     return(GetFilteredRecruiterOrganisationsQuery(dc, new SplitList <Guid>(recruiterIds).ToString(), new SplitList <Guid>(organisationIds).ToString(), _locationQuery));
 }
コード例 #7
0
 private Organisation GetRecruiterOrganisation(RecruitersDataContext dc, Guid recruiterId)
 {
     dc.LoadOptions = OrganisationLoadOptions;
     return(GetRecruiterOrganisationQuery(dc, recruiterId, _locationQuery));
 }
コード例 #8
0
 private IEnumerable <Tuple <Organisation, Guid?> > GetOrganisationsInHierarchy(RecruitersDataContext dc, Guid organisationId)
 {
     dc.LoadOptions = OrganisationLoadOptions;
     return(GetOrganisationsInHierarchyQuery(dc, organisationId, _locationQuery));
 }
コード例 #9
0
 private VerifiedOrganisation GetOrganisation(RecruitersDataContext dc, string fullName)
 {
     dc.LoadOptions = OrganisationLoadOptions;
     return(GetOrganisationByFullNameQuery(dc, fullName, _locationQuery));
 }
コード例 #10
0
 private Organisation GetOrganisation(RecruitersDataContext dc, Guid?parentId, string name)
 {
     dc.LoadOptions = OrganisationLoadOptions;
     return(GetOrganisationByParentQuery(dc, parentId, name, _locationQuery));
 }
コード例 #11
0
 private static OrganisationEntity GetOrganisationEntity(RecruitersDataContext dc, Guid id)
 {
     dc.LoadOptions = OrganisationLoadOptions;
     return(GetOrganisationEntityQuery(dc, id));
 }
コード例 #12
0
 private IEnumerable <Organisation> GetOrganisations(RecruitersDataContext dc, IEnumerable <Guid> ids)
 {
     dc.LoadOptions = OrganisationLoadOptions;
     return(GetOrganisationsQuery(dc, new SplitList <Guid>(ids).ToString(), _locationQuery));
 }