コード例 #1
0
 /// <summary>
 /// Gets category from actual plan of work by it's ID
 /// </summary>
 /// <param name="pow"></param>
 /// <returns></returns>
 public ClassificationReference GetCategory(PlanOfWork pow)
 {
     if (pow.ClassificationSystems == null)
     {
         return(null);
     }
     return((from classification in pow.ClassificationSystems where classification.ClassificationReferences != null from reference in classification.ClassificationReferences where reference.Id == CategoryId select reference).FirstOrDefault());
 }
コード例 #2
0
ファイル: DPoWObject.cs プロジェクト: McLeanBH/XbimExchange
 public IEnumerable<ClassificationReference> GetClassificationReferences(PlanOfWork pow)
 {
     if(ClassificationReferenceIds == null || !ClassificationReferenceIds.Any()) yield break;
     if (pow.ClassificationSystems == null || !pow.ClassificationSystems.Any()) yield break;
     foreach (var reference in from system in pow.ClassificationSystems where system.ClassificationReferences != null && system.ClassificationReferences.Any() from reference in system.ClassificationReferences where ClassificationReferenceIds.Contains(reference.Id) select reference)
     {
         yield return reference;
     }
 }
コード例 #3
0
 /// <summary>
 /// Gets all classification references based on IDs
 /// </summary>
 /// <param name="pow">Plan of work in which this object and classification references live</param>
 /// <returns>Enumeration of classification references</returns>
 public IEnumerable <ClassificationReference> GetClassificationReferences(PlanOfWork pow)
 {
     if (ClassificationReferenceIds == null || pow.ClassificationSystems == null)
     {
         yield break;
     }
     foreach (var reference in from classification in pow.ClassificationSystems where classification.ClassificationReferences != null from reference in classification.ClassificationReferences where ClassificationReferenceIds.Contains(reference.Id) select reference)
     {
         yield return(reference);
     }
 }
コード例 #4
0
        private static string GetUniclassCode(DPoWObject asset, PlanOfWork pow)
        {
            var uniclass = pow.ClassificationSystems.FirstOrDefault(c => c.Name == "Uniclass2015");
            var classification = asset.GetClassificationReferences(pow);

            foreach(var ci in classification)
            {
                var item = uniclass.ClassificationReferences.FirstOrDefault(c => c.Id == ci.Id);
                if (item != null) return item.ClassificationCode;
            }
            return string.Empty;
        }
コード例 #5
0
ファイル: Facility.cs プロジェクト: McLeanBH/XbimExchange
        /// <summary>
        /// Gets category from actual plan of work by it's ID
        /// </summary>
        /// <param name="pow"></param>
        /// <returns></returns>
        public Tuple<Classification, ClassificationReference> GetClassificationAndReference(PlanOfWork pow)
        {
            if (pow.ClassificationSystems == null) return null;
            foreach (var classification in pow.ClassificationSystems)
            {
                if (classification.ClassificationReferences == null) continue;
                var reference = classification.ClassificationReferences.FirstOrDefault(r => r.Id == CategoryId);
                if(reference == null) continue;
                return new Tuple<Classification, ClassificationReference>(classification, reference);
            }

            return null;
        }
コード例 #6
0
ファイル: Convertor.cs プロジェクト: theNBS/dPOWToMSProject
        /// <summary>
        /// Perform the conversion, writing data to the provided output path
        /// </summary>
        /// <param name="outputFilePath">Path of output xml file (should have the extension .xml so the MPXJ library automatically infers the file type)</param>
        public void Convert(string outputFilePath)
        {
            // Open and parse dPOW file
            pow = PlanOfWork.OpenJson(inputFilePath);

            // Create project file
            project = new ProjectFile();

            // Insert data to project file
            InsertDataToProject();

            // Write file to mpx
            ProjectWriter mpxWriter = ProjectWriterUtility.getProjectWriter(outputFilePath);
            mpxWriter.write(project, outputFilePath);
        }
コード例 #7
0
ファイル: DPoWObject.cs プロジェクト: tnesser/XbimExchange
 public IEnumerable <ClassificationReference> GetClassificationReferences(PlanOfWork pow)
 {
     if (ClassificationReferenceIds == null || !ClassificationReferenceIds.Any())
     {
         yield break;
     }
     if (pow.ClassificationSystems == null || !pow.ClassificationSystems.Any())
     {
         yield break;
     }
     foreach (var reference in from system in pow.ClassificationSystems where system.ClassificationReferences != null && system.ClassificationReferences.Any() from reference in system.ClassificationReferences where ClassificationReferenceIds.Contains(reference.Id) select reference)
     {
         yield return(reference);
     }
 }
コード例 #8
0
        /// <summary>
        /// Gets category from actual plan of work by it's ID
        /// </summary>
        /// <param name="pow"></param>
        /// <returns></returns>
        public void GetCategory(PlanOfWork pow, out Classification classification, out ClassificationReference classificationReference)
        {
            classification          = null;
            classificationReference = null;

            if (pow.ClassificationSystems == null)
            {
                return;
            }

            var result = (from c in pow.ClassificationSystems where c.ClassificationReferences != null from r in c.ClassificationReferences where r.Id == CategoryId select new { c, r }).FirstOrDefault();

            if (result == null)
            {
                return;
            }

            classification          = result.c;
            classificationReference = result.r;
        }
