コード例 #1
0
        protected virtual void SaveDescriptors(int AddedBy)
        {
            //SubState and Agency Users use the Actual SubState/AgencyID; others use the constant
            int RegionId = (this.UserRegistrationData.RoleRequested.scope.IsLowerOrEqualTo(Scope.SubStateRegion)) ? this.UserRegistrationData.UserRegionalAccessProfile.RegionId : Constants.Defaults.DefaultValues.AgencyIdForNonAgencyUsers;

            foreach (int DescriptorId in this.UserRegistrationData.UserRegionalAccessProfile.DescriptorIDList)
            {
                //TODO: Can be replaced by LINQ in 1 line.

                if (!SaveDescriptor(DescriptorId, RegionId, AddedBy))
                {
                    this.ErrorMessage = "Error occured while saving " + DescriptorId.ToEnumObject <Descriptor>().Description() + " descriptor information.";
                    break;
                }
            }
        }
コード例 #2
0
        ////////////////////////////////////////////////////////////////////////////////////////////////
        /*--------------------------------------------------------------------------------------------*/
        private void AddFactor(SetupMemberId pMemId, SetupArtifactId pPrimArtId,
                               SetupArtifactId pRelArtId, DescriptorId pDescId, DirectorId?pDirId,
                               EventorId?pEventId, IdentorId?pIdentId, LocatorId?pLocId, VectorId?pVectId,
                               bool pIsDefining, FactorAssertion.Id pAstId, string pNote)
        {
            Descriptor desc = DescMap[(long)pDescId];

            var f = new Factor();

            f.AssertionType  = (byte)pAstId;
            f.IsDefining     = pIsDefining;
            f.Note           = pNote;
            f.DescriptorType = desc.Type;
            AddVertex(f, (SetupVertexId)(++vIdCount));

            ////

            Member mem = Data.GetVertex <Member>((long)pMemId);

            var mcf = new MemberCreatesFactor();

            mcf.Timestamp         = f.Timestamp;
            mcf.DescriptorType    = f.DescriptorType;
            mcf.PrimaryArtifactId = (long)pPrimArtId;
            mcf.RelatedArtifactId = (long)pRelArtId;

            AddEdge(mem, mcf, f);
            AddEdge(f, new FactorCreatedByMember(), mem);

            ////

            Artifact priArt = Data.GetVertex <Artifact>((long)pPrimArtId);
            Artifact relArt = Data.GetVertex <Artifact>((long)pRelArtId);

            var aupf = new ArtifactUsedAsPrimaryByFactor();

            aupf.Timestamp         = f.Timestamp;
            aupf.DescriptorType    = f.DescriptorType;
            aupf.RelatedArtifactId = relArt.VertexId;

            var aurf = new ArtifactUsedAsRelatedByFactor();

            aurf.Timestamp         = f.Timestamp;
            aurf.DescriptorType    = f.DescriptorType;
            aurf.PrimaryArtifactId = priArt.VertexId;

            AddEdge(priArt, aupf, f);
            AddEdge(relArt, aurf, f);
            AddEdge(f, new FactorUsesPrimaryArtifact(), priArt);
            AddEdge(f, new FactorUsesRelatedArtifact(), relArt);

            ////

            if (desc.PrimArtRefId != null)
            {
                AddEdge(f, new FactorDescriptorRefinesPrimaryWithArtifact(),
                        Data.GetVertex <Artifact>((long)desc.PrimArtRefId));
            }

            if (desc.TypeArtRefId != null)
            {
                AddEdge(f, new FactorDescriptorRefinesTypeWithArtifact(),
                        Data.GetVertex <Artifact>((long)desc.TypeArtRefId));
            }

            if (desc.RelArtRefId != null)
            {
                AddEdge(f, new FactorDescriptorRefinesRelatedWithArtifact(),
                        Data.GetVertex <Artifact>((long)desc.RelArtRefId));
            }

            if (pDirId != null)
            {
                Director dir = DirMap[(long)pDirId];
                f.DirectorType          = dir.Type;
                f.DirectorPrimaryAction = dir.PrimaryDirectorActionId;
                f.DirectorRelatedAction = dir.RelatedDirectorActionId;
            }

            if (pEventId != null)
            {
                Eventor e = EveMap[(long)pEventId];
                f.EventorType     = e.Type;
                f.EventorDateTime = e.DateTime;
            }

            if (pIdentId != null)
            {
                Identor i = IdenMap[(long)pIdentId];
                f.IdentorType  = i.Type;
                f.IdentorValue = i.Value;
            }

            if (pLocId != null)
            {
                Locator l = LocMap[(long)pLocId];
                f.LocatorType   = l.Type;
                f.LocatorValueX = l.ValueX;
                f.LocatorValueY = l.ValueY;
                f.LocatorValueZ = l.ValueZ;
            }

            if (pVectId != null)
            {
                Vector v = VecMap[(long)pVectId];
                f.VectorType       = v.Type;
                f.VectorUnit       = v.Unit;
                f.VectorUnitPrefix = v.UnitPrefix;
                f.VectorValue      = v.Value;
                AddEdge(f, new FactorVectorUsesAxisArtifact(), Data.GetVertex <Artifact>(v.AxisArtId));
            }

            Data.ElapseTime();
        }