/// <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 { lock (DataModel.SyncRoot) { EntityTreeRow entityTreeRow = DataModel.EntityTree.EntityTreeKeyChildIdParentId.Find(child.EntityId, parent.EntityId); TradingSupportClient client = new TradingSupportClient(Properties.Settings.Default.TradingSupportEndpoint); MethodResponseErrorCode response = client.DeleteEntityTree( new EntityTree[] { new EntityTree() { RowId = entityTreeRow.EntityTreeId, RowVersion = entityTreeRow.RowVersion } }); if (!response.IsSuccessful) { if (response.Errors.Length > 0) { GuardianObject.ThrowErrorInfo(response.Errors[0]); } else { GuardianObject.ThrowErrorInfo(response.Result); } } client.Close(); } } catch (FaultException <RecordNotFoundFault> exception) { EventLog.Warning("{0}: {1}\n{2}", exception.GetType(), exception.Message, exception.StackTrace); } 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.UnlinkFolderFailed, child, parent), Application.Current.MainWindow.Title)), DispatcherPriority.Normal); } }