Пример #1
0
        public JsonResult PackageWBSCopy(string ProjectInfoID, string TargetNodes, string DataSource)
        {
            var    targetNodes = JsonHelper.ToList(TargetNodes);
            var    sourceNodes = JsonHelper.ToList(DataSource);
            Action action      = () =>
            {
                var fo = FormulaHelper.CreateFO <WBSFO>();
                fo.ImportPackageNodes(targetNodes, sourceNodes);
            };

            if (System.Configuration.ConfigurationManager.AppSettings["UseMsdtc"].ToLower() == "true")
            {
                System.Transactions.TransactionOptions tranOp = new System.Transactions.TransactionOptions();
                tranOp.IsolationLevel = System.Transactions.IsolationLevel.ReadUncommitted;
                using (System.Transactions.TransactionScope ts =
                           new System.Transactions.TransactionScope(System.Transactions.TransactionScopeOption.Required, tranOp))
                {
                    action();
                    ts.Complete();
                }
            }
            else
            {
                action();
            }
            return(Json(""));
        }
Пример #2
0
        public IQueryable <dnn_YourCompany_LogEntry> Get(string keyWord)
        {
            IQueryable <dnn_YourCompany_LogEntry> items = null;
            var transactionOptions = new System.Transactions.TransactionOptions();

            transactionOptions.IsolationLevel = System.Transactions.IsolationLevel.ReadUncommitted;

            using (var transactionScope = new System.Transactions.TransactionScope(System.Transactions.TransactionScopeOption.Required, transactionOptions))
            {
                using (dotnetnukeEntities db = new dotnetnukeEntities())
                {
                    try
                    {
                        db.Configuration.ProxyCreationEnabled = false;
                        items = db.dnn_YourCompany_LogEntry.Where(e => e.Entry.Contains(keyWord))
                                .ToList().AsQueryable <dnn_YourCompany_LogEntry>();
                    }
                    catch (Exception e)
                    {
                        string error = e.Message;
                    }
                }
                transactionScope.Complete();
            }
            return(items);
        }
Пример #3
0
        public int Post(dnn_YourCompany_LogEntry logEntry)
        {
            var transactionOptions = new System.Transactions.TransactionOptions();

            transactionOptions.IsolationLevel = System.Transactions.IsolationLevel.ReadUncommitted;
            int newItemid = 0;

            using (var transactionScope = new System.Transactions.TransactionScope(System.Transactions.TransactionScopeOption.Required, transactionOptions))
            {
                using (dotnetnukeEntities db = new dotnetnukeEntities())
                {
                    try
                    {
                        db.Configuration.ProxyCreationEnabled = false;
                        logEntry.CreatedDate = DateTime.Now;
                        logEntry.EntryDate   = DateTime.Now;
                        logEntry.ModuleID    = 380;
                        db.Set <dnn_YourCompany_LogEntry>().Add(logEntry);
                        db.SaveChanges();
                        newItemid = logEntry.ItemID;
                    }
                    catch (Exception e)
                    {
                        string error = e.Message;
                    }
                }
                transactionScope.Complete();
            }
            return(newItemid);
        }
Пример #4
0
 public bool CheckConditionRewardByDatenUserID(DateTime pStartDate, string pUserID)
 {
     try
     {
         var countReward        = 0;
         var transactionOptions = new System.Transactions.TransactionOptions();
         transactionOptions.IsolationLevel = System.Transactions.IsolationLevel.ReadUncommitted;
         using (var transactionScope = new System.Transactions.TransactionScope(System.Transactions.TransactionScopeOption.Required, transactionOptions))
         {
             countReward = new TransactionQueryBuilder(new WalletEntities()).CountRewardTransactionByDatenUserID(pStartDate, pUserID);
         }
         if (countReward > EwalletConstant.LimitTopupExtraPerUser)
         {
             return(false);
         }
         else
         {
             return(true);
         }
     }
     catch (Exception ex)
     {
         var logWallet = new LogWallet();
         logWallet.Log(MethodBase.GetCurrentMethod(), "", ex, "");
         return(false);
     }
 }
        public List <TRegistro> LeerRegistros(int posicion, int cantidad, List <ClausulaDeFiltrado> filtros = null, List <ClausulaDeOrdenacion> orden = null, List <ClausulaDeJoin> joins = null, ParametrosDeNegocio parametros = null)
        {
            List <TRegistro> elementosDeBd;

            if (parametros == null)
            {
                parametros = new ParametrosDeNegocio(enumTipoOperacion.LeerSinBloqueo);
            }

            IQueryable <TRegistro> registros = DefinirConsulta(posicion, cantidad, filtros, orden, joins, parametros);

            if (!Contexto.HayTransaccion && parametros.Operacion == enumTipoOperacion.LeerSinBloqueo)
            {
                var transactionOptions = new System.Transactions.TransactionOptions();
                transactionOptions.IsolationLevel = System.Transactions.IsolationLevel.ReadUncommitted;
                using (var transactionScope = new System.Transactions.TransactionScope(System.Transactions.TransactionScopeOption.Required, transactionOptions))
                {
                    elementosDeBd = parametros.LeerParaActualizar ? registros.ToList() : registros.AsNoTracking().ToList();
                    transactionScope.Complete();
                }
            }
            else
            {
                elementosDeBd = parametros.LeerParaActualizar ? registros.ToList() : registros.AsNoTracking().ToList();
            }

            return(elementosDeBd);
        }
Пример #6
0
        public void Delete(int itemid)
        {
            var transactionOptions = new System.Transactions.TransactionOptions();

            transactionOptions.IsolationLevel = System.Transactions.IsolationLevel.ReadUncommitted;

            using (var transactionScope = new System.Transactions.TransactionScope(System.Transactions.TransactionScopeOption.Required, transactionOptions))
            {
                using (dotnetnukeEntities db = new dotnetnukeEntities())
                {
                    try
                    {
                        dnn_YourCompany_LogEntry _logEntry = db.dnn_YourCompany_LogEntry
                                                             .Where(e => e.ItemID == itemid).FirstOrDefault();
                        if (_logEntry != null)
                        {
                            db.Configuration.ProxyCreationEnabled = false;
                            db.Set <dnn_YourCompany_LogEntry>().Remove(_logEntry);
                            db.SaveChanges();
                        }
                    }
                    catch (Exception e)
                    {
                        string error = e.Message;
                    }
                }
                transactionScope.Complete();
            }
        }
