当前位置: 首页>>代码示例>>C#>>正文


C# TransactionStatus类代码示例

本文整理汇总了C#中TransactionStatus的典型用法代码示例。如果您正苦于以下问题:C# TransactionStatus类的具体用法?C# TransactionStatus怎么用?C# TransactionStatus使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。


TransactionStatus类属于命名空间,在下文中一共展示了TransactionStatus类的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。

示例1: Success_ReturnsCorrectResult

        internal void Success_ReturnsCorrectResult(TransactionStatus transactionStatus, bool statusSuccess, bool expected)
        {
            Status status = Factory.CreateStatus(statusSuccess);

            CreditResult creditResult = new CreditResult { Status = status, TransactionStatus = transactionStatus };
            Assert.AreEqual(expected, creditResult.Success);
        }
开发者ID:Amulius112,项目名称:PayEx.EPi.Commerce.Payment,代码行数:7,代码来源:CreditResultTests.cs

示例2: InvokeOutcomeFunction

 private void InvokeOutcomeFunction(TransactionStatus status)
 {
     WeakReference weakRealTransaction = null;
     lock (this)
     {
         if (this.haveIssuedOutcome)
         {
             return;
         }
         this.haveIssuedOutcome = true;
         this.savedStatus = status;
         weakRealTransaction = this.weakRealTransaction;
     }
     if (weakRealTransaction != null)
     {
         RealOletxTransaction target = weakRealTransaction.Target as RealOletxTransaction;
         if (target != null)
         {
             target.FireOutcome(status);
             if (target.phase0EnlistVolatilementContainerList != null)
             {
                 foreach (OletxPhase0VolatileEnlistmentContainer container in target.phase0EnlistVolatilementContainerList)
                 {
                     container.OutcomeFromTransaction(status);
                 }
             }
             if (((TransactionStatus.Aborted == status) || (TransactionStatus.InDoubt == status)) && (target.phase1EnlistVolatilementContainer != null))
             {
                 target.phase1EnlistVolatilementContainer.OutcomeFromTransaction(status);
             }
         }
         weakRealTransaction.Target = null;
     }
 }
开发者ID:pritesh-mandowara-sp,项目名称:DecompliedDotNetLibraries,代码行数:34,代码来源:OutcomeEnlistment.cs

示例3: Success_ReturnsCorrectResult

        public void Success_ReturnsCorrectResult(TransactionStatus transactionStatus, bool statusSuccess, bool expected)
        {
            Status status = Factory.CreateStatus(statusSuccess);

            CompleteResult completeResult = new CompleteResult { Status = status, TransactionStatus = transactionStatus };
            Assert.AreEqual(expected, completeResult.Success);
        }
开发者ID:Amulius112,项目名称:PayEx.EPi.Commerce.Payment,代码行数:7,代码来源:CompleteResultTests.cs

