示例#1
0
        /// <summary>
        /// Return a table of the intances of the specified application
        /// </summary>
        /// <param name="applicationID"></param>
        /// <returns></returns>
        public DataTable GetApplicationInstances(int applicationID)
        {
            if (isDebugEnabled)
            {
                logger.Debug(System.Reflection.MethodBase.GetCurrentMethod().Name + " in");
            }

            DataTable applicationsTable = new DataTable(TableNames.APPLICATION_INSTANCES);

            if (compactDatabaseType)
            {
                try
                {
                    using (SqlCeCommand command = new SqlCeCommand("SELECT APPLICATION_INSTANCES._INSTANCEID ,APPLICATION_INSTANCES._APPLICATIONID ,APPLICATION_INSTANCES._ASSETID ,APPLICATION_INSTANCES._PRODUCTID ,APPLICATION_INSTANCES._CDKEY " +
                                                                   ",APPLICATIONS._NAME ,APPLICATIONS._VERSION ,APPLICATIONS._PUBLISHER ,APPLICATIONS._GUID ,APPLICATIONS._IGNORED ,APPLICATIONS._ALIASED_TOID ,APPLICATIONS._USER_DEFINED " +
                                                                   ",ASSETS._NAME AS ASSETNAME " +
                                                                   ",ASSET_TYPES._ICON AS ASSETICON " +
                                                                   ",LOCATIONS._FULLNAME AS FULLLOCATIONNAME " +
                                                                   ",LOCATIONS._NAME AS LOCATIONNAME " +
                                                                   ",DOMAINS._NAME AS DOMAINNAME " +
                                                                   "FROM APPLICATION_INSTANCES " +
                                                                   "LEFT JOIN APPLICATIONS ON (APPLICATION_INSTANCES._APPLICATIONID = APPLICATIONS._APPLICATIONID) " +
                                                                   "LEFT JOIN ASSETS ON (APPLICATION_INSTANCES._ASSETID = ASSETS._ASSETID) " +
                                                                   "LEFT JOIN ASSET_TYPES ON (ASSETS._ASSETTYPEID = ASSET_TYPES._ASSETTYPEID) " +
                                                                   "LEFT JOIN LOCATIONS ON (ASSETS._LOCATIONID = LOCATIONS._LOCATIONID) " +
                                                                   "LEFT JOIN DOMAINS ON (ASSETS._DOMAINID = DOMAINS._DOMAINID) " +
                                                                   "WHERE APPLICATION_INSTANCES._APPLICATIONID = @applicationID " +
                                                                   "AND ASSETS._STOCK_STATUS <> 3", DatabaseConnection.OpenCeConnection()))
                    {
                        command.Parameters.AddWithValue("@applicationID", applicationID);
                        new SqlCeDataAdapter(command).Fill(applicationsTable);
                    }
                }
                catch (SqlCeException ex)
                {
                    Utility.DisplayErrorMessage("A database error has occurred in AuditWizard." + Environment.NewLine + Environment.NewLine +
                                                "Please see the log file for further details.");
                    logger.Error("Exception in " + System.Reflection.MethodBase.GetCurrentMethod().Name, ex);
                }
                catch (Exception ex)
                {
                    Utility.DisplayErrorMessage("A database error has occurred in AuditWizard." + Environment.NewLine + Environment.NewLine +
                                                "Please see the log file for further details.");

                    logger.Error("Exception in " + System.Reflection.MethodBase.GetCurrentMethod().Name, ex);
                }
            }
            else
            {
                AuditWizardDataAccess lAuditWizardDataAccess = new AuditWizardDataAccess();
                applicationsTable = lAuditWizardDataAccess.GetApplicationInstances(applicationID);
            }

            if (isDebugEnabled)
            {
                logger.Debug(System.Reflection.MethodBase.GetCurrentMethod().Name + " out");
            }
            return(applicationsTable);
        }
示例#2
0
        /// <summary>
        /// Load this Application with it's instances and licenses
        /// </summary>
        public void LoadData()
        {
            // Read instances of this application
            AuditWizardDataAccess lwDataAccess   = new AuditWizardDataAccess();
            DataTable             instancesTable = lwDataAccess.GetApplicationInstances(_applicationID);

            LoadInstances(instancesTable);

            // Read licenses for this application if any
            DataTable licensesTable = lwDataAccess.GetApplicationLicenses(_applicationID);

            LoadLicenses(licensesTable);
        }
示例#3
0
        /// <summary>
        /// Load this Application with it's instances and licenses
        /// </summary>
        public void LoadData()
        {
            // Read instances of this application
            AuditWizardDataAccess lwDataAccess   = new AuditWizardDataAccess();
            DataTable             instancesTable = lwDataAccess.GetApplicationInstances(_osid);

            LoadInstances(instancesTable);

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

            LoadLicenses(licensesTable);

            // Flag that the data has already been loaded
            _dataLoaded = true;
        }