📄 globalcache.cs
字号:
using System;
using System.Collections.Generic;
using System.Text;
using System.Data.SqlServerCe;
namespace HardwareDistributor.Business
{
sealed class GlobalCache
{
private static readonly GlobalCache _instance = new GlobalCache();
private GlobalCache() { }
private string _appPath = string.Empty;
private string _connectionString = string.Empty;
private string _deviceName = string.Empty;
private string _configFile = string.Empty;
private string _internetUrl = string.Empty;
private string _internetLogin = string.Empty;
private string _internetPassword = string.Empty;
private string _publisher = string.Empty;
private string _publisherDatabase = string.Empty;
private string _publication = string.Empty;
private string _subscriber = string.Empty;
private short _compressionLevel = 0;
private string _sqlEvDatabase = string.Empty;
private string _sqlEvPassword = string.Empty;
private string _ipAddress = string.Empty;
private string _operatingSystem = string.Empty;
private string _operatingSystemVersion = string.Empty;
private string _netCFVersion = string.Empty;
private string _appVersion = string.Empty;
private string _deviceId = string.Empty;
private string _mapPointUserName = string.Empty;
private string _mapPointPassword = string.Empty;
private string _mapPointFindServiceUrl = string.Empty;
private string _mapPointRenderServiceUrl = string.Empty;
private string _mapPointRouteServiceUrl = string.Empty;
private SqlCeConnection _cn = null;
private CustomerCollection _customers = null;
/// <summary>
/// The entry point into this singleton
/// </summary>
public static GlobalCache Instance
{
get
{
return _instance;
}
}
/// <summary>
/// The unique GUID assigned to the device
/// </summary>
public string DeviceId
{
get
{
return _deviceId;
}
set
{
_deviceId = value;
}
}
/// <summary>
/// The Hardware Distributor's version number
/// </summary>
public string AppVersion
{
get
{
return _appVersion;
}
set
{
_appVersion = value;
}
}
/// <summary>
/// The .NET Compact Framework's version number
/// </summary>
public string NetCFVersion
{
get
{
return _netCFVersion;
}
set
{
_netCFVersion = value;
}
}
/// <summary>
/// The Operating System's version number
/// </summary>
public string OperatingSystemVersion
{
get
{
return _operatingSystemVersion;
}
set
{
_operatingSystemVersion = value;
}
}
/// <summary>
/// URL that points to the Route web service
/// </summary>
public string MapPointRouteServiceUrl
{
get
{
return _mapPointRouteServiceUrl;
}
set
{
_mapPointRouteServiceUrl = value;
}
}
/// <summary>
/// URL that points to the Render web service
/// </summary>
public string MapPointRenderServiceUrl
{
get
{
return _mapPointRenderServiceUrl;
}
set
{
_mapPointRenderServiceUrl = value;
}
}
/// <summary>
/// URL that points to the Find web service
/// </summary>
public string MapPointFindServiceUrl
{
get
{
return _mapPointFindServiceUrl;
}
set
{
_mapPointFindServiceUrl = value;
}
}
/// <summary>
/// Password needed to access the MapPoint web services
/// </summary>
public string MapPointPassword
{
get
{
return _mapPointPassword;
}
set
{
_mapPointPassword = value;
}
}
/// <summary>
/// Username needed to access the MapPoint web service
/// </summary>
public string MapPointUserName
{
get
{
return _mapPointUserName;
}
set
{
_mapPointUserName = value;
}
}
/// <summary>
/// Collection of Customer objects
/// </summary>
public CustomerCollection Customers
{
get
{
return _customers;
}
set
{
_customers = value;
}
}
/// <summary>
/// SQL Server Everywhere cached connection
/// object for better performance
/// </summary>
public SqlCeConnection Connection
{
get
{
return _cn;
}
set
{
_cn = value;
}
}
/// <summary>
/// Operating System name
/// </summary>
public string OperatingSystem
{
get
{
return _operatingSystem;
}
set
{
_operatingSystem = value;
}
}
/// <summary>
/// The device's current IP address
/// </summary>
public string IpAddress
{
get
{
return _ipAddress;
}
set
{
_ipAddress = value;
}
}
/// <summary>
/// Password to access SQL Server Everywhere database
/// </summary>
public string SqlEvPassword
{
get
{
return _sqlEvPassword;
}
set
{
_sqlEvPassword = value;
}
}
/// <summary>
/// Name of SQL Server Everywhere database
/// </summary>
public string SqlEvDatabase
{
get
{
return _sqlEvDatabase;
}
set
{
_sqlEvDatabase = value;
}
}
/// <summary>
/// Level of compression used for replication
/// </summary>
public short CompressionLevel
{
get
{
return _compressionLevel;
}
set
{
_compressionLevel = value;
}
}
/// <summary>
/// Replication subscriber name
/// </summary>
public string Subscriber
{
get
{
return _subscriber;
}
set
{
_subscriber = value;
}
}
/// <summary>
/// Replication publication name
/// </summary>
public string Publication
{
get
{
return _publication;
}
set
{
_publication = value;
}
}
/// <summary>
/// Database name
/// </summary>
public string PublisherDatabase
{
get
{
return _publisherDatabase;
}
set
{
_publisherDatabase = value;
}
}
/// <summary>
/// Database server name
/// </summary>
public string Publisher
{
get
{
return _publisher;
}
set
{
_publisher = value;
}
}
/// <summary>
/// Password needed to access IIS
/// </summary>
public string InternetPassword
{
get
{
return _internetPassword;
}
set
{
_internetPassword = value;
}
}
/// <summary>
/// Username needed to access IIS
/// </summary>
public string InternetLogin
{
get
{
return _internetLogin;
}
set
{
_internetLogin = value;
}
}
/// <summary>
/// URL that points to SQL Server Everywhere ISAPI DLL
/// </summary>
public string InternetUrl
{
get
{
return _internetUrl;
}
set
{
_internetUrl = value;
}
}
/// <summary>
/// Path to the folder where the application resides
/// </summary>
public string AppPath
{
get
{
return _appPath;
}
set
{
_appPath = value;
}
}
/// <summary>
/// Name of the XML configuration file
/// </summary>
public string ConfigFile
{
get
{
return _configFile;
}
set
{
_configFile = value;
}
}
/// <summary>
/// SQL Server Everywhere database connection string
/// </summary>
public string ConnectionString
{
get
{
if (_appPath != "" && _sqlEvDatabase != "" && _sqlEvPassword != "")
{
return @"Data Source=" + _appPath + _sqlEvDatabase + ";" +
@"Password=" + _sqlEvPassword + ";" +
@"Encrypt Database=True";
}
else
{
return "";
}
}
}
/// <summary>
/// Name of the Windows Mobile device
/// </summary>
public string DeviceName
{
get
{
return _deviceName;
}
set
{
_deviceName = value;
}
}
}
}
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -