public Hashtable GetUsers(string application) { //Get user list for an application Hashtable users = null; try { users = new Hashtable(); users.Add(USER_ALL, USER_ALL); AppConfigDS config = new AppConfigDS(); DataSet ds = fillDataset(USP_CONFIG_GETLIST, TBL_CONFIGURATION, new object[] { application }); if (ds != null) { config.Merge(ds); } for (int i = 0; i < config.ConfigTable.Rows.Count; i++) { string user = config.ConfigTable.Rows[i]["PCName"].ToString(); if (!users.ContainsKey(user)) { users.Add(user, user); } } } catch (Exception ex) { throw new ApplicationException("Unexpected error while reading users from the application configuration.", ex); } return(users); }
public UserConfiguration GetUserConfiguration(string application, string username) { //Get configuration data for the specified application and username UserConfiguration config = null; try { config = new UserConfiguration(application); AppConfigDS configDS = new AppConfigDS(); DataSet ds = fillDataset(USP_CONFIG_GETLIST, TBL_CONFIGURATION, new object[] { application }); if (ds != null) { configDS.Merge(ds); for (int i = 0; i < configDS.ConfigTable.Rows.Count; i++) { ConfigurationEntry entry = new ConfigurationEntry(configDS.ConfigTable[i]); if (!config.ContainsKey(entry.Key)) { if (entry.UserName.ToLower() == UserConfiguration.USER_DEFAULT.ToLower() || entry.UserName.ToLower() == username.ToLower()) { config.Add(entry.Key, entry.Value); } } else { if (entry.UserName.ToLower() == username.ToLower()) { config[entry.Key] = entry.Value; } } } } } catch (Exception ex) { throw new FaultException <ConfigurationFault>(new ConfigurationFault(new ApplicationException("Unexpected error while reading the user configuration.", ex))); } return(config); }
public Hashtable GetApplications() { //Get a list of applications Hashtable apps = null; try { apps = new Hashtable(); AppConfigDS config = new AppConfigDS(); DataSet ds = fillDataset(USP_CONFIG_GETLIST, TBL_CONFIGURATION, new object[] { null }); if (ds != null) { config.Merge(ds); } for (int i = 0; i < config.ConfigTable.Rows.Count; i++) { string app = config.ConfigTable.Rows[i]["Application"].ToString(); if (app.Length > 0 && !apps.ContainsKey(app)) { apps.Add(app, app); } } } catch (Exception ex) { throw new ApplicationException("Unexpected error while reading applications.", ex); } return(apps); }
public ApplicationConfiguration GetConfiguration(string application, string username) { //Get configuration data for the specified application ApplicationConfiguration config = null; try { config = new ApplicationConfiguration(application); AppConfigDS configDS = new AppConfigDS(); DataSet ds = fillDataset(USP_CONFIG_GETLIST, TBL_CONFIGURATION, new object[] { application }); if (ds != null) { configDS.Merge(ds); for (int i = 0; i < configDS.ConfigTable.Rows.Count; i++) { ConfigurationEntry entry = new ConfigurationEntry(configDS.ConfigTable[i]); if (username.ToLower() == USER_ALL.ToLower() || entry.UserName.ToLower() == username.ToLower()) { config.Add(entry); } } } } catch (Exception ex) { throw new ApplicationException("Unexpected error while reading the user configuration.", ex); } return(config); }