Example #1
0
        //+------------------------------------------------------------------+
        //| Get array of dealer balance operation                            |
        //+------------------------------------------------------------------+
        public bool GetUserDeal(out CIMTDealArray deals, UInt64 login, DateTime time_from, DateTime time_to)
        {
            deals = null;
            //--- request array
            MTRetCode res = m_manager.DealRequest(login, SMTTime.FromDateTime(time_from), SMTTime.FromDateTime(time_to), m_deal_array);

            if (res != MTRetCode.MT_RET_OK)
            {
                m_manager.LoggerOut(EnMTLogCode.MTLogErr, "DealRequest fail({0})", res);
                return(false);
            }
            //---
            deals = m_deal_array;
            return(true);
        }
Example #2
0
        //return list of all Deals at given UserLogin
        public List <CIMTDeal> GetAllDeals(ulong UserLogin, out MTRetCode requestResult, DateTime StartDate, DateTime EndDate)
        {
            List <CIMTDeal> result = new List <CIMTDeal>();

            requestResult = MTRetCode.MT_RET_ERROR;
            if (!CheckIfMannagerWorks())
            {
                return(result);
            }

            DateTime ZeroDate    = new DateTime(1970, 1, 1);
            long     startSecond = (long)(StartDate - ZeroDate).TotalSeconds;
            long     stopSecond  = (long)(EndDate - ZeroDate).TotalSeconds;

            try
            {
                var dealsList = m_manager.DealCreateArray();
                //requestResult = m_manager.DealRequest(UserLogin, 1, 3153600000, dealsList);
                requestResult = m_manager.DealRequest(UserLogin, startSecond, stopSecond, dealsList);

                if (requestResult == MTRetCode.MT_RET_OK)
                {
                    var realdeal = dealsList.ToArray();
                    foreach (var actDeal in realdeal)
                    {
                        result.Add(actDeal);
                    }
                }
                else
                {
                    LogOut($"Error getting Deals for user: user_Login={UserLogin} error msg={requestResult}");
                }
            }
            catch (Exception ex)
            {
                LogOut($"Error getting Deals for user: user_Login={UserLogin} error msg={ex}");
            }

            return(result);
        }