示例4: Run

        // TODO: Issue #10353 - These variations need to be added once we have promotion support.
        /*
        [InlineData(CloneType.Normal, true, true, TransactionStatus.Committed)]
        [InlineData(CloneType.Normal, IsolationLevel.RepeatableRead, false, false, TransactionStatus.Committed)]
        [InlineData(CloneType.Normal, IsolationLevel.ReadCommitted, false, false, TransactionStatus.Committed)]
        [InlineData(CloneType.Normal, IsolationLevel.ReadUncommitted, false, false, TransactionStatus.Committed)]
        [InlineData(CloneType.Normal, IsolationLevel.Snapshot, false, false, TransactionStatus.Committed)]
        [InlineData(CloneType.Normal, IsolationLevel.Chaos, false, false, TransactionStatus.Committed)]
        [InlineData(CloneType.Normal, IsolationLevel.Unspecified, false, false, TransactionStatus.Committed)]
        [InlineData(CloneType.BlockingDependent, IsolationLevel.Serializable, true, true, TransactionStatus.Committed)]
        [InlineData(CloneType.BlockingDependent, IsolationLevel.RepeatableRead, true, true, TransactionStatus.Committed)]
        [InlineData(CloneType.BlockingDependent, IsolationLevel.ReadCommitted, true, true, TransactionStatus.Committed)]
        [InlineData(CloneType.BlockingDependent, IsolationLevel.ReadUncommitted, true, true, TransactionStatus.Committed)]
        [InlineData(CloneType.BlockingDependent, IsolationLevel.Snapshot, true, true, TransactionStatus.Committed)]
        [InlineData(CloneType.BlockingDependent, IsolationLevel.Chaos, true, true, TransactionStatus.Committed)]
        [InlineData(CloneType.BlockingDependent, IsolationLevel.Unspecified, true, true, TransactionStatus.Committed)]
        [InlineData(CloneType.RollbackDependent, IsolationLevel.Serializable, true, true, TransactionStatus.Committed)]
        [InlineData(CloneType.RollbackDependent, IsolationLevel.RepeatableRead, true, true, TransactionStatus.Committed)]
        [InlineData(CloneType.RollbackDependent, IsolationLevel.ReadCommitted, true, true, TransactionStatus.Committed)]
        [InlineData(CloneType.RollbackDependent, IsolationLevel.ReadUncommitted, true, true, TransactionStatus.Committed)]
        [InlineData(CloneType.RollbackDependent, IsolationLevel.Snapshot, true, true, TransactionStatus.Committed)]
        [InlineData(CloneType.RollbackDependent, IsolationLevel.Chaos, true, true, TransactionStatus.Committed)]
        [InlineData(CloneType.RollbackDependent, IsolationLevel.Unspecified, true, true, TransactionStatus.Committed)]
        */
        public void Run(CloneType cloneType, IsolationLevel isoLevel, bool forcePromote, bool completeClone, TransactionStatus expectedStatus )
        {
            TransactionOptions options = new TransactionOptions
            {
                IsolationLevel = isoLevel,
                // Shorten the delay before a timeout for blocking clones.
                Timeout = TimeSpan.FromSeconds(1)
            };

            CommittableTransaction tx = new CommittableTransaction(options);

            Transaction clone;
            switch (cloneType)
            {
                case CloneType.Normal:
                    {
                        clone = tx.Clone();
                        break;
                    }
                case CloneType.BlockingDependent:
                    {
                        clone = tx.DependentClone(DependentCloneOption.BlockCommitUntilComplete);
                        break;
                    }
                case CloneType.RollbackDependent:
                    {
                        clone = tx.DependentClone(DependentCloneOption.RollbackIfNotComplete);
                        break;
                    }
                default:
                    {
                        throw new Exception("Unexpected CloneType - " + cloneType.ToString());
                    }
            }

            if (forcePromote)
            {
                HelperFunctions.PromoteTx(tx);
            }

            Assert.Equal(clone.IsolationLevel, tx.IsolationLevel);
            Assert.Equal(clone.TransactionInformation.Status, tx.TransactionInformation.Status);
            Assert.Equal(clone.TransactionInformation.LocalIdentifier, tx.TransactionInformation.LocalIdentifier);
            Assert.Equal(clone.TransactionInformation.DistributedIdentifier, tx.TransactionInformation.DistributedIdentifier);

            CommittableTransaction cloneCommittable = clone as CommittableTransaction;
            Assert.Null(cloneCommittable);

            try
            {
                tx.Commit();
            }
            catch (TransactionAbortedException)
            {
                Assert.Equal(expectedStatus, TransactionStatus.Aborted);
            }

            Assert.Equal(expectedStatus, tx.TransactionInformation.Status);
        }
开发者ID:krytarowski,项目名称:corefx,代码行数:83,代码来源:CloneTxTests.cs

示例5: Constructor_Empty

        public void Constructor_Empty()
        {
            var actual = new TransactionStatus();

            Assert.AreEqual(TransactionStatusCode.NotExecuted, actual.StatusCode);
            Assert.AreEqual("", actual.ErrorMessage);
            Assert.AreEqual("", actual.TransactionInfo);
        }
开发者ID:hogberg43,项目名称:App,代码行数:8,代码来源:TransactionStatusTests.cs

示例6: GetAllOutgoingSingleCredit

 public IList<OutgoingSingleCredit> GetAllOutgoingSingleCredit(TransactionStatus transactionStatus)
 {
     using (var db = new RTGSGen2DBContext(connectionString))
     {
         IList<OutgoingSingleCredit> outgoingSingleCreditList = db.GetAllOutgoingSingleCredit().ToList();
         return outgoingSingleCreditList
                 .Where(o => o.Status == transactionStatus.ToString()).ToList();
     }
 }
开发者ID:agimassardi,项目名称:RTGSGen2Interface,代码行数:9,代码来源:OutgoingSingleCreditRepository.cs

示例7: Document

 /// <summary>
 /// 
 /// </summary>
 /// <param name="documentName">the name of the Document</param>
 protected Document(string documentName)
 {
     this.documentName = documentName;
     //this.hasNoTransactionStatus = true;
     this.hasNoLogStatus = true;
     this.status = TransactionStatus.Success;
     this.message = "";
     this.properties = new Dictionary<string, Property>();
     this.collections = new Dictionary<string, DocumentCollection>();
 }
