/// <summary> /// Returns all permission exceptions for the specified date /// </summary> public async Task <List <AuditPermissionActivity> > GetLoginActivity(DateTime date, int pageCount = 1, int pageSize = 500) { var t = ServiceManager.GetTableClient().GetTableReference(TableAssist.AuditLogins()); var query = new TableQuery <AuditPermissionActivity>().Where(TableQuery.GenerateFilterCondition("PartitionKey", QueryComparisons.Equal, date.ToString("yyyyMM"))); if (pageCount > 1) { query = query.Take(pageSize).Skip((pageCount - 1) * pageSize).AsTableQuery(); } else { query = query.Take(pageSize); } return((await t.ExecuteQuerySegmentedAsync(query, null)).Results); }
async Task ProcessLogin(AuditActivity auditActivity) { var activityUser = new AuditUserActivity(auditActivity.On, auditActivity.ById, auditActivity.ByName) { AuditType = auditActivity.AuditType, ExtraInfo = auditActivity.Description }; if (auditActivity.Entity != null && bool.TryParse(auditActivity.Entity, out bool isSuccess)) { activityUser.IsSuccessful = isSuccess; } await ExecuteAsync(ServiceManager.GetTableClient().GetTableReference(TableAssist.AuditUsers()), TableOperation.InsertOrReplace(activityUser)); await ExecuteAsync(ServiceManager.GetTableClient().GetTableReference(TableAssist.AuditUsers()), TableOperation.InsertOrReplace(activityUser)); await ExecuteAsync(ServiceManager.GetTableClient().GetTableReference(TableAssist.AuditUserLogins()), TableOperation.InsertOrReplace(activityUser)); var activityLogin = new AuditLoginActivity(auditActivity.On.DateTime, auditActivity.ById, auditActivity.ByName) { ExtraInfo = auditActivity.Description }; await ExecuteAsync(ServiceManager.GetTableClient().GetTableReference(TableAssist.AuditLogins()), TableOperation.InsertOrReplace(activityLogin)); }