/// <summary> /// /// </summary> /// <param name="consumer"></param> public static MethodResponseErrorCode UpdateConsumer(Consumer consumer) { if (consumer.RowId == Guid.Empty) { throw new MissingFieldException("RowId is not set"); } lock (DataModel.SyncRoot) { ConsumerRow row = DataModel.Consumer.ConsumerKey.Find(consumer.RowId); if (TradingSupportWebService.ColumnChanged(row, consumer)) { return(UpdateConsumer(new Consumer[] { consumer })); } else { return(null); } } }
/// <summary> /// /// </summary> /// <param name="consumerTrust"></param> /// <returns></returns> public static MethodResponseErrorCode UpdateSecurity(Security security) { if (security.RowId == Guid.Empty) { throw new MissingFieldException("RowId is not set"); } lock (DataModel.SyncRoot) { SecurityRow row = DataModel.Security.SecurityKey.Find(security.RowId); if (TradingSupportWebService.ColumnChanged(row, security)) { return(UpdateSecurity(new Security[] { security })); } else { return(null); } } }
/// <summary> /// /// </summary> /// <param name="consumer"></param> public static MethodResponseErrorCode UpdateNegotiaton(Negotiation negotiation) { if (negotiation.RowId == Guid.Empty) { throw new MissingFieldException("RowId is not set"); } lock (DataModel.SyncRoot) { NegotiationRow row = DataModel.Negotiation.NegotiationKey.Find(negotiation.RowId); if (TradingSupportWebService.ColumnChanged(row, negotiation)) { return(UpdateNegotiaton(new Negotiation[] { negotiation })); } else { return(null); } } }
/// <summary> /// /// </summary> /// <param name="workingOders"></param> public static MethodResponseErrorCode UpdateWorkingOrder(WorkingOrderRecord workingOrder) { MethodResponseErrorCode response = null; // Update the database. TradingSupportClient tradingSupportClient = new TradingSupportClient(Guardian.Properties.Settings.Default.TradingSupportEndpoint); try { lock (DataModel.SyncRoot) { WorkingOrderRow row = DataModel.WorkingOrder.WorkingOrderKey.Find(workingOrder.RowId); if (TradingSupportWebService.ColumnChanged(row, workingOrder)) { response = tradingSupportClient.UpdateWorkingOrder(new WorkingOrderRecord[] { workingOrder }); } else { response = null; } } } catch (Exception exception) { // Any issues trying to communicate to the server are logged. EventLog.Error("{0}, {1}", exception.Message, exception.StackTrace); } finally { if (tradingSupportClient != null && tradingSupportClient.State == CommunicationState.Opened) { tradingSupportClient.Close(); } } return(response); }