public CDBTurnoverFee CalcFeeFromTrunOver(decimal inpTurnover)
        {
            CDBTurnoverFee dBTurnoverFee = null;

            int i = _lstTurnOverFeeDep.Count - 1;

            do
            {
                dBTurnoverFee = _lstTurnOverFeeDep[i];
            }while (i-- >= 0 && inpTurnover <= dBTurnoverFee.turnover);

            return(dBTurnoverFee.Copy());
        }
        public void UpdateFeeTurnoverCoefs()
        {
            List <CDBTurnoverFee> lstDbFeesToUpdate = new List <CDBTurnoverFee>();

            //iterate turnovers
            _lstTurnOvers.ForEach(el =>
            {
                CDBTurnoverFee dbTrn = CalcFeeFromTrunOver(el.turnover);
                //find accountTradeId in accounts
                foreach (var kvp in AccountsTrade)
                {
                    if (kvp.Key == el.account_trade_Id)
                    {
                        bool bChanged = false;
                        if (kvp.Value.proc_fee_turnover_limit != dbTrn.proc_fee_turnover_limit)
                        {
                            Log(String.Format("accountTradeId={0} change proc_fee_turnover_limit {1} => {2}",
                                              kvp.Key,
                                              kvp.Value.proc_fee_turnover_limit,
                                              dbTrn.proc_fee_turnover_limit));

                            kvp.Value.proc_fee_turnover_limit = dbTrn.proc_fee_turnover_limit;

                            bChanged = true;
                        }

                        if (kvp.Value.proc_fee_turnover_market != dbTrn.proc_fee_turnover_market)
                        {
                            Log(String.Format("accountTradeId={0} change proc_fee_turnover_market {1} => {2}",
                                              kvp.Key,
                                              kvp.Value.proc_fee_turnover_market,
                                              dbTrn.proc_fee_turnover_market));

                            kvp.Value.proc_fee_turnover_market = dbTrn.proc_fee_turnover_market;

                            bChanged = true;
                        }



                        if (bChanged)
                        {
                            kvp.Value.proc_fee_turnover_limit  = dbTrn.proc_fee_turnover_limit;
                            kvp.Value.proc_fee_turnover_market = dbTrn.proc_fee_turnover_market;

                            dbTrn.account_money_id = kvp.Key;

                            lstDbFeesToUpdate.Add(dbTrn);

                            break;
                        }
                    }
                }
            }
                                  );

            if (lstDbFeesToUpdate.Count > 0)
            {
                DBCommunicator.UpdateTradersFeeProc(lstDbFeesToUpdate);
            }
        }