예제 #1
0
        /// <summary>
        ///		Call this method to commit a transaction.
        /// </summary>
        /// <returns></returns>
        public ActionResult CommitTransaction()
        {
            try
            {
                // throw exception if ApiContext not in Transaction
                if (!IsInTransaction || _transactionScope == null)
                {
                    Exceptions.TransactionException.Factory("ApiContext is not in Transaction");
                }

                IsInTransaction = false;

                // Complete
                _transactionScope.Complete();
            }
            catch (System.Exception ex)
            {
                throw Helpers.Exceptions.TransactionException.Factory(ex);
            }
            finally
            {
                if (_transactionScope != null)
                {
                    _transactionScope.Dispose();
                    _transactionScope = null;
                }
            }

            return(Helpers.ActionResult.Factory(true));
        }
예제 #2
0
 /// <summary>
 /// Commits the transaction.
 /// </summary>
 internal void CommitTransaction()
 {
     if (_transScope != null)
     {
         _transScope.Complete();
         _transScope.Dispose();
     }
 }
예제 #3
0
        public static IList <DC_M_masterattributevalue> GetMasterAttributesValues(string MasterFor, string Name)
        {
            List <DC_M_masterattributevalue> result = new List <DC_M_masterattributevalue>();

            using (var scope = new System.Transactions.TransactionScope(System.Transactions.TransactionScopeOption.RequiresNew, new System.Transactions.TransactionOptions()
            {
                IsolationLevel = System.Transactions.IsolationLevel.ReadUncommitted,
                Timeout = new TimeSpan(0, 2, 0)
            }))
            {
                using (TLGX_Entities context = new TLGX_Entities())
                {
                    result = (from ma in context.m_masterattribute
                              join mav in context.m_masterattributevalue on ma.MasterAttribute_Id equals mav.MasterAttribute_Id
                              join pav in context.m_masterattributevalue on mav.ParentAttributeValue_Id equals pav.MasterAttributeValue_Id into paval
                              from pavalid in paval.DefaultIfEmpty()
                              where ma.MasterFor == MasterFor && ma.Name == Name && (mav.IsActive ?? false) == true
                              select new DC_M_masterattributevalue
                    {
                        MasterAttribute_Id = mav.MasterAttribute_Id,
                        MasterAttributeValue_Id = mav.MasterAttributeValue_Id,
                        AttributeValue = mav.AttributeValue ?? "",
                        OTA_CodeTableValue = mav.OTA_CodeTableValue ?? "",
                        IsActive = mav.IsActive ?? false == true ? "Y" : "N",
                        ParentAttributeValue_Id = pavalid.MasterAttributeValue_Id,
                        ParentAttributeValue = pavalid.AttributeValue,
                    }).ToList();
                }
                scope.Complete();
                scope.Dispose();
            }
            return(result);
        }
예제 #4
0
 public override void Dispose()
 {
     if (_systemTransactionScope != null)
     {
         _systemTransactionScope.Dispose();
     }
     base.Dispose();
 }
예제 #5
0
        public void Dispose()
        {
            if (_innerScope != null)
            {
                // De-register this scope as the primary transaction so others can be created
                _transactionScopeManager?.DeregisterTransaction(this);

                // Dispose of the EF transaction which should tidy itself up.
                _innerScope.Dispose();
            }
        }
        private static void ReadNextQueryAfterTxAbortedTest(string connString)
        {
            using (System.Transactions.TransactionScope scope = new System.Transactions.TransactionScope())
            {
                using (SqlConnection sqlConnection = new SqlConnection(connString))
                {
                    SqlCommand cmd = new SqlCommand("SELECT 1", sqlConnection);
                    sqlConnection.Open();
                    var reader = cmd.ExecuteReader();
                    // Disposing Transaction Scope before completing read triggers GitHub issue #980 use-case that leads to wrong data in future rounds.
                    scope.Dispose();
                }

                using (SqlConnection sqlConnection = new SqlConnection(connString))
                    using (SqlCommand cmd = new SqlCommand("SELECT 2", sqlConnection))
                    {
                        sqlConnection.Open();
                        using (SqlDataReader reader = cmd.ExecuteReader())
                        {
                            bool result = reader.Read();
                            Assert.True(result);
                            Assert.Equal(2, reader.GetValue(0));
                        }
                    }

                using (SqlConnection sqlConnection = new SqlConnection(connString))
                    using (SqlCommand cmd = new SqlCommand("SELECT 3", sqlConnection))
                    {
                        sqlConnection.Open();
                        using (SqlDataReader reader = cmd.ExecuteReaderAsync().Result)
                        {
                            bool result = reader.ReadAsync().Result;
                            Assert.True(result);
                            Assert.Equal(3, reader.GetValue(0));
                        }
                    }

                if (DataTestUtility.IsNotAzureSynapse())
                {
                    using (SqlConnection sqlConnection = new SqlConnection(connString))
                        using (SqlCommand cmd = new SqlCommand("SELECT TOP(1) 4 Clm0 FROM sysobjects FOR XML AUTO", sqlConnection))
                        {
                            sqlConnection.Open();
                            using (System.Xml.XmlReader reader = cmd.ExecuteXmlReader())
                            {
                                bool result = reader.Read();
                                Assert.True(result);
                                Assert.Equal("4", reader[0]);
                            }
                        }
                }
            }
        }
예제 #7
0
        public static void InsertKpiMeasuerementImported(int kpiId, List <KPIMeasurements> theList, string type)
        {
            if (kpiId <= 0)
            {
                throw new ArgumentException(Resources.ImportData.ZeroKpiId);
            }

            using (System.Transactions.TransactionScope transaction = new System.Transactions.TransactionScope())
            {
                try
                {
                    KpiMeasurementDSTableAdapters.QueriesTableAdapter queries = new KpiMeasurementDSTableAdapters.QueriesTableAdapter();

                    foreach (KPIMeasurements theData in theList)
                    {
                        if (theData.DataTime != null)
                        {
                            theData.Measurement = KPIDataTimeBLL.GetValueFromKPIDataTime(theData.DataTime);
                        }

                        if (!string.IsNullOrEmpty(theData.MeasurementIDsToReplace) && type.Equals("R"))
                        {
                            queries.DeleteKpiMeasurementByListIds(theData.MeasurementIDsToReplace);
                        }

                        int?newData = 0;
                        queries.InsertKpiMeasurement(ref newData, kpiId, theData.Date, theData.Measurement);

                        if (!string.IsNullOrEmpty(theData.Detalle))
                        {
                            string[] itemList     = theData.Detalle.Split(',');
                            string[] categoryList = theData.Categories.Split(',');
                            for (int i = 0; i < itemList.Length; i++)
                            {
                                queries.InsertKpiMeasurementCategories(newData.Value, itemList[i].Trim(), categoryList[i].Trim());
                            }
                        }
                    }

                    transaction.Complete();
                }
                catch (Exception exc)
                {
                    log.Error("Error en InsertKpiMeasuerementImported para kpiId: " + kpiId, exc);
                    transaction.Dispose();
                    throw new Exception(Resources.ImportData.InsertMeasurementError);
                }
            }
        }