コード例 #9
0
ファイル: Project.cs プロジェクト: tnesser/XbimExchange
 /// <summary>
 /// Gets current project stage. Use 'CurrentProjectStageId' to set current project stage.
 /// </summary>
 /// <param name="pow">Plan of work</param>
 /// <returns>Current project stage</returns>
 public ProjectStage GetCurrentProjectStage(PlanOfWork pow)
 {
     return(pow.ProjectStages != null?pow.ProjectStages.FirstOrDefault(ps => ps.Id == CurrentProjectStageId) :
                null);
 }
コード例 #10
0
 /// <summary>
 /// Gets responsible role from plan of work
 /// </summary>
 /// <param name="pow">Plan of work</param>
 /// <returns>Responsible role</returns>
 public Role GetResponsibleRole(PlanOfWork pow)
 {
     return pow.Roles == null ? null : pow.Roles.FirstOrDefault(r => r.Id == ResponsibleRoleId);
 }
コード例 #11
0
 /// <summary>
 /// Gets responsible contact from plan of work
 /// </summary>
 /// <param name="pow">Plan of work</param>
 /// <returns>Responsible contact</returns>
 public Contact GetResponsibleContact(PlanOfWork pow)
 {
     return pow.Contacts == null ? null : pow.Contacts.FirstOrDefault(c => c.Id == ResponsibleContactId);
 }
コード例 #12
0
 /// <summary>
 /// Gets all classification references based on IDs
 /// </summary>
 /// <param name="pow">Plan of work in which this object and classification references live</param>
 /// <returns>Enumeration of classification references</returns>
 public IEnumerable<ClassificationReference> GetClassificationReferences(PlanOfWork pow)
 {
     if (ClassificationReferenceIds == null || pow.ClassificationSystems == null) yield break;
     foreach (var reference in from classification in pow.ClassificationSystems where classification.ClassificationReferences != null from reference in classification.ClassificationReferences where ClassificationReferenceIds.Contains(reference.Id) select reference)
         yield return reference;
 }
コード例 #13
0
 /// <summary>
 /// Gets responsible contact from plan of work
 /// </summary>
 /// <param name="pow">Plan of work</param>
 /// <returns>Responsible contact</returns>
 public Contact GetResponsibleContact(PlanOfWork pow)
 {
     return(pow.Contacts == null ? null : pow.Contacts.FirstOrDefault(c => c.Id == ResponsibleContactId));
 }
コード例 #14
0
ファイル: Facility.cs プロジェクト: McLeanBH/XbimExchange
 /// <summary>
 /// Gets category from actual plan of work by it's ID
 /// </summary>
 /// <param name="pow"></param>
 /// <returns></returns>
 public ClassificationReference GetCategory(PlanOfWork pow)
 {
     if (pow.ClassificationSystems == null) return null;
     return (from classification in pow.ClassificationSystems where classification.ClassificationReferences != null from reference in classification.ClassificationReferences where reference.Id == CategoryId select reference).FirstOrDefault();
 }
コード例 #15
0
 /// <summary>
 /// Gets responsible role from plan of work
 /// </summary>
 /// <param name="pow">Plan of work</param>
 /// <returns>Responsible role</returns>
 public Role GetResponsibleRole(PlanOfWork pow)
 {
     return(pow.Roles == null ? null : pow.Roles.FirstOrDefault(r => r.Id == ResponsibleRoleId));
 }
コード例 #16
0
ファイル: Project.cs プロジェクト: McLeanBH/XbimExchange
 /// <summary>
 /// Gets current project stage. Use 'CurrentProjectStageId' to set current project stage.
 /// </summary>
 /// <param name="pow">Plan of work</param>
 /// <returns>Current project stage</returns>
 public ProjectStage GetCurrentProjectStage(PlanOfWork pow)
 {
     return pow.ProjectStages != null ? pow.ProjectStages.FirstOrDefault(ps => ps.Id == CurrentProjectStageId) :
     null;
 }
コード例 #17
0
        /// <summary>
        /// Gets category from actual plan of work by it's ID
        /// </summary>
        /// <param name="pow"></param>
        /// <returns></returns>
        public Tuple <Classification, ClassificationReference> GetClassificationAndReference(PlanOfWork pow)
        {
            if (pow.ClassificationSystems == null)
            {
                return(null);
            }
            foreach (var classification in pow.ClassificationSystems)
            {
                if (classification.ClassificationReferences == null)
                {
                    continue;
                }
                var reference = classification.ClassificationReferences.FirstOrDefault(r => r.Id == CategoryId);
                if (reference == null)
                {
                    continue;
                }
                return(new Tuple <Classification, ClassificationReference>(classification, reference));
            }

            return(null);
        }