PMEnvironment Class |
Namespace: PM90SettingsAPI
public class PMEnvironment
The PMEnvironment type exposes the following members.
Name | Description | |
---|---|---|
PMEnvironment |
Initializes a new instance of InstallationInfo which connects to the database and attempts retrieve basic information
|
Name | Description | |
---|---|---|
DatabaseCatalog |
The Database name within SQL Server
| |
DatabaseInstance |
The MS SQL Server Instance this installation is pointed to
| |
DatabaseVersion |
The database schema version number as a string
| |
InstallationVersion |
The installed or last run version.
| |
InstalledLocally |
Returns true if the PMTracking service is installed locally, based on Programs and Features.
| |
ServiceReachable |
Checks that service is actually reachable. First checks InstalledLocally for possible quick fail.
|
Exception | Condition |
---|---|
PMDatabaseConnectionNotFoundException | No database connection available on this system |
PMDatabaseException | Represents an database connection or syntax error that has occurred when processing an API request |
PMException | Unexcpected exception has occurred, check inner exception |
try { //Checking if service is installed if (PMEnvironment.InstalledLocally) { Console.WriteLine("Service installed"); if (PMEnvironment.ServiceReachable) { Console.WriteLine("Service reachable"); } } PMEnvironment info = new PMEnvironment(); Console.WriteLine("SQL Server : " + info.DatabaseInstance); Console.WriteLine("Database Name : " + info.DatabaseCatalog); Console.WriteLine("Database Version : " + info.DatabaseVersion); Console.WriteLine("Installation Version : " + info.InstallationVersion); } catch (PMDatabaseConnectionNotFoundException) { Console.WriteLine("No Print Manager Plus database connection exists on this system."); } catch (PMDatabaseException ex) { //The inner exception will typically contain the raw database error information Console.WriteLine("Database Error : " + ex.InnerException != null ? ex.InnerException.Message : ex.Message); } catch (PMException ex) { //other exceptions Console.WriteLine("API Error: " + ex.Message + ex.InnerException != null ? (", The inner exception message is: " + ex.InnerException.Message) : ""); }