예제 #1
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));
        }