/// <summary>
        /// Builds the DbCommand to delete the task dependency(s) for the given taskQueueCode.
        /// </summary>
        /// <param name="daMgr">DataAccessMgr object</param>
        /// <param name="taskQueueItem">Datarow containing the parameter values</param>
        /// <param name="deleteAll">Indicates whether or not to delete all dependencies.</param>
        /// <returns>DbCommand Object with DbNull Parameter values</returns>
        public static DbCommand GetDeleteQueueItemCmd(DataAccessMgr daMgr, DataRow taskQueueItem, bool deleteAll)
        {
            if (taskQueueItem == null ||
                !taskQueueItem.Table.Columns.Contains(TaskProcessing.Constants.TaskQueueCode))
            {
                throw new ExceptionEvent(enumExceptionEventCodes.NullOrEmptyParameter
                                         , "DataRow (taskQueueItem) containing TaskDependency data was empty");
            }

            DbTableDmlMgr dmlMgr = daMgr.DbCatalogGetTableDmlMgr(DataAccess.Constants.SCHEMA_CORE
                                                                 , TaskProcessing.Constants.TaskDependencies);

            dmlMgr.SetWhereCondition(w => w.Column(TaskProcessing.Constants.TaskQueueCode)
                                     == w.Parameter(TaskProcessing.Constants.TaskQueueCode));
            if (!deleteAll)
            {
                System.Linq.Expressions.Expression waitTaskExp =
                    DbPredicate.CreatePredicatePart(w => w.Column(TaskProcessing.Constants.WaitTaskQueueCode)
                                                    == w.Parameter(TaskProcessing.Constants.WaitTaskQueueCode));
                dmlMgr.AddToWhereCondition(System.Linq.Expressions.ExpressionType.AndAlso, waitTaskExp);
            }
            DbCommand dbCmd = daMgr.BuildDeleteDbCommand(dmlMgr);

            dbCmd.Parameters[daMgr.BuildParamName(TaskProcessing.Constants.TaskQueueCode)].Value
                = Convert.ToInt32(taskQueueItem[TaskProcessing.Constants.TaskQueueCode]);
            if (!deleteAll)
            {
                dbCmd.Parameters[daMgr.BuildParamName(TaskProcessing.Constants.WaitTaskQueueCode)].Value
                    = Convert.ToInt32(taskQueueItem[TaskProcessing.Constants.WaitTaskQueueCode]);
            }
            return(dbCmd);
        }
Ejemplo n.º 2
0
        static DbCommand BuildCmdDelInActiveUserSessionsList(DataAccessMgr daMgr)
        {
            DbTableDmlMgr dmlDeleteMgr = daMgr.DbCatalogGetTableDmlMgr(DataAccess.Constants.SCHEMA_CORE
                                                                       , Constants.UserSessions);
            string joinTable = dmlDeleteMgr.AddJoin(DataAccess.Constants.SCHEMA_CORE
                                                    , Constants.SignonControl, DbTableJoinType.Cross, null);
            string dateAdd = daMgr.FormatDateMathSql(EnumDateDiffInterval.Second
                                                     , dmlDeleteMgr.AliasedColumn(joinTable, Constants.StatusSeconds),
                                                     dmlDeleteMgr.Column(Constants.SessionDateTime));

            dmlDeleteMgr.SetWhereCondition(j => j.Function(dateAdd)
                                           < j.Function(daMgr.GetDbTimeAs(EnumDateTimeLocale.UTC, null)));
            return(daMgr.BuildDeleteDbCommand(dmlDeleteMgr));
        }
Ejemplo n.º 3
0
        /// <summary>
        /// Removes the session record for the given session code.
        /// </summary>
        /// <param name="daMgr">DataAccessMgr object</param>
        /// <param name="sessionCode">Unique session code</param>
        public static void Signoff(DataAccessMgr daMgr, Int64 sessionCode)
        {
            DbTableDmlMgr dmlDeleteMgr = daMgr.DbCatalogGetTableDmlMgr(DataAccess.Constants.SCHEMA_CORE
                                                                       , Constants.UserSessions);

            dmlDeleteMgr.SetWhereCondition((j) => j.Column(Constants.SessionCode)
                                           == j.Parameter(dmlDeleteMgr.MainTable.SchemaName
                                                          , dmlDeleteMgr.MainTable.TableName
                                                          , Constants.SessionCode
                                                          , daMgr.BuildParamName(Constants.SessionCode)));
            DbCommand cmdDeleteUserSession = daMgr.BuildDeleteDbCommand(dmlDeleteMgr);

            cmdDeleteUserSession.Parameters[daMgr.BuildParamName(Constants.SessionCode)].Value = sessionCode;
            daMgr.ExecuteNonQuery(cmdDeleteUserSession, null, null);
        }
        /// <summary>
        /// Builds the DbCommand to delete a task queue record for the given taskQueueItem from the
        /// TaskProcessingQueue table.
        /// </summary>
        /// <param name="daMgr">DataAccessMgr object</param>
        /// <param name="taskQueueItem">Unique Identifier of the TaskProcessingQueue record to delete</param>
        /// <returns>DbCommand Object with given Parameter values</returns>
        public static DbCommand GetDeleteQueueItemCmd(DataAccessMgr daMgr, DataRow taskQueueItem)
        {
            if (taskQueueItem == null ||
                !taskQueueItem.Table.Columns.Contains(TaskProcessing.Constants.TaskQueueCode))
            {
                throw new ExceptionEvent(enumExceptionEventCodes.NullOrEmptyParameter
                                         , "DataRow (taskQueueItem) containing TaskProcessingQueue data was empty");
            }

            DbTableDmlMgr dmlMgr = daMgr.DbCatalogGetTableDmlMgr(DataAccess.Constants.SCHEMA_CORE
                                                                 , TaskProcessing.Constants.TaskProcessingQueue);

            dmlMgr.SetWhereCondition(w => w.Column(TaskProcessing.Constants.TaskQueueCode)
                                     == w.Parameter(TaskProcessing.Constants.TaskQueueCode));
            DbCommand dbCmd = daMgr.BuildDeleteDbCommand(dmlMgr);

            dbCmd.Parameters[daMgr.BuildParamName(TaskProcessing.Constants.TaskQueueCode)].Value
                = Convert.ToInt32(taskQueueItem[TaskProcessing.Constants.TaskQueueCode]);
            return(dbCmd);
        }
Ejemplo n.º 5
0
        DbCommand GetDeleteSessionRecordCmd()
        {
            DbTableStructure tblAppSesssion = _daMgr.DbCatalogGetTable(DataAccess.Constants.SCHEMA_CORE
                                                                       , Constants.SignonControl);
            DbTableDmlMgr dmlDeleteMgr = _daMgr.DbCatalogGetTableDmlMgr(DataAccess.Constants.SCHEMA_CORE
                                                                        , Constants.AppSessions
                                                                        , Constants.AppId
                                                                        , Constants.StartDateTime);

            dmlDeleteMgr.SetWhereCondition((j) => j.Column(Constants.AppCode)
                                           == j.Parameter(dmlDeleteMgr.MainTable.SchemaName
                                                          , dmlDeleteMgr.MainTable.TableName
                                                          , Constants.AppCode
                                                          , _daMgr.BuildParamName(Constants.AppCode)) &&
                                           j.Column(Constants.MultipleSessionCode)
                                           == j.Parameter(dmlDeleteMgr.MainTable.SchemaName
                                                          , dmlDeleteMgr.MainTable.TableName
                                                          , Constants.MultipleSessionCode
                                                          , _daMgr.BuildParamName(Constants.MultipleSessionCode)));

            return(_daMgr.BuildDeleteDbCommand(dmlDeleteMgr));
        }