Пример #7
0
        public JsonResult DeleteWBS(string WBSInfo, string ProjectInfoID)
        {
            var    list   = JsonHelper.ToList(WBSInfo);
            Action action = () =>
            {
                var productDt = this.SqlHelper.ExecuteDataTable(String.Format("SELECT ID,WBSFullID FROM S_E_Product WITH(NOLOCK) WHERE ProjectInfoID='{0}'",
                                                                              ProjectInfoID));
                var deleteWBSList = new List <Dictionary <string, object> >();
                foreach (var item in list)
                {
                    if (!list.Exists(c => c.GetValue("ID") == item.GetValue("ParentID")))
                    {
                        deleteWBSList.Add(item);
                    }
                }

                foreach (var item in deleteWBSList)
                {
                    var wbsId  = item.GetValue("ID");
                    var fullID = item.GetValue("FullID");
                    if (item.GetValue("WBSType") == WBSNodeType.Project.ToString())
                    {
                        throw new Formula.Exceptions.BusinessValidationException("WBS【" + item.GetValue("Name") + "】是根节点,不能删除");
                    }
                    else if (string.IsNullOrEmpty(item.GetValue("MajorCode")) || item.GetValue("VirtualWBSType") == WBSNodeType.Major.ToString())
                    {
                        throw new Formula.Exceptions.BusinessValidationException("只能删除专业下层节点");
                    }
                    if (Convert.ToInt32(productDt.Compute("Count(ID)", "WBSFullID like '" + fullID + "%'")) > 0)
                    {
                        //判定有成果的节点不允许删除
                        throw new Formula.Exceptions.BusinessValidationException("WBS【" + item.GetValue("Name") + "】已经有成果或它的下级节点有成果,无法进行删除");
                    }
                    this.SqlHelper.ExecuteNonQuery(String.Format("delete from S_W_WBS where FullID like '{0}%'", fullID));
                    this.SqlHelper.ExecuteNonQuery(String.Format(@"delete from S_P_CooperationPlan where 
WBSID in (select ID from S_W_WBS where FullID like  '{0}%')", fullID));
                    this.SqlHelper.ExecuteNonQuery(String.Format(@"delete from S_W_Activity where 
WBSID in (select ID from S_W_WBS where FullID like  '{0}%')", fullID));
                    this.SqlHelper.ExecuteNonQuery(String.Format(@"delete from S_P_MileStone where 
WBSID in (select ID from S_W_WBS where FullID like  '{0}%')", fullID));
                }
            };

            if (System.Configuration.ConfigurationManager.AppSettings["UseMsdtc"].ToLower() == "true")
            {
                System.Transactions.TransactionOptions tranOp = new System.Transactions.TransactionOptions();
                tranOp.IsolationLevel = System.Transactions.IsolationLevel.ReadUncommitted;
                using (System.Transactions.TransactionScope ts =
                           new System.Transactions.TransactionScope(System.Transactions.TransactionScopeOption.Required, tranOp))
                {
                    action();
                    ts.Complete();
                }
            }
            else
            {
                action();
            }
            return(Json(""));
        }
Пример #8
0
        /// <summary>
        /// 指事务隔离级别执行相关查询
        /// </summary>
        /// <param name="query">待查询对象</param>
        /// <param name="action">查询方法</param>
        /// <param name="isolationLevel">默认读未提交</param>
        /// <param name="timeOut">事务溢出时间</param>
        /// <typeparam name="TEntity">查询对象类型</typeparam>
        public static void QueryWithTransactions <TEntity>(this IQueryable <TEntity> query, Action action, System.Transactions.IsolationLevel isolationLevel = System.Transactions.IsolationLevel.ReadUncommitted, TimeSpan?timeOut = null)
        {
            if (action == null)
            {
                return;
            }

            var transactionOptions = new System.Transactions.TransactionOptions
            {
                IsolationLevel = isolationLevel
            };

            if (timeOut != null)
            {
                transactionOptions.Timeout = timeOut.Value;
            }

            using (var transactionScope = new System.Transactions.TransactionScope(System.Transactions.TransactionScopeOption.Required, transactionOptions))
            {
                try
                {
                    action();
                }
                finally
                {
                    transactionScope.Complete();
                }
            }
        }
 protected System.Transactions.TransactionScope NewTransactionScope( )
 {
     System.Transactions.TransactionOptions options = new System.Transactions.TransactionOptions( );
     options.IsolationLevel = System.Transactions.IsolationLevel.ReadCommitted;
     options.Timeout        = TimeSpan.MaxValue;
     return(new System.Transactions.TransactionScope(System.Transactions.TransactionScopeOption.RequiresNew, options));
 }
Пример #10
0
        internal static Func <System.Transactions.TransactionScope> DefaultNewScopeFunc(System.Transactions.IsolationLevel isolationLevel, bool isAlwaysNewScope)
        {
            var scopeOption        = isAlwaysNewScope ? System.Transactions.TransactionScopeOption.RequiresNew : System.Transactions.TransactionScopeOption.Required;
            var transactionOptions = new System.Transactions.TransactionOptions
            {
                IsolationLevel = isolationLevel,
            };

            return(() => new System.Transactions.TransactionScope(scopeOption, transactionOptions));
        }
Пример #11
0
		/// <summary>
		/// Create a transaction scope of specified TransactionScope
		/// Sets the isolation level to ReadCommitted
		/// </summary>
		/// <returns></returns>
		public static System.Transactions.TransactionScope CreateTransactionScope(System.Transactions.TransactionScopeOption tranScopeOption)
		{

			System.Transactions.TransactionOptions tranOption = new System.Transactions.TransactionOptions();
			tranOption.IsolationLevel = System.Transactions.IsolationLevel.ReadCommitted;

			System.Transactions.TransactionScope scope = new System.Transactions.TransactionScope(tranScopeOption, tranOption);
			//Console.WriteLine(string.Format("Transaction Id={0}, DistId={1}", System.Transactions.Transaction.Current.TransactionInformation.LocalIdentifier, System.Transactions.Transaction.Current.TransactionInformation.DistributedIdentifier));
			return scope;
		}
Пример #12
0
        public JsonResult PublishWBSBulk(string ProjectInfoID)
        {
            var projectDt = this.SqlHelper.ExecuteDataTable(String.Format("select * from S_I_ProjectInfo where ID='{0}'", ProjectInfoID));

            if (projectDt.Rows.Count == 0)
            {
                throw new Formula.Exceptions.BusinessValidationException("没有找到指定ID为【" + ProjectInfoID + "】的项目信息,请联系管理员");
            }
            var    versionDic = new Dictionary <string, object>();
            Action action     = () =>
            {
                var versionDt = this.SqlHelper.ExecuteDataTable("select * from S_W_WBS_Version where ProjectInfoID='" + ProjectInfoID + "' and FlowPhase!='End'");
                if (versionDt.Rows.Count > 0)
                {
                    //如果之前存在一个临时版本(流程未完成的版本),则删除该版本下所有节点
                    this.SqlHelper.ExecuteNonQuery("delete from S_W_WBS_Version_Node where VersionID='" + versionDt.Rows[0]["ID"] + "'");
                    versionDic = FormulaHelper.DataRowToDic(versionDt.Rows[0]);
                }
                else
                {
                    versionDic.SetValue("ID", FormulaHelper.CreateGuid());
                    versionDic.SetValue("FlowPhase", "Start");
                    versionDic.SetValue("CreateDate", DateTime.Now);
                    versionDic.SetValue("CreateUser", this.CurrentUserInfo.UserName);
                    versionDic.SetValue("CreateUserID", this.CurrentUserInfo.UserID);
                    versionDic.SetValue("ProjectInfoID", ProjectInfoID);
                    versionDic.SetValue("ProjectInfoName", projectDt.Rows[0]["Name"]);
                    versionDic.SetValue("ProjectInfo", ProjectInfoID);
                    versionDic.SetValue("ProjectInfoCode", projectDt.Rows[0]["Code"]);
                    var maxVersion = Convert.ToInt32(
                        this.SqlHelper.ExecuteScalar("select isnull(Max(VersionNumber),0)+1 from S_W_WBS_Version where ProjectInfoID='" + ProjectInfoID + "'"));
                    versionDic.SetValue("VersionNumber", maxVersion);
                    versionDic.SetValue("VersionName", projectDt.Rows[0]["Name"] + "第【" + maxVersion + "】版WBS计划");
                    versionDic.InsertDB(this.SqlHelper, "S_W_WBS_Version", versionDic.GetValue("ID"));
                }
                S_W_WBS_Version.UpgradeVersion(versionDic);
            };

            if (System.Configuration.ConfigurationManager.AppSettings["UseMsdtc"].ToLower() == "true")
            {
                System.Transactions.TransactionOptions tranOp = new System.Transactions.TransactionOptions();
                tranOp.IsolationLevel = System.Transactions.IsolationLevel.ReadUncommitted;
                using (System.Transactions.TransactionScope ts =
                           new System.Transactions.TransactionScope(System.Transactions.TransactionScopeOption.Required, tranOp))
                {
                    action();
                    ts.Complete();
                }
            }
            else
            {
                action();
            }
            return(Json(new { FormID = versionDic.GetValue("ID") }));
        }
Пример #13
0
        private void resetTablesToolStripMenuItem_Click(object sender, EventArgs e)
        {
            try
            {
                using (var db = new CoursemoDataContext())
                {
                    var TxOptions = new System.Transactions.TransactionOptions();
                    TxOptions.IsolationLevel = System.Transactions.IsolationLevel.Serializable;

                    using (var Tx = new System.Transactions.TransactionScope(System.Transactions.TransactionScopeOption.Required, TxOptions))
                    {
                        var query = from en in db.Enrolleds
                                    select en;

                        foreach (Enrolled en in query)
                        {
                            db.Enrolleds.DeleteOnSubmit(en);
                        }

                        //db.Enrolleds.DeleteAllOnSubmit(query);

                        var query2 = from w in db.Waitlists
                                     select w;

                        foreach (Waitlist w in query2)
                        {
                            db.Waitlists.DeleteOnSubmit(w);
                        }
                        //db.Waitlists.DeleteAllOnSubmit(query2);

                        db.SubmitChanges();

                        Tx.Complete();
                    } //Using tx
                }     //Using db

                MessageBox.Show("Deletes successful");
            }

            catch (Exception ex)
            {
                MessageBox.Show("Delete failed + " + ex.Message);
            }
            finally
            {
                StudentListBox_SelectedIndexChanged(sender, e);
                CourseListBox_SelectedIndexChanged(sender, e);
            }
        }
Пример #14
0
 public IQueryable<vu_DashboardLogsLatest> Refresh()
 {
     IQueryable<vu_DashboardLogsLatest> data;
     var transactionOptions = new System.Transactions.TransactionOptions();
     transactionOptions.IsolationLevel = System.Transactions.IsolationLevel.ReadUncommitted;
     using (var transactionScope = new System.Transactions.TransactionScope(System.Transactions.TransactionScopeOption.Required, transactionOptions))
     {
         if (_bitsDashboardContext != null)
             _bitsDashboardContext.Connection.Close();
         _bitsDashboardContext = new DashboardEntities();
         data =  _bitsDashboardContext.vu_DashboardLogsLatest.OrderByDescending(logData => logData.StartTime);
         transactionScope.Complete();
         return data;
     }
 }
Пример #15
0
        public virtual void BulkInsert <T>(IEnumerable <T> list) where T : class
        {
            var dbContext          = GetDbContext();
            var transactionOptions = new System.Transactions.TransactionOptions
            {
                IsolationLevel = System.Transactions.IsolationLevel.Serializable,
                Timeout        = TimeSpan.FromSeconds(0)
            };

            try
            {
                using (var transactionScope = new System.Transactions.TransactionScope(System.Transactions.TransactionScopeOption.RequiresNew, transactionOptions))
                {
                    var dbSet = dbContext.Set <T>();
                    foreach (var entity in list)
                    {
                        if (dbContext.Entry(entity).State == EntityState.Detached)
                        {
                            dbSet.Attach(entity);
                        }
                        dbSet.Add(entity);
                        dbContext.ObjectContext.ObjectStateManager.ChangeObjectState(entity, EntityState.Added);
                    }

                    dbContext.SaveChanges();
                    transactionScope.Complete();
                }
            }
            catch (System.Data.Entity.Validation.DbEntityValidationException vex)
            {
                int errorId = 0;
                foreach (var item in vex.EntityValidationErrors)
                {
                    foreach (var error in item.ValidationErrors)
                    {
                        errorId++;
                        string key = string.Format("{0}{1}", error.PropertyName, errorId);
                        vex.Data.Add(key, error.ErrorMessage);
                    }
                }
                throw;
            }
            catch (Exception exp)
            {
                throw;
            }
        }
Пример #16
0
        private void InitGateCampsFromLastHour()
        {
            LOGGER.Debug("Starting GateCampDetection Initialization");
            try
            {
                //declare the transaction options
                var transactionOptions = new System.Transactions.TransactionOptions
                {
                    IsolationLevel = System.Transactions.IsolationLevel.ReadUncommitted
                };
                //set it to read uncommited
                //create the transaction scope, passing our options in
                using (
                    var transactionScope = new System.Transactions.TransactionScope(
                        System.Transactions.TransactionScopeOption.Required,
                        transactionOptions))
                {
                    var start = DateTime.UtcNow;
                    using (var context = new DatabaseContext())
                    {
                        context.ObjectContext.CommandTimeout = 300;
                        var startDateTime      = DateTime.UtcNow - new TimeSpan(1, 0, 0);
                        var killsInTheLastHour = context.Kills.Where(kill => kill.KillTime > startDateTime)
                                                 .AsQueryable()
                                                 .Include(kill => kill.Attackers)
                                                 .Include(kill => kill.Victim)
                                                 .ToList()
                                                 .Select(kill => new KillResult(kill));

                        transactionScope.Complete();
                        _gateCampDetector.AddRange(killsInTheLastHour);

                        _gateCampDetector.DetectGateCamps();

                        LOGGER.Debug("Initial gate camps detected: " + _gateCampDetector.GateCamps.Count);

                        _gateCampDifferenceDetector.SetNextStatus(_gateCampDetector.GateCamps);
                    }
                    LOGGER.Debug("Loaded initial kills in " + (DateTime.UtcNow - start).TotalSeconds + "s");
                }
            }
            catch (Exception e)
            {
                LOGGER.Error("ERROR initializing gate camp detection", e);
                throw;
            }
        }
Пример #17
0
        public static void NoLockInvokeDB(Action action)
        {
            var transactionOptions = new System.Transactions.TransactionOptions();

            transactionOptions.IsolationLevel = System.Transactions.IsolationLevel.ReadUncommitted;
            using (var transactionScope = new System.Transactions.TransactionScope(System.Transactions.TransactionScopeOption.Required, transactionOptions))
            {
                try
                {
                    action();
                }
                finally
                {
                    transactionScope.Complete();
                }
            }
        }
Пример #18
0
        private static void InvokeDB(Action action, System.Transactions.IsolationLevel isolationLevel)
        {
            var transactionOptions = new System.Transactions.TransactionOptions();

            transactionOptions.IsolationLevel = isolationLevel;
            using (var transactionScope = new System.Transactions.TransactionScope(System.Transactions.TransactionScopeOption.Required, transactionOptions))
            {
                try
                {
                    action();
                }
                finally
                {
                    transactionScope.Complete();
                }
            }
        }
Пример #19
0
 public TownBusTrip GetMaxChargeByTripID(TownBusEntities newWalletEntities, int TripID)
 {
     try
     {
         var transactionOptions = new System.Transactions.TransactionOptions();
         transactionOptions.IsolationLevel = System.Transactions.IsolationLevel.ReadUncommitted;
         using (var transactionScope = new System.Transactions.TransactionScope(System.Transactions.TransactionScopeOption.Required, transactionOptions))
         {
             return(new WalletTownbusQueryBuilder(newWalletEntities).GetTownbusInfoByTripID(TripID).FirstOrDefault());
         }
     }
     catch (Exception ex)
     {
         var logWallet = new LogWallet();
         logWallet.Log(MethodBase.GetCurrentMethod(), "", ex, "");
         return(null);
     }
 }
Пример #20
0
        public Wallet_Account_Reward GetRewardByAccID(string pAccID)
        {
            var logWallet = new LogWallet();

            try
            {
                var transactionOptions = new System.Transactions.TransactionOptions();
                transactionOptions.IsolationLevel = System.Transactions.IsolationLevel.ReadUncommitted;
                using (var transactionScope = new System.Transactions.TransactionScope(System.Transactions.TransactionScopeOption.Required, transactionOptions))
                {
                    return(new WalletRewardQueryBuilder(new WalletEntities()).GetRewardByAccID(pAccID).FirstOrDefault());
                }
            }
            catch (Exception ex)
            {
                logWallet.Log(MethodBase.GetCurrentMethod(), pAccID, ex, "");
                return(null);
            }
        }
Пример #21
0
        public List <Wallet_Account_Reward> GetRewardsByAccIds(List <string> Ids)
        {
            var logWallet = new LogWallet();

            try
            {
                var transactionOptions = new System.Transactions.TransactionOptions();
                transactionOptions.IsolationLevel = System.Transactions.IsolationLevel.ReadUncommitted;
                using (var transactionScope = new System.Transactions.TransactionScope(System.Transactions.TransactionScopeOption.Required, transactionOptions))
                {
                    return(new WalletRewardQueryBuilder(new WalletEntities()).GotBalance().HaveIds(Ids).ToList());
                }
            }
            catch (Exception ex)
            {
                logWallet.Log(MethodBase.GetCurrentMethod(), "", ex, "Error in GetRewardsByAccIds of TallyWithdrawBalance");
                return(null);
            }
        }
Пример #22
0
        public void Put(dnn_YourCompany_LogEntry logEntry)
        {
            var transactionOptions = new System.Transactions.TransactionOptions();

            transactionOptions.IsolationLevel = System.Transactions.IsolationLevel.ReadUncommitted;

            using (var transactionScope = new System.Transactions.TransactionScope(System.Transactions.TransactionScopeOption.Required, transactionOptions))
            {
                using (dotnetnukeEntities db = new dotnetnukeEntities())
                {
                    try
                    {
                        dnn_YourCompany_LogEntry _logEntry = db.dnn_YourCompany_LogEntry
                                                             .Where(e => e.ItemID == logEntry.ItemID).FirstOrDefault();
                        if (_logEntry != null)
                        {
                            db.Configuration.ProxyCreationEnabled = false;

                            if (_logEntry.EntryDate == null)
                            {
                                _logEntry.EntryDate = DateTime.Now;
                            }


                            _logEntry.EntryDate = logEntry.EntryDate;
                            _logEntry.Entry     = logEntry.Entry;

                            db.SaveChanges();
                        }
                        else
                        {
                            Post(logEntry);
                        }
                    }
                    catch (Exception e)
                    {
                        string error = e.Message;
                    }
                }
                transactionScope.Complete();
            }
        }
Пример #23
0
        public Wallet_Account GetWalletAccByUserIDnCurrencyCode(string UserID, string CurrencyCode)
        {
            var WalletAcc = new Wallet_Account();

            try
            {
                var transactionOptions = new System.Transactions.TransactionOptions();
                transactionOptions.IsolationLevel = System.Transactions.IsolationLevel.ReadUncommitted;
                using (var transactionScope = new System.Transactions.TransactionScope(System.Transactions.TransactionScopeOption.Required, transactionOptions))
                {
                    WalletAcc = new WalletAccountQueryBuilder(new WalletEntities()).GetAccIdByUserIDnCurrencyCode(UserID, CurrencyCode).FirstOrDefault();
                }
                return(WalletAcc);
            }
            catch (Exception ex)
            {
                var logWallet = new LogWallet();
                Task.Factory.StartNew(() => logWallet.Log(MethodBase.GetCurrentMethod(), UserID + "|" + CurrencyCode, ex, ""));
                return(WalletAcc);
            }
        }
Пример #24
0
        public bool IsExistUserID(string pUserID)
        {
            bool result = false;

            try
            {
                var transactionOptions = new System.Transactions.TransactionOptions();
                transactionOptions.IsolationLevel = System.Transactions.IsolationLevel.ReadUncommitted;
                using (var transactionScope = new System.Transactions.TransactionScope(System.Transactions.TransactionScopeOption.Required, transactionOptions))
                {
                    result = new WalletUserQueryBuilder(new WalletEntities()).HasUserId(pUserID);
                }
                return(result);
            }
            catch (Exception ex)
            {
                var logWallet = new LogWallet();
                Task.Factory.StartNew(() => logWallet.Log(MethodBase.GetCurrentMethod(), pUserID, ex, ""));
                return(result);
            }
        }
Пример #25
0
        public List <Wallet_Account> GetWalletAccsByWalletIdCurrencies(List <string> walletCurrencies)
        {
            var WalletAccs = new List <Wallet_Account>();

            try
            {
                var transactionOptions = new System.Transactions.TransactionOptions();
                transactionOptions.IsolationLevel = System.Transactions.IsolationLevel.ReadUncommitted;
                using (var transactionScope = new System.Transactions.TransactionScope(System.Transactions.TransactionScopeOption.Required, transactionOptions))
                {
                    WalletAccs = new WalletAccountQueryBuilder(new WalletEntities()).HasWalletCurrencies(walletCurrencies).ToList();
                }
                return(WalletAccs);
            }
            catch (Exception ex)
            {
                var logWallet = new LogWallet();
                Task.Factory.StartNew(() => logWallet.Log(MethodBase.GetCurrentMethod(), walletCurrencies.Aggregate((a, b) => $"{a},{b}"), ex, ""));
                return(WalletAccs);
            }
        }
Пример #26
0
        public List <Transaction> GetTransTopupWithoutVerified()
        {
            var Tran = new List <Transaction>();

            try
            {
                var transactionOptions = new System.Transactions.TransactionOptions();
                transactionOptions.IsolationLevel = System.Transactions.IsolationLevel.ReadUncommitted;
                using (var transactionScope = new System.Transactions.TransactionScope(System.Transactions.TransactionScopeOption.Required, transactionOptions))
                {
                    Tran = new TransactionQueryBuilder(new WalletEntities()).GetTransTopup().ToList();
                }
                return(Tran);
            }
            catch (Exception ex)
            {
                var logWallet = new LogWallet();
                Task.Factory.StartNew(() => logWallet.Log(MethodBase.GetCurrentMethod(), "", ex, ""));
                return(Tran);
            }
        }
Пример #27
0
        public List <Transaction> GetTranTownBusnWithdrawByUserIDNoVerify(string pUserID, string pCurrencyCode)
        {
            var Tran = new List <Transaction>();

            try
            {
                var transactionOptions = new System.Transactions.TransactionOptions();
                transactionOptions.IsolationLevel = System.Transactions.IsolationLevel.ReadUncommitted;
                using (var transactionScope = new System.Transactions.TransactionScope(System.Transactions.TransactionScopeOption.Required, transactionOptions))
                {
                    Tran = new TransactionQueryBuilder(new WalletEntities()).GetTranTownBusnWithdrawByUserIDNoVerify(pUserID, pCurrencyCode).ToList();
                }
                return(Tran);
            }
            catch (Exception ex)
            {
                var logWallet = new LogWallet();
                Task.Factory.StartNew(() => logWallet.Log(MethodBase.GetCurrentMethod(), "", ex, ""));
                return(Tran);
            }
        }
Пример #28
0
        public Transaction GetWalletTranByTranID(string TranID)
        {
            var Tran = new Transaction();

            try
            {
                var transactionOptions = new System.Transactions.TransactionOptions();
                transactionOptions.IsolationLevel = System.Transactions.IsolationLevel.ReadUncommitted;
                using (var transactionScope = new System.Transactions.TransactionScope(System.Transactions.TransactionScopeOption.Required, transactionOptions))
                {
                    Tran = new TransactionQueryBuilder(new WalletEntities()).GetTranByTranID(TranID).FirstOrDefault();
                }
                return(Tran);
            }
            catch (Exception ex)
            {
                var logWallet = new LogWallet();
                Task.Factory.StartNew(() => logWallet.Log(MethodBase.GetCurrentMethod(), TranID, ex, ""));
                return(Tran);
            }
        }
Пример #29
0
        public Wallet_Rule GetWalletRuleByAccID(string pAccID)
        {
            var WalletRule = new Wallet_Rule();

            try
            {
                var transactionOptions = new System.Transactions.TransactionOptions();
                transactionOptions.IsolationLevel = System.Transactions.IsolationLevel.ReadUncommitted;
                using (var transactionScope = new System.Transactions.TransactionScope(System.Transactions.TransactionScopeOption.Required, transactionOptions))
                {
                    WalletRule = new WalletRuleQueryBuilder(new WalletEntities()).GetWalletByID(pAccID).FirstOrDefault();
                }
                return(WalletRule);
            }
            catch (Exception ex)
            {
                var logWallet = new LogWallet();
                Task.Factory.StartNew(() => logWallet.Log(MethodBase.GetCurrentMethod(), pAccID, ex, ""));
                return(WalletRule);
            }
        }
Пример #30
0
        /// <summary>
        /// Get AspNetUser by aspNetUserId
        /// </summary>
        /// <param name="aspNetUserId"></param>
        /// <returns></returns>
        public List <User_Bank_Account> GetBankAccwithoutPending()
        {
            var user_bank = new List <User_Bank_Account>();

            try
            {
                var transactionOptions = new System.Transactions.TransactionOptions();
                transactionOptions.IsolationLevel = System.Transactions.IsolationLevel.ReadUncommitted;
                using (var transactionScope = new System.Transactions.TransactionScope(System.Transactions.TransactionScopeOption.Required, transactionOptions))
                {
                    user_bank = new UserBankAccountQueryBuilder(new WalletEntities()).GetBankAccwithoutPending().ToList();
                }
                return(user_bank);
            }
            catch (Exception ex)
            {
                var logWallet = new LogWallet();
                Task.Factory.StartNew(() => logWallet.Log(MethodBase.GetCurrentMethod(), "", ex, ""));
                return(user_bank);
            }
        }
Пример #31
0
        public List <Wallet_Account> GetWalletAccountByUserID(string pUserID)
        {
            var WalletAcc = new List <Wallet_Account>();

            try
            {
                var transactionOptions = new System.Transactions.TransactionOptions();
                transactionOptions.IsolationLevel = System.Transactions.IsolationLevel.ReadUncommitted;
                using (var transactionScope = new System.Transactions.TransactionScope(System.Transactions.TransactionScopeOption.Required, transactionOptions))
                {
                    WalletAcc = new WalletAccountQueryBuilder(new WalletEntities()).GetWalletByUserID(pUserID).ToList();
                }
                return(WalletAcc);
            }
            catch (Exception ex)
            {
                var logWallet = new LogWallet();
                Task.Factory.StartNew(() => logWallet.Log(MethodBase.GetCurrentMethod(), pUserID, ex, ""));
                return(WalletAcc);
            }
        }
Пример #32
0
        public List <User_Bank_Account> LoadVerificationStatus(string userID, string currency)
        {
            List <string> messages = new List <string>();
            var           userBank = new List <User_Bank_Account>();

            try
            {
                var transactionOptions = new System.Transactions.TransactionOptions();
                transactionOptions.IsolationLevel = System.Transactions.IsolationLevel.ReadUncommitted;
                using (var transactionScope = new System.Transactions.TransactionScope(System.Transactions.TransactionScopeOption.Required, transactionOptions))
                {
                    userBank = new UserBankAccountQueryBuilder(new WalletEntities()).GetInfoUserBankAccount(userID, currency).ToList();
                }
            }
            catch (Exception ex)
            {
                var logWallet = new LogWallet();
                Task.Factory.StartNew(() => logWallet.Log(MethodBase.GetCurrentMethod(), "", ex, ""));
            }
            return(userBank);
        }
Пример #33
0
        /// <summary>
        ///     Initializes a new instance of the <see cref="EffortTransaction" /> class.
        /// </summary>
        /// <param name="connection">
        ///     The <see cref="EffortTransaction" /> object.
        /// </param>
        /// <param name="isolationLevel">
        ///     The isolation level.
        /// </param>
        /// <exception cref="System.InvalidOperationException">
        ///     Ambient transaction is already set.
        /// </exception>
        public EffortTransaction(
            EffortConnection connection,
            System.Data.IsolationLevel isolationLevel)
        {
            if (System.Transactions.Transaction.Current != null)
            {
                throw new InvalidOperationException("Ambient transaction is already set.");
            }

            this.connection = connection;
            this.isolationLevel = isolationLevel;

            // Initialize new ambient transaction
            System.Transactions.TransactionOptions options =
                new System.Transactions.TransactionOptions();

            options.IsolationLevel = TranslateIsolationLevel(isolationLevel);
            options.Timeout = new TimeSpan(0, 0, connection.ConnectionTimeout);

            this.systemTransaction = new System.Transactions.CommittableTransaction(options);

            this.transaction = NMemory.Transactions.Transaction.Create(this.systemTransaction);
        }
Пример #34
0
      public static void RunScheduledTasks()
      {
          
            var transactionOptions = new System.Transactions.TransactionOptions();
            transactionOptions.IsolationLevel = System.Transactions.IsolationLevel.ReadUncommitted;
          
            using (var transactionScope = new System.Transactions.TransactionScope(System.Transactions.TransactionScopeOption.Required, transactionOptions))
            {
                using (DashboardEntities ef = new DashboardEntities())
                {

                    IList<string> listConfig = GetDashboardLogConfigs(ef);
                    foreach (string config in listConfig)
                    {
                        string dir = config;
                        string ext = "*.*";
                        DataTable dt = GetDataTable();
                        DataTable dtStats = GetStatsDataTable();
                        List<string> listOfSupressedErrors = GetListOfSupressedErrors();
                        foreach (String file in Directory.GetFiles(dir, ext))
                        {

                            if (File.GetLastWriteTime(file) > DateTime.Now.AddDays(-1))
                            {

                                try
                                {
                                    using (var r = new StreamReader(file))
                                    {

                                        FileInfo fi = new FileInfo(file);
                                        _bitsList = file.Split('\\').ToList<string>();
                                        string record = "";


                                        string server = _bitsList[2];
                                        string bitsInstance = _bitsList[4];
                                        foreach (
                                            var source in
                                                ef.tbl_SLA_DashboardLogs.OrderByDescending(a => a.StartTime)
                                                    .Where(a => a.Server == server && a.BITSInstance == bitsInstance))
                                        {
                                            tbl_SLA_DashboardLogs logstemp = source;
                                            maxDateTime = (DateTime)logstemp.StartTime;
                                            break;
                                        }
                                        //  maxDateTime = maxDateTime.AddDays(-2);
                                        maxDateTime = maxDateTime.AddMinutes(-10);

                                        while ((record = r.ReadLine()) != null)
                                        {
                                            try
                                            {
                                                DateTime recDate;
                                                if (record.Length < 19 ||
                                                    !DateTime.TryParse(record.Substring(0, 19), out recDate))
                                                    continue;

                                                DataRow dr = dt.NewRow();
                                                dr["Date"] = Convert.ToDateTime(record.Substring(0, 19));
                                                dr["Level"] =
                                                    record.Substring(24, 6).Trim().ToString(CultureInfo.InvariantCulture);

                                                int idx1 = record.IndexOf("ID=", StringComparison.Ordinal);
                                                if (idx1 < 0)
                                                    continue;

                                                string kc = record.Substring(idx1);
                                                int idx2 = kc.IndexOf(" -", StringComparison.Ordinal);
                                                kc = kc.Substring(3, idx2 - 3);
                                                if (kc != "(null)")
                                                {
                                                    dr["KeyCode"] = kc;
                                                    dr["Message"] = record.Substring(idx1 + idx2);
                                                    if (dr["Level"].ToString() != "INFO")
                                                        dt.Rows.Add(dr);

                                                    if (record.Contains("Beginning executing job") &&
                                                        record.Contains("Execution mode"))
                                                    {
                                                        DataRow drStat = dtStats.NewRow();

                                                        drStat["KeyCode"] = kc;
                                                        drStat["Name"] =
                                                            record.Substring(record.IndexOf("Beginning executing job ",
                                                                StringComparison.Ordinal))
                                                                .Replace("Beginning executing job ", "")
                                                                .Replace("_Job in Execution mode.", "");
                                                        drStat["StartTime"] = dr["Date"];
                                                        try
                                                        {
                                                            if (maxDateTime <= (DateTime)drStat["StartTime"])
                                                                dtStats.Rows.Add(drStat);
                                                        }
                                                        catch
                                                        {
                                                        }
                                                    }

                                                    DataRow foundRow = dtStats.Rows.Find(kc);
                                                    if (foundRow != null)
                                                    {
                                                        foundRow.BeginEdit();
                                                        foundRow["EndTime"] = dr["Date"];
                                                        foundRow["Seconds"] =
                                                            ((DateTime)foundRow["EndTime"] - (DateTime)foundRow["StartTime"])
                                                                .Seconds;
                                                        foundRow["Server"] = _bitsList[2];
                                                        foundRow["BITSInstance"] = _bitsList[4];
                                                        foundRow["Message"] = dr["Message"].ToString().Replace(",", " ;");

                                                        // Todo:  
                                                        if (
                                                            dr["Message"].ToString()
                                                                .Contains("Beginning write to file"))
                                                        {
                                                            String[] data = record.Replace("  ", " ").Split(new char[] { ' ' });
                                                            tbl_SLA_FileChecker filesChecker = new tbl_SLA_FileChecker();

                                                            filesChecker.jobKeyCode = kc;
                                                            filesChecker.FileName = data[9];


                                                            if (Convert.ToDateTime(record.Substring(0, 19)) >= maxDateTime)
                                                                ef.AddTotbl_SLA_FileChecker(filesChecker);

                                                        }

                                                        foundRow.EndEdit();
                                                    }

                                                    else if (foundRow == null)
                                                    {

                                                        if (maxDateTime <= (DateTime)dr["Date"])
                                                        {
                                                            DataRow runRow = dtStats.NewRow();
                                                            runRow["KeyCode"] = kc;
                                                            runRow["BITSInstance"] = _bitsList[4];
                                                            runRow["Message"] = record.Substring(idx1 + idx2);
                                                            runRow["Name"] = record.Substring(
                                                                record.IndexOf("Beginning executing job ",
                                                                    System.StringComparison.Ordinal))
                                                                .Replace("Beginning executing job ", "")
                                                                .Replace("_Job in Execution mode.", "");
                                                            runRow["StartTime"] = dr["Date"];
                                                            dtStats.Rows.Add(runRow);

                                                        }
                                                    }

                                                }
                                                Console.WriteLine("KEycode=" + kc);


                                                String[] data1 = record.Replace("  ", " ").Split(new[] { ' ' });
                                                tbl_SLA_BITSJobRequest reuestRequest = new tbl_SLA_BITSJobRequest();
                                                reuestRequest.RequestTime = Convert.ToDateTime(record.Substring(0, 19));
                                                reuestRequest.JobName = data1[7].Replace("_Job.", "");
                                                reuestRequest.RequestedBy = data1[10].Replace("FOUNTAINHEAD\\", "");
                                                reuestRequest.MachineName = data1[12];
                                                foreach (var s in dtStats.Select("Name Like '%" + reuestRequest.JobName + "%'"))
                                                {
                                                    reuestRequest.KeyCode = s["KeyCode"].ToString();
                                                }

                                                if (Convert.ToDateTime(record.Substring(0, 19)) >= maxDateTime && reuestRequest.JobName.Contains("ADHOC") && reuestRequest.KeyCode != String.Empty)
                                                    ef.AddTotbl_SLA_BITSJobRequest(reuestRequest);

                                            }

                                            catch (Exception ex)
                                            {
                                                Console.Write(ex);
                                            }

                                        }
                                    }
                                }
                                catch (Exception)
                                {
                                    ;
                                }

                                foreach (DataRow drStat in dtStats.Rows)
                                {
                                    tbl_SLA_DashboardLogs logs = new tbl_SLA_DashboardLogs();
                                    logs.Server = drStat["Server"].ToString();
                                    logs.BITSInstance = drStat["BITSInstance"].ToString();
                                    logs.KeyCode = drStat["KeyCode"].ToString();
                                    logs.Name = drStat["Name"].ToString().Replace("_Job in Initialization mode.", "");
                                    logs.StartTime = (DateTime?)drStat["StartTime"];
                                    logs.EndTime = (DateTime?)drStat["EndTime"];
                                    TimeSpan diffTime = (TimeSpan)(logs.EndTime - logs.StartTime);
                                    logs.Seconds = (int?)diffTime.TotalMinutes;
                                    logs.Message = drStat["Message"].ToString().Replace("\n", "|").Replace("\t", " ");



                                    // Error handeling 

                                    if (IsError(logs.Message) && listOfSupressedErrors.Contains(logs.Message))
                                        logs.Status = "Error";


                                    else if (drStat["Status"].ToString() == String.Empty)
                                    {

                                        double timeDiff = diffTime.TotalMinutes * 60;

                                        logs.Status = timeDiff > 0 ? "Completed" : "Running";
                                    }
                                    else if (drStat["Status"].ToString() == "Started")
                                    {
                                        logs.Status = "Running";
                                    }


                                    if (logs.StartTime >= maxDateTime)
                                        ef.AddTotbl_SLA_DashboardLogs(logs);


                                }
                                try
                                {
                                    ef.SaveChanges();

                                }
                                catch
                                {
                                    ;
                                }
                                finally {
                                    transactionScope.Complete();
                                }
                            }
                        }


                    }

                }
            }
      }
Пример #35
0
        //public IList<Models.Worklist> GetWorkList(string destination, DateTime startDate, DateTime endDate)
        //{
        //    using (var edm = new Models.DianPingK2ServerLogContext())
        //    {
        //        //return edm.Worklist.Select(_ =>
        //        //    new Models.Worklist
        //        //    {
        //        //        DestType = _.DestType,
        //        //        ProcInst = new Models.ProcInst
        //        //        {
        //        //            Folio = _.ProcInst.Folio
        //        //        }
        //        //    }).Where(_ => _.Destination == destination && _.ProcInst.StartDate > startDate).ToList();
        //        return edm.Worklist.Include("ProcInst")
        //            .Where(_ => _.Destination == destination && _.ProcInst.StartDate > startDate).ToList();
        //    }
        //}
        public QueryListResultBase<Worklist> GetWorkList(QueryCriteriaBase<QueryWorkList> queryPara)
        {
            var result = new QueryListResultBase<Worklist>();

            var transactionOptions = new System.Transactions.TransactionOptions();
            transactionOptions.IsolationLevel = System.Transactions.IsolationLevel.ReadUncommitted;

            var edm = new DianPingK2ServerLogContext();
            //edm.Database.ExecuteSqlCommand("SET TRANSACTION ISOLATION LEVEL READ UNCOMMITTED;");

            var query = edm.Worklist.Include("ProcInst").AsQueryable().Where(_ => _.Status == 0);

            if (queryPara != null)
            {
                var criteria = queryPara.QueryCriteria;
                if (criteria != null)
                {
                    //if (criteria.ProcessFullName != null && criteria.ProcessFullName.Count > 0)
                    //{
                    //    query = query.Where(_ => criteria.ProcessFullName.Contains(_.ProcInst.proc.ProcSet.FullName));
                    //}
                    if (criteria.ProcessCodes != null && criteria.ProcessCodes.Count > 0)
                    {
                        query = query.Where(_ => criteria.ProcessCodes.Contains(_.ProcInst.proc.ProcSet.Descr));
                    }
                    if (criteria.LoginIds != null && criteria.LoginIds.Count > 0)
                    {
                        IList<string> loginIdsStr = criteria.LoginIds.Select(_ => string.Format("K2SQL:{0}", _)).ToList();
                        query = query.Where(_ => loginIdsStr.Contains(_.Destination));
                    }
                    if (criteria.OriginatorLoginIds != null && criteria.OriginatorLoginIds.Count > 0)
                    {
                        IList<string> loginIdsStr = criteria.OriginatorLoginIds.Select(_ => string.Format("K2SQL:{0}", _)).ToList();
                        query = query.Where(_ => loginIdsStr.Contains(_.ProcInst.Originator));
                    }
                    if (criteria.ProcInstIds != null && criteria.ProcInstIds.Count > 0)
                    {
                        query = query.Where(_ => criteria.ProcInstIds.Contains(_.ProcInst.ID));
                    }
                    if (!string.IsNullOrEmpty(criteria.Folio))
                    {
                        query = query.Where(_ => _.ProcInst.Folio.StartsWith(criteria.Folio));
                    }
                    if (criteria.TaskStartDate != null)
                    {
                        if (criteria.TaskStartDate.DateFrom.HasValue)
                        {
                            query = query.Where(_ => _.StartDate >= criteria.TaskStartDate.DateFrom.Value);
                        }
                        if (criteria.TaskStartDate.DateTo.HasValue)
                        {
                            query = query.Where(_ => _.StartDate < criteria.TaskStartDate.DateTo.Value);
                        }
                    }
                    if (criteria.ProcessStartDate != null)
                    {
                        if (criteria.ProcessStartDate.DateFrom.HasValue)
                        {
                            query = query.Where(_ => _.ProcInst.StartDate >= criteria.ProcessStartDate.DateFrom.Value);
                        }
                        if (criteria.ProcessStartDate.DateTo.HasValue)
                        {
                            query = query.Where(_ => _.ProcInst.StartDate < criteria.ProcessStartDate.DateTo.Value);
                        }
                    }
                    if (queryPara.PagingInfo != null)
                    {
                        using (var transactionScope = new System.Transactions.TransactionScope(System.Transactions.TransactionScopeOption.Required, transactionOptions))
                        {
                            queryPara.PagingInfo.ItemCount = query.Count();
                            transactionScope.Complete();
                        }
                        if (queryPara.PagingInfo.SortField != null)
                        {
                            switch (queryPara.PagingInfo.SortField.ToLower())
                            {
                                case "folio":
                                    if (queryPara.PagingInfo.SortOrder == Common.Enum.SortOrder.Descending)
                                    {
                                        query = query.OrderByDescending(_ => _.ProcInst.Folio);
                                    }
                                    else
                                    {
                                        query = query.OrderBy(_ => _.ProcInst.Folio);
                                    }
                                    break;
                                case "worklisttime":
                                    if (queryPara.PagingInfo.SortOrder == Common.Enum.SortOrder.Descending)
                                    {
                                        query = query.OrderByDescending(_ => _.StartDate);
                                    }
                                    else
                                    {
                                        query = query.OrderBy(_ => _.StartDate);
                                    }
                                    break;
                                case "procstarttime":
                                    if (queryPara.PagingInfo.SortOrder == Common.Enum.SortOrder.Descending)
                                    {
                                        query = query.OrderByDescending(_ => _.ProcInst.StartDate);
                                    }
                                    else
                                    {
                                        query = query.OrderBy(_ => _.ProcInst.StartDate);
                                    }
                                    break;
                                default:
                                    query = query.OrderByDescending(_ => _.StartDate);
                                    break;
                            }
                        }
                        else
                        {
                            query = query.OrderByDescending(_ => _.StartDate);
                        }
                        query = query
                            .Skip(queryPara.PagingInfo.PageIndex == 0 ? 0 : (queryPara.PagingInfo.PageIndex - 1) * queryPara.PagingInfo.PageSize)
                            .Take(queryPara.PagingInfo.PageSize);
                    }
                }
                result.PagingInfo = queryPara.PagingInfo;
            }
            //result.PagingInfo = null;

            using (var transactionScope = new System.Transactions.TransactionScope(System.Transactions.TransactionScopeOption.Required, transactionOptions))
            {
                result.ResultList = query.ToList();
                transactionScope.Complete();
            }
            return result;
        }