/// <summary> /// Apply changes. /// </summary> /// <param name="entity">The entity to apply changes to.</param> private void Apply(Blotter entity) { try { entity.Commit(); this.Dispatcher.BeginInvoke( new Action(() => this.Entity.Reset()), DispatcherPriority.Normal); } catch (SecurityAccessDeniedException) { this.Dispatcher.BeginInvoke(new Action(delegate() { MessageBox.Show(this, Properties.Resources.CommitFailedAccessDenied, this.Title); }), DispatcherPriority.Normal); } catch (Exception exception) { this.Dispatcher.BeginInvoke(new Action(delegate() { MessageBox.Show(this, Properties.Resources.OperationFailed, this.Title); }), DispatcherPriority.Normal); EventLog.Warning("Unknown error in entity commit: {0}: {1}\n{2}", exception.GetType(), exception.Message, exception.StackTrace); } }
/// <summary> /// Actual execute a move by moving the securities. /// </summary> /// <param name="client">The trading support client to use.</param> /// <param name="records">The security records to move.</param> /// <param name="newParent">The new blotter.</param> /// <returns>The server response</returns> protected virtual MethodResponseErrorCode MoveSecurity( TradingSupportClient client, BaseRecord[] records, Blotter newParent) { throw new NotImplementedException("Only consumer debt securities are implemented"); }
/// <summary> /// Create a duplicate blotter. /// </summary> /// <param name="source">The original blotter.</param> public Blotter(Blotter source) : base(source) { if (source.CommissionSchedule != null) { this.commissionSchedule = new CommissionSchedule(source.CommissionSchedule); this.commissionSchedule.PropertyChanged += this.OnCommissionScheduleChanged; } }
/// <summary> /// Make sure we're editing a own copy of the blotter. /// </summary> /// <param name="sender">The schedule window.</param> /// <param name="baseValue">The blotter the property was set to.</param> /// <returns>A clone of the value.</returns> private static Entity CoerceEntity(DependencyObject sender, object baseValue) { Blotter clone = (baseValue as Blotter).Clone() as Blotter; clone.Reset(); return(clone); }
/// <summary> /// Actual execute a move by moving the securities. /// </summary> /// <param name="client">The trading support client to use.</param> /// <param name="records">The security records to move.</param> /// <param name="newParent">The new blotter.</param> /// <returns>The server response</returns> protected override MethodResponseErrorCode MoveSecurity( TradingSupportClient client, BaseRecord[] records, Blotter newParent) { MethodResponseErrorCode response = null; response = client.MoveConsumerDebtToBlotter(newParent.BlotterId, records); return(response); }
/// <summary> /// Create an independent clone of this blotter. /// </summary> /// <returns>The new blotter.</returns> public override GuardianObject Clone() { GuardianObject newEntity = base.Clone(); if (this.CommissionSchedule != null) { Blotter newBlotter = newEntity as Blotter; newBlotter.commissionSchedule = new CommissionSchedule(this.commissionSchedule); newBlotter.commissionSchedule.PropertyChanged += newBlotter.OnCommissionScheduleChanged; } return(newEntity); }
/// <summary> /// Retrieve the commission schedule in use for this blotter, whether or not the schedule is set at this level in the tree. This function locks the data model. /// </summary> /// <param name="blotterId">The blotter id of the blotter.</param> /// <returns>The commission schedule, or a new one if none could be found.</returns> public static CommissionSchedule GetEffectiveCommissionSchedule(Guid blotterId) { CommissionSchedule commissionSchedule = null; lock (DataModel.SyncRoot) { // HACK: The commission schedule is keyed to the debt class right now, but should change to Blotter. Guid?commissionScheduleId = (Guid?)Blotter.FindEffectiveField <Guid>(blotterId, DataModel.DebtClass.CommissionScheduleIdColumn); if (commissionScheduleId != null) { commissionSchedule = new CommissionSchedule( DataModel.CommissionSchedule.CommissionScheduleKey.Find(commissionScheduleId.Value)); } else { commissionSchedule = new CommissionSchedule(); } } return(commissionSchedule); }
/// <summary> /// Retrieve the commission schedule in use for this blotter, whether or not the schedule is set at this level in the tree. This function locks the data model. /// </summary> /// <returns>The commission schedule, or a new one if none could be found.</returns> public CommissionSchedule GetEffectiveCommissionSchedule() { return(Blotter.GetEffectiveCommissionSchedule(this.BlotterId)); }