public void GetAuditDataWithARecordWithNoChanges()
        {
            SimpleDataWebServiceClient webServiceClient = Create();

            InMemoryRecord record = ProductionRecords.NewRecord().MarkAsNew();

            SubmitDataRequest submitRequest = new SubmitDataRequest
            {
                Credentials       = CreateCredentials(),
                SubmitDataRecords = new[]
                {
                    record.ConvertToSubmitDataRecord()
                }
            };

            webServiceClient.SubmitData(submitRequest);
            Assert.That(DatabaseRecords, Is.Not.Empty);
            int recordId = DatabaseRecords[0].RecordId;

            GetAuditDataRequest request = new GetAuditDataRequest
            {
                Credentials = CreateCredentials(),
                Filter      = new GetAuditDataFilter {
                    Location = location, Module = AmplaModules.Production, SetId = Convert.ToString(recordId)
                }
            };

            GetAuditDataResponse response = webServiceClient.GetAuditData(request);

            Assert.That(response.RowSets, Is.Not.Empty);
            Assert.That(response.RowSets[0].Rows, Is.Empty);
        }
        public void GetAuditDataWithARecordWithChanges()
        {
            SimpleDataWebServiceClient webServiceClient = Create();

            InMemoryRecord record = ProductionRecords.NewRecord().MarkAsNew();

            record.SetFieldValue("Field 1", 150);

            SubmitDataRequest submitRequest = new SubmitDataRequest
            {
                Credentials       = CreateCredentials(),
                SubmitDataRecords = new[]
                {
                    record.ConvertToSubmitDataRecord()
                }
            };

            webServiceClient.SubmitData(submitRequest);

            Assert.That(DatabaseRecords, Is.Not.Empty);
            int recordId = DatabaseRecords[0].RecordId;

            InMemoryRecord updateRecord = new InMemoryRecord(ProductionViews.StandardView())
            {
                Location = record.Location,
                Module   = record.Module,
                RecordId = recordId
            };

            updateRecord.SetFieldValue("Field 1", 200);

            SubmitDataRequest update = new SubmitDataRequest
            {
                Credentials       = CreateCredentials(),
                SubmitDataRecords = new[]
                {
                    updateRecord.ConvertToSubmitDataRecord()
                }
            };

            webServiceClient.SubmitData(update);

            GetAuditDataRequest request = new GetAuditDataRequest
            {
                Credentials = CreateCredentials(),
                Filter      = new GetAuditDataFilter {
                    Location = location, Module = AmplaModules.Production, SetId = Convert.ToString(recordId)
                }
            };

            GetAuditDataResponse response = webServiceClient.GetAuditData(request);

            AssertAuditTableContains(response, location, recordId, "Field 1", "150", "200");
        }
Beispiel #3
0
        public GetAuditDataResponse GetAuditData(GetAuditDataRequest request)
        {
            CheckCredentials(request.Credentials);

            InMemoryFilterMatcher filterMatcher = new InMemoryFilterMatcher(request.Filter);

            string module = request.Filter.Module.ToString();
            List <InMemoryAuditRecord> auditRecords = amplaDatabase.GetAuditRecords(module).Where(filterMatcher.Matches).ToList();

            List <GetAuditDataRow> rows = new List <GetAuditDataRow>();

            foreach (InMemoryAuditRecord record in auditRecords)
            {
                GetAuditDataRow row = new GetAuditDataRow
                {
                    EditedBy       = record.EditedBy,
                    EditedDateTime = record.EditedDateTime,
                    EditedValue    = record.EditedValue,
                    Field          = record.Field,
                    Location       = record.Location,
                    OriginalValue  = record.OriginalValue,
                    RecordType     = record.RecordType,
                    SetId          = record.SetId
                };

                rows.Add(row);
            }

            GetAuditDataResponse response = new GetAuditDataResponse
            {
                Context = new GetAuditDataResponseContext
                {
                    Filter = new GetAuditDataResponseFilter
                    {
                        Module             = request.Filter.Module,
                        Location           = request.Filter.Location,
                        RecordType         = request.Filter.RecordType,
                        SetId              = request.Filter.SetId,
                        EditedBy           = request.Filter.EditedBy,
                        EditedSamplePeriod = null
                    }
                },
                RowSets = new[]
                {
                    new GetAuditDataRowSet
                    {
                        Rows = rows.ToArray(),
                    }
                }
            };

            return(response);
        }