开发者ID:Sage,项目名称:SData-Contracts,代码行数:14,代码来源:Document.cs

示例8: TransactionInfo

 public TransactionInfo(Guid txnJobId, TransactionStatus txnStatus, TransactionType txnType, ulong dataStart, ulong dataLength, DateTime txnStartTime)
 {
     VersionNumber = 1;
     JobId = txnJobId;
     TransactionStatus = txnStatus;
     TransactionType = txnType;
     DataStartPosition = dataStart;
     DataLength = dataLength;
     TransactionStartTime = txnStartTime.ToUniversalTime();
 }
开发者ID:Garwin4j,项目名称:BrightstarDB,代码行数:10,代码来源:TransactionInfo.cs

示例9: CreateServerResponseString

        /// <summary>
        /// Creates a response message confirming delivery of transaction result
        /// </summary>
        /// <param name="status">Result of delivery (note this is to confirm that you have received the result, not the result itself)</param>
        /// <param name="message">Optional message for example, any exceptions that may have occurred</param>
        /// <returns>String</returns>
        public string CreateServerResponseString(TransactionStatus status, string message = "")
        {
            var response = new NameValueCollection();
            response.Add("StatusCode", (int)status);
            if (!string.IsNullOrEmpty(message)) {
                response.Add("Message", message);
            }

            return response.ToQueryString();
        }
开发者ID:dineshkummarc,项目名称:cardsavedotnet,代码行数:16,代码来源:HostedPaymentProcessor.cs

示例10: OletxVolatileEnlistment

 internal OletxVolatileEnlistment(IEnlistmentNotificationInternal enlistmentNotification, EnlistmentOptions enlistmentOptions, OletxTransaction oletxTransaction) : base(null, oletxTransaction)
 {
     this.iEnlistmentNotification = enlistmentNotification;
     this.enlistDuringPrepareRequired = (enlistmentOptions & EnlistmentOptions.EnlistDuringPrepareRequired) != EnlistmentOptions.None;
     this.container = null;
     this.pendingOutcome = TransactionStatus.Active;
     if (DiagnosticTrace.Information)
     {
         EnlistmentTraceRecord.Trace(System.Transactions.SR.GetString("TraceSourceOletx"), base.InternalTraceIdentifier, EnlistmentType.Volatile, enlistmentOptions);
     }
 }
开发者ID:pritesh-mandowara-sp,项目名称:DecompliedDotNetLibraries,代码行数:11,代码来源:OletxVolatileEnlistment.cs

示例11: Constructor_DataTableWithColumnsButBadRows

        public void Constructor_DataTableWithColumnsButBadRows()
        {
            // Arrange
            var dt = new DataTable();
            dt.Columns.Add(new DataColumn("ErrorCode"));
            dt.Columns.Add(new DataColumn("ErrorMessage"));
            dt.Columns.Add(new DataColumn("TransactionInfo"));

            var test = new TransactionStatus(dt);
            Assert.IsNotNull(test);
        }
开发者ID:hogberg43,项目名称:App,代码行数:11,代码来源:TransactionStatusTests.cs

示例12: SetExchangeStatus

        public Result<List<CreditTransaction>> SetExchangeStatus(IDbConnection db, string orderId, TransactionStatus newStatus)
        {
            // TODO
            // Step 1: Find and Update CoinTransaction 's status to "failure"
            // Step 2: If not found, try on FreeCoinTransaction. Status to "failure"

            // Step 3: CreditTransaction status also mark as "failure"




            // TEST //
            return Result<List<CreditTransaction>>.Null();
        }
开发者ID:vietplayfuri,项目名称:Asp_Master,代码行数:14,代码来源:Transaction-Query.cs