예제 #8
0
 public override void Intercept(IInvocation invocation)
 {
     using (System.Transactions.TransactionScope transactionScope = new System.Transactions.TransactionScope())
     {
         try
         {
             invocation.Proceed();
             transactionScope.Complete();
         }
         catch (System.Exception)
         {
             transactionScope.Dispose();
             throw;
         }
     }
 }
         public void PostTipoDeCanal()
         {
             TipoDeCanalesController controller = NewController();
 
             // Act
             TipoDeCanal tipoDeCanal = new TipoDeCanal() { Descripcion = "Unit Test Des", Nombre = "Unit Test" };
             var response = new HttpResponseMessage();
             using (System.Transactions.TransactionScope ts = new System.Transactions.TransactionScope(TransactionScopeOption.RequiresNew))
             {
                 response = controller.PostTipoDeCanal(tipoDeCanal);
                 ts.Dispose();
             }
 
             // Assert
             Assert.AreEqual(System.Net.HttpStatusCode.Created,
                response.StatusCode);
         }
예제 #10
0
            public void Dispose()
            {
                try {
                    if (txScope != null)
                    {
                        txScope.Dispose();
                        return;
                    }

                    if (txBeganHere)
                    {
                        try {
                            txAdo.Dispose();
                        } finally {
                            RemoveTxFromDao();
                        }
                    }
                } finally {
                    connHolder.Dispose();
                }
            }
