⭐ 欢迎来到虫虫下载站! | 📦 资源下载 📁 资源专辑 ℹ️ 关于我们
⭐ 虫虫下载站

📄 globalcache.cs

📁 微软的行业应用解决方案示例
💻 CS
字号:
using System;
using System.Collections.Generic;
using System.Text;

namespace HardwareDistributor.Business
{
    public 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 _sqlCeDatabase = string.Empty;
        private string _sqlCePassword = 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 string _helpPath = string.Empty;
		private string _htmlTitle = string.Empty;
		private string _htmlHeader = string.Empty;
		private string _htmlMessage = string.Empty;
		private string _htmlDetail = string.Empty;
        private List<Customer> _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>
        /// List of Customer objects
        /// </summary>
        public List<Customer> Customers
        {
            get
            {
                return _customers;
            }
            set
            {
                _customers = 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 Compact database
        /// </summary>
        public string SqlCePassword
        {
            get
            {
                return _sqlCePassword;
            }
            set
            {
                _sqlCePassword = value;
            }
        }


        /// <summary>
        /// Name of SQL Server Compact database
        /// </summary>
        public string SqlCeDatabase
        {
            get
            {
                return _sqlCeDatabase;
            }
            set
            {
                _sqlCeDatabase = 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 Compact database connection string
        /// </summary>
        public string ConnectionString
        {
            get
            {
                if (!string.IsNullOrEmpty(_appPath) && 
                    !string.IsNullOrEmpty(_sqlCeDatabase) && 
                    !string.IsNullOrEmpty(_sqlCePassword))
                {
                    return @"Data Source=" + _appPath + _sqlCeDatabase + ";" +
                           @"Password=" + _sqlCePassword + ";" +
                           @"Encrypt Database=True";
                }
                else
                {
                    return string.Empty;
                }
            }
        }
        

        /// <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 + -