using System; using System.Collections.Generic; using System.Linq; using System.Text; //---------------------------------------------------------------- //Module Name: $safeprojectname$ //Purpose: //CopyRight: Muchinfo //History: //---------------------------------------------------------------- //DateTime 2016/4/6 18:17:54 //Author //Description Create //---------------------------------------------------------------- using Muchinfo.MTPClient.Adapter.Abstract; using Muchinfo.MTPClient.Adapter.Utilities; using Muchinfo.MTPClient.Data; using Muchinfo.MTPClient.Data.Enums; using Muchinfo.MTPClient.Data.Model; using Muchinfo.MTPClient.Data.Model.Account; using tas; namespace Muchinfo.MTPClient.Adapter.ProtoBuf { public class SaleProtoBufAdapter:SaleAdapter { //private OrderHead ToOrderHead(NewEntrustOrder entrustorder) //{ // return new OrderHead() // { // //OrderID = entrustorder.RelationTicket, ////委托单号 // AccountType = (uint)entrustorder.AccountType, // ValidType = (int)entrustorder.ValidType, // ClientSerialNo = Guid.NewGuid().ToString(), // AccountID = (uint)entrustorder.AccountId, // OperatorID = (uint)entrustorder.AccountId, // ClientOrderTime = entrustorder.EntrurstTime.ToString("yyyy-MM-dd HH:mm:ss"), // OperateType = 0, // ClientFlag = 2 + string.Empty, // GoodsID = entrustorder.GoodsId, // ///ClientOrderTime // // ClientFlag= ////默认PC交易端 // // AccountID=entrustorder.TradeCode, /// // //AccountStatus // //GoodsID // //ValidTime // //OperateType // //OperatorID // //OrderSrc // //AttachParam // }; //} public override byte[] ToSaleEntrustOrder(Data.Model.NewEntrustOrder entrustOrder) { return null; //var marketOrder = new IMOrderReq() //{ // OrderPrice = Convert.ToDouble(entrustOrder.EntrustPrice), // OrderQty = Convert.ToDouble(entrustOrder.EntrustQuantity), // BuyOrSell = (uint)entrustOrder.BuyOrSell, // BuildType = (uint)entrustOrder.BuildType, // //RelateOrderID=entrustOrder.RelationTicket, //}; //marketOrder.Header = new MessageHead() { AccountID = entrustOrder.AccountId, GoodsID = entrustOrder.GoodsId, UUID = Guid.NewGuid().ToString() }; //marketOrder.OrderHead = ToOrderHead(entrustOrder); //return ProtoBufHelper.EntitySerialize(marketOrder, false); } public override Data.ResponeEntity ToSaleOrder(object responeData) { return null; //var buffer = responeData as byte[]; //if (buffer == null) //{ // throw new Exception(System.Reflection.MethodBase.GetCurrentMethod().Name + "进行反序列化对象内容为空!"); //} //var imOrderRsp = ProtoBufHelper.EntityDeSerialize(buffer); //return new ResponeEntity() //{ // RetCode = imOrderRsp.RetCode, // RetMessage = imOrderRsp.RetDesc, // Entity = new OrderDetail() // { // //OrderID = imOrderRsp.OrderID, // EntrustOrderType = (eBuildType)imOrderRsp.OrderType, // ////todo:生成委托 // } //}; } public override byte[] ToDepositReqBytes(DepositOrder depositOrder) { return null; //var depositReq = new DepositReq() //{ // //accountId = depositOrder.Accountid, // depositId=depositOrder.DepositId, // depositNum=Convert.ToDouble( depositOrder.DepositNum), // depositType=(int)depositOrder.BuildType, // warehouseId=depositOrder.WarehouseId, // storeinId=depositOrder.StoreinId, //}; ////marketOrder.Header = new MessageHead() { AccountId = entrustOrder.AccountId, GoodsId = entrustOrder.GoodsId, UUID = Guid.NewGuid().ToByteArray() }; ////marketOrder.OrderHead = ToOrderHead(entrustOrder); //return ProtoBufHelper.EntitySerialize(depositReq, true); } public override ResponeEntity ToLocalDepositEntity(object responeData) { return null; //var buffer = responeData as byte[]; //if (buffer == null) //{ // throw new Exception(System.Reflection.MethodBase.GetCurrentMethod().Name + "进行反序列化对象内容为空!"); //} //var imOrderRsp = ProtoBufHelper.EntityDeSerialize(buffer); //return new ResponeEntity() //{ // RetCode = imOrderRsp.RetCode, // RetMessage = imOrderRsp.RetDesc, // Entity = new DepositOrder() // { // //Accountid = imOrderRsp.accountId, // BuildType = (eBuildType)imOrderRsp.depositType, // ////todo:生成委托 // } //}; } } }