예제 #11
0
        public override IMessage Invoke(IMessage msg)
        {
            #region 日志准备

            List <string> opObjPerporty = UtilitysForT <SSY_LOGENTITY> .GetAllColumns(new SSY_LOGENTITY()); //要操作的属性名

            List <string> opWherePerporty = new List <string>();                                            //where条件属性名
            opWherePerporty.Add("LOGID");
            List <string> mainProperty = new List <string>();                                               //主键属性名
            mainProperty.Add("LOGID");

            //string errStr = string.Empty;
            List <string>        errStr  = new List <string>();
            List <SSY_LOGENTITY> opList  = new List <SSY_LOGENTITY>();
            SSY_LOGENTITY        logenti = null;

            BizExectuteCommon recordLog = new BizExectuteCommon(ManagerSysEnvironment.GetSysEnvironmentSerialize()); //其他工厂记录日志也利用该公共方法

            //日志固定部分
            string USERNAMES = string.Empty;
            if (FrameCommon.SysEnvironment.SysUserDict != null)
            {
                if (FrameCommon.SysEnvironment.SysUserDict.USERNAME != null)
                {
                    USERNAMES = FrameCommon.SysEnvironment.SysUserDict.USERNAME.ToString();
                }
            }
            string IPS = string.Empty;
            if (!string.IsNullOrEmpty(FrameCommon.SysEnvironment.Ips))
            {
                IPS = FrameCommon.SysEnvironment.Ips;
            }
            string SYSTEMNAME = string.Empty;
            if (!string.IsNullOrEmpty(FrameCommon.SysEnvironment.distManagerParam.DistributeDataNodes[0].Systemname))
            {
                SYSTEMNAME = FrameCommon.SysEnvironment.distManagerParam.DistributeDataNodes[0].Systemname;
            }

            #endregion

            IMethodCallMessage mcall = (IMethodCallMessage)msg; //劫持方法,准备执行
            var resResult            = new ReturnMessage(new Exception(), mcall);

            #region 获取必要参数

            //distributeActionIden  分布式动作识别, 必须存在
            //distributeDataNodes 分布式数据节点集合, 必须存在
            //distributeDataNode 分布式数据节点参数, 必须存在
            //distriActionSql 分布式操作sql集合,必须存在,包括sql正文和参数
            //ddnmParams

            //singleActionList  单点操作失败集合, out参数 非必须存在,传入空的参数即可

            //TODO 检查必须的参数,若不存在不进行执行业务方法,返回执行异常

            //获取分布式管理参数
            DistributeDataNodeManagerParams distManagerParam = new  DistributeDataNodeManagerParams();
            for (int i = 0; i < mcall.InArgs.Length; i++)
            {
                if (mcall.GetInArgName(i).ToUpper() == "ddnmParams".ToUpper())
                {
                    distManagerParam = ((DistributeDataNodeManagerParams)mcall.GetInArg(i));
                    //SYSTEMNAME = distManagerParam.DistributeDataNodes[0].Systemname;
                    break;
                }
            }

            //获取分布式动作识别参数
            DistributeActionIden distBAC = distManagerParam.DistributeActionIden;

            //加载数据节点集合,然后根据节点数量及分布式动作识别初始化分布式数据节点及分布式事务处理
            //数据节点集合由服务方法传入
            //获取数据节点集合参数
            List <SSY_DATANODE_ADDR> dataNodes = distManagerParam.DistributeDataNodes;

            //获取数据节点参数
            DistributeDataNode ddn = distManagerParam.DistributeDataNode;

            //单点操作失败集合,最后要报告给节点中心,out参数
            bool permitSingleDataOperation = false; //是否支持单点操作失败后进行报告
            List <SSY_DATA_ACTION_TASK> data_action_task = new List <SSY_DATA_ACTION_TASK>();
            for (int i = 0; i < mcall.InArgs.Length; i++)
            {
                if (mcall.GetInArgName(i).ToUpper() == "singleActionList".ToUpper())
                {
                    permitSingleDataOperation = true;
                    data_action_task          = mcall.GetInArg(i) as List <SSY_DATA_ACTION_TASK>;
                    break;
                }
            }

            #endregion

            if (distBAC == DistributeActionIden.Query)
            {
                //处理数据节点
                //distManagerParam.DistributeDataNode
                distManagerParam.DistributeDataNode.Connectionstring = string.Format(dataNodes[0].Data_conn, dataNodes[0].Url_addr,
                                                                                     dataNodes[0].Data_user, dataNodes[0].Data_password);
                distManagerParam.DistributeDataNode.DbSchema = dataNodes[0].Data_schema;

                //只执行一次即可
                #region 执行业务方法

                try
                {
                    object objRv = mcall.MethodBase.Invoke(this.Target, mcall.Args);

                    #region 记录业务日志

                    //执行方法后记录正常业务日志,内容来自方法ListBizLog参数
                    //若要记录日志,要求该方法必须传入该参数,且名字必须为ListBizLog,内容为要记录的业务日志内容
                    SSY_LOGENTITY tempLog = null;
                    for (int i = 0; i < mcall.InArgs.Length; i++)
                    {
                        if (mcall.GetInArgName(i).ToUpper() == "ListBizLog".ToUpper())
                        {
                            List <SSY_LOGENTITY> dictBizLog = mcall.GetInArg(i) as List <SSY_LOGENTITY>;

                            for (int j = 0; j < dictBizLog.Count; j++)
                            {
                                //遍历记录业务日志
                                tempLog = dictBizLog[j] as SSY_LOGENTITY;

                                //获取日志控制,确定是否记录该类日志
                                if (recordLog.CheckIsRecord(tempLog.DOMAINNAME.ToString(), tempLog.OPTIONNAME.ToString(), distManagerParam))
                                {
                                    tempLog.LOGID = recordLog.GetID(MakeIDType.YMDHMS_3, string.Empty, null, distManagerParam);

                                    //业务直接使用业务端提交的数据,不在读取框架环境变量,因为登录时这部分数据滞后,导致不能记入日志
                                    //tempLog.USERNAMES = USERNAMES;
                                    //tempLog.IPS = IPS;
                                    //tempLog.SYSTEMNAME = SYSTEMNAME;

                                    opList.Add(tempLog);
                                }
                            }
                            if (opList.Count > 0)
                            {
                                //记录日志
                                bool flag = recordLog.OpBizObjectSingle <SSY_LOGENTITY>(opList, opObjPerporty, opWherePerporty, mainProperty, errStr, distManagerParam);
                            }
                            break;
                        }
                    }

                    #endregion

                    resResult = new ReturnMessage(objRv, mcall.Args, mcall.Args.Length, mcall.LogicalCallContext, mcall);
                }
                catch (Exception ex)
                {
                    Common.Utility.RecordLog("工厂 Query 模式发生异常!原因" + ex.Message + ex.Source, this.logpathForDebug, this.isLogpathForDebug);

                    #region 记录异常日志

                    if (ex.InnerException != null)
                    {
                        //获取日志控制,确定是否记录该类日志
                        if (recordLog.CheckIsRecord("ExceptionErr", "ExceptionErr", distManagerParam))
                        {
                            //处理异常类相关信息
                            string CLASSNAME   = mcall.TypeName;
                            string METHORDNAME = mcall.MethodName;

                            //异常时这部分可没有内容
                            string TABLENAME            = "";
                            string RECORDIDENCOLS       = "";
                            string RECORDIDENCOLSVALUES = "";
                            string FUNCTIONNAME         = "";

                            logenti = LogCommon.CreateLogDataEnt(LogTypeDomain.ExceptionErr, LogLevelOption.ExecptionErr, recordLog.GetSystemDateTime(distManagerParam),
                                                                 CLASSNAME, METHORDNAME, LogAction.ExecptionErr, TABLENAME, RECORDIDENCOLS, RECORDIDENCOLSVALUES, USERNAMES, IPS, FUNCTIONNAME,
                                                                 ex.InnerException.Message, SYSTEMNAME, "");
                            logenti.LOGID = recordLog.GetID(MakeIDType.YMDHMS_3, string.Empty, null, distManagerParam);

                            opList.Add(logenti);

                            if (opList.Count > 0)
                            {
                                //记录日志
                                bool flag = recordLog.OpBizObjectSingle <SSY_LOGENTITY>(opList, opObjPerporty, opWherePerporty, mainProperty, errStr, distManagerParam);
                            }
                        }

                        resResult = new ReturnMessage(ex.InnerException, mcall);
                    }

                    #endregion

                    resResult = new ReturnMessage(ex, mcall);
                }

                #endregion
            }
            else if (distBAC == DistributeActionIden.SingleAction)
            {
                //数据节点有几个执行几次,单次提交,发现执行异常,将异常报告给节点中心,继续执行,直到完毕
                for (int m = 0; m < dataNodes.Count; m++)
                {
                    //ddn.DbFactoryName  数据库工厂取配置文件,目前不考虑同构不同种类的数据库
                    distManagerParam.DistributeDataNode.Connectionstring = string.Format(dataNodes[m].Data_conn, dataNodes[m].Url_addr, dataNodes[m].Data_user,
                                                                                         dataNodes[m].Data_password);
                    distManagerParam.DistributeDataNode.DbSchema = dataNodes[m].Data_schema;

                    #region 执行业务方法

                    try
                    {
                        object objRv = mcall.MethodBase.Invoke(this.Target, mcall.Args);

                        #region 记录业务日志

                        //执行方法后记录正常业务日志,内容来自方法ListBizLog参数
                        //若要记录日志,要求该方法必须传入该参数,且名字必须为ListBizLog,内容为要记录的业务日志内容
                        SSY_LOGENTITY tempLog = null;
                        for (int i = 0; i < mcall.InArgs.Length; i++)
                        {
                            if (mcall.GetInArgName(i).ToUpper() == "ListBizLog".ToUpper())
                            {
                                List <SSY_LOGENTITY> dictBizLog = mcall.GetInArg(i) as List <SSY_LOGENTITY>;

                                for (int j = 0; j < dictBizLog.Count; j++)
                                {
                                    //遍历记录业务日志
                                    tempLog = dictBizLog[j] as SSY_LOGENTITY;

                                    //获取日志控制,确定是否记录该类日志
                                    if (recordLog.CheckIsRecord(tempLog.DOMAINNAME.ToString(), tempLog.OPTIONNAME.ToString(), distManagerParam))
                                    {
                                        tempLog.LOGID = recordLog.GetID(MakeIDType.YMDHMS_3, string.Empty, null, distManagerParam);

                                        //业务直接使用业务端提交的数据,不在读取框架环境变量,因为登录时这部分数据滞后,导致不能记入日志
                                        //tempLog.USERNAMES = USERNAMES;
                                        //tempLog.IPS = IPS;
                                        //tempLog.SYSTEMNAME = SYSTEMNAME;

                                        opList.Add(tempLog);
                                    }
                                }
                                if (opList.Count > 0)
                                {
                                    //记录日志
                                    bool flag = recordLog.OpBizObjectSingle <SSY_LOGENTITY>(opList, opObjPerporty, opWherePerporty, mainProperty, errStr, distManagerParam);
                                }
                                break;
                            }
                        }

                        #endregion

                        resResult = new ReturnMessage(objRv, mcall.Args, mcall.Args.Length, mcall.LogicalCallContext, mcall);
                    }
                    catch (Exception ex)
                    {
                        SSY_DATA_ACTION_TASK tempDataTask = null;

                        #region 记录异常日志

                        if (ex.InnerException != null)
                        {
                            //获取日志控制,确定是否记录该类日志
                            if (recordLog.CheckIsRecord("ExceptionErr", "ExceptionErr", distManagerParam))
                            {
                                //处理异常类相关信息
                                string CLASSNAME   = mcall.TypeName;
                                string METHORDNAME = mcall.MethodName;

                                //异常时这部分可没有内容
                                string TABLENAME            = "";
                                string RECORDIDENCOLS       = "";
                                string RECORDIDENCOLSVALUES = "";
                                string FUNCTIONNAME         = "";

                                logenti = LogCommon.CreateLogDataEnt(LogTypeDomain.ExceptionErr, LogLevelOption.ExecptionErr, recordLog.GetSystemDateTime(distManagerParam),
                                                                     CLASSNAME, METHORDNAME, LogAction.ExecptionErr, TABLENAME, RECORDIDENCOLS, RECORDIDENCOLSVALUES, USERNAMES, IPS, FUNCTIONNAME,
                                                                     ex.InnerException.Message, SYSTEMNAME, "");
                                logenti.LOGID = recordLog.GetID(MakeIDType.YMDHMS_3, string.Empty, null, distManagerParam);

                                opList.Add(logenti);

                                if (opList.Count > 0)
                                {
                                    //记录日志
                                    bool flag = recordLog.OpBizObjectSingle <SSY_LOGENTITY>(opList, opObjPerporty, opWherePerporty, mainProperty, errStr, distManagerParam);
                                }
                            }
                            if (permitSingleDataOperation)
                            {
                                #region 获取失败操作sql

                                //获取失败记录,以便将任务报告给节点中心
                                //获取操作sql  List<DistActionSql> DistriActionSqlParams

                                for (int task = 0; task < distManagerParam.DistriActionSqlParams.Count; task++)
                                {
                                    tempDataTask            = new SSY_DATA_ACTION_TASK();
                                    tempDataTask.Action_sql = distManagerParam.DistriActionSqlParams[task].ActionSqlText;
                                    string tempSqlParamSeq = string.Empty;
                                    bool   temddddd        = JsonSerializer.Serialize(distManagerParam.DistriActionSqlParams[task].ActionSqlTextParams, out tempSqlParamSeq);
                                    //保存sql参数序列化结果
                                    tempDataTask.Action_sql_params = tempSqlParamSeq;
                                    tempDataTask.Data_real_conn    = ddn.Connectionstring;
                                    data_action_task.Add(tempDataTask);
                                }
                                //执行完毕后,清除本次的sql记录
                                distManagerParam.DistriActionSqlParams.Clear();

                                //TODO 报告单点异常给节点中心,暂时不支持,后续扩展
                                #endregion
                            }
                        }

                        #endregion

                        continue; //继续执行
                    }

                    #endregion
                }
            }
            else if (distBAC == DistributeActionIden.TransAction)
            {
                try
                {
                    //分布式事务执行, 按数据节点数量执行,同步提交
                    using (var ts = new System.Transactions.TransactionScope(System.Transactions.TransactionScopeOption.Required, TimeSpan.FromHours(1)))
                    {
                        for (int m = 0; m < dataNodes.Count; m++)
                        {
                            //ddn.DbFactoryName  数据库工厂取配置文件,目前不考虑同构不同种类的数据库
                            distManagerParam.DistributeDataNode.Connectionstring = string.Format(dataNodes[m].Data_conn, dataNodes[m].Url_addr, dataNodes[m].Data_user,
                                                                                                 dataNodes[m].Data_password);
                            distManagerParam.DistributeDataNode.DbSchema = dataNodes[m].Data_schema;

                            #region 执行业务方法

                            object objRv = mcall.MethodBase.Invoke(this.Target, mcall.Args);

                            #region 记录业务日志

                            //执行方法后记录正常业务日志,内容来自方法ListBizLog参数
                            //若要记录日志,要求该方法必须传入该参数,且名字必须为ListBizLog,内容为要记录的业务日志内容
                            SSY_LOGENTITY tempLog = null;
                            for (int i = 0; i < mcall.InArgs.Length; i++)
                            {
                                if (mcall.GetInArgName(i).ToUpper() == "ListBizLog".ToUpper())
                                {
                                    List <SSY_LOGENTITY> dictBizLog = mcall.GetInArg(i) as List <SSY_LOGENTITY>;

                                    for (int j = 0; j < dictBizLog.Count; j++)
                                    {
                                        //遍历记录业务日志
                                        tempLog = dictBizLog[j] as SSY_LOGENTITY;

                                        //获取日志控制,确定是否记录该类日志
                                        if (recordLog.CheckIsRecord(tempLog.DOMAINNAME.ToString(), tempLog.OPTIONNAME.ToString(), distManagerParam))
                                        {
                                            tempLog.LOGID = recordLog.GetID(MakeIDType.YMDHMS_3, string.Empty, null, distManagerParam);

                                            //业务直接使用业务端提交的数据,不在读取框架环境变量,因为登录时这部分数据滞后,导致不能记入日志
                                            //tempLog.USERNAMES = USERNAMES;
                                            //tempLog.IPS = IPS;
                                            //tempLog.SYSTEMNAME = SYSTEMNAME;

                                            opList.Add(tempLog);
                                        }
                                    }
                                    //这里事物不能同时记录日志,需要放到业务方法提交完成后单独记录日志
                                    if (opList.Count > 0)
                                    {
                                        //记录日志
                                        bool flag = recordLog.OpBizObjectSingle <SSY_LOGENTITY>(opList, opObjPerporty, opWherePerporty, mainProperty, errStr, distManagerParam);
                                    }
                                    break;
                                }
                            }

                            #endregion

                            resResult = new ReturnMessage(objRv, mcall.Args, mcall.Args.Length, mcall.LogicalCallContext, mcall);

                            #endregion
                        }

                        ts.Complete();
                        ts.Dispose();
                    }

                    //同时记录日志,因为日志记录去掉事物方式
                    ////恢复事物默认标识
                    //distManagerParam.DistributeActionIden = DistributeActionIden.Query;
                    ////启用事物日志需要独立记录,不能和业务操作混在一个事物里
                    //for (int m = 0; m < dataNodes.Count; m++)
                    //{
                    //    //ddn.DbFactoryName  数据库工厂取配置文件,目前不考虑同构不同种类的数据库
                    //    distManagerParam.DistributeDataNode.Connectionstring = string.Format(dataNodes[m].Data_conn, dataNodes[m].Url_addr, dataNodes[m].Data_user,
                    //    dataNodes[m].Data_password);
                    //    distManagerParam.DistributeDataNode.DbSchema = dataNodes[m].Data_schema;

                    //    if (opList.Count > 0)
                    //    {
                    //        //记录日志
                    //        bool flag = recordLog.OpBizObjectSingle<SSY_LOGENTITY>(opList, opObjPerporty, opWherePerporty, mainProperty, errStr, distManagerParam);

                    //    }
                    //}
                }
                catch (Exception ex)
                {
                    Common.Utility.RecordLog("工厂 TransAction 模式发生异常!原因" + ex.Message + ex.Source, this.logpathForDebug, this.isLogpathForDebug);
                }
            }

            //最终返回结果,循环处理数据节点时,只返回最后一个执行成功的数据节点的执行情况
            return(resResult);
        }
