using System; using System.Collections.Generic; using System.Linq; using System.Runtime.Remoting.Messaging; using System.Text; using tas; 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; namespace Muchinfo.MTPClient.Adapter.ProtoBuf { public class AnnouncementProtoAdapter : AnnouncementAdapter { public override Data.ResponeEntity> ToLocalQueryClientBM(object obj) { return null; //var buffer = obj as byte[]; //if (buffer == null) //{ // throw new Exception(System.Reflection.MethodBase.GetCurrentMethod().Name + "进行反序列化对象内容为空!"); //} //var rspData = ProtoBufHelper.EntityDeSerialize(buffer); //var resultEntity = new ResponeEntity>() //{ // RetCode = rspData.RetCode, // RetMessage = rspData.RetDesc, // Entity = new List(), //}; //if (rspData.Rsps == null || !rspData.Rsps.Any()) //{ // //todo:查询内容空 // return resultEntity; //} //foreach (var item in rspData.Rsps) //{ // var announcement = new Announcement() // { // MsgID = item.MsgID, // MsgType = (Muchinfo.MTPClient.Data.Enums.MsgTypeEnum)item.MsgType, // PublishDate =ToDateTime(item.PublishDate), // Title = Encoding.UTF8.GetString(item.Title), // Content = Encoding.UTF8.GetString(item.Content), // PubAccountCode = item.PubAccountCode, // ValidDate = ToDateTime(item.ValidDate), // RecvAccountType = (eAccountType)item.RecvAccountType, // PubExchName = item.PubExchName, // PubAccountType = (eAccountType)item.PubAccountType, // ReadStatus = item.ReadStatus, // RiskLevel = item.RiskLevel, // }; // resultEntity.Entity.Add(announcement); //} //return resultEntity; } public override byte[] ToRequestQueryClientBM(QueryClientBMParam clientBMPar) { return null; //if (clientBMPar.TradeAccount == null) return null; //Data.Enums.ClientRiskNtfType riskNtfType = Data.Enums.ClientRiskNtfType.InvestorRiskNtfType; //switch (clientBMPar.TradeAccount.AccountType) //{ // case eUserType.USERTYPE_INVESTOR: // riskNtfType = Data.Enums.ClientRiskNtfType.InvestorRiskNtfType; // break; // default: // riskNtfType = Data.Enums.ClientRiskNtfType.MemberRiskNtfType; // break; //} //var queryClientBM = new QueryClientBMReq() //{ // StartDate =new DateTime(clientBMPar.StartDate.Year, clientBMPar.StartDate.Month, clientBMPar.StartDate.Day, 0, 0, 0).ToString("yyyy-MM-dd HH:mm:ss"), // EndDate = new DateTime(clientBMPar.EndDate.Year, clientBMPar.EndDate.Month, clientBMPar.EndDate.Day, 23, 59, 59).ToString("yyyy-MM-dd HH:mm:ss"), // MsgType = (int)clientBMPar.MsgTypeEnum, // AccountType =(int)clientBMPar.TradeAccount.AccountType, // RiskNtfType = (int)riskNtfType, // AccountCode = clientBMPar.TradeAccount.AccountCode, // AreaCode = clientBMPar.TradeAccount.AreaCode, // MemberCode = clientBMPar.TradeAccount.MemberCode, // Title = clientBMPar.Title, // IsValid = (int)IsValidType.Valid, // PageInfo = new tas.QueryReqPageInfo() // { // NeedTotalCount = 20, // PageNumber=0, // }, // Header=new MessageHead() // { // AccountID = clientBMPar.TradeAccount.AccountId // } //}; //return ProtoBufHelper.EntitySerialize(queryClientBM); } public static DateTime ToDateTime(string dateTime) { DateTime date = DateTime.MinValue; DateTime.TryParse(dateTime, out date); return date; } public override ResponeEntity ToLocalModifyBulletinNotifyStatus(object obj) { return null; //var byteArr = obj as byte[]; //if (byteArr == null) //{ // throw new Exception(System.Reflection.MethodBase.GetCurrentMethod().Name + "进行反序列化对象内容为空!"); //} //var modifyBulletin = ProtoBufHelper.EntityDeSerialize(byteArr); //var responeEntity = new ResponeEntity() //{ // RetCode = modifyBulletin.RetCode, // RetMessage = modifyBulletin.RetDesc, //}; //return responeEntity; } public override byte[] ToReqeustModifyBulletinNotifyStatus(ulong accountID, long msgId, int msgType) { return null; //var updMsgReads = new UpdMsgReadStatus(); //updMsgReads.AccountId = (long)accountID; //updMsgReads.MsgId = msgId; //updMsgReads.MsgType = msgType; //return ProtoBufHelper.EntitySerialize(updMsgReads); } } }