Example #1
0
 public DBConfigEntry(AppConfigDS.ConfigTableRow entry, Mediator mediator)
 {
     //Constructor
     try {
         this.mMediator = mediator;
         if (entry != null)
         {
             if (!entry.IsApplicationNull())
             {
                 this._application = entry.Application;
             }
             if (!entry.IsPCNameNull())
             {
                 this._pcname = entry.PCName;
             }
             if (!entry.IsKeyNull())
             {
                 this._key = entry.Key;
             }
             if (!entry.IsValueNull())
             {
                 this._value = entry.Value;
             }
             if (!entry.IsSecurityNull())
             {
                 this._security = entry.Security;
             }
         }
     }
     catch (Exception ex) { throw ex; }
 }
Example #2
0
        public DBConfigEntry Item(string pcName, string key)
        {
            //Return an existing entry object from the database entries collection
            DBConfigEntry entry = null;

            try {
                //Merge from collection (dataset)
                if (pcName != "" && key != "")
                {
                    AppConfigDS.ConfigTableRow row = (AppConfigDS.ConfigTableRow) this.mConfigEntries.ConfigTable.Select("Application='" + this.mProductName + "'" + " AND PCName='" + pcName + "'" + " AND Key='" + key + "'")[0];
                    entry          = new DBConfigEntry(row, this.mMediator);
                    entry.Changed += new EventHandler(OnEntryChanged);
                }
                else
                {
                    entry = Item();
                }
            }
            catch (Exception ex) { throw new ApplicationException("Unexpected error getting configuration entry.", ex); }
            return(entry);
        }