Exemplo n.º 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);
        }
Exemplo n.º 2
0
        //+------------------------------------------------------------------+
        //|                                                                  |
        //+------------------------------------------------------------------+
        private void OnBnClickedButtonGetdeals(object sender = null, EventArgs e = null)
        {
            CIMTDealArray deal_array = null;
            CIMTDeal      deal       = null;
            UInt64        login      = 0;
            DateTime      from       = m_From.Value;
            DateTime      to         = m_To.Value;
            string        stype      = string.Empty;

            //--- user login
            UInt64.TryParse(m_User.Text, out login);
            //--- get deal array
            if (!m_manager.GetUserDeal(out deal_array, login, from, to))
            {
                //--- clear list
                m_List.Items.Clear();
                //---
                MessageBox.Show("Get user deal fail", "ERROR", MessageBoxButtons.OK, MessageBoxIcon.Error);
                return;
            }
            //--- clear list
            m_List.Items.Clear();
            //--- for all deal in array
            for (uint i = 0; i < deal_array.Total(); i++)
            {
                //--- get deal
                deal = deal_array.Next(i);
                //--- check error
                if (deal == null)
                {
                    break;
                }
                //--- check action
                switch ((CIMTDeal.EnDealAction)deal.Action())
                {
                case CIMTDeal.EnDealAction.DEAL_BALANCE:
                    stype = "Balance";
                    break;

                case CIMTDeal.EnDealAction.DEAL_CREDIT:
                    stype = "Credit";
                    break;

                case CIMTDeal.EnDealAction.DEAL_CHARGE:
                    stype = "Charge";
                    break;

                case CIMTDeal.EnDealAction.DEAL_CORRECTION:
                    stype = "Correction";
                    break;

                case CIMTDeal.EnDealAction.DEAL_BONUS:
                    stype = "Bonus";
                    break;

                case CIMTDeal.EnDealAction.DEAL_COMMISSION:
                    stype = "Commission";
                    break;

                default:
                    //--- skip other actions
                    continue;
                }
                //---
                string stime = SMTTime.ToDateTime(deal.Time()).ToString("yyyy.MM.dd HH:mm:ss.fff");
                //--- insert item
                string[] row = { deal.Deal().ToString(), stype, deal.Profit().ToString() };
                var      it  = m_List.Items.Insert(0, stime);
                it.SubItems.AddRange(row);
                m_List.EnsureVisible(0);
                m_List.Update();
            }
        }