private bool TryApplyTransaction() { TransactionManagerProxy proxyForTM = new TransactionManagerProxy(); //Zapocni transakciju i prijavi se na nju bool pom = false; while (!pom) { pom = proxyForTM.StartEnlist(); } proxyForTM.Enlist(); //Posalji Scadi i CEu novi model NMSSCADAProxy proxyForScada = new NMSSCADAProxy(); NMSCalculationEngineProxy proxyForCE = new NMSCalculationEngineProxy(); bool success = false; if (proxyForScada.ModelUpdate(affectedEntities)) { success = true; } if (proxyForCE.ModelUpdate(affectedEntities)) { success = true; } proxyForTM.EndEnlist(success); try { var instance = NMSServiceBus.StartInstance().GetAwaiter().GetResult(); var dtos = DtoConverter.Convert(networkDataModelCopy); var command = new ModelUpdateCommand(dtos); instance.Send(command).ConfigureAwait(false).GetAwaiter().GetResult(); } catch { } return(success); }
public void EnList() { TransactionManagerProxy proxyForTM = new TransactionManagerProxy(); proxyForTM.Enlist(); }