/// <summary>
        /// Load this Application with it's instances and licenses
        /// </summary>
        public void LoadData()
        {
            DataTable instancesTable = new ApplicationInstanceDAO().GetApplicationInstances(_applicationID);

            LoadInstances(instancesTable);

            DataTable licensesTable = new LicensesDAO().GetApplicationLicenses(_applicationID);

            LoadLicenses(licensesTable);
        }
        /// <summary>
        /// Delete the current license from the database
        /// </summary>
        public void Delete()
        {
            // Delete from the database
            LicensesDAO lwDataAccess = new LicensesDAO();

            lwDataAccess.LicenseDelete(this);

            // ...and audit the deletion
            AuditTrailEntry ate = BuildATE();

            ate.Type = AuditTrailEntry.TYPE.deleted;
            new AuditTrailDAO().AuditTrailAdd(ate);
        }
        /// <summary>
        /// Update this defininition in the database
        /// </summary>
        /// <returns></returns>
        public int Update(ApplicationLicense oldLicense)
        {
            LicensesDAO lwDataAccess = new LicensesDAO();

            if (_licenseID == 0)
            {
                Add();
            }
            else if (oldLicense != this)
            {
                lwDataAccess.LicenseUpdate(this);
                AuditChanges(oldLicense);
            }

            return(0);
        }
Beispiel #4
0
        /// <summary>
        /// Load this Application with it's instances and licenses
        /// </summary>
        public void LoadData()
        {
            // Read instances of this application
            ApplicationInstanceDAO lwDataAccess = new ApplicationInstanceDAO();
            DataTable instancesTable            = lwDataAccess.GetApplicationInstances(_osid);

            LoadInstances(instancesTable);

            // Read licenses for this application if any
            DataTable licensesTable = new LicensesDAO().GetApplicationLicenses(_osid);

            LoadLicenses(licensesTable);

            // Flag that the data has already been loaded
            _dataLoaded = true;
        }
        /// <summary>
        /// Add this APPLICATION LICENSE to the database
        /// </summary>
        /// <returns></returns>
        public int Add()
        {
            int status = -1;

            // If already exists then call the update instead
            if (_licenseID != 0)
            {
                return(Update(null));
            }

            // Add the supplier to the database
            LicensesDAO lwDataAccess = new LicensesDAO();
            int         id           = lwDataAccess.LicenseAdd(this);

            if (id != 0)
            {
                AuditChanges(null);
                _licenseID = id;
                status     = 0;
            }

            return(status);
        }