示例#1
0
        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);
        }
示例#2
0
        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);
        }
示例#3
0
        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);
        }
示例#4
0
        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);
        }