//using Muchinfo.PC.Common.Bosn;
//using Muchinfo.MTPClient.Data.Enums;
//using Muchinfo.MTPClient.Data.Model;
//using Muchinfo.MTPClient.Data.Model.Account;
//using Muchinfo.MTPClient.Data.Model.Bank;
//using Muchinfo.MTPClient.Data.Model.Delivery;
//using Muchinfo.MTPClient.Resources;
//using System;
//using System.Collections.Generic;
//using System.IO;
//using System.Linq;
//using System.Text;
//namespace Muchinfo.MTPClient.Infrastructure.Utilities
//{
// public class LogManager
// {
// private static readonly object _lockObject = new object();
// ///
// /// 获取特定时间日志
// ///
// /// The date time.
// /// List{Data.Model.Account.Log}.
// public static List GetLog(DateTime dateTime)
// {
// lock (_lockObject)
// {
// var filePath = Path.Combine(UserManager.UserSettingsFolder, "Log", UserManager.CurrentTradeAccount.LoginCode, dateTime.ToString("yyyyMMdd") + ".log");
// if (!File.Exists(filePath))
// {
// return null;
// }
// var result = BsonHelper.LoadData(filePath);
// if (result == null)
// {
// return null;
// }
// return result.OrderByDescending(z => z.Time).ToList();
// }
// }
// #region 写日志
// ///
// /// 写登录日志
// ///
// /// The trade account.
// public static void WriteLoginLog(TradeAccount tradeAccount)
// {
// var content = Client_Resource.Infrastructure_UerLogin + tradeAccount.LoginCode + "(" + tradeAccount.AccountCode + ")";
// WriteLog(LogType.Login, content);
// }
// ///
// /// 写登出日志
// ///
// /// The trade account.
// public static void WriteLogoutLog(TradeAccount tradeAccount)
// {
// var content = Client_Resource.Infrastructure_UerLogout + tradeAccount.LoginCode + "(" + tradeAccount.AccountCode + ")";
// WriteLog(LogType.Logout, content);
// }
// ///
// /// 写委托日志
// ///
// /// entrustOrder
// /// goodsName
// public static void WriteEntrustLog(NewEntrustOrder entrustOrder, string goodsName)
// {
// if (entrustOrder == null)
// {
// return;
// }
// var content = new StringBuilder();
// content.Append(Client_Resource.Infrastructure_Entrust);
// var logType = LogType.OpenOrder;
// //switch (entrustOrder.OrderType)
// //{
// // case OrderType.MarketOpenOrder:
// // case OrderType.LimitOpenOrder:
// // logType = LogType.OpenOrder;
// // content.Append(Client_Resource.Infrastructure_OpenPosition);
// // break;
// // case OrderType.MarketCloseOrder:
// // logType = LogType.CloseOrder;
// // content.Append(Client_Resource.Infrastructure_ClosePosition);
// // break;
// //}
// content.Append(entrustOrder.BuyOrSell == Direction.Bid ? Client_Resource.Infrastructure_buy : Client_Resource.Infrastructure_sell);
// content.Append(goodsName + " ");
// content.Append(entrustOrder.EntrustQuantity + " ");
// content.Append(entrustOrder.EntrustPrice);
// if (entrustOrder.RelationTicket != 0)
// {
// content.Append(" " + entrustOrder.RelationTicket);
// }
// WriteLog(logType, content.ToString());
// }
// ///
// /// 写撤单日志
// ///
// /// The entrust identifier.
// public static void WriteCancelOrderLog(long entrustId)
// {
// var content = Client_Resource.Infrastructure_Cancellation + entrustId;
// WriteLog(LogType.CancelOrder, content);
// }
// ///
// /// 写交收申请日志
// ///
// /// The delivery apply.
// /// Name of the goods.
// public static void WriteDeliveryApplyLog(EntrustDeliveryDetail deliveryApply, string goodsName)
// {
// if (deliveryApply == null)
// {
// return;
// }
// var content = new StringBuilder();
// content.Append(Client_Resource.Infrastructure_ApplicationDelivery + goodsName);
// content.Append(deliveryApply.DeliveryPrice + " ");
// var count = deliveryApply.HoldDetail.Sum(z => z.HoldQty);
// content.Append(count + " ");
// content.Append(deliveryApply.DeliveryAmount + " ");
// WriteLog(LogType.DeliveryApply, content.ToString());
// }
// ///
// /// 写单据成交日志
// ///
// /// The order complete argument.
// public static void WriteOrderCompleteLog(OrderCompleteArg orderCompleteArg)
// {
// var content = Client_Resource.Infrastructure_Deal + (orderCompleteArg.OrderCompleteType == OrderCompleteType.Open ? Client_Resource.Infrastructure_OpenPosition : Client_Resource.Infrastructure_ClosePosition) + orderCompleteArg.TradeQuantity + " " + orderCompleteArg.Amount + " " + orderCompleteArg.OrderId;
// WriteLog(LogType.OrderComplete, content);
// }
// ///
// /// 写出入金申请人日志
// ///
// /// Type of the apply.
// /// The trade account.
// /// The amount.
// /// The bank account information.
// public static void WriteFundApplyLog(FundsApplyType applyType, TradeAccount tradeAccount, decimal amount, SigningBank bankAccountInfo)
// {
// var content = applyType == FundsApplyType.Withdraw ? Client_Resource.Infrastructure_WithdrawRequest : Client_Resource.Infrastructure_DepositRequest;
// content += tradeAccount.LoginCode + " " + amount;
// if (bankAccountInfo != null)
// {
// content += bankAccountInfo.Name + " " + bankAccountInfo.AccountName;
// }
// WriteLog(applyType == FundsApplyType.Withdraw ? LogType.Withdraw : LogType.Deposit, content);
// }
// ///
// /// 写银行签约解约日志
// ///
// /// 0:签约, 1:解约
// /// The signing bank.
// /// The trade account.
// public static void WriteBankApplyLog(int type, SigningBank signingBank, TradeAccount tradeAccount)
// {
// if (signingBank == null)
// {
// return;
// }
// var content = tradeAccount.LoginCode + " " + (type == 0 ? Client_Resource.Infrastructure_BankSignRequest : Client_Resource.Infrastructure_BankCancellationRequest) + signingBank.BranchBankName + " " + signingBank.AccountName + " " + signingBank.BankAccount;
// WriteLog(type == 0 ? LogType.BankContractApply : LogType.BankCaneclSignApply, content);
// }
// ///
// /// 写修改密码日志
// ///
// /// The trade account.
// /// The type.
// public static void WritePassWordModifyLog(TradeAccount tradeAccount, int type)
// {
// string value = string.Empty;
// switch (type)
// {
// case 1:
// value = Client_Resource.Infrastructure_ChangePhPassword;
// break;
// case 2:
// value = Client_Resource.Infrastructure_ChangeComPassword;
// break;
// case 3:
// value = Client_Resource.Infrastructure_ChangeFundPassword;
// break;
// case 4:
// value = Client_Resource.Infrastructure_ChangeTradingPassword;
// break;
// }
// var content = tradeAccount.LoginCode + " " + value;
// WriteLog(LogType.PassWordModify, content);
// }
// ///
// /// 写日志
// ///
// /// Type of the log.
// /// The content.
// private static void WriteLog(LogType logType, string content)
// {
// if (string.IsNullOrWhiteSpace(content))
// {
// return;
// }
// lock (_lockObject)
// {
// var folderPath = Path.Combine(UserManager.UserSettingsFolder, "Log", UserManager.CurrentTradeAccount.LoginCode);
// if (!Directory.Exists(folderPath))
// {
// Directory.CreateDirectory(folderPath);
// }
// var log = new Log()
// {
// LogType = logType,
// Time = DateTime.Now,
// Content = content
// };
// BsonHelper.SaveData(Path.Combine(folderPath, DateTime.Now.ToString("yyyyMMdd") + ".log"), log, new LogComparer(), false);
// //todo:发送写日志消息通知操作日志页面
// }
// }
// #endregion
// }
//}