예제 #12
0
 public void Dispose()
 {
     _transScope.Dispose();
 }
예제 #13
0
        public ActionResult Save(SaveVoucherJsonModel model)
        {
            var alreadyUsedVoucherNo = _fR.GetAny <Order>(x => x.VoucherNumber == model.VoucherNo && x.Status && !x.IsDeleted);

            if (alreadyUsedVoucherNo)
            {
                return(Json(new Response {
                    Status = false, Message = "Belge no daha önce kullanılmış"
                }, JsonRequestBehavior.AllowGet));
            }

            using (System.Transactions.TransactionScope scope = new System.Transactions.TransactionScope())
            {
                try
                {
                    //
                    //order date parse useable datetime format
                    DateTime voucherDate;
                    try
                    {
                        voucherDate = DateTime.ParseExact(model.VoucherDate, "dd.MM.yyyy", System.Globalization.CultureInfo.InvariantCulture);
                    }
                    catch (Exception ex)
                    {
                        return(Json(new Response {
                            Status = false, Message = "Tarih formatı yanlış Lütfen sayfayı yenileyip tekrar deneyin"
                        }, JsonRequestBehavior.AllowGet));
                    }
                    //
                    var order = new Order
                    {
                        PlatformCode  = model.PlatformCode,
                        CompanyId     = model.CustomerId,
                        SupplierId    = model.SupplierId,
                        VoucherNumber = model.VoucherNo,
                        VoucherDate   = voucherDate,
                        CreatedDate   = DateTime.Now,
                        Tax           = model.TaxPercent,
                        Status        = true
                    };
                    //
                    //save order
                    _fR.Add(order);
                    _fR.SaveChanges();

                    var productList = new List <OrderProduct>();
                    foreach (var item in model.Products)
                    {
                        var op = new OrderProduct
                        {
                            OrderId        = order.Id,
                            ProductId      = item.ProductId,
                            ProductBarcode = item.Barcode,
                            ProductName    = item.ProductName,
                            Discount       = item.ProductDiscount,
                            DiscountName   = item.ProductDiscountName,
                            Quantity       = item.ProductQuantity,
                            Price          = string.IsNullOrEmpty(item.ProductPrice) ? 0 : Convert.ToDecimal(item.ProductPrice),
                        };
                        //
                        op.Total = op.CalculateTotalPrice();
                        var taxAmount = op.Total * order.Tax / 100;
                        op.Total = op.Total + taxAmount;
                        //
                        productList.Add(op);
                    }
                    //
                    //save order
                    _fR.AddList(productList);
                    _fR.SaveChanges();
                    //
                    scope.Complete();
                    return(Json(new Response {
                        Status = true, EntityId = model.VoucherNo + 1, Message = "Belge kayıt edildi."
                    }, JsonRequestBehavior.AllowGet));
                }
                catch (Exception ex)
                {
                    scope.Dispose();
                    return(Json(new Response {
                        Status = false, EntityId = 0, Message = ex.InnerException?.InnerException.Message ?? ex.Message, TotalCount = 0
                    }));
                }
            }
        }
