Exemplo n.º 1
0
        ///////////////////////////////////////////////
        public CResultAErreur BeginTrans(System.Data.IsolationLevel isolationLevel)
        {
            ArrayList      lstStarted = new ArrayList();
            CResultAErreur result     = CResultAErreur.True;

            if (SessionPourTransactions != this)
            {
                return(SessionPourTransactions.BeginTrans(isolationLevel));
            }
            foreach (IFournisseurServiceTransactionPourSession fournisseur in m_listeFournisseursTransaction)
            {
                IServiceTransactions service = fournisseur.GetServiceTransaction(IdSession);
                if (service.AccepteTransactionsImbriquees || m_nNbTransactions == 0)
                {
                    result = service.BeginTrans(isolationLevel);
                    if (!result)
                    {
                        foreach (IServiceTransactions serviceFait in lstStarted)
                        {
                            serviceFait.RollbackTrans();
                        }
                        return(result);
                    }
                    else
                    {
                        lstStarted.Add(service);
                    }
                }
            }
            m_nNbTransactions++;
            return(result);
        }
Exemplo n.º 2
0
        ///////////////////////////////////////////////
        public CResultAErreur CommitTrans()
        {
            CResultAErreur result = CResultAErreur.True;

            if (SessionPourTransactions != this)
            {
                return(SessionPourTransactions.CommitTrans());
            }
            foreach (IFournisseurServiceTransactionPourSession fournisseur in m_listeFournisseursTransaction)
            {
                IServiceTransactions service = fournisseur.GetServiceTransaction(IdSession);
                if (m_nNbTransactions == 1 || service.AccepteTransactionsImbriquees)
                {
                    result = service.CommitTrans();
                }
                if (!result)
                {
                    return(result);
                }
            }
            m_nNbTransactions--;
            return(result);
        }
Exemplo n.º 3
0
 /// <summary>
 /// Initializes a new instance of the <see cref="T:Gnb.BusinessMen.Api.Controllers.TransactionsController"/> class.
 /// </summary>
 /// <param name="serviceTransactions">Service transactions.</param>
 public TransactionsController(IServiceTransactions serviceTransactions, ILogger <TransactionsController> logger)
 {
     this.serviceTransactions = serviceTransactions;
     this._logger             = logger;
 }