Beispiel #4
0
        public GetAuditDataRequest GetAuditDataRequest(AmplaRecord record)
        {
            GetAuditDataRequest request = new GetAuditDataRequest
            {
                Credentials = CreateCredentials(),
                Filter      = new GetAuditDataFilter
                {
                    Location = record.Location,
                    Module   = ModelProperties.Module,
                    SetId    = Convert.ToString(record.Id)
                }
            };

            return(request);
        }
        public void GetAuditData()
        {
            SimpleDataWebServiceClient webServiceClient = Create();

            GetAuditDataRequest request = new GetAuditDataRequest
            {
                Credentials = CreateCredentials(),
                Filter      = new GetAuditDataFilter {
                    Location = location, Module = AmplaModules.Production
                }
            };

            GetAuditDataResponse response = webServiceClient.GetAuditData(request);

            Assert.That(response.RowSets, Is.Not.Empty);
            Assert.That(response.RowSets[0].Rows, Is.Empty);
        }
 public GetAuditDataResponse GetAuditData(GetAuditDataRequest request)
 {
     return(Create().GetAuditData(request));
 }
        public void GetAuditDataWithARecordWithChanges()
        {
            SimpleDataWebServiceClient webServiceClient = new SimpleDataWebServiceClient(module, location);

            InMemoryRecord record = ProductionRecords.NewRecord().MarkAsNew();
            record.SetFieldValue("Field 1", 150);

            SubmitDataRequest submitRequest = new SubmitDataRequest
            {
                Credentials = CreateCredentials(),
                SubmitDataRecords = new[]
                    {
                        record.ConvertToSubmitDataRecord()
                    }
            };

            webServiceClient.SubmitData(submitRequest);

            Assert.That(webServiceClient.DatabaseRecords, Is.Not.Empty);
            int recordId = webServiceClient.DatabaseRecords[0].RecordId;

            InMemoryRecord updateRecord = new InMemoryRecord
                {
                    Location = record.Location,
                    Module = record.Module,
                    RecordId = recordId
                };
            updateRecord.SetFieldValue("Field 1", 200);

            SubmitDataRequest update = new SubmitDataRequest
                {
                    Credentials = CreateCredentials(),
                    SubmitDataRecords = new[]
                        {
                            updateRecord.ConvertToSubmitDataRecord()
                        }
                };

            webServiceClient.SubmitData(update);

            GetAuditDataRequest request = new GetAuditDataRequest
            {
                Credentials = CreateCredentials(),
                Filter = new GetAuditDataFilter { Location = location, Module = AmplaModules.Production, SetId = Convert.ToString(recordId) }
            };

            GetAuditDataResponse response = webServiceClient.GetAuditData(request);

            AssertAuditTableContains(response, location, recordId, "Field 1", "150", "200");
        }
        public void GetAuditData()
        {
            SimpleDataWebServiceClient webServiceClient = new SimpleDataWebServiceClient(module, location);

            GetAuditDataRequest request = new GetAuditDataRequest
                {
                    Credentials = CreateCredentials(),
                    Filter = new GetAuditDataFilter {Location = location, Module = AmplaModules.Production}
                };

            GetAuditDataResponse response = webServiceClient.GetAuditData(request);
            Assert.That(response.RowSets, Is.Not.Empty);
            Assert.That(response.RowSets[0].Rows, Is.Empty);
        }
        public void GetAuditDataWithARecordWithNoChanges()
        {
            SimpleDataWebServiceClient webServiceClient = new SimpleDataWebServiceClient(module, location);

            InMemoryRecord record = ProductionRecords.NewRecord().MarkAsNew();

            SubmitDataRequest submitRequest = new SubmitDataRequest
            {
                Credentials = CreateCredentials(),
                SubmitDataRecords = new[]
                    {
                        record.ConvertToSubmitDataRecord()
                    }
            };

            webServiceClient.SubmitData(submitRequest);
            Assert.That(webServiceClient.DatabaseRecords, Is.Not.Empty);
            int recordId = webServiceClient.DatabaseRecords[0].RecordId;

            GetAuditDataRequest request = new GetAuditDataRequest
            {
                Credentials = CreateCredentials(),
                Filter = new GetAuditDataFilter { Location = location, Module = AmplaModules.Production, SetId = Convert.ToString(recordId)}
            };

            GetAuditDataResponse response = webServiceClient.GetAuditData(request);
            Assert.That(response.RowSets, Is.Not.Empty);
            Assert.That(response.RowSets[0].Rows, Is.Empty);
        }
Beispiel #10
0
 public GetAuditDataResponse GetAuditData(GetAuditDataRequest request)
 {
     logger.Log("GetAuditData ({0})", request);
     return(implementation.GetAuditData(request));
 }