public OrderDetailsPresentationModel(IOrderDetailsView view, IAccountPositionService accountPositionService, IOrdersService ordersService) { this.View = view; this.accountPositionService = accountPositionService; this.ordersService = ordersService; this.transactionInfo = new TransactionInfo(); //use localizable enum descriptions this.AvailableOrderTypes = new List<ValueDescription<OrderType>> { new ValueDescription<OrderType>(OrderType.Limit, Resources.OrderType_Limit), new ValueDescription<OrderType>(OrderType.Market, Resources.OrderType_Market), new ValueDescription<OrderType>(OrderType.Stop, Resources.OrderType_Stop) }; this.AvailableTimesInForce = new List<ValueDescription<TimeInForce>> { new ValueDescription<TimeInForce>(TimeInForce.EndOfDay, Resources.TimeInForce_EndOfDay), new ValueDescription<TimeInForce>(TimeInForce.ThirtyDays, Resources.TimeInForce_ThirtyDays) }; this.SubmitCommand = new DelegateCommand<object>(this.Submit, this.CanSubmit); this.CancelCommand = new DelegateCommand<object>(this.Cancel); this.View.SetModel(this); this.SetInitialValidState(); }
public OrderDetailsPresentationModel(IOrderDetailsView view, IAccountPositionService accountPositionService, IOrdersService ordersService) { View = view; this.accountPositionService = accountPositionService; this.ordersService = ordersService; _transactionInfo = new TransactionInfo(); //use localizable enum descriptions AvailableOrderTypes = new List<ValueDescription<OrderType>> { new ValueDescription<OrderType>(OrderType.Limit, Resources.OrderType_Limit), new ValueDescription<OrderType>(OrderType.Market, Resources.OrderType_Market), new ValueDescription<OrderType>(OrderType.Stop, Resources.OrderType_Stop) }; AvailableTimesInForce = new List<ValueDescription<TimeInForce>> { new ValueDescription<TimeInForce>(TimeInForce.EndOfDay, Resources.TimeInForce_EndOfDay), new ValueDescription<TimeInForce>(TimeInForce.ThirtyDays, Resources.TimeInForce_ThirtyDays) }; View.Model = this; ValidateModel(); SubmitCommand = new DelegateCommand<object>(Submit, CanSubmit); CancelCommand = new DelegateCommand<object>(Cancel); SubmitCommand.IsActive = view.IsActive; CancelCommand.IsActive = view.IsActive; view.IsActiveChanged += view_IsActiveChanged; }
public OrderDetailsPresentationModel(IOrderDetailsView view, IAccountPositionService accountPositionService, IOrdersService ordersService) { this.View = view; this.accountPositionService = accountPositionService; this.ordersService = ordersService; this.transactionInfo = new TransactionInfo(); //use localizable enum descriptions this.AvailableOrderTypes = new List <ValueDescription <OrderType> > { new ValueDescription <OrderType>(OrderType.Limit, Resources.OrderType_Limit), new ValueDescription <OrderType>(OrderType.Market, Resources.OrderType_Market), new ValueDescription <OrderType>(OrderType.Stop, Resources.OrderType_Stop) }; this.AvailableTimesInForce = new List <ValueDescription <TimeInForce> > { new ValueDescription <TimeInForce>(TimeInForce.EndOfDay, Resources.TimeInForce_EndOfDay), new ValueDescription <TimeInForce>(TimeInForce.ThirtyDays, Resources.TimeInForce_ThirtyDays) }; this.SubmitCommand = new DelegateCommand <object>(this.Submit, this.CanSubmit); this.CancelCommand = new DelegateCommand <object>(this.Cancel); this.View.SetModel(this); this.SetInitialValidState(); }
public OrderDetailsPresentationModel(IOrderDetailsView view, IAccountPositionService accountPositionService, IOrdersService ordersService) { View = view; this.accountPositionService = accountPositionService; this.ordersService = ordersService; _transactionInfo = new TransactionInfo(); //use localizable enum descriptions AvailableOrderTypes = new List <ValueDescription <OrderType> > { new ValueDescription <OrderType>(OrderType.Limit, Resources.OrderType_Limit), new ValueDescription <OrderType>(OrderType.Market, Resources.OrderType_Market), new ValueDescription <OrderType>(OrderType.Stop, Resources.OrderType_Stop) }; AvailableTimesInForce = new List <ValueDescription <TimeInForce> > { new ValueDescription <TimeInForce>(TimeInForce.EndOfDay, Resources.TimeInForce_EndOfDay), new ValueDescription <TimeInForce>(TimeInForce.ThirtyDays, Resources.TimeInForce_ThirtyDays) }; View.Model = this; ValidateModel(); SubmitCommand = new DelegateCommand <object>(Submit, CanSubmit); CancelCommand = new DelegateCommand <object>(Cancel); SubmitCommand.IsActive = view.IsActive; CancelCommand.IsActive = view.IsActive; view.IsActiveChanged += view_IsActiveChanged; }
public OrderDetailsPresenter(IOrderDetailsView view) { _View = view; _Admin = Auth.IsAdminUser(); _View.Admin = _Admin; _View.BtnCancelOrderClicked += CancelOrder; _View.BtnSellItemClicked += SellOrderedItem; }
/// <summary> /// Raises the <see cref="E:System.Web.UI.Control.PreRender"/> event. /// </summary> /// <param name="e">An <see cref="T:System.EventArgs"/> object that contains the event data.</param> protected override void OnPreRender(EventArgs e) { Debug.ArgumentNotNull(e, "e"); base.OnPreRender(e); IOrderDetailsView view = this.Page.Items["OrderDetailsView"] as IOrderDetailsView; Assert.IsNotNull(view, "Unable to render Order Field Editor. View cannot be null."); bool needsDataBind = false; foreach (DataField field in this.fieldEditorLeft.Fields.Concat(this.fieldEditorRight.Fields)) { if (!field.ReadOnly && view.IsReadOnly) { needsDataBind = true; field.ReadOnly = true; } if (field.Name == "State") { needsDataBind = true; field.ReadOnly = field.ReadOnly && !view.CanReopenOrder; } } if (needsDataBind) { OrderStateList orderStateList = this.fieldEditorLeft.Controls.Flatten <OrderStateList>().Concat(this.fieldEditorRight.Controls.Flatten <OrderStateList>()).SingleOrDefault(); string persistedValue = null; bool disableSubstateAnimation = false; if (orderStateList != null) { persistedValue = orderStateList.GetValue(); disableSubstateAnimation = orderStateList.DisableSubstateAnimation; } this.fieldEditorLeft.DataBind(); this.fieldEditorRight.DataBind(); orderStateList = this.fieldEditorLeft.Controls.Flatten <OrderStateList>().Concat(this.fieldEditorRight.Controls.Flatten <OrderStateList>()).SingleOrDefault(); if (orderStateList != null) { orderStateList.SetValue(persistedValue); orderStateList.DisableSubstateAnimation = disableSubstateAnimation; } } }
public TestableOrderDetailsPresenter(IOrderDetailsView view, IAccountPositionService accountPositionService, IOrdersService ordersService) : base(view, accountPositionService, ordersService) { }
public TestableOrderDetailsPresenter(IOrderDetailsView view, IAccountPositionService accountPositionService) : this(view, accountPositionService, new MockOrdersService()) { }
private static OrderDetailsPresentationModel CreatePresentationModel(IOrderDetailsView view, IAccountPositionService accountPositionService) { return(new OrderDetailsPresentationModel(view, accountPositionService, new MockOrdersService())); }
private static OrderDetailsPresentationModel CreatePresentationModel(IOrderDetailsView view, IAccountPositionService accountPositionService) { return new OrderDetailsPresentationModel(view, accountPositionService, new MockOrdersService()); }
/// <summary> /// Initializes a new instance of the <see cref="OrderDetailsPresenter"/> class. /// </summary> /// <param name="view">The view.</param> public OrderDetailsPresenter([NotNull] IOrderDetailsView view) { Assert.ArgumentNotNull(view, "view"); this.view = view; }