コード例 #1
0
ファイル: appconfig.cs プロジェクト: jpheary/Argix08
        /// <summary>Get a configuration for the speciified users.</summary>
        /// <param name="names">PCName fieldname in the database Configuration table.</param>
        /// <returns>Argix.Configuration.AppConfig object for the specified user.</returns>
        public AppConfig Item(string[] names)
        {
            //Get a configuration for all specified names
            AppConfigDS ds = new AppConfigDS();

            DataRow[] rows = this.mConfigDS.ConfigTable.Select("PCName = '" + USER_DEFAULT + "'");
            if (rows.Length > 0)
            {
                ds.Merge(rows);
            }
            foreach (string name in names)
            {
                if (name != USER_DEFAULT)
                {
                    rows = this.mConfigDS.ConfigTable.Select("PCName = '" + name + "'");
                    if (rows.Length > 0)
                    {
                        ds.Merge(rows);
                    }
                }
            }
            AppConfig ac = NewAppConfig("", ds);

            ac.Changed          += new EventHandler(OnAppConfigChanged);
            this.ConfigsChanged += new ConfigEventHandler(ac.OnConfigsChanged);
            return(ac);
        }
コード例 #2
0
ファイル: appconfig.cs プロジェクト: jpheary/Argix08
 //Interface
 /// <summary>Constructor.</summary>
 /// <param name="productName">Application fieldname in the database Configuration table.</param>
 public AppConfigFactory(string productName)
 {
     try {
         this.mProductName = productName;
         this.mConfigDS    = new AppConfigDS();
         this.mUsers       = new Hashtable();
         Refresh();
     }
     catch (Exception ex) { throw new ApplicationException("Unexpected error while creating new AppConfigFactory instance.", ex); }
 }
コード例 #3
0
ファイル: appconfig.cs プロジェクト: jpheary/Argix08
 //Interface
 /// <summary>Constructor</summary>
 /// <param name="PCName">A configuration user- can be username or machine name.</param>
 /// <param name="ds">Configuration data associated with PCName.</param>
 /// <param name="mediator">An Argix.Data.Mediator instance for access to the configuration database.</param>
 public AppConfig(string PCName, DataSet ds, Mediator mediator)
 {
     try {
         this.mPCName   = PCName;
         this.mConfigDS = new AppConfigDS();
         if (ds != null)
         {
             this.mConfigDS.Merge(ds);
         }
         this.mMediator = mediator;
     }
     catch (Exception ex) { throw new ApplicationException("Unexpected error while creating new AppConfig instance.", ex); }
 }