コード例 #1
0
ファイル: LicensesDAO.cs プロジェクト: windygu/AW-master
        /// <summary>
        /// Return a table containing all of the license which have been declared for the
        /// specified application
        /// </summary>
        /// <param name="applicationID"></param>
        /// <returns></returns>
        public DataTable GetApplicationLicenses(int applicationID)
        {
            //if (isDebugEnabled) logger.Debug(System.Reflection.MethodBase.GetCurrentMethod().Name + " in");

            DataTable licensesTable = new DataTable(TableNames.LICENSES);

            if (compactDatabaseType)
            {
                try
                {
                    //using (SqlCeConnection conn = DatabaseConnection.CreateOpenCEConnection())
                    //{
                    string commandText =
                        "SELECT LICENSES._LICENSEID, LICENSES._LICENSETYPEID ,LICENSES._COUNT " +
                        ",LICENSES._APPLICATIONID ,LICENSES._SUPPORTED, LICENSES._SUPPORT_EXPIRES ,LICENSES._SUPPORT_ALERTDAYS " +
                        ",LICENSES._SUPPORT_ALERTBYEMAIL ,LICENSES._SUPPORT_ALERTRECIPIENTS " +
                        ",LICENSES._SUPPLIERID " +
                        ",LICENSE_TYPES._NAME AS LICENSE_TYPES_NAME ,LICENSE_TYPES._COUNTED " +
                        ",APPLICATIONS._NAME AS APPLICATION_NAME " +
                        ",SUPPLIERS._NAME AS SUPPLIER_NAME " +
                        "FROM LICENSES " +
                        "LEFT JOIN LICENSE_TYPES ON (LICENSES._LICENSETYPEID = LICENSE_TYPES._LICENSETYPEID) " +
                        "LEFT JOIN APPLICATIONS ON (LICENSES._APPLICATIONID = APPLICATIONS._APPLICATIONID) " +
                        "LEFT JOIN SUPPLIERS ON (LICENSES._SUPPLIERID = SUPPLIERS._SUPPLIERID) " +
                        "WHERE LICENSES._APPLICATIONID = @applicationID";

                    using (SqlCeCommand command = new SqlCeCommand(commandText, DatabaseConnection.OpenCeConnection()))
                    {
                        command.Parameters.AddWithValue("@applicationID", applicationID);
                        new SqlCeDataAdapter(command).Fill(licensesTable);
                    }
                    //}
                }
                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();
                licensesTable = lAuditWizardDataAccess.GetApplicationLicenses(applicationID);
            }

            //if (isDebugEnabled) logger.Debug(System.Reflection.MethodBase.GetCurrentMethod().Name + " out");
            return(licensesTable);
        }
コード例 #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;
        }