private void CreateFileValidationResult(bool isMissing, string fileType) { try { var fvResult = new DTOs.RDO(); fvResult.ArtifactTypeGuids.Add(new Guid(MainApp.Helper.Constant.OBJECT_TYPE_FILE_VALIDATIOM_RESULT_GUID)); DTOs.FieldValueList <DTOs.Document> docObjects = new DTOs.FieldValueList <DTOs.Document>(); var doc = new DTOs.Document(ArtifactID); docObjects.Add(doc); fvResult.Fields.Add(new DTOs.FieldValue(new Guid(MainApp.Helper.Constant.FIELD_FR_NAME), DateTime.UtcNow.ToString("MM-dd-yyyy HH:mm:ss"))); fvResult.Fields.Add(new DTOs.FieldValue(new Guid(MainApp.Helper.Constant.FIELD_FR_DOCUMENT), docObjects)); fvResult.Fields.Add(new DTOs.FieldValue(new Guid(MainApp.Helper.Constant.FIELD_FR_VALIDATION_DATE), DateTime.UtcNow)); fvResult.Fields.Add(new DTOs.FieldValue(new Guid(MainApp.Helper.Constant.FIELD_FR_EXIST), isMissing)); fvResult.Fields.Add(new DTOs.FieldValue(new Guid(MainApp.Helper.Constant.FIELD_FR_TYPE), fileType)); DTOs.WriteResultSet <DTOs.RDO> writeResults = Connection.Repositories.RDO.Create(fvResult); if (!writeResults.Success) { throw new Exception(string.Format("An error occurred in result creation: {0}", writeResults.Results[0].Message)); } } catch (Exception ex) { throw ex; } }
public Entities.Document Get(int artifactId) { Entities.Document document = new Entities.Document(); try { DTOs.Document documentDTO = client.Repositories.Document.ReadSingle(artifactId); List <Entities.Comment> comments = new List <Entities.Comment>(); CommentRepositoryRSAPI cr = new CommentRepositoryRSAPI(this.client); DTOs.FieldValue f1 = new DTOs.FieldValue(); document.amountComments = 0; foreach (var f in documentDTO.Fields) { if (f.Name == "Commens - Document") { if (f.Value != null) { DTOs.FieldValueList <DTOs.Artifact> list = (DTOs.FieldValueList <DTOs.Artifact>)f.Value; document.amountComments = list.Count; foreach (var field in list) { comments.Add(cr.Get(field.ArtifactID)); } } } } document.ArtifactId = documentDTO.ArtifactID; document.Name = documentDTO.TextIdentifier; document.Comments = comments; Entities.Artifact user = new Entities.Artifact(documentDTO.SystemCreatedBy.ArtifactID); user.Name = documentDTO.SystemCreatedBy.FullName; document.CreatedBy = user; } catch (Exception) { throw; } return(document); }