• 设为首页
  • 点击收藏
  • 手机版
    手机扫一扫访问
    迪恩网络手机版
  • 关注官方公众号
    微信扫一扫关注
    公众号

C# Transactions.TransactionOptions类代码示例

原作者: [db:作者] 来自: [db:来源] 收藏 邀请

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



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

示例1: GuardarAsignaciones

        public void GuardarAsignaciones(IList<int> ordenesVenta, IList<Usuario> asistentes)
        {
            try
            {
                var transactionOptions = new TransactionOptions { IsolationLevel = IsolationLevel.ReadUncommitted };

                using (var transactionScope = new TransactionScope(TransactionScopeOption.Required, transactionOptions))
                {
                    foreach (var idOrdenVenta in ordenesVenta)
                    {
                        var ordenVenta = _orderVentaDA.ObtenerPorID(idOrdenVenta);

                        var asistenteConMenorCarga = asistentes.OrderBy(p => p.CantidadOV).FirstOrDefault();

                        if (asistenteConMenorCarga != null)
                        {
                            asistenteConMenorCarga.CantidadOV++;

                            ordenVenta.Estado = Constantes.EstadoOrdenVenta.Asignado;
                            ordenVenta.AsistentePlaneamiento = asistenteConMenorCarga;

                            _orderVentaDA.AsignarAsistentePlaneamiento(ordenVenta);
                        }
                    }

                    transactionScope.Complete();
                }
            }
            catch (Exception ex)
            {
                throw ThrowException(ex, MethodBase.GetCurrentMethod().Name);
            }
        }
开发者ID:steel-framing,项目名称:metal-forming,代码行数:33,代码来源:OrdenVentaBL.cs


示例2: JobEntity

 private static WaitCallback JobEntity(TransactionOptions options)
 {
     return state =>
         {
             try
             {
                 using (var scope = new TransactionScope(TransactionScopeOption.RequiresNew, options))
                 {
                     using (var context = new ProjectTemplate_DevEntities())
                     {
                         var element = context.Element.First(d => d.Id == "d0530ea7-639f-4d5e-91fb-1a4fed1debfe");
                         var intInternalName = Int32.Parse(element.InternalName);
                         PrintMessage("ReadValue=" + intInternalName.ToString());
                         element.InternalName = (intInternalName + 1).ToString();
                         PrintMessage("Incrementing to" + element.InternalName);
                         Thread.Sleep(2000);
                         context.SaveChanges(); // Save changes to DB
                         PrintMessage("Saving");
                         Thread.Sleep(2000);
                     }
                     scope.Complete(); // Commit transaction
                     PrintMessage("Commit");
                 }
             }
             catch (Exception e)
             {
                 PrintMessage( e.Message);
             }finally
             {
                 ((ManualResetEvent)state).Set();
             }
         };
 }
开发者ID:rodrijp,项目名称:TransactionOptions,代码行数:33,代码来源:Program.cs


示例3: MsmqScopeOptions

        public MsmqScopeOptions(TimeSpan? requestedTimeout = null, IsolationLevel? requestedIsolationLevel = null)
        {
            var timeout = TransactionManager.DefaultTimeout;
            var isolationLevel = IsolationLevel.ReadCommitted;
            if (requestedTimeout.HasValue)
            {
                var maxTimeout = GetMaxTimeout();

                if (requestedTimeout.Value > maxTimeout)
                {
                    throw new ConfigurationErrorsException(
                        "Timeout requested is longer than the maximum value for this machine. Override using the maxTimeout setting of the system.transactions section in machine.config");
                }

                timeout = requestedTimeout.Value;
            }

            if (requestedIsolationLevel.HasValue)
            {
                isolationLevel = requestedIsolationLevel.Value;
            }

            TransactionOptions = new TransactionOptions
            {
                IsolationLevel = isolationLevel,
                Timeout = timeout
            };
        }
