| 123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241 |
- //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();
- // /// <summary>
- // /// 获取特定时间日志
- // /// </summary>
- // /// <param name="dateTime">The date time.</param>
- // /// <returns>List{Data.Model.Account.Log}.</returns>
- // public static List<Data.Model.Account.Log> 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<Data.Model.Account.Log>(filePath);
- // if (result == null)
- // {
- // return null;
- // }
- // return result.OrderByDescending(z => z.Time).ToList();
- // }
- // }
- // #region 写日志
- // /// <summary>
- // /// 写登录日志
- // /// </summary>
- // /// <param name="tradeAccount">The trade account.</param>
- // public static void WriteLoginLog(TradeAccount tradeAccount)
- // {
- // var content = Client_Resource.Infrastructure_UerLogin + tradeAccount.LoginCode + "(" + tradeAccount.AccountCode + ")";
- // WriteLog(LogType.Login, content);
- // }
- // /// <summary>
- // /// 写登出日志
- // /// </summary>
- // /// <param name="tradeAccount">The trade account.</param>
- // public static void WriteLogoutLog(TradeAccount tradeAccount)
- // {
- // var content = Client_Resource.Infrastructure_UerLogout + tradeAccount.LoginCode + "(" + tradeAccount.AccountCode + ")";
- // WriteLog(LogType.Logout, content);
- // }
- // /// <summary>
- // /// 写委托日志
- // /// </summary>
- // /// <param name="entrustOrder">entrustOrder</param>
- // /// <param name="goodsName">goodsName</param>
- // 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());
- // }
- // /// <summary>
- // /// 写撤单日志
- // /// </summary>
- // /// <param name="entrustId">The entrust identifier.</param>
- // public static void WriteCancelOrderLog(long entrustId)
- // {
- // var content = Client_Resource.Infrastructure_Cancellation + entrustId;
- // WriteLog(LogType.CancelOrder, content);
- // }
- // /// <summary>
- // /// 写交收申请日志
- // /// </summary>
- // /// <param name="deliveryApply">The delivery apply.</param>
- // /// <param name="goodsName">Name of the goods.</param>
- // 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());
- // }
- // /// <summary>
- // /// 写单据成交日志
- // /// </summary>
- // /// <param name="orderCompleteArg">The order complete argument.</param>
- // 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);
- // }
- // /// <summary>
- // /// 写出入金申请人日志
- // /// </summary>
- // /// <param name="applyType">Type of the apply.</param>
- // /// <param name="tradeAccount">The trade account.</param>
- // /// <param name="amount">The amount.</param>
- // /// <param name="bankAccountInfo">The bank account information.</param>
- // 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);
- // }
- // /// <summary>
- // /// 写银行签约解约日志
- // /// </summary>
- // /// <param name="type">0:签约, 1:解约</param>
- // /// <param name="signingBank">The signing bank.</param>
- // /// <param name="tradeAccount">The trade account.</param>
- // 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);
- // }
- // /// <summary>
- // /// 写修改密码日志
- // /// </summary>
- // /// <param name="tradeAccount">The trade account.</param>
- // /// <param name="type">The type.</param>
- // 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);
- // }
- // /// <summary>
- // /// 写日志
- // /// </summary>
- // /// <param name="logType">Type of the log.</param>
- // /// <param name="content">The content.</param>
- // 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<Log>(Path.Combine(folderPath, DateTime.Now.ToString("yyyyMMdd") + ".log"), log, new LogComparer(), false);
- // //todo:发送写日志消息通知操作日志页面
- // }
- // }
- // #endregion
- // }
- //}
|