コード例 #1
0
        public async Task <List <AuditActivityHistory> > GetAuditActivity(DateTime date, int pageCount = 1, int pageSize = 500)
        {
            var t     = ServiceManager.GetTableClient().GetTableReference(TableAssist.AuditActivityHistories());
            var query = new TableQuery <AuditActivityHistory>().Where(TableQuery.GenerateFilterCondition("PartitionKey", QueryComparisons.Equal, date.ToString("yyyyMMdd")));

            if (pageCount > 1)
            {
                query = query.Take(pageSize).Skip((pageCount - 1) * pageSize).AsTableQuery();
            }
            else
            {
                query = query.Take(pageSize);
            }

            return((await t.ExecuteQuerySegmentedAsync(query, null)).Results);
        }
コード例 #2
0
        public async Task <List <AuditActivityHistory> > GetAuditActivity(int pageCount = 1, int pageSize = 500)
        {
            var t     = ServiceManager.GetTableClient().GetTableReference(TableAssist.AuditActivityHistories());
            var query = new TableQuery <AuditActivityHistory>();

            if (pageCount > 1)
            {
                query = query.Take(pageSize).Skip((pageCount - 1) * pageSize).AsTableQuery();
            }
            else
            {
                query = query.Take(pageSize);
            }

            return((await t.ExecuteQuerySegmentedAsync(query, null)).Results);
        }
コード例 #3
0
        async Task ProcessActivity(AuditActivity auditActivity)
        {
            var activityUser = new AuditUserActivity(auditActivity.On, auditActivity.ById, auditActivity.ByName)
            {
                AuditType          = auditActivity.AuditType,
                EntityPartitionKey = auditActivity.PartitionKey,
                EntityRowKey       = auditActivity.RowKey,
                EntityType         = auditActivity.EntityType,
                EntityId           = auditActivity.EntityId
            };
            var auditUserHistoryActivity = new AuditUserHistoryActivity(auditActivity.On, auditActivity.ById, auditActivity.ByName);
            var activityHistory          = new AuditActivityHistory(TimeZoneHelper.GetDate(auditActivity.On), auditActivity.ById, auditActivity.ByName, auditActivity.PartitionKey, auditActivity.RowKey)
            {
                EntityType = auditActivity.EntityType,
                EntityId   = auditActivity.EntityId,
                On         = auditActivity.On,
                AuditType  = auditActivity.AuditType
            };

            await ExecuteAsync(ServiceManager.GetTableClient().GetTableReference(TableAssist.AuditActivities()), TableOperation.Insert(auditActivity));
            await ExecuteAsync(ServiceManager.GetTableClient().GetTableReference(TableAssist.AuditUsers()), TableOperation.Insert(activityUser));
            await ExecuteAsync(ServiceManager.GetTableClient().GetTableReference(TableAssist.AuditUsers()), TableOperation.InsertOrReplace(auditUserHistoryActivity));
            await ExecuteAsync(ServiceManager.GetTableClient().GetTableReference(TableAssist.AuditActivityHistories()), TableOperation.InsertOrReplace(activityHistory));

            if (auditActivity.GetActivityType() == AuditActivityType.Delete)
            {
                var deletion = new AuditDeletion(auditActivity.EntityType, auditActivity.EntityId)
                {
                    Entity = auditActivity.Entity,
                    ById   = auditActivity.ById,
                    ByName = auditActivity.ByName,
                    On     = auditActivity.On
                };
                await ExecuteAsync(ServiceManager.GetTableClient().GetTableReference(TableAssist.AuditDeletions()), TableOperation.Insert(deletion));
            }
            ;
        }