/*
         * public bool IsOrderFromPrevSession(CRawUserDeal rd)
         * {
         *   try
         *   {
         *       long OrderId = 0;
         *
         *       if (rd.Ext_id_buy != 0)
         *           OrderId = rd.Id_ord_buy;
         *       else if (rd.Ext_id_sell != 0)
         *           OrderId = rd.Id_ord_sell;
         *
         *
         *       string isin = Instruments.GetInstrumentByIsinId(rd.Isin_Id); //DictIsin_id[rd.Isin_Id];
         *
         *       UserOrderBox.mxListRawOrders.WaitOne();
         *
         *       foreach (CRawOrdersLogStruct rols in UserOrderBox.ListRawOrdersStruct)
         *           if (rols.Id_ord == OrderId && rols.Moment < SessionBox.CurrentSession.SessionBegin)
         *           {
         *               UserOrderBox.mxListRawOrders.ReleaseMutex();
         *               return true;
         *
         *           }
         *
         *
         *       UserOrderBox.mxListRawOrders.ReleaseMutex();
         *   }
         *   catch (Exception e)
         *   {
         *       Error("IsOrderFromPrevSession", e);
         *   }
         *
         *
         *   return false; ;
         * }
         */



        /// <summary>
        /// Call from native
        /// </summary>
        /// <param name="isinId"></param>
        /// <param name="sourceStock"></param>
        public void UpdateInpStocks(long isinId, ref CSharedStocks sourceStock)
        {
            string instrument = Instruments.GetInstrumentByIsinId(isinId);

            //TODO normal
            while (SnapshoterStock == null)
            {
                Thread.Sleep(100);
            }

            if (instrument != "")
            {
                //	 SnapshoterStock.UpdateInpStocks(instrument, ref sourceStock);

                StockBoxP2.UpdateStockFromNative(instrument, ref sourceStock);
            }

            EvStockOnline.Set();
            //var s = StockBoxInp.S

            // if (stockConv != null)
            //   Thread.Sleep(0);
        }