/// <summary> /// Инициализация потоков исторических данных /// </summary> /// <param name="insID">Инструмент</param> public void InitInsStores(int insID) { var isNewTran = _storage.BeginTransaction(); try { foreach (var tf in _tfs) { var insStore = _insStoreDA.GetInsStore(insID, tf); if (insStore == null) { int insStoreID = _insStoreDA.CreateInsStore(insID, tf, true); insStore = _insStoreDA.GetInsStoreByID(insStoreID); } BarRow bars = new BarRow(tf, insStore.InsID); _insStore_barRow.Add(insStore, bars); if (!_insID_barRows.ContainsKey(insID)) { _insID_barRows.Add(insStore.InsID, new List <BarRow>()); } _insID_barRows[insID].Add(bars); } _storage.Commit(isNewTran); } catch (Exception ex) { _storage.Rollback(isNewTran); _logger.AddException("InsStoreBL:CreateInsStore", ex); } }
/// <summary> /// Создать объект InsStore, если не существует /// </summary> /// <param name="insID">Инструмент</param> /// <param name="tf">ТФ</param> /// <returns>InsStore</returns> public CommonData.InsStore CreateInsStore(int insID, Timeframes tf) { var insStore = _insStoreDA.GetInsStore(insID, tf); if (insStore == null) { int insStoreID = _insStoreDA.CreateInsStore(insID, tf, true); insStore = _insStoreDA.GetInsStoreByID(insStoreID); } return(insStore); }