private async Task RefreshDataAsync() { if (_eventLogTable == null) { var account = CloudStorageAccount.Parse(Secrets.StorageConnectionString); var tableClient = account.CreateCloudTableClient(); _eventLogTable = tableClient.GetTableReference("EventLog"); await _eventLogTable.CreateIfNotExistsAsync(); } EventLogs.Clear(); var buffer = new List <EventLog>(); TableContinuationToken token = null; var query = new TableQuery <EventLog>(); do { var result = await _eventLogTable.ExecuteQuerySegmentedAsync(query, token); token = result.ContinuationToken; buffer.AddRange(result.Results); }while (token != null); foreach (var x in buffer.OrderBy(x => x.Timestamp)) { EventLogs.Add(x); } }
/// <summary> /// Add Events To Context after update AuditTrailsId Property Value . /// </summary> /// <param name="entries"></param> /// <param name="eventLogs"></param> private void AddEventsToContext(IEnumerable <DbEntityEntry> entries, IEnumerable <EventLog> eventLogs) { foreach (var eventItem in eventLogs) { foreach (var auditItem in entries) { string tableName = (auditItem.Entity as AuditTrail).TableName; var auditId = long.Parse(((auditItem.Entity as AuditTrail).Id).ToString()); if (tableName == eventItem.TableName) { eventItem.AuditTrailsId = auditId; EventLog @event = new EventLog { ItineraryKey = eventItem.ItineraryKey, ActionId = eventItem.ActionId, AuditTrailsId = eventItem.AuditTrailsId, EventDate = eventItem.EventDate, ProcessName = eventItem.ProcessName, RoleId = eventItem.RoleId, ServiceId = eventItem.ServiceId, StepName = eventItem.StepName, TableName = eventItem.TableName, UserId = eventItem.UserId }; EventLogs.Add(@event); } } } }
private GenericResult HandleCommand( OrderStateMachine.Trigger trigger, ITriggerContext context, IOrderEditableData editableData = null, IOrderDealingData dealingData = null, IOrderCoreData coreData = null, TriggerStatus status = TriggerStatus.Done) { Contract.Requires(context != null, "context != null"); _workingData = CurrentData.Clone() .SetRoutingData(dealingData) .SetEditableData(editableData) .SetTrigger(trigger) .SetPendingTrigger(status.IsPendingReply() && this.PendingTrigger == trigger ? null : this.PendingTrigger); var result = EnforceTriggerStatus(trigger, ref status); if (result.IsFailure()) { return(result); } if (status == TriggerStatus.Rejected) { result = GenericResult.Success(); } else { var triggerSucceeded = status == TriggerStatus.Pending ? _stateMachine.CanFireTrigger(trigger) : _stateMachine.TryFireTrigger(trigger); result = triggerSucceeded ? GenericResult.Success() : GenericResult.Failure(string.Concat(_workingData.StateMachineErrorMessage, String.Format("The commmand {0} is not allowed when the order is in {1} state", trigger, OrderState))); } if (result.IsSuccess()) { _workingData.SetOrderState(_stateMachine.GetState); if (editableData != null) { if (coreData != null) { this.InsertDataFrom(coreData); } EventLogs.Add(new OrderParameterEventLog <IOrderEditableData>(context, trigger, status, _workingData.OrderState, this, editableData)); } else if (dealingData != null) { EventLogs.Add(new OrderParameterEventLog <IOrderDealingData>(context, trigger, status, _workingData.OrderState, this, dealingData)); if (dealingData.Trade != null) { _workingData.SetExecutionQuantity(ComputeExecutionQuantity(_workingData.Side)); } } else { EventLogs.Add(new OrderEventLog(context, trigger, status, _workingData.OrderState, this)); } _workingData.SetOrderStatus(ComputeOrderStatus(_workingData)); RefreshCurrentData(_workingData); } _workingData = null; return(result); }
public void IsBusyChanged() { EventLogs.Add("IsBusy Changed : " + IsBusy); StartTimer(); }
public void BusyChanged(object param) { EventLogs.Add("IsBusy Changed : " + IsBusy); StartTimer(); }
public void DateChanged(object param) { EventLogs.Add("DateTimeChanged:" + SelectedDate.ToString()); }