| 12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970717273747576777879808182838485868788899091 |
- using System;
- using System.Collections.Generic;
- using System.Linq;
- using System.Text;
- //----------------------------------------------------------------
- //Module Name: $safeprojectname$
- //Purpose:
- //CopyRight: Muchinfo
- //History:
- //----------------------------------------------------------------
- //DateTime 2016/7/27 20:28:55
- //Author
- //Description Create
- //----------------------------------------------------------------
- using Muchinfo.MTPClient.Data;
- using Muchinfo.MTPClient.Data.Enums;
- using Muchinfo.MTPClient.Data.Model;
- using Muchinfo.MTPClient.Data.Model.Account;
- using Muchinfo.MTPClient.Infrastructure.Utilities;
- namespace Muchinfo.MTPClient.Trade.ViewModels
- {
- public class MixPayTradeViewModel:MixTradeViewModel
- {
- public MixPayTradeViewModel(QuoteGoods goods, Direction direction)
- : base(goods, direction)
- {
-
- OpenCloseMode = OpenCloseMode.BUILDTYPE_OPEN;
- }
- public MixPayTradeViewModel(QuoteGoods goods, OrderBase orderBase)
- : base(goods, orderBase)
- {
- }
- public override bool IsSellEnable
- {
- get
- {
- var holdingOrders = UserManager.GetCacheOrders<HoldingOrder>();
- if (holdingOrders == null || !holdingOrders.Any())
- {
- return false;
- }
- //全款划扣商品-》只有买入方向的平仓单
- return holdingOrders.Where((item) => item.GoodsId == _currentGoods.GoodsId && item.Direction == Direction.Bid).ToList().Any();
-
- }
- }
- /// <summary>
- /// 按单、寸头是否可见
- /// </summary>
- public override bool IsCloseTypeVsb
- {
- get
- {
- //卖方向的时候可见
- return Direction == Direction.Ask;
- }
- }
- public override void PostOrder(Action<OrderDetail> successAction, Action<ErrorEntity> errorAction)
- {
- var entrustOrder = BuildEntrustOrder();
- entrustOrder.BuildType = Direction == Direction.Ask ? OpenCloseMode.BUILDTYPE_CLOSE : OpenCloseMode.BUILDTYPE_OPEN;
- ////按单平
- if (Direction == Direction.Ask && GoodsOrderMode == GoodsOrderMode.Order)
- {
- //entrustOrder.RelationTicket = SelectOrder == null ? 0 : SelectOrder.OrderID;
- }
- _orderService.MixMarketEntrustOrder(entrustOrder, successAction, errorAction);
- }
- protected override void SetMinMaxQtyVaule()
- {
- if (this.Direction == Direction.Bid)
- {
- SetOpenQty(); //设置建仓最大最小数量
- }
- else
- {
- SetCloseQty();//设置平仓最大最小数量
- }
- }
- }
- }
|