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); } } }
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; } } }
private static void DeleteAssociations(RecruitersDataContext dc, CommunityOrganisationalUnitEntity entity) { if (entity.CommunityAssociationEntities != null && entity.CommunityAssociationEntities.Count > 0) { dc.CommunityAssociationEntities.DeleteAllOnSubmit(entity.CommunityAssociationEntities); entity.CommunityAssociationEntities.Clear(); } }
private OrganisationHierarchy CreateOrganisationHierarchy(RecruitersDataContext dc, Guid organisationId) { return(new OrganisationHierarchy { Organisation = GetOrganisation(dc, organisationId), ChildOrganisationHierarchies = new List <OrganisationHierarchy>(), }); }
private static ContactDetails GetEffectiveContactDetails(RecruitersDataContext dc, Guid organisationId) { dc.LoadOptions = OrganisationLoadOptions; return(GetEffectiveContactDetailsQuery(dc, organisationId)); }
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)); }
private Organisation GetRecruiterOrganisation(RecruitersDataContext dc, Guid recruiterId) { dc.LoadOptions = OrganisationLoadOptions; return(GetRecruiterOrganisationQuery(dc, recruiterId, _locationQuery)); }
private IEnumerable <Tuple <Organisation, Guid?> > GetOrganisationsInHierarchy(RecruitersDataContext dc, Guid organisationId) { dc.LoadOptions = OrganisationLoadOptions; return(GetOrganisationsInHierarchyQuery(dc, organisationId, _locationQuery)); }
private VerifiedOrganisation GetOrganisation(RecruitersDataContext dc, string fullName) { dc.LoadOptions = OrganisationLoadOptions; return(GetOrganisationByFullNameQuery(dc, fullName, _locationQuery)); }
private Organisation GetOrganisation(RecruitersDataContext dc, Guid?parentId, string name) { dc.LoadOptions = OrganisationLoadOptions; return(GetOrganisationByParentQuery(dc, parentId, name, _locationQuery)); }
private static OrganisationEntity GetOrganisationEntity(RecruitersDataContext dc, Guid id) { dc.LoadOptions = OrganisationLoadOptions; return(GetOrganisationEntityQuery(dc, id)); }
private IEnumerable <Organisation> GetOrganisations(RecruitersDataContext dc, IEnumerable <Guid> ids) { dc.LoadOptions = OrganisationLoadOptions; return(GetOrganisationsQuery(dc, new SplitList <Guid>(ids).ToString(), _locationQuery)); }