示例13: InDoubt

 internal void InDoubt()
 {
     OletxVolatileEnlistmentState active = OletxVolatileEnlistmentState.Active;
     IEnlistmentNotificationInternal iEnlistmentNotification = null;
     lock (this)
     {
         if (OletxVolatileEnlistmentState.Prepared == this.state)
         {
             active = this.state = OletxVolatileEnlistmentState.InDoubt;
             iEnlistmentNotification = this.iEnlistmentNotification;
         }
         else
         {
             if (OletxVolatileEnlistmentState.Preparing == this.state)
             {
                 this.pendingOutcome = TransactionStatus.InDoubt;
             }
             active = this.state;
         }
     }
     if (OletxVolatileEnlistmentState.InDoubt == active)
     {
         if (iEnlistmentNotification != null)
         {
             if (DiagnosticTrace.Verbose)
             {
                 EnlistmentNotificationCallTraceRecord.Trace(System.Transactions.SR.GetString("TraceSourceOletx"), base.InternalTraceIdentifier, NotificationCall.InDoubt);
             }
             iEnlistmentNotification.InDoubt(this);
             return;
         }
         if (DiagnosticTrace.Critical)
         {
             InternalErrorTraceRecord.Trace(System.Transactions.SR.GetString("TraceSourceOletx"), "");
         }
         throw new InvalidOperationException(System.Transactions.SR.GetString("InternalError"));
     }
     if ((OletxVolatileEnlistmentState.Preparing != active) && (OletxVolatileEnlistmentState.Done != active))
     {
         if (DiagnosticTrace.Critical)
         {
             InternalErrorTraceRecord.Trace(System.Transactions.SR.GetString("TraceSourceOletx"), "");
         }
         throw new InvalidOperationException(System.Transactions.SR.GetString("InternalError"));
     }
 }
开发者ID:pritesh-mandowara-sp,项目名称:DecompliedDotNetLibraries,代码行数:46,代码来源:OletxVolatileEnlistment.cs

示例14: TwoPhaseDurable

        public void TwoPhaseDurable(int volatileCount, EnlistmentOptions volatileEnlistmentOption, EnlistmentOptions durableEnlistmentOption, Phase1Vote volatilePhase1Vote, Phase1Vote durablePhase1Vote, bool commit, EnlistmentOutcome expectedVolatileOutcome, EnlistmentOutcome expectedDurableOutcome, TransactionStatus expectedTxStatus)
        {
            Transaction tx = null;
            try
            {
                using (TransactionScope ts = new TransactionScope())
                {
                    tx = Transaction.Current.Clone();

                    if (volatileCount > 0)
                    {
                        TestEnlistment[] volatiles = new TestEnlistment[volatileCount];
                        for (int i = 0; i < volatileCount; i++)
                        {
                            // It doesn't matter what we specify for SinglePhaseVote.
                            volatiles[i] = new TestEnlistment(volatilePhase1Vote, expectedVolatileOutcome);
                            tx.EnlistVolatile(volatiles[i], volatileEnlistmentOption);
                        }
                    }

                    TestEnlistment durable = new TestEnlistment(Phase1Vote.Prepared, expectedDurableOutcome);
                    // TODO: Issue #10353 - This needs to change once we have promotion support.
                    Assert.Throws<PlatformNotSupportedException>(() => // Creation of two phase durable enlistment attempts to promote to MSDTC
                    {
                        tx.EnlistDurable(Guid.NewGuid(), durable, durableEnlistmentOption);
                    });

                    if (commit)
                    {
                        ts.Complete();
                    }
                }
            }
            catch (TransactionInDoubtException)
            {
                Assert.Equal(expectedTxStatus, TransactionStatus.InDoubt);
            }
            catch (TransactionAbortedException)
            {
                Assert.Equal(expectedTxStatus, TransactionStatus.Aborted);
            }

            Assert.NotNull(tx);
            Assert.Equal(expectedTxStatus, tx.TransactionInformation.Status);
        }
开发者ID:geoffkizer,项目名称:corefx,代码行数:45,代码来源:LTMEnlistmentTests.cs

示例15: GetFreeCoinTransaction

        public Result<FreeCoinTransaction> GetFreeCoinTransaction(IDbConnection db, string orderId, TransactionStatus? statusFilter = null)
        {
            var trans = db.Query<FreeCoinTransaction>("SELECT * FROM free_coin_transaction WHERE [email protected]", new { orderId }).FirstOrDefault();
            if (trans == null)
                return Result<FreeCoinTransaction>.Null(ErrorCodes.InvalidTransactionId);

            if (statusFilter.HasValue)
            {
                if (statusFilter.Value.ToString() != trans.status)
                {
                    bool accepted = (trans.status == ConstantValues.S_ACCEPTED);
                    return Result<FreeCoinTransaction>.Null(accepted ? ErrorCodes.TransactionAlreadyProcessed : ErrorCodes.TransactionNotFound);
                }
            }

            // TODO: Need a collection data structure in FreeCoinTransaction to hold packages //
            return Result<FreeCoinTransaction>.Make(trans);
        }
开发者ID:vietplayfuri,项目名称:Asp_Master,代码行数:18,代码来源:Transaction-Query.cs


注:本文中的TransactionStatus类示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。