public AlgorithmMessage UpdateAlgorithmMessage(AlgorithmMessage message) { return(ExecuteFaultHandledOperation(() => { IAlgorithmInstanceRepository algorithmInstanceRepository = _DataRepositoryFactory.GetDataRepository <IAlgorithmInstanceRepository>(); AlgorithmInstance instance = algorithmInstanceRepository.Get(message.AlgorithmInstanceID); if (instance == null) { NotFoundFault fault = new NotFoundFault(string.Format("No algorithm instance found for instanceId '{0}'.", message.AlgorithmInstanceID)); throw new FaultException <NotFoundFault>(fault, fault.Message); } IAlgorithmMessageRepository messageRepository = _DataRepositoryFactory.GetDataRepository <IAlgorithmMessageRepository>(); AlgorithmMessage updatedEntity = null; if (message.AlgorithmMessageID == 0) { updatedEntity = messageRepository.Add(message); } else { updatedEntity = messageRepository.Update(message); } return updatedEntity; })); }
private void OnAlgorithmMessageChanged(object sender, NotifyCollectionChangedEventArgs e) { if (e.Action == NotifyCollectionChangedAction.Add) { foreach (var item in e.NewItems) { AlgorithmMessage message = (AlgorithmMessage)item; if (_logger != null) { if (message.Exception != null) { _logger.LogException(message.Severity, message.Exception, message.Message); } else { _logger.LogMessage(message.Severity, message.Message); } } } } if (e.Action == NotifyCollectionChangedAction.Replace) { // } if (e.Action == NotifyCollectionChangedAction.Remove) { // } if (e.Action == NotifyCollectionChangedAction.Move) { // } }
public AlgorithmMessage UpdateAlgorithmMessage(AlgorithmMessage message) { WithStrategyClient(strategyClient => { _algorithmMessageResult = strategyClient.UpdateAlgorithmMessage(message); }); return(_algorithmMessageResult); }
public async Task <AlgorithmMessage> UpdateAlgorithmMessageAsync(AlgorithmMessage message) { await WithStrategyClientAsync(async strategyClient => { _algorithmMessageResult = await strategyClient.UpdateAlgorithmMessageAsync(message); }); return(_algorithmMessageResult); }
protected async Task AddAlgorithmMessage(string message, bool saveMesage = true, TraceEventType type = 0, Exception ex = null) { var newMessage = new AlgorithmMessage() { AlgorithmInstanceID = _instance.AlgorithmInstanceID, Message = message, Severity = type, Exception = ex }; // limit coll. size due to memory if (Messages.Count >= 200) { Messages.RemoveAt(0); } Messages.Add(newMessage); if (saveMesage) { StrategyCaller.Instance().UpdateAlgorithmMessageAsync(newMessage); } }
public AlgorithmMessage UpdateAlgorithmMessage(AlgorithmMessage message) { return(Channel.UpdateAlgorithmMessage(message)); }
public Task <AlgorithmMessage> UpdateAlgorithmMessageAsync(AlgorithmMessage message) { return(Channel.UpdateAlgorithmMessageAsync(message)); }