예제 #14
0
        public override void DoWork()
        {
            if (trigger == null)
            {
                return;
            }

            _db.Entry(trigger).Reload();

            if (!CanExecuteNow())
            {
                return;
            }

            var txOptions = new System.Transactions.TransactionOptions();

            txOptions.IsolationLevel = System.Transactions.IsolationLevel.Snapshot;

            System.Transactions.TransactionScope txnScope = new System.Transactions.TransactionScope(System.Transactions.TransactionScopeOption.RequiresNew, txOptions);
            try
            {
                JournalRunResult runResult;
                using (txnScope)
                {
                    runResult = _journalGenerator.Run(_db, trigger);
                    if ((runResult.Errors.Count() == 0) && (runResult.Holders.Count() == 0) && (runResult.Deferrals.Count() == 0))
                    {
                        _db.SaveChanges();
                        txnScope.Complete();
                    }
                    else
                    {
                        txnScope.Dispose();
                    }
                }

                foreach (var err in runResult.Errors)
                {
                    log.Exceptions.Add(new TransactionTriggerException()
                    {
                        Message       = err,
                        ExceptionType = "E"
                    });
                }

                foreach (var err in runResult.Holders)
                {
                    log.Exceptions.Add(new TransactionTriggerException()
                    {
                        Message       = err,
                        ExceptionType = "H"
                    });
                }

                foreach (var err in runResult.Deferrals)
                {
                    log.Exceptions.Add(new TransactionTriggerException()
                    {
                        Message       = err,
                        ExceptionType = "D"
                    });
                }

                if (runResult.Errors.Count() > 0)
                {
                    MarkError();
                }

                if (runResult.Holders.Count() > 0)
                {
                    MarkHold();
                }

                if ((runResult.Errors.Count() == 0) && (runResult.Holders.Count() == 0) && (runResult.Deferrals.Count() == 0))
                {
                    if (runResult.Journals.Count > 0)
                    {
                        //
                    }
                }
            }
            catch (Exception ex)
            {
                txnScope.Dispose();

                if ((!(ex is OptimisticConcurrencyException)) && (!ex.Message.Contains("deadlock victim")))
                {
                    MarkError();
                }

                if (ex is AggregateException)
                {
                    foreach (var ex2 in (ex as AggregateException).InnerExceptions)
                    {
                        log.Exceptions.Add(new TransactionTriggerException()
                        {
                            Message       = ex2.Message,
                            ExceptionType = "E"
                        });
                    }
                }
                else
                {
                    log.Exceptions.Add(new TransactionTriggerException()
                    {
                        Message       = ex.Message,
                        ExceptionType = "E"
                    });
                }
                throw ex;
            }
        }
