/// <summary> /// Commit the new link to the database. /// </summary> /// <param name="parent">The parent folder.</param> /// <param name="child">The child folder.</param> private void Commit(Entity parent, Entity child) { try { TradingSupportClient client = new TradingSupportClient(Properties.Settings.Default.TradingSupportEndpoint); MethodResponseArrayOfguid response = client.CreateEntityTree(new EntityTree[] { new EntityTree() { ChildId = child.EntityId, ParentId = parent.EntityId } }); if (!response.IsSuccessful) { if (response.Errors.Length > 0) { GuardianObject.ThrowErrorInfo(response.Errors[0]); } else { Application.Current.Dispatcher.BeginInvoke(new WaitCallback(data => MessageBox.Show( Application.Current.MainWindow, String.Format(FluidTrade.Guardian.Properties.Resources.LinkFolderFailed, data), Application.Current.MainWindow.Title)), DispatcherPriority.Normal, child); } } client.Close(); } catch (FaultException <RecordExistsFault> exception) { EventLog.Warning("{0}: {1}\n{2}", exception.GetType(), exception.Message, exception.StackTrace); Application.Current.Dispatcher.BeginInvoke(new WaitCallback(data => MessageBox.Show( Application.Current.MainWindow, String.Format(FluidTrade.Guardian.Properties.Resources.LinkFolderFailedRecordExists, data), Application.Current.MainWindow.Title)), DispatcherPriority.Normal, child); } catch (Exception exception) { EventLog.Error("{0}: {1}\n{2}", exception.GetType(), exception.Message, exception.StackTrace); Application.Current.Dispatcher.BeginInvoke(new WaitCallback(data => MessageBox.Show( Application.Current.MainWindow, String.Format(FluidTrade.Guardian.Properties.Resources.LinkFolderFailed, data), Application.Current.MainWindow.Title)), DispatcherPriority.Normal, child); } }