private async Task CreateResults(int workspaceArtifactId, List <Person> detectedPeople, int imageArtifactId) { // Sets the fields to populate. MassCreateResult results = null; List <FieldRef> fields = new List <FieldRef> { new FieldRef() { Guid = Constant.Guids.Field.FaceRecognitionResults.NAME }, new FieldRef() { Guid = Constant.Guids.Field.FaceRecognitionResults.PERSON_NAME }, new FieldRef() { Guid = Constant.Guids.Field.FaceRecognitionResults.CONFIDENCE }, new FieldRef() { Guid = Constant.Guids.Field.FaceRecognitionResults.RESULTS } }; // Sets the values in the order that the fields provided. List <List <object> > fieldValues = detectedPeople.Select(person => new List <object> { Guid.NewGuid().ToString(), person.Name, person.Confidence, new RelativityObjectRef() { ArtifactID = imageArtifactId } }).ToList(); using (IObjectManager objectManager = CreateObjectManager()) { MassCreateRequest massCreateRequest = new MassCreateRequest { ObjectType = new ObjectTypeRef { Guid = Constant.Guids.ObjectType.FACE_RECOGNITION_RESULTS }, Fields = fields, ValueLists = fieldValues }; results = await objectManager.CreateAsync(workspaceArtifactId, massCreateRequest); } }
public async Task <int> CreateRelativity(IServicesMgr serviceManager, int workspaceId, string name, int savedSearchId) { int returnValue = 0; using (IObjectManager objectManager = serviceManager.CreateProxy <IObjectManager>(ExecutionIdentity.System)) { List <FieldRefValuePair> fieldValues = new List <FieldRefValuePair> { new FieldRefValuePair { Field = new FieldRef() { Guid = Guids.Model.NAME_FIELD }, Value = name }, new FieldRefValuePair { Field = new FieldRef() { Guid = Guids.Model.SAVED_SEARCH_FIELD }, Value = new RelativityObjectRef { ArtifactID = savedSearchId } } }; CreateRequest createRequest = new CreateRequest { ObjectType = new ObjectTypeRef { Guid = Guids.Model.OBJECT_TYPE }, FieldValues = fieldValues }; CreateResult result = await objectManager.CreateAsync(workspaceId, createRequest); returnValue = result.Object.ArtifactID; } return(returnValue); }
public static async Task CreateAsync_SanityCheckRDO_ReturnsSuccess(this IObjectManager manager, IHelper helper, int workspaceId, Guid objectTypeGuid) { //ARRANGE var fieldGuid = Guid.Parse(SingleObjectFieldDefinitions.LongText); var fieldValue = "Asdf"; var dbContext = helper.GetDBContext(workspaceId); var sql = "select o.[DescriptorArtifactTypeID] from [eddsdbo].[ObjectType] o join [eddsdbo].[ArtifactGuid] ag on o.artifactId = ag.ArtifactID where ag.ArtifactGuid = @guid"; var objectTypeId = dbContext.ExecuteSqlStatementAsScalar <int?>(sql, new[] { new SqlParameter("@guid", objectTypeGuid) }); var artifact = SharedTestCases.CreateTestObject(null, new FieldRef(fieldGuid), fieldValue, objectTypeId); //ACT var result = await manager.CreateAsync(workspaceId, artifact, null); artifact.ArtifactId = result.Object.ArtifactId; var readResult = await manager.ReadAsync(workspaceId, artifact, null); //ASSERT Assert.Equal(fieldValue, result.Object[fieldGuid].ValueAsString()); }
public async Task <int> CreateInvoice(IServicesMgr serviceManager, int workspaceId, string name) { int returnValue = 0; using (IObjectManager objectManager = serviceManager.CreateProxy <IObjectManager>(ExecutionIdentity.System)) { List <FieldRefValuePair> fieldValues = new List <FieldRefValuePair> { new FieldRefValuePair { Field = new FieldRef() { Guid = Guids.Invoice.NAME_FIELD }, Value = name } }; CreateRequest createRequest = new CreateRequest { ObjectType = new ObjectTypeRef { Guid = Guids.Invoice.OBJECT_TYPE }, FieldValues = fieldValues }; CreateResult result = await objectManager.CreateAsync(workspaceId, createRequest); returnValue = result.Object.ArtifactID; } if (returnValue > 0) { foreach (InvoiceLineItem lineItem in LineItems) { await lineItem.CreateRelativity(serviceManager, workspaceId, returnValue); } } return(returnValue); }
public async Task <int> CreateRelativity(IServicesMgr serviceManager, int workspaceId, int invoiceArtifactId) { int returnValue = 0; using (IObjectManager objectManager = serviceManager.CreateProxy <IObjectManager>(ExecutionIdentity.System)) { List <FieldRefValuePair> fieldValues = new List <FieldRefValuePair> { new FieldRefValuePair { Field = new FieldRef() { Guid = NameField }, Value = Name }, new FieldRefValuePair { Field = new FieldRef() { Guid = InvoiceField }, Value = new RelativityObjectRef { ArtifactID = invoiceArtifactId } }, new FieldRefValuePair { Field = new FieldRef() { Guid = DescriptionField }, Value = Description }, new FieldRefValuePair { Field = new FieldRef() { Guid = RateField }, Value = Rate }, new FieldRefValuePair { Field = new FieldRef() { Guid = QuantityField }, Value = Quantity }, new FieldRefValuePair { Field = new FieldRef() { Guid = LineTotalField }, Value = LineTotal } }; CreateRequest createRequest = new CreateRequest { ObjectType = new ObjectTypeRef { Guid = ObjectType }, ParentObject = new RelativityObjectRef { ArtifactID = invoiceArtifactId }, FieldValues = fieldValues }; CreateResult result = await objectManager.CreateAsync(workspaceId, createRequest); returnValue = result.Object.ArtifactID; } return(returnValue); }