开发者ID:Particular,项目名称:NServiceBus,代码行数:28,代码来源:MsmqScopeOptions.cs


示例4: Abandon

        public void Abandon(int masterSysNo, int userSysNo)
        {
            TransactionOptions options = new TransactionOptions();
            options.IsolationLevel = System.Transactions.IsolationLevel.ReadCommitted;
            options.Timeout = TransactionManager.DefaultTimeout;

            using (TransactionScope scope = new TransactionScope(TransactionScopeOption.Required, options))
            {

                //�����dz�ʼ״̬
                POInfo dbInfo = LoadPO(masterSysNo);
                if ( dbInfo == null )
                    throw new BizException("does not exist this po sysno");
                if ( dbInfo.Status != (int)AppEnum.POStatus.Origin )
                    throw new BizException("status is not origin now, abandon failed");

                //���� ���š�״̬�������
                Hashtable ht = new Hashtable(4);

                ht.Add("SysNo", masterSysNo);
                ht.Add("Status", (int)AppEnum.POStatus.Abandon);
                if ( 1!=new PODac().UpdateMaster(ht))
                    throw new BizException("expected one-row update failed, verify failed ");

                ProductIDManager.GetInstance().AbandonProductIDsByPO(masterSysNo);

                scope.Complete();
            }
        }
开发者ID:ue96,项目名称:ue96,代码行数:29,代码来源:PurchaseManager.cs


示例5: TransactionScope

		public TransactionScope (TransactionScopeOption scopeOption,
			TransactionOptions options,
			DTCOption opt)
		{
			Initialize (scopeOption, null, options, opt,
				TransactionManager.DefaultTimeout);
		}
开发者ID:Profit0004,项目名称:mono,代码行数:7,代码来源:TransactionScope.cs


示例6: AddRMA

        /// <summary>
        /// ����rma��
        /// </summary>
        /// <param name="rmaInfo"></param>
        public void AddRMA(RMAInfo rmaInfo)
        {
            TransactionOptions options = new TransactionOptions();
            options.IsolationLevel = System.Transactions.IsolationLevel.ReadCommitted;
            options.Timeout = TransactionManager.DefaultTimeout;

            using (TransactionScope scope = new TransactionScope(TransactionScopeOption.Required, options))
            {
                if(!this.IfExistOpenedRMA(rmaInfo.SOSysNo))
                {
                    Hashtable leftHash = this.GetLeftRMAQty(rmaInfo.SOSysNo);
                    foreach(RMAItemInfo item in rmaInfo.ItemHash.Values)
                    {
                        if(item.RMAQty>(int)leftHash[item.ProductSysNo])
                            throw new BizException("����д�ı�����Ʒ�����������۵���ʵ�ʹ�����������ȷ���豣�޵���Ʒ��Ϊ�˵�����");
                    }
                    rmaInfo.SysNo = SequenceDac.GetInstance().Create("RMA_Sequence");
                    rmaInfo.RMAID = this.BuildRMAID(rmaInfo.SysNo);
                    rmaInfo.SubmitInfo = this.GetRMASnapShot(rmaInfo);
                    rmaInfo.Status = (int)AppEnum.RMAStatus.Origin;
                    this.InsertMaster(rmaInfo);
                    foreach(RMAItemInfo rmaItem in rmaInfo.ItemHash.Values)
                    {
                        rmaItem.RMASysNo = rmaInfo.SysNo;
                        this.InsertItem(rmaItem);
                    }
                }
                else
                    throw new BizException("�����۵��Ѿ�����һ�ű��޵��ڴ����У�������������ύ�µı������룬����ϵORS�̳ǿͷ�");
                scope.Complete();
            }
        }
开发者ID:ue96,项目名称:ue96,代码行数:36,代码来源:RMAManager.cs