예제 #15
0
        /// <summary>
        /// 전표생성을 눌렀을경우
        /// </summary>
        /// <param name="sender">The source of the event.</param>
        /// <param name="e">The <see cref="System.EventArgs"/> instance containing the event data.</param>
        private void btnAccount_Click(object sender, EventArgs e)
        {
            try
            {
                this.Cursor = Cursors.WaitCursor;
                if (dtDetail.Rows.Count <= 0)
                {
                    return;
                }
                else if (this.gridViewMaster.FocusedRowHandle < 0)
                {
                    return;
                }

                string code       = this.gridViewMaster.GetRowCellValue(this.gridViewMaster.FocusedRowHandle, "CODE").ToString().Trim();
                string Write_date = this.gridViewMaster.GetRowCellValue(this.gridViewMaster.FocusedRowHandle, "WRITE_DATE").ToString().Trim();

                if (CHK_MK("CHK") == "Y")
                {
                    return;
                }


                /*기 전표 생성여부체크*/
                /*삭제시 WHERE 조건동일사용*/
                string SQL_CHECK_BILL = @"SELECT COUNT(BAN_DECI_DATE) AS CNT
	                                            FROM AUTODOCU 
		                                             WHERE 
				                                            DATA_GUBUN = '85'          AND
				                                            DATA_NO    =  {0}          AND  
				                                            WRITE_DATE = '{1}'         AND
				                                            DEPT_CODE = '002020102000' AND
				                                            NODE_CODE = '1000'         AND
				                                            C_CODE = '1000'"                ;

                /*{0} = 구분코드 {1} = 일자*/

                /*있으면
                 * 전표삭제후 재생성 해야 합니다.
                 */

                SQL_CHECK_BILL = string.Format(SQL_CHECK_BILL, code, Write_date);

                System.Data.SqlClient.SqlDataAdapter ad = new System.Data.SqlClient.SqlDataAdapter(SQL_CHECK_BILL, SQLConnectString);
                DataTable dtCnt = new DataTable();

                ad.Fill(dtCnt);

                if (int.Parse(dtCnt.Rows[0][0].ToString().Trim()) > 0)
                {
                    Basic.ShowMessage(1, "기 생성된 전표가 존재 합니다.\n\r전표삭제 후 재생성 해야 합니다.");
                    return;
                }


                string Query = @"INSERT INTO AUTODOCU
                                                      ( DATA_GUBUN,
                                                        WRITE_DATE,
                                                        DATA_NO,
                                                        DATA_LINE,
                                                        DATA_SLIP,
                                                        DEPT_CODE,
                                                        NODE_CODE,
                                                        C_CODE,
                                                        DATA_CODE,
                                                        DOCU_STAT,
                                                        DOCU_TYPE,
                                                        DOCU_GUBUN,
                                                        AMT_GUBUN,
                                                        DR_AMT,
                                                        CR_AMT,
                                                        ACCT_CODE,
                                                        CHECK_CODE1,
                                                        CHECK_CODE2,
                                                        CHECK_CODE3,
                                                        CHECK_CODE4,
                                                        CHECKD_CODE1,
                                                        CHECKD_CODE2,
                                                        CHECKD_CODE3,
                                                        CHECKD_CODE4,
                                                        CHECKD_NAME1,
                                                        CHECKD_NAME2,
                                                        CHECKD_NAME3,
                                                        CHECKD_NAME4
                                                      ) 
                                                        VALUES ('{0}' , 
                                                                '{1}' ,
                                                                 {2}  ,
                                                                 {3}  ,
                                                                 {4}  ,
                                                                '{5}' ,
                                                                '{6}' ,
                                                                '{7}' ,
                                                                '{8}' ,
                                                                '{9}' ,
                                                                '{10}' ,
                                                                '{11}' ,
                                                                '{12}' ,
                                                                 {13}  ,
                                                                 {14}  ,
                                                                '{15}' ,
                                                                '{16}' ,
                                                                '{17}' ,
                                                                '{18}' ,
                                                                '{19}' ,
                                                                '{20}' ,
                                                                '{21}' ,
                                                                '{22}' ,
                                                                '{23}' ,
                                                                '{24}' ,
                                                                '{25}' ,
                                                                '{26}' ,
                                                                '{27}' 
                                                                )";


                using (System.Transactions.TransactionScope scope = new System.Transactions.TransactionScope())
                {
                    using (System.Data.SqlClient.SqlConnection cn = new System.Data.SqlClient.SqlConnection(SQLConnectString))
                    {
                        try
                        {
                            cn.Open();
                        }
                        catch (System.Data.SqlClient.SqlException sqlex)
                        {
                            Basic.ShowMessage(3, sqlex.Message);
                            cn.Dispose();
                            return;
                        }

                        this.pgb.Visible            = true;
                        this.pgb.Properties.Maximum = dtDetail.Rows.Count - 1;
                        this.pgb.Properties.Minimum = 0;
                        this.pgb.EditValue          = 0;


                        for (int i = 0; i < dtDetail.Rows.Count; i++)
                        {
                            this.pgb.EditValue = i;
                            Application.DoEvents();

                            object[] obj = new object[28];
                            for (int j = 0; j < obj.Length; j++)
                            {
                                obj[j] = dtDetail.Rows[i][j].ToString().Trim();
                            }

                            string insertQuery = string.Format(Query, obj);

                            using (System.Data.SqlClient.SqlCommand cmd = new System.Data.SqlClient.SqlCommand(insertQuery, cn))
                            {
                                int row = cmd.ExecuteNonQuery();
                                cmd.Dispose();
                            }
                        }

                        string Query_In = @"INSERT INTO ONKET_ID
                                            SELECT '1000' C_CODE, CHECKD_CODE2, CHECKD_NAME2, '20101101' aS JOB_DATE FROM AUTODOCU
                                            WHERE DATA_GUBUN = '85'           
                                              AND DATA_NO    = {0}           
                                              AND WRITE_DATE = '{1}'     
                                              AND DEPT_CODE  = '002020102000' 
                                              AND NODE_CODE  = '1000'         
                                              AND C_CODE     = '1000'         
                                              AND CHECK_CODE2 = 'M57'
                                              AND CHECKD_CODE2 <> '999999'
                                              AND CHECKD_CODE2 NOT IN (SELECT ID_CODE FROM ONKET_ID WHERE C_CODE = '1000')";
                        Query_In = string.Format(Query_In, code, Write_date);

                        using (System.Data.SqlClient.SqlCommand cmd1 = new System.Data.SqlClient.SqlCommand(Query_In, cn))
                        {
                            int row1 = cmd1.ExecuteNonQuery();
                            cmd1.Dispose();
                        }

                        CHK_MK("C_MK");

                        Basic.ShowMessage(1, "생성 하였습니다.");



                        if (cn.State == ConnectionState.Open)
                        {
                            cn.Close();
                        }

                        cn.Dispose();
                    }

                    scope.Complete();
                    scope.Dispose();
                }
                InvokeOnClick(this.btnSelect, new EventArgs());
            }
            catch (Exception ex)
            {
                Basic.ShowMessage(3, ex.Message);
            }
            finally
            {
                this.pgb.Visible = false;
                this.Cursor      = Cursors.Default;
            }
        }
예제 #16
0
 void IDisposable.Dispose() => _t.Dispose();
 public void Dispose() => transactionScope.Dispose();
예제 #18
0
 public void AfterTest(TestDetails testDetails)
 {
     _transactionScope.Dispose();
 }
예제 #19
0
 void IDisposable.Dispose()
 {
     _t.Dispose();
 }
예제 #20
0
        /// <summary>
        /// 전표생성을 눌렀을경우
        /// </summary>
        /// <param name="sender">The source of the event.</param>
        /// <param name="e">The <see cref="System.EventArgs"/> instance containing the event data.</param>
        private void btnAccount_Click(object sender, EventArgs e)
        {
            try
            {
                this.Cursor = Cursors.WaitCursor;
                if (dtDetail.Rows.Count <= 0)
                {
                    return;
                }
                else if (this.gridViewMaster.FocusedRowHandle < 0)
                {
                    return;
                }

                string code       = this.gridViewMaster.GetRowCellValue(this.gridViewMaster.FocusedRowHandle, "DETAIL").ToString().Trim();
                string Write_date = this.gridViewMaster.GetRowCellValue(this.gridViewMaster.FocusedRowHandle, "CLOSE_DATE").ToString().Trim();

                // 업장별 마감 체크 확인필요
                //  if (CHK_MK("CHK") == "Y") return;
                // 지금은 고객쪽만 체크하게 되어있음 추가적으로 골프, 영업장, 그외 마감체크 필요

                /*기 전표 생성여부체크*/
                /*삭제시 WHERE 조건동일사용*/
                string SQL_CHECK_BILL = @"SELECT COUNT(IN_DT) AS CNT
	                                            FROM SAUTODOCUD 
		                                             WHERE 
				                                            IN_DT    = {0} AND
				                                            IN_SQ    =  {1}            "                ;

                /*{0} = 처리일자 {1} = 처리번호(구분자)*/

                /*있으면
                 * 전표삭제후 재생성 해야 합니다.
                 */

                SQL_CHECK_BILL = string.Format(SQL_CHECK_BILL, Write_date, code);

                System.Data.SqlClient.SqlDataAdapter ad = new System.Data.SqlClient.SqlDataAdapter(SQL_CHECK_BILL, SQLConnectString);
                DataTable dtCnt = new DataTable();

                ad.Fill(dtCnt);

                if (int.Parse(dtCnt.Rows[0][0].ToString().Trim()) > 0)
                {
                    Basic.ShowMessage(1, "기 생성된 전표가 존재 합니다.\n\r전표삭제 후 재생성 해야 합니다.");
                    return;
                }


                string Query = @"INSERT INTO SAUTODOCUD
                                                      (IN_DT,
                                                       IN_SQ,
                                                       LN_SQ,
                                                       CO_CD,
                                                       IN_DIV_CD,
                                                       LOGIC_CD,
                                                       ISU_DT,
                                                       ISU_SQ,
                                                       DIV_CD,
                                                       DEPT_CD,
                                                       EMP_CD,
                                                       ACCT_CD,
                                                       DRCR_FG,
                                                       ACCT_AM,
                                                       RMK_NB,
                                                       RMK_DC,
                                                       ATTR_CD,
                                                       TRCD_TY,
                                                       TRNM_TY,
                                                       DEPTCD_TY,
                                                       PJTCD_TY,
                                                       CTNB_TY,
                                                       FRDT_TY,
                                                       TODT_TY,
                                                       QT_TY,
                                                       AM_TY,
                                                       RT_TY,
                                                       DEAL_TY,
                                                       TR_CD,
                                                       TR_NM,
                                                       CT_DEPT,
                                                       DEPT_NM,
                                                       PJT_CD,
                                                       PJT_NM,
                                                       CT_NB,
                                                       FR_DT,
                                                       TO_DT,
                                                       CT_QT,
                                                       CT_AM,
                                                       CT_RT,
                                                       CT_DEAL,
                                                       DEAL_NM,
                                                       CT_USER1,
                                                       USER1_NM 
                                                      ) 
                                                        VALUES ('{0}' , 
                                                                '{1}' ,
                                                                 {2}  ,
                                                                 {3}  ,
                                                                 {4}  ,
                                                                '{5}' ,
                                                                '{6}' ,
                                                                '{7}' ,
                                                                '{8}' ,
                                                                '{9}' ,
                                                                '{10}' ,
                                                                '{11}' ,
                                                                '{12}' ,
                                                                 {13}  ,
                                                                 {14}  ,
                                                                '{15}' ,
                                                                '{16}' ,
                                                                '{17}' ,
                                                                '{18}' ,
                                                                '{19}' ,
                                                                '{20}' ,
                                                                '{21}' ,
                                                                '{22}' ,
                                                                '{23}' ,
                                                                '{24}' ,
                                                                '{25}' ,
                                                                '{26}' ,
                                                                '{27}' ,
                                                                '{28}' ,
                                                                '{29}' ,
                                                                '{30}' ,
                                                                 {31}  ,
                                                                 {32}  ,
                                                                '{33}' ,
                                                                '{34}' ,
                                                                '{35}' ,
                                                                '{36}' ,
                                                                '{37}' ,
                                                                '{38}' ,
                                                                '{39}' ,
                                                                '{40}' ,
                                                                '{41}' ,
                                                                '{42}' ,
                                                                '{43}' ,
                                                                '{44}'  
                                                                )";


                using (System.Transactions.TransactionScope scope = new System.Transactions.TransactionScope())
                {
                    using (System.Data.SqlClient.SqlConnection cn = new System.Data.SqlClient.SqlConnection(SQLConnectString))
                    {
                        try
                        {
                            cn.Open();
                        }
                        catch (System.Data.SqlClient.SqlException sqlex)
                        {
                            Basic.ShowMessage(3, sqlex.Message);
                            cn.Dispose();
                            return;
                        }

                        this.pgb.Visible            = true;
                        this.pgb.Properties.Maximum = dtDetail.Rows.Count - 1;
                        this.pgb.Properties.Minimum = 0;
                        this.pgb.EditValue          = 0;


                        for (int i = 0; i < dtDetail.Rows.Count; i++)
                        {
                            this.pgb.EditValue = i;
                            Application.DoEvents();

                            object[] obj = new object[28];
                            for (int j = 0; j < obj.Length; j++)
                            {
                                obj[j] = dtDetail.Rows[i][j].ToString().Trim();
                            }

                            string insertQuery = string.Format(Query, obj);

                            using (System.Data.SqlClient.SqlCommand cmd = new System.Data.SqlClient.SqlCommand(insertQuery, cn))
                            {
                                int row = cmd.ExecuteNonQuery();
                                cmd.Dispose();
                            }
                        }

                        /* 관리항목 OR 관리내역 추가 필요해서 넣었는데.. 확인 요함
                         * string Query_In = @"INSERT INTO ONKET_ID
                         *                  SELECT '1000' C_CODE, CHECKD_CODE2, CHECKD_NAME2, '20101101' aS JOB_DATE FROM AUTODOCU
                         *                  WHERE DATA_GUBUN = '85'
                         *                    AND DATA_NO    = {0}
                         *                    AND WRITE_DATE = '{1}'
                         *                    AND DEPT_CODE  = '002020102000'
                         *                    AND NODE_CODE  = '1000'
                         *                    AND C_CODE     = '1000'
                         *                    AND CHECK_CODE2 = 'M57'
                         *                    AND CHECKD_CODE2 <> '999999'
                         *                    AND CHECKD_CODE2 NOT IN (SELECT ID_CODE FROM ONKET_ID WHERE C_CODE = '1000')";
                         * Query_In = string.Format(Query_In, code, Write_date);
                         *
                         * using (System.Data.SqlClient.SqlCommand cmd1 = new System.Data.SqlClient.SqlCommand(Query_In, cn))
                         * {
                         *
                         *  int row1 = cmd1.ExecuteNonQuery();
                         *  cmd1.Dispose();
                         *
                         * }
                         *
                         * CHK_MK("C_MK");
                         */
                        Basic.ShowMessage(1, "생성 하였습니다.");



                        if (cn.State == ConnectionState.Open)
                        {
                            cn.Close();
                        }

                        cn.Dispose();
                    }

                    scope.Complete();
                    scope.Dispose();
                }
                InvokeOnClick(this.btnSelect, new EventArgs());
            }
            catch (Exception ex)
            {
                Basic.ShowMessage(3, ex.Message);
            }
            finally
            {
                this.pgb.Visible = false;
                this.Cursor      = Cursors.Default;
            }
        }
예제 #21
0
        private static void addCategory(int index)
        {
            Task.Run(() =>
            {
                try
                {
                    Console.WriteLine("Start before " + index);
                    using (var trans = new System.Transactions.TransactionScope())
                    {
                        Console.WriteLine("Starting " + index);
                        using (var db = new IntelEntities())
                        {
                            // 主-外键 添加1
                            tCategory category = new tCategory()
                            {
                                Code            = "Code_" + index,
                                ContentType     = 1,
                                DisplayName     = "Name_" + index,
                                IsAdvanceSearch = true,
                                IsMultiple      = true,
                                Position        = 1,
                                Sort            = 1
                            };

                            tCategoryItem item = new tCategoryItem()
                            {
                                CategoryID = category.ID,
                                Code       = "Code_Item_" + index,
                                Sort       = 1
                            };

                            db.tCategories.Add(category);
                            db.tCategoryItems.Add(item);

                            //// 主-外键 添加2
                            //tCategory category2 = new tCategory()
                            //{
                            //    Code = "Code_" + index,
                            //    ContentType = 1,
                            //    DisplayName = "Name_" + index,
                            //    IsAdvanceSearch = true,
                            //    IsMultiple = true,
                            //    Position = 1,
                            //    Sort = 1
                            //};

                            //tCategoryItem item2 = new tCategoryItem()
                            //{
                            //    Code = "Code_Item_" + index,
                            //    Sort = 1,
                            //    tCategory = category2
                            //};

                            //db.tCategoryItems.Add(item2);



                            tCategoryItem item2 = new tCategoryItem()
                            {
                                Code = "Code_Item_" + index,
                                Sort = 1
                            };
                            tCategory category2 = new tCategory()
                            {
                                Code            = "Code_" + index,
                                ContentType     = 1,
                                DisplayName     = "Name_" + index,
                                IsAdvanceSearch = true,
                                IsMultiple      = true,
                                Position        = 1,
                                Sort            = 1,
                                tCategoryItems  = new List <tCategoryItem> {
                                    item2
                                }
                            };
                            db.tCategories.Add(category2);


                            db.SaveChanges();
                            Console.WriteLine("Saved " + index);
                        }

                        Thread.Sleep(200);
                        trans.Complete();

                        trans.Dispose();
                        Console.WriteLine("Completed " + index);
                    }
                }
                catch (Exception ex)
                {
                    Console.WriteLine("Error " + index + " " + ex.Message);
                }
            });
        }
 protected override void InternalSubmit()
 {
     transaction.Dispose();
 }
예제 #23
0
 public void Dispose()
 {
     // Dispose
     _transactionScope.Dispose();
 }
 public void TearDown()
 {
     _transactionScope.Dispose();
 }
예제 #25
0
 public void AfterTest(ITest test)
 {
     _transactionScope.Dispose();
 }