public void UpdateModel(RelationshipType relationshipType, ICollection <OrganizationTypeRelationshipType> allOrganizationTypeRelationshipTypes)
        {
            relationshipType.RelationshipTypeName = RelationshipTypeName;

            var organizationTypesUpdated = OrganizationTypeIDs.Select(x => new OrganizationTypeRelationshipType(x, relationshipType.RelationshipTypeID)).ToList();

            relationshipType.OrganizationTypeRelationshipTypes.Merge(organizationTypesUpdated,
                                                                     allOrganizationTypeRelationshipTypes,
                                                                     (x, y) => x.OrganizationTypeID == y.OrganizationTypeID && x.RelationshipTypeID == y.RelationshipTypeID);

            relationshipType.CanStewardProjects             = CanStewardProjects ?? false;                                                                                           // Should never be null due to required validation attribute
            relationshipType.IsPrimaryContact               = IsPrimaryContact ?? false;                                                                                             // Should never be null due to required validation attribute
            relationshipType.CanOnlyBeRelatedOnceToAProject = relationshipType.CanStewardProjects || relationshipType.IsPrimaryContact || (CanOnlyBeRelatedOnceToAProject ?? false); // can steward projects and isprimarycontact can only related once to a project
            relationshipType.ShowOnFactSheet             = ShowOnFactSheet ?? false;                                                                                                 // sShould never be null due to required validation attribute
            relationshipType.RelationshipTypeDescription = RelationshipTypeDescription;
        }
Exemplo n.º 2
0
        public void UpdateModel(OrganizationRelationshipType organizationRelationshipType, ICollection <OrganizationTypeOrganizationRelationshipType> allOrganizationTypeOrganizationRelationshipTypes)
        {
            organizationRelationshipType.OrganizationRelationshipTypeName = OrganizationRelationshipTypeName;

            var organizationTypesUpdated = OrganizationTypeIDs.Select(x => new OrganizationTypeOrganizationRelationshipType(x, organizationRelationshipType.OrganizationRelationshipTypeID)).ToList();

            organizationRelationshipType.OrganizationTypeOrganizationRelationshipTypes.Merge(organizationTypesUpdated,
                                                                                             allOrganizationTypeOrganizationRelationshipTypes,
                                                                                             (x, y) => x.OrganizationTypeID == y.OrganizationTypeID && x.OrganizationRelationshipTypeID == y.OrganizationRelationshipTypeID, HttpRequestStorage.DatabaseEntities);

            organizationRelationshipType.CanStewardProjects = CanStewardProjects ?? false;                                                                                                                                               // Should never be null due to required validation attribute
            organizationRelationshipType.IsPrimaryContact   = IsPrimaryContact ?? false;                                                                                                                                                 // Should never be null due to required validation attribute
            organizationRelationshipType.IsOrganizationRelationshipTypeRequired = organizationRelationshipType.CanStewardProjects || organizationRelationshipType.IsPrimaryContact || (IsOrganizationRelationshipTypeRequired ?? false); // can steward projects and isprimarycontact can only related once to a project
            organizationRelationshipType.ShowOnFactSheet = ShowOnFactSheet ?? false;                                                                                                                                                     // sShould never be null due to required validation attribute
            organizationRelationshipType.OrganizationRelationshipTypeDescription = OrganizationRelationshipTypeDescription;
        }