/// <summary> /// Синхронизация позиций по деньгам /// </summary> /// <param name="localAccountID">Локальный AccountID</param> /// <param name="remoteAccountID">Удаленный AccountID</param> private async Task SyncCash(ISyncPipeServer sps, int localAccountID, int remoteAccountID) { var remCash = await sps.GetCash(remoteAccountID); if (remCash == null) { return; } if (remCash == null) { return; } var cash = _accountDA.GetCash(localAccountID); if (cash == null) { _accountDA.CreateCash(localAccountID, remCash.Initial, remCash.Current, remCash.Sell, remCash.Buy, remCash.SellComm, remCash.BuyComm); } else { bool isUpdate = false; if (cash.Buy != remCash.Buy) { cash.Buy = remCash.Buy; isUpdate = true; } if (cash.BuyComm != remCash.BuyComm) { cash.BuyComm = remCash.BuyComm; isUpdate = true; } if (cash.Sell != remCash.Sell) { cash.Sell = remCash.Sell; isUpdate = true; } if (cash.SellComm != remCash.SellComm) { cash.SellComm = remCash.SellComm; isUpdate = true; } if (cash.Current != remCash.Current) { cash.Current = remCash.Current; isUpdate = true; } if (cash.Initial != remCash.Initial) { cash.Initial = remCash.Initial; isUpdate = true; } if (isUpdate) { _accountDA.UpdateCash(cash); } } }