public UserConfiguration GetUserConfiguration(string application, string[] usernames) { //Get configuration data for the specified application and usernames UserConfiguration config = null; try { // config = new UserConfiguration(application); DataSet ds = new DataService().FillDataset(this.mConnectionID, USP_CONFIG_GETLIST, TBL_CONFIGURATION, new object[] { application }); if (ds != null && ds.Tables[TBL_CONFIGURATION] != null) { for (int i = 0; i < ds.Tables[TBL_CONFIGURATION].Rows.Count; i++) { string userName = ds.Tables[TBL_CONFIGURATION].Rows[i]["PCName"].ToString(); string key = ds.Tables[TBL_CONFIGURATION].Rows[i]["Key"].ToString(); string value = ds.Tables[TBL_CONFIGURATION].Rows[i]["Value"].ToString(); if (!config.ContainsKey(key)) { if (userName.ToLower() == UserConfiguration.USER_DEFAULT.ToLower()) { config.Add(key, value); } else { for (int j = 0; j < usernames.Length; j++) { if (userName.ToLower() == usernames[j].ToLower()) { config.Add(key, value); } } } } else { for (int j = 0; j < usernames.Length; j++) { if (userName.ToLower() == usernames[j].ToLower()) { config[key] = value; } } } } } } catch (Exception ex) { throw new FaultException <ConfigurationFault>(new ConfigurationFault(ex.Message), "Unexpected Error"); } return(config); }
public UserConfiguration GetUserConfiguration(string application, string[] usernames) { //Get configuration data for the specified application and usernames 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, true, MissingSchemaAction.Ignore); 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()) { config.Add(entry.Key, entry.Value); } else { for (int j = 0; j < usernames.Length; j++) { if (entry.UserName.ToLower() == usernames[j].ToLower()) { config.Add(entry.Key, entry.Value); } } } } else { for (int j = 0; j < usernames.Length; j++) { if (entry.UserName.ToLower() == usernames[j].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); }