#pragma warning restore 1591 // restore the xmlComments warning /// <summary> /// Returns the entire data table of application session records in the /// database based on the given enumeration. /// </summary> /// <param name="daMgr">DataAccessMgr object</param> /// <param name="tpqList">Enumeration indicating what type of session records to return</param> /// <returns>DataTable of Task Processing Queue records</returns> public static DataTable TaskProcessingQueueList(DataAccessMgr daMgr, ListEnum tpqList) { DbCommand dbCmd; switch (tpqList) { case ListEnum.Queued: dbCmd = daMgr.DbCmdCacheGetOrAdd("BuildCmdGetTPQListByWaitDateTime" , BuildCmdGetTPQListByWaitDateTime); dbCmd.Parameters[daMgr.BuildParamName(Constants.StatusCode)].Value = Convert.ToByte(tpqList); break; case ListEnum.Failed: case ListEnum.Succeeded: case ListEnum.InProcess: case ListEnum.NotQueued: dbCmd = daMgr.DbCmdCacheGetOrAdd("BuildCmdGetTPQListByStatusDateTime" , BuildCmdGetTPQListByStatusDateTime); dbCmd.Parameters[daMgr.BuildParamName(Constants.StatusCode)].Value = Convert.ToByte(tpqList); break; default: dbCmd = daMgr.DbCmdCacheGetOrAdd("BuildCmdGetTPQListByTaskId", BuildCmdGetTPQListByTaskId); break; } return(daMgr.ExecuteDataSet(dbCmd, null, null).Tables[0]); }
/// <summary> /// Returns the list of registered tasks as a datatable /// </summary> /// <param name="daMgr">DataAccess manager object</param> /// <returns></returns> public static DataTable GetRegisteredTasks(DataAccessMgr daMgr) { DbCommand dbCmd = daMgr.DbCmdCacheGetOrAdd(Constants.TaskRegistrationList , BuildCmdGetRegisteredTasksList); return(daMgr.ExecuteDataSet(dbCmd, null, null).Tables[0]); }
/// <summary> /// Loads the access control rules for the given user's access control group /// </summary> /// <returns>Access control rules for the given user's access control group</returns> AccessControlGroupStructure LoadAccessControl() { if (!_accessControlCache.Exists(_userSignon.DefaultAccessGroupCode.ToString())) { AccessControlGroupStructure accessControlGroup = new AccessControlGroupStructure(); accessControlGroup.AccessGroupCode = _userSignon.DefaultAccessGroupCode; CacheMgr <bool> accessControlRules = new CacheMgr <bool>(); DbCommand dbCmd = _daMgr.DbCmdCacheGetOrAdd(Constants.AccessControlGroupRules, BuildCmdGetAccessControlRulesList); dbCmd.Parameters[_daMgr.BuildParamName(Constants.AccessControlGroupCode)].Value = _userSignon.DefaultAccessGroupCode; DataTable accessRules = _daMgr.ExecuteDataSet(dbCmd, null, null).Tables[0]; foreach (DataRow accessRule in accessRules.Rows) { accessControlGroup.DefaultAccessDenied = Convert.ToBoolean( accessRule[Constants.DefaultAccessDenied]); accessControlGroup.AccessGroupName = accessRule[Constants.AccessControlGroupName].ToString(); if (accessRule[Constants.UIControlCode] != DBNull.Value) { Int32 uiControlCode = Convert.ToInt32(accessRule[Constants.UIControlCode]); bool accessDenied = Convert.ToBoolean(accessRule[Constants.AccessDenied]); accessControlRules.Set(uiControlCode.ToString(), accessDenied); } accessControlGroup.AccessControlRules = accessControlRules; } _accessControlCache.Set(_userSignon.DefaultAccessGroupCode.ToString(), accessControlGroup); } return(_accessControlCache.Get(_userSignon.DefaultAccessGroupCode.ToString())); }
/// <summary> /// Builds the DbCommand to get a list of the given task's dependency records /// </summary> /// <param name="daMgr">DataAccessMgr object</param> /// <param name="taskQueueCode">Unique identifier of the task whose dependencies will be returned</param> /// <returns>DateTable of the given task's dependencies</returns> public static DataTable TaskDependenciesList(DataAccessMgr daMgr, Int32 taskQueueCode) { DbCommand dbCmd = daMgr.DbCmdCacheGetOrAdd("BuildCmdGetTaskDependencies" , BuildCmdGetTaskDependencies); dbCmd.Parameters[daMgr.BuildParamName(Constants.TaskQueueCode)].Value = taskQueueCode; return(daMgr.ExecuteDataSet(dbCmd, null, null).Tables[0]); }
#pragma warning restore 1591 // restore the xmlComments warning /// <summary> /// Returns the entire data table of user session records in the /// database based on the given enumeration. /// </summary> /// <param name="daMgr">DataAccessMgr object</param> /// <param name="userSessionList">Enumeration indicating what type of session records to return</param> /// <returns>DataTable of application session records</returns> public static DataTable UserSessions(DataAccessMgr daMgr, UserSessionListEnum userSessionList) { DbCommand dbCmd; if (userSessionList == UserSessionListEnum.AllUserSessions) { dbCmd = daMgr.DbCmdCacheGetOrAdd(userSessionList.ToString(), BuildCmdGetAllUserSessionsList); } else if (userSessionList == UserSessionListEnum.ActiveUserSessions) { dbCmd = daMgr.DbCmdCacheGetOrAdd(userSessionList.ToString(), BuildCmdGetActiveUserSessionsList); } else { dbCmd = daMgr.DbCmdCacheGetOrAdd(userSessionList.ToString(), BuildCmdGetInActiveUserSessionsList); } return(daMgr.ExecuteDataSet(dbCmd, null, null).Tables[0]); }
/// <summary> /// Returns the set of dependency relationships where the given task is the dependent task /// </summary> /// <param name="daMgr">DbAccessMgr object instance</param> /// <param name="waitTaskQueueCode">The taskQueueCode that other tasks may be dependent on</param> /// <returns>The DataTable of dependency relationhips</returns> public static DataTable GetDependentTasks(DataAccessMgr daMgr , Int32 waitTaskQueueCode) { DbCommand dbCmd = daMgr.DbCmdCacheGetOrAdd("GetDependentTasksCmd", GetDependentTasksCmd); dbCmd.Parameters[daMgr.BuildParamName(TaskProcessing.Constants.WaitTaskQueueCode)].Value = waitTaskQueueCode; return(daMgr.ExecuteDataSet(dbCmd, null, null).Tables[0]); }
private Dictionary <string, IEnumerable <string> > GetAppConfigSettings(string sysConfigSetName, string appConfigSetName) { // Get the AppSettings DbCommand from the cache - create one if NOT exist in the cache DbCommand dbCmd = _daMgr.DbCmdCacheGetOrAdd(Configuration.Constants.AppSettingCacheName, CreateAppSettingsDbCommand); // Get the system config set name Dictionary <string, IEnumerable <string> > sys = _daMgr.ExecuteReader(dbCmd, null, rdr => CreateAppConfigSettingDictionary(rdr, sysConfigSetName), _daMgr.BuildParamName(Configuration.Constants.ConfigSetName), sysConfigSetName); // Get the application config set name Dictionary <string, IEnumerable <string> > app = _daMgr.ExecuteReader(dbCmd, null, rdr => CreateAppConfigSettingDictionary(rdr, null), _daMgr.BuildParamName(Configuration.Constants.ConfigSetName), appConfigSetName); return(sys.Union(app).ToDictionary(kv => kv.Key, kv => kv.Value)); }
public static DbCommand GetUserMasterCmd(DataAccessMgr daMgr) { return(daMgr.DbCmdCacheGetOrAdd(Constants.CacheKey_GetUserMasterCmd, BuildGetUserMasterCmd)); }
/// <summary> /// Removes all inactive session records from the database /// </summary> /// <param name="daMgr">DataAcessMgr object</param> public static void CleanupInactiveSessions(DataAccessMgr daMgr) { DbCommand dbCmd = daMgr.DbCmdCacheGetOrAdd("CleanupInactiveUserSessions", BuildCmdDelInActiveUserSessionsList); daMgr.ExecuteNonQuery(dbCmd, null, null); }
public static DbCommand GetUpdateUserSessionDbCommand(DataAccessMgr daMgr) { return(daMgr.DbCmdCacheGetOrAdd("UpdateUserSessionDbCommand", BuildCmdGetUpdateUserSession)); }