示例7: Execute

        /// Execute action
        public override object Execute()
        {
            TransactionOptions options = new TransactionOptions
                                             {
                                                 IsolationLevel = IsolationLevel,
                                                 Timeout = (Utils.ToTimeSpan(Context.TransformStr(Timeout, Transform)) ?? TimeSpan.FromSeconds(60))
                                             };

            VerboseMessage(" -- Starting transaction {0} (Isolation: {1}) --",Option,IsolationLevel);

            object ret;
            using (TransactionScope scope=new TransactionScope(Option,options))
            {
                try
                {
                    ret = base.Execute();
                    scope.Complete();
                    VerboseMessage(" -- Transaction commit --");
                }
                catch
                {
                    VerboseMessage(" -- Transaction rollback --");
                    throw;
                }
            }

            return ret;
        }
开发者ID:xsharper,项目名称:xsharper,代码行数:29,代码来源:Transaction.cs


示例8: CreateTransactionScope

 public static TransactionScope CreateTransactionScope()
 {
     var transactionOptions = new TransactionOptions();
     transactionOptions.IsolationLevel = IsolationLevel.ReadCommitted;
     transactionOptions.Timeout = TimeSpan.MaxValue;
     return new TransactionScope(TransactionScopeOption.Required, transactionOptions);
 }
开发者ID:Newbourne,项目名称:CAPITAL,代码行数:7,代码来源:TransactionUtil.cs


示例9: CreateTransactionScope

 public static TransactionScope CreateTransactionScope()
 {
     var transactionOptions = new TransactionOptions();
     transactionOptions.IsolationLevel = IsolationLevel.ReadCommitted;
     transactionOptions.Timeout = TransactionManager.MaximumTimeout;
     return new TransactionScope(TransactionScopeOption.Required, transactionOptions);
 }
开发者ID:gbsens,项目名称:Community,代码行数:7,代码来源:TransactionUtils.cs


示例10: GetTransactionOptions

 /// <summary>
 /// 获取事务隔离级别
 /// </summary>
 /// <returns></returns>
 public static TransactionOptions GetTransactionOptions()
 {
     TransactionOptions transactionOptions = new TransactionOptions();
         switch (ConfigurationManager.AppSettings["IsolationLevel"].ToString())
         {
             case "Chaos":
                 transactionOptions.IsolationLevel = IsolationLevel.Chaos;
                 break;
             case "ReadCommitted":
                 transactionOptions.IsolationLevel = IsolationLevel.ReadCommitted;
                 break;
             case "ReadUncommitted":
                 transactionOptions.IsolationLevel = IsolationLevel.ReadUncommitted;
                 break;
             case "RepeatableRead":
                 transactionOptions.IsolationLevel = IsolationLevel.RepeatableRead;
                 break;
             case "Serializable":
                 transactionOptions.IsolationLevel = IsolationLevel.Serializable;
                 break;
             case "Snapshot":
                 transactionOptions.IsolationLevel = IsolationLevel.Snapshot;
                 break;
             case "Unspecified":
                 transactionOptions.IsolationLevel = IsolationLevel.Unspecified;
                 break;
             default:
                 transactionOptions.IsolationLevel = IsolationLevel.ReadCommitted;
                 break;
         }
     return transactionOptions;
 }
开发者ID:loozhang,项目名称:WebApplication3---copy,代码行数:36,代码来源:PublicMethod.cs


示例11: CommendCustomerEmailVerified

        public void CommendCustomerEmailVerified(int CustomerSysNo,string CommendEmail)
        {
            TransactionOptions options = new TransactionOptions();
            options.IsolationLevel = System.Transactions.IsolationLevel.ReadCommitted;
            options.Timeout = TransactionManager.DefaultTimeout;

            using (TransactionScope scope = new TransactionScope(TransactionScopeOption.Required, options))
            {
                CustomerCommendInfo oInfo = LoadCustomerCommend(CommendEmail);
                if(oInfo == null)
                    throw new BizException("");
                decimal increment = 5; //�Ƽ��ĺ���ͨ��Email��֤����5���˷�
                int rowsAffected = new FreeShipFeeDac().SetFreeShipFee(CustomerSysNo, increment);
                if (rowsAffected != 1)
                    throw new BizException("�ͻ��˷�������ʧ�ܣ�������Ϊ�˷����㡣");

                UpdateCustomerCommendStatus(CommendEmail, (int) AppEnum.CommendStatus.Registered); //�����Ƽ�״̬

                if (increment != 0)
                {
                    int freeShipFeeLogType = (int)AppEnum.FreeShipFeeLogType.CustomerRegister;
                    string freeShipFeeLogMemo = "�Ƽ��ͻ�ע�����˷� - " + CommendEmail;
                    CustomerFreeShipFeeLogInfo oLog = new CustomerFreeShipFeeLogInfo(CustomerSysNo, freeShipFeeLogType, increment, freeShipFeeLogMemo);
                    oLog.LogCheck = oLog.CalcLogCheck();

                    if (1 != new FreeShipFeeDac().Insert(oLog))
                        throw new BizException("�����˷����ʧ��");
                }

                scope.Complete();
            }
        }
开发者ID:ue96,项目名称:ue96,代码行数:32,代码来源:FreeShipFeeManager.cs


示例12: CommendCustomerEmailList

        public void CommendCustomerEmailList(int CustomerSysNo,decimal FreeShipFee,Hashtable ht,string EmailBody)
        {
            TransactionOptions options = new TransactionOptions();
            options.IsolationLevel = System.Transactions.IsolationLevel.ReadCommitted;
            options.Timeout = TransactionManager.DefaultTimeout;

            using (TransactionScope scope = new TransactionScope(TransactionScopeOption.Required, options))
            {
                if (!VerifyValidEmailList(ht))
                    throw new BizException("�����ظ��Ƽ�!");

                CustomerInfo cInfo = CustomerManager.GetInstance().Load(CustomerSysNo);
                string CustomerName = cInfo.CustomerName;
                string mailSubject = CustomerName + " �����Ƽ�ORS�̳���";
                foreach (string email in ht.Keys)
                {
                    UpdateCustomerCommendStatus(email, (int) AppEnum.CommendStatus.Origin);

                    string mailBody = "@FriendName<br>" + EmailBody + "<br>@CustomerName<br>" + DateTime.Now.ToString(AppConst.DateFormat);
                    mailBody = mailBody.Replace("@FriendName", ht[email].ToString());
                    mailBody = mailBody.Replace("@CustomerName", CustomerName);

                    EmailInfo oEmail = new EmailInfo(email, mailSubject, mailBody);
                    EmailManager.GetInstance().InsertEmail(oEmail);
                }

                SetFreeShipFee(CustomerSysNo, FreeShipFee, (int)AppEnum.FreeShipFeeLogType.CommendCustomer, "�Ƽ�����Email");

                scope.Complete();
            }
        }
开发者ID:ue96,项目名称:ue96,代码行数:31,代码来源:FreeShipFeeManager.cs


示例13: AddItem

        public int AddItem(RMARevertInfo oParam)
        {
            TransactionOptions options = new TransactionOptions();
            options.IsolationLevel = System.Transactions.IsolationLevel.ReadCommitted;
            options.Timeout = TransactionManager.DefaultTimeout;

            using (TransactionScope scope = new TransactionScope(TransactionScopeOption.Required, options))
            {
                foreach (int registerSysNo in oParam.ItemHash.Keys)
                {
                    RMARevertItemInfo oRevertItem = new RMARevertItemInfo();
                    oRevertItem.RegisterSysNo = registerSysNo;
                    oRevertItem.RevertSysNo = oParam.SysNo;
                    //��Register�ֿ��д��RMA_Revert_Item
                    int revertStockSysNo = AppConst.IntNull;
                    DataRow regdr = RMARegisterManager.GetInstance().GetRegisterRow(registerSysNo);
                    revertStockSysNo = Util.TrimIntNull(regdr["RevertStockSysNo"]);

                    oRevertItem.StockSysNo = Util.TrimIntNull(revertStockSysNo);

                    this.InsertRevertItem(oRevertItem);
                }

                scope.Complete();
                return oParam.SysNo;
            }
        }
开发者ID:ue96,项目名称:ue96,代码行数:27,代码来源:RMARevertManager.cs


示例14: Init

        /// <summary>
        /// Initializes the <see cref="IDequeueMessages" />.
        /// </summary>
        /// <param name="address">The address to listen on.</param>
        /// <param name="transactionSettings">The <see cref="TransactionSettings" /> to be used by <see cref="IDequeueMessages" />.</param>
        /// <param name="tryProcessMessage">Called when a message has been dequeued and is ready for processing.</param>
        /// <param name="endProcessMessage">Needs to be called by <see cref="IDequeueMessages" /> after the message has been processed regardless if the outcome was successful or not.</param>
        public void Init(Address address, TransactionSettings transactionSettings, Func<TransportMessage, bool> tryProcessMessage, Action<TransportMessage, Exception> endProcessMessage)
        {
            this.tryProcessMessage = tryProcessMessage;
            this.endProcessMessage = endProcessMessage;
            this.workQueue = this.NamePolicy.GetQueueName(address);
            this.clientInfo = string.Format("OracleAQDequeueStrategy for {0}", this.workQueue);

            this.transactionOptions = new TransactionOptions
            {
                IsolationLevel = transactionSettings.IsolationLevel,
                Timeout = transactionSettings.TransactionTimeout,
            };

            this.dequeueOptions = new OracleAQDequeueOptions
            {
                DequeueMode = OracleAQDequeueMode.Remove,
                ProviderSpecificType = true,
                Wait = 0,
            };

            if (this.PurgeOnStartup)
            {
                this.Purger.Purge(this.workQueue);
            }
        }
开发者ID:rosieks,项目名称:NServiceBus.OracleAQ,代码行数:32,代码来源:OracleAQDequeueStrategy.cs


示例15: GetSalesHistory

        public static List<SalesHistoryData> GetSalesHistory()
        {
            List<SalesHistoryData> result = new List<SalesHistoryData>();
            try
            {
                // The encrypted list will timeout for slightly large lists (in the hundreds), so the list is
                // being grabbed in smaller chunks.  Transaction logic is used to lock the list while the list is being
                // grabbed.
                TransactionOptions transactionOptions = new TransactionOptions();
                transactionOptions.IsolationLevel = IsolationLevel.RepeatableRead;
                transactionOptions.Timeout = new TimeSpan(0, 2, 0);
                using (TransactionScope scope = new TransactionScope(TransactionScopeOption.RequiresNew, transactionOptions))
                {
                    Console.WriteLine("Test 1: List all Sales Orders");
                    int take = 5;
                    int count = UserSession.Current.Client.GetSalesOrderListCount();
                    for (int skip = 0; skip < count; skip = skip + take)
                    {
                        List<SalesHistoryData> salesOrders = UserSession.Current.Client.GetSalesHistory(take, skip).ToList();
                        result = result.Union(salesOrders).ToList();
                    }
                    result = result.OrderByDescending(so => so.SalesOrderNumber).ThenBy(so => so.SortOrder).ToList();
                    //No scope.Complete here as no write tasks are being scoped.

                    scope.Dispose();
                }
            }
            catch (Exception) { throw; }
            return result;
        }
开发者ID:JamieMellway,项目名称:BicycleWorldWCFAssignment,代码行数:30,代码来源:SalesHistoryClient.cs


示例16: CancelAbandon

        public void CancelAbandon(int masterSysNo)
        {
            TransactionOptions options = new TransactionOptions();
            options.IsolationLevel = System.Transactions.IsolationLevel.ReadCommitted;
            options.Timeout = TransactionManager.DefaultTimeout;

            using (TransactionScope scope = new TransactionScope(TransactionScopeOption.Required, options))
            {

                AdjustInfo masterInfo = Load(masterSysNo);

                //�����Ƿ���״̬
                if ( masterInfo.Status != (int)AppEnum.AdjustStatus.Abandon )
                    throw new BizException("status is not abandon now ,  cancel abandon failed");

                //���� ���š�״̬
                Hashtable ht = new Hashtable(4);
                ht.Add("SysNo", masterSysNo);
                ht.Add("Status", (int)AppEnum.AdjustStatus.Origin);
                if ( 1!=new AdjustDac().UpdateMaster(ht))
                    throw new BizException("expected one-row update failed, cancel abandon failed ");

                //���Ӷ�available������ռ��
                foreach(AdjustItemInfo item in masterInfo.itemHash.Values)
                {
                    if ( item.AdjustQty < 0 )
                    {
                        InventoryManager.GetInstance().SetAvailableQty(masterInfo.StockSysNo, item.ProductSysNo, -1*item.AdjustQty);
                    }
                }
                scope.Complete();
            }
        }
开发者ID:ue96,项目名称:ue96,代码行数:33,代码来源:AdjustManager.cs


示例17: TransactionCommit

        public void TransactionCommit()
        {
            ITransactionScopeAdapter txAdapter = (ITransactionScopeAdapter) mocks.CreateMock(typeof(ITransactionScopeAdapter));

            using (mocks.Ordered())
            {
                Expect.Call(txAdapter.IsExistingTransaction).Return(false);
                TransactionOptions txOptions = new TransactionOptions();
                txOptions.IsolationLevel = IsolationLevel.ReadCommitted;
                txAdapter.CreateTransactionScope(TransactionScopeOption.Required, txOptions, EnterpriseServicesInteropOption.None);

                Expect.Call(txAdapter.RollbackOnly).Return(false);
                txAdapter.Complete();
                txAdapter.Dispose();
            }
            mocks.ReplayAll();

            TxScopeTransactionManager tm = new TxScopeTransactionManager(txAdapter);
            tm.TransactionSynchronization = TransactionSynchronizationState.Always;

            TransactionTemplate tt = new TransactionTemplate(tm);
            tt.Execute(status =>
                           {
                               Assert.IsTrue(TransactionSynchronizationManager.SynchronizationActive);
                               Assert.IsFalse(TransactionSynchronizationManager.CurrentTransactionReadOnly);
                               return null;
                           });

            Assert.IsFalse(TransactionSynchronizationManager.SynchronizationActive);
            Assert.IsFalse(TransactionSynchronizationManager.CurrentTransactionReadOnly);   

            mocks.VerifyAll();


        }
开发者ID:ouyangyl,项目名称:MySpringNet,代码行数:35,代码来源:TxScopeTransactionManagerTests.cs


示例18: Commit

 public void Commit(TransactionScopeOption scopeOption, TransactionOptions transactionOptions)
 {
     using (TransactionScope scope = new TransactionScope(scopeOption, transactionOptions))
     {
         foreach (UnitOfWork.Operation operation2 in from o in this.operations
                                                     orderby o.ProcessDate
                                                     select o)
         {
             switch (operation2.Type)
             {
                 case UnitOfWork.OperationType.Insert:
                     operation2.Repository.PersistNewItem(operation2.Entity);
                     break;
                 case UnitOfWork.OperationType.Update:
                     operation2.Repository.PersistUpdatedItem(operation2.Entity);
                     break;
                 case UnitOfWork.OperationType.Delete:
                     operation2.Repository.PersistDeletedItem(operation2.Entity);
                     break;
             }
         }
         scope.Complete();
     }
     foreach (EntityBase entityBase in (from operation in this.operations
                                        select operation.Entity).OfType<EntityBase>())
     {
         entityBase.ClearChangedProperties();
     }
     this.Reset();
 }
开发者ID:wesleyzen,项目名称:UserSystem,代码行数:30,代码来源:UnitOfWork.cs


示例19: AddRMA

        /// <summary>
        /// ����rma��
        /// </summary>
        /// <param name="rmaInfo"></param>
        public void AddRMA(RMARequestInfo rmaInfo)
        {
            TransactionOptions options = new TransactionOptions();
            options.IsolationLevel = System.Transactions.IsolationLevel.ReadCommitted;
            options.Timeout = TransactionManager.DefaultTimeout;

            using (TransactionScope scope = new TransactionScope(TransactionScopeOption.Required, options))
            {
                rmaInfo.SysNo = SequenceDac.GetInstance().Create("RMA_Request_Sequence");
                rmaInfo.RequestID = this.BuildRMAID(rmaInfo.SysNo);
                rmaInfo.Status = (int)AppEnum.RMAStatus.Origin;
                this.InsertRequest(rmaInfo);
                foreach (RMARegisterInfo rmaItem in rmaInfo.ItemHash.Values)
                {
                    rmaItem.SysNo = SequenceDac.GetInstance().Create("RMA_Register_Sequence");
                    rmaItem.Status = (int)AppEnum.RMARequestStatus.Orgin;
                    rmaItem.OwnBy = (int)AppEnum.RMAOwnBy.Origin;
                    rmaItem.Location = (int)AppEnum.RMALocation.Origin;
                    RMARegisterManager.GetInstance().InsertRegister(rmaItem);
                    RMARequestItemInfo rmaiteminfo = new RMARequestItemInfo();
                    rmaiteminfo.RegisterSysNo = rmaItem.SysNo;
                    rmaiteminfo.RequestSysNo = rmaInfo.SysNo;
                    this.InsertRequestItem(rmaiteminfo);
                }

                scope.Complete();
            }
            //SendMail(rmaInfo);
        }
开发者ID:ue96,项目名称:ue96,代码行数:33,代码来源:RMARequestManager.cs


示例20: GetCardCash

        public ATMOperationResult GetCardCash(string cardNumber, string cardPIN, out decimal cash)
        {
            cash = 0.0M;

            var options = new TransactionOptions
            {
                IsolationLevel = IsolationLevel.RepeatableRead,
                Timeout = new TimeSpan(0, 0, 0, 10)
            };

            using (var scope = new TransactionScope(TransactionScopeOption.RequiresNew, options))
            {
                var matches = this.atmContext.CardAccounts.Where(a => a.CardNumber == cardNumber).ToList();

                if (matches.Count == 0)
                {
                    return ATMOperationResult.CardNumberInvalid;
                }

                var account = matches[0];

                if (account.CardPIN != cardPIN)
                {
                    return ATMOperationResult.CardPINInvalid;
                }

                cash = account.CardCash;

                scope.Complete();

                return ATMOperationResult.Success;
            }
        }
开发者ID:nikolaynikolov,项目名称:Telerik,代码行数:33,代码来源:DataManager.cs



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


鲜花

握手

雷人

路过

鸡蛋
该文章已有0人参与评论

请发表评论

全部评论

专题导读
上一篇:
C# Transactions.TransactionScope类代码示例发布时间:2022-05-26
下一篇:
C# Transactions.Transaction类代码示例发布时间:2022-05-26
热门推荐
阅读排行榜

扫描微信二维码

查看手机版网站

随时了解更新最新资讯

139-2527-9053

在线客服(服务时间 9:00~18:00)

在线QQ客服
地址:深圳市南山区西丽大学城创智工业园
电邮:jeky_zhao#qq.com
移动电话:139-2527-9053

Powered by 互联科技 X3.4© 2001-2213 极客世界.|Sitemap