/// <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()); }
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; } }
/// <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); } }
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; }
/// <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; }
/// <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); }
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); } }
/// <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; }
/// <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); }
/// <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); }
/// <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); }
/// <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; }
/// <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)); }
/// <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(); }
/// <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)); }
/// <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; }
/// <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); }