/// <summary>
        /// 获取新闻公告信息
        /// </summary>
        /// <param name="LoginId">登录用户标识ID</param>
        /// <param name="starttime">开始时间</param>
        /// <param name="endtime">结束时间</param>
        /// <param name="NType">新闻类型</param>
        /// <param name="pageindex">页索引</param>
        /// <param name="pagesize">页大小</param>
        /// <param name="page">页总数</param>
        ///  <param name="list">新闻数据集</param>
        /// <returns></returns>
        public ErrType GetTradeNewsInfoWithPage(
            string loginId, DateTime starttime, DateTime endtime, NewsTypeEnum nType,
            int pageindex, int pagesize, ref int page, ref ObservableCollection <NewsInfo> list)
        {
            try
            {
                NewsLqc lqc = new NewsLqc();
                lqc.EndTime   = endtime;
                lqc.LoginID   = loginId;
                lqc.NType     = (NewsType)nType;
                lqc.StartTime = starttime;
                TradeNewsInfo result = TradeService.GetTradeNewsInfoWithPage(lqc, pageindex, pagesize, ref page);
                if (!result.Result)
                {
                    return(new ErrType(ERR.SERVICE, result.Desc));
                }

                foreach (TradeNews news in result.TradeNewsInfoList)
                {
                    list.Add(TradeConverter.ToNewsInfo(news));
                }
                return(GeneralErr.Success);
            }
            catch (TimeoutException te)
            {
                FileLog.WriteLog("", Assembly.GetExecutingAssembly().GetName().Name, this.GetType().Name, new StackTrace().GetFrame(0).GetMethod().Name, te.Message); return(new ErrType(ERR.EXEPTION, ErrorText.TimeoutException));
            }
            catch (Exception ex)
            {
                FileLog.WriteLog("", Assembly.GetExecutingAssembly().GetName().Name, this.GetType().Name, new StackTrace().GetFrame(0).GetMethod().Name, ex.Message);
                return(new ErrType(ERR.EXEPTION, ErrorText.GetTradeNewsInfo));
            }
        }
        public ErrType GetHistoryDataInfoWithPage(
            string loginId, string weekTime, DateTime starttime, DateTime endtime, string productNum, string cycle,
            int pageindex, int pagesize, ref int page, ref ObservableCollection <Gss.Entities.JTWEntityes.HisData> list)
        {
            HisQueryCon hqc = new HisQueryCon();

            hqc.EndTime   = endtime;
            hqc.StartTime = starttime;
            hqc.weekflg   = cycle;
            hqc.pricecode = productNum;

            hqc.weektime = weekTime;
            List <Gss.TradeService.TradeService.HisData> result;

            try
            {
                result = TradeService.GetHisDataWithPage(hqc, pageindex, pagesize, ref page);
                foreach (var item in result)
                {
                    list.Add(TradeConverter.ToHisDataInfo(item));
                }
                return(GeneralErr.Success);
            }
            catch (Exception ex)
            {
                FileLog.WriteLog("", Assembly.GetExecutingAssembly().GetName().Name, this.GetType().Name, new StackTrace().GetFrame(0).GetMethod().Name, ex.Message);
                return(new ErrType(ERR.EXEPTION, ErrorText.GetHistoryData));
            }
        }
        /// <summary>
        /// 有效定单入库
        /// </summary>
        /// <param name="loginID">登陆标识</param>
        /// <param name="userType">用户类型,0:交易用户,1:管理员,2:金商</param>
        /// <param name="orderInfo">平仓信息</param>
        /// <returns>ErrType</returns>
        public ErrType WarehousingOrder(string loginID, int userType, OrderChangedInformation orderInfo)
        {
            try
            {
                DeliveryEnter delEnter = TradeConverter.ToDeliveryEnter(loginID, userType, orderInfo);
                //Todo:金能网待处理
                #region 金能网待处理
                //Marketorders result = TradeService.GetMarDelivery(delEnter);
                //if (!result.Result)
                //    return new ErrType(ERR.SERVICE, result.Desc);
                #endregion

                return(GeneralErr.Success);
            }
            catch (TimeoutException te)
            {
                FileLog.WriteLog("", Assembly.GetExecutingAssembly().GetName().Name, this.GetType().Name, new StackTrace().GetFrame(0).GetMethod().Name, te.Message);
                return(new ErrType(ERR.EXEPTION, ErrorText.TimeoutException));
            }
            catch (Exception ex)
            {
                FileLog.WriteLog("", Assembly.GetExecutingAssembly().GetName().Name, this.GetType().Name, new StackTrace().GetFrame(0).GetMethod().Name, ex.Message);
                return(new ErrType(ERR.EXEPTION, ErrorText.OperationError));
            }
        }
        /// <summary>
        /// 限价挂单定单
        /// </summary>
        /// <param name="loginID">登陆标识</param>
        /// <param name="clientAccountName">要下单的客户账户名</param>
        /// <param name="userType">用户类型,0:交易用户,1:管理员,2:金商</param>
        /// <param name="newOrderInfo">下单的定单信息</param>
        /// <returns>ErrType</returns>
        public ErrType PendingOrder(string loginID, string clientAccountName, int userType, NewPendingOrderInfo newOrderInfo)
        {
            try
            {
                OrdersLncoming orderLn = TradeConverter.ToOrdersLncoming(loginID, clientAccountName, userType, newOrderInfo);
                Orders         result  = TradeService.GetOrders(orderLn);
                if (!result.Result)
                {
                    return(new ErrType(ERR.SERVICE, result.Desc));
                }

                //这里还应进行账户资金方面的处理
                return(GeneralErr.Success);
            }
            catch (TimeoutException te)
            {
                FileLog.WriteLog("", Assembly.GetExecutingAssembly().GetName().Name, this.GetType().Name, new StackTrace().GetFrame(0).GetMethod().Name, te.Message);
                return(new ErrType(ERR.EXEPTION, ErrorText.TimeoutException));
            }
            catch (Exception ex)
            {
                FileLog.WriteLog("", Assembly.GetExecutingAssembly().GetName().Name, this.GetType().Name, new StackTrace().GetFrame(0).GetMethod().Name, ex.Message);
                return(new ErrType(ERR.EXEPTION, ErrorText.OperationError));
            }
        }
 /// <summary>
 /// 获取用户资金信息
 /// </summary>
 /// <param name="accountName">用户账号</param>
 /// <param name="loginId">登录ID</param>
 /// <param name="fund">ref  FundInformation</param>
 /// <returns>ErrType</returns>
 public ErrType GetMoneyInventoryEx(string accountName, string loginId, ref FundInformation fund)
 {
     try
     {
         MoneyInventory moneyInfo = TradeService.GetMoneyInventoryEx(accountName, loginId);
         fund = TradeConverter.ToFundInformation(moneyInfo);
         return(moneyInfo.Result ? GeneralErr.Success : new ErrType(ERR.ERROR, moneyInfo.Desc));
     }
     catch (Exception ex)
     {
         FileLog.WriteLog("", Assembly.GetExecutingAssembly().GetName().Name, this.GetType().Name, new StackTrace().GetFrame(0).GetMethod().Name, ex.Message);
         return(new ErrType(ERR.EXEPTION, ErrorText.GetClientFundsInfo));
     }
 }
 public ErrType ModifyHisData(Gss.Entities.JTWEntityes.HisData hisdata, string pricecode, string weekflg)
 {
     try
     {
         var result = TradeService.ModifyHisData(TradeConverter.ToServiceHisDataInfo(hisdata), pricecode, weekflg);
         if (!result.Result)
         {
             return(new ErrType(ERR.ERROR, "修改历史数据失败"));
         }
         return(GeneralErr.Success);
     }
     catch (Exception ex)
     {
         FileLog.WriteLog("", Assembly.GetExecutingAssembly().GetName().Name, this.GetType().Name, new StackTrace().GetFrame(0).GetMethod().Name, ex.Message);
         return(new ErrType(ERR.EXEPTION, ErrorText.OperationError));
     }
 }
 /// <summary>
 /// 获取入库单历史记录列表
 /// </summary>
 /// <param name="loginID">登陆标识</param>
 /// <param name="searchInfo">查询信息</param>
 /// <param name="pageCnt">返回的记录页数</param>
 /// <param name="historyList">返回的有效定单历史记录列表</param>
 /// <returns>ErrType</returns>
 public ErrType GetWarehousingRecorder(string loginID, HistorySearchInfo searchInfo, ref int pageCnt, out List <WarehousingHistoryData> historyList)
 {
     historyList = null;
     try
     {
         LQueryCon          lqCon = TradeConverter.ToLQuery(searchInfo, loginID);
         List <LTradeOrder> list  = TradeService.GetLTradeOrder(lqCon, "2", searchInfo.PageIndex, searchInfo.PageSize, ref pageCnt);
         historyList = list.Select(TradeConverter.ToWarehousingHistory).OrderByDescending(a => a.TradeTime).ToList();
         return(GeneralErr.Success);
     }
     catch (TimeoutException te)
     {
         FileLog.WriteLog("", Assembly.GetExecutingAssembly().GetName().Name, this.GetType().Name, new StackTrace().GetFrame(0).GetMethod().Name, te.Message); return(new ErrType(ERR.EXEPTION, ErrorText.TimeoutException));
     }
     catch (Exception ex)
     {
         FileLog.WriteLog("", Assembly.GetExecutingAssembly().GetName().Name, this.GetType().Name, new StackTrace().GetFrame(0).GetMethod().Name, ex.Message);
         return(new ErrType(ERR.EXEPTION, ErrorText.GetWarehousingRecorder));
     }
 }
        /// <summary>
        /// 撤销限价挂单
        /// </summary>
        /// <param name="loginID">登陆标识</param>
        /// <param name="userType">用户类型,0:交易用户,1:管理员,2:金商</param>
        /// <param name="orderData">要撤销的限价挂单</param>
        /// <returns>ErrType</returns>
        public ErrType RevocationPendingOrder(string loginID, int userType, PendingOrderData orderData)
        {
            try
            {
                DelHoldInfo delHoldInfo = TradeConverter.ToDelHoldInfo(loginID, userType, orderData);
                MarDelivery marDel      = TradeService.DelHoldOrder(delHoldInfo);
                if (!marDel.Result)
                {
                    return(new ErrType(ERR.SERVICE, marDel.Desc));
                }

                return(GeneralErr.Success);
            }
            catch (TimeoutException te)
            {
                FileLog.WriteLog("", Assembly.GetExecutingAssembly().GetName().Name, this.GetType().Name, new StackTrace().GetFrame(0).GetMethod().Name, te.Message);
                return(new ErrType(ERR.EXEPTION, ErrorText.TimeoutException));
            }
            catch (Exception ex)
            {
                FileLog.WriteLog("", Assembly.GetExecutingAssembly().GetName().Name, this.GetType().Name, new StackTrace().GetFrame(0).GetMethod().Name, ex.Message);
                return(new ErrType(ERR.EXEPTION, ErrorText.OperationError));
            }
        }
        /// <summary>
        /// 市价单定单
        /// </summary>
        /// <param name="loginID">登陆标识</param>
        /// <param name="clientAccountName">要下单的客户账户名</param>
        /// <param name="userType">用户类型,0:交易用户,1:管理员,2:金商</param>
        /// <param name="newOrderInfo">下单的定单信息</param>
        /// <returns>ErrType</returns>
        public ErrType MarketOrder(string loginID, string clientAccountName, int userType, NewMarketOrderInfo newOrderInfo)
        {
            try
            {
                MarOrdersLn  marOln = TradeConverter.ToMarOrdersLn(loginID, clientAccountName, userType, newOrderInfo);
                Marketorders result = TradeService.GetWXMarketorders(marOln, null);//null为临时指定,微交易管理端下单不考虑券
                if (!result.Result)
                {
                    return(new ErrType(ERR.SERVICE, result.Desc));
                }

                //这里还应进行账户资金方面的处理
                return(GeneralErr.Success);
            }
            catch (TimeoutException te)
            {
                FileLog.WriteLog("", Assembly.GetExecutingAssembly().GetName().Name, this.GetType().Name, new StackTrace().GetFrame(0).GetMethod().Name, te.Message); return(new ErrType(ERR.EXEPTION, ErrorText.TimeoutException));
            }
            catch (Exception ex)
            {
                FileLog.WriteLog("", Assembly.GetExecutingAssembly().GetName().Name, this.GetType().Name, new StackTrace().GetFrame(0).GetMethod().Name, ex.Message);
                return(new ErrType(ERR.EXEPTION, ErrorText.OperationError));
            }
        }