using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
//----------------------------------------------------------------
//Module Name: $safeprojectname$
//Purpose:
//CopyRight: Muchinfo
//History:
//----------------------------------------------------------------
//DateTime 2016/11/3 18:02:43
//Author
//Description Create
//----------------------------------------------------------------
using System.Windows.Documents;
using Muchinfo.MTPClient.Data.Enums;
using Muchinfo.MTPClient.Data.Helper;
namespace Muchinfo.MTPClient.Data.Model.Account
{
///
/// 协议平仓
///
public class DealCloseModel
{
// d.AUTOID , // 协议单号
//d.TRADEMODE, // 交易模式
//d.BUYACCOUNTID, //买方账号
//d.SELLACCOUNTID , //卖方账号
//sellconfirmtime 卖方确认时间
//BuyConfirmTime 买方确认时间
// BuyAccountCode买方账号
// BuyAccountname 买方名称
// SellAccountCode卖方账号
//ORDERQTY 委托数量
// ORDERPRICE 委托价格
//ORDERQTY 委托数量
// STATUS 状态
// 商品名称
//d.ORDERQTY ,
//d.ORDERPRICE,
//d.CREATETIME,
//d.STATUS,
//d.CREATORID,
//d.CHECKTIME ,
//d.CHECKID,
//d.DEALCLOSETIME
// d.DEALCLOSEMODE ,
//d.ACCOUNTSURE ,
///
/// 协议单号
///
[PropertyDisc("AUTOID")]
public uint DealNum { get; set; }
///
/// 交易模式
///
[PropertyDisc("TRADEMODE")]
public eTradeMode TRADEMODE { get; set; }
///
/// 买方账号
///
[PropertyDisc("BUYACCOUNTID")]
public long BuyAccountId { get; set; }
///
/// 卖方账号
///
[PropertyDisc("SELLACCOUNTID")]
public ulong SellAccountId { get; set; }
///
/// 商品ID
///
[PropertyDisc("GOODSID")]
public long GoodsId { get; set; }
///
/// 商品名称
///
[PropertyDisc("GoodsName")]
public string GoodsName { get; set; }
///
/// 商品代码
///
[PropertyDisc("GoodsCode")]
public string GoodsCode { get; set; }
///
/// BuyAccountname 买方名称
///
[PropertyDisc("BuyAccountname")]
public string BuyAccountName { get; set; }
///
/// BuyAccountCode买方账号
///
[PropertyDisc("BuyAccountCode")]
public string BuyAccountCode { get; set; }
///
/// SellAccountName卖方名称
///
[PropertyDisc("SellAccountName")]
public string SellAccountName { get; set; }
///
/// SellAccountCode卖方账号
///
[PropertyDisc("SellAccountCode")]
public string SellAccountCode { get; set; }
///
///ORDERQTY 委托数量
///
[PropertyDisc("ORDERQTY")]
public long OrderQty { get; set; }
///
/// ORDERPRICE 委托价格
///
[PropertyDisc("ORDERPRICE")]
public decimal OrderPrice { get; set; }
///
/// STATUS 状态
///
[PropertyDisc("STATUS")]
public DealCloseStatus Status { get; set; }
///
///
///
[PropertyDisc("ACCOUNTSURE")]
public NeedComfrim AccountSure { get; set; }
///
///DEALCLOSETIME 平仓时间
///
[PropertyDisc("DEALCLOSETIME")]
public DateTime DealCloseTime
{
get; set;
}
///
///BuyConfirmTime 买方确认时间
///
[PropertyDisc("BuyConfirmTime")]
public DateTime BuyConfirmTime { get; set; }
///
///sellconfirmtime 卖方确认时间
///
[PropertyDisc("sellconfirmtime")]
public DateTime SellConfirmTime { get; set; }
///
/// 审核状态
///
[PropertyDisc("AuditStatus")]
public eAuditStatus AuditStatus { get; set; }
///
/// 己方ID
///
public ulong SelfAccountId { get; set; }
///
/// 状态
///
public string StatusDisplay
{
get
{
return Status.Discription();
//if (IsShowComfrim)
//{
// return Status.Discription();
//}
//return "--";
}
}
///
/// 对方Code
///
public string PartnerCode
{
get
{
if (SelfAccountId == SellAccountId)
{
return BuyAccountCode;
}
else
{
return SellAccountCode;
}
}
}
///
/// 对方名称
///
public string PartnerName
{
get
{
if (SelfAccountId == SellAccountId)
{
return BuyAccountName;
}
else
{
return SellAccountName;
}
}
}
public Direction Direction
{
get
{
if (SelfAccountId == SellAccountId)
{
return Direction.Ask;
}
else
{
return Direction.Bid;
}
}
}
///
/// 显示方向
///
public string DirectionDisplay
{
get
{
return Direction.Discription();
}
}
///
/// 是否可平仓
///
public bool CanComfrim
{
get
{
if (AuditStatus != eAuditStatus.AUDITSTATUS_SUCCESS)
{
return false;
}
switch (Status)
{
case DealCloseStatus.AllComfirmed:
case DealCloseStatus.AllTraded:
case DealCloseStatus.Dealing:
case DealCloseStatus.CloseFail:
case DealCloseStatus.SysCancel:
case DealCloseStatus.SelfCanel: ////不可确认的状态
return false;
}
if (Direction == Direction.Ask) ////其他状态看对应方向的确认时间是否有值判断是否可确认
{
return SellConfirmTime == DateTime.MinValue;
}
else
{
return BuyConfirmTime == DateTime.MinValue;
}
}
}
///
/// /是否显示确认
///
public bool IsShowComfrim
{
get
{
return AccountSure == NeedComfrim.Yes;
}
}
}
}