Ejemplo n.º 1
0
        /// <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);
        }
Ejemplo n.º 2
0
 //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); }
 }
Ejemplo n.º 3
0
 //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); }
 }