using Common;
|
using System;
|
|
namespace CMPPHOST
|
{
|
|
|
public class SysConf
|
{
|
private int _activeTestInterval;
|
private bool _autoConnection;
|
private int _currentMsgLevel;
|
private string _dbConnstr;
|
private string _dbPassWD;
|
private string _dbSource;
|
private string _dbUserID;
|
private string _initialCatalog;
|
private static SysConf _instance;
|
private int _msgListBoxMaxRow;
|
private int _mtLimit;
|
private string _passwd;
|
private string _programId;
|
private int _reSubmitInterval;
|
private string _serverip;
|
private int _serverport;
|
private int _slidingWindowSize;
|
private string _spcode;
|
private string _spid;
|
internal static readonly string AppFile = @".\app.config";
|
internal static readonly string LogFilePath = @".\Syslog\";
|
|
public int SMSCount = 0;
|
public int SubmitSmsCount = 0;
|
public DateTime startTime = DateTime.MinValue;
|
public DateTime endTime = DateTime.MinValue;
|
public int ActiveTestInterval
|
{
|
get
|
{
|
return this._activeTestInterval;
|
}
|
set
|
{
|
this._activeTestInterval = value;
|
AppConfiguration.UpdateConfValue(AppFile, "ActiveTestInterval", this._activeTestInterval.ToString());
|
}
|
}
|
|
public bool AutoConnection
|
{
|
get
|
{
|
return this._autoConnection;
|
}
|
set
|
{
|
this._autoConnection = value;
|
AppConfiguration.UpdateConfValue(AppFile, "AutoConnection", this._autoConnection.ToString());
|
}
|
}
|
|
public int CurrentMsgLevel
|
{
|
get
|
{
|
return this._currentMsgLevel;
|
}
|
set
|
{
|
this._currentMsgLevel = value;
|
AppConfiguration.UpdateConfValue(AppFile, "CurrentMsgLevel", this._currentMsgLevel.ToString());
|
}
|
}
|
|
public string DBConnstr
|
{
|
get
|
{
|
return this._dbConnstr;
|
}
|
set
|
{
|
this._dbConnstr = value;
|
}
|
}
|
|
public string DBPassWD
|
{
|
get
|
{
|
return this._dbPassWD;
|
}
|
set
|
{
|
this._dbPassWD = value;
|
AppConfiguration.UpdateConfValue(AppFile, "DBPassWD", this._dbPassWD.ToString());
|
}
|
}
|
|
public string DBSource
|
{
|
get
|
{
|
return this._dbSource;
|
}
|
set
|
{
|
this._dbSource = value;
|
AppConfiguration.UpdateConfValue(AppFile, "DBSource", this._dbSource.ToString());
|
}
|
}
|
|
public string DBUserID
|
{
|
get
|
{
|
return this._dbUserID;
|
}
|
set
|
{
|
this._dbUserID = value;
|
AppConfiguration.UpdateConfValue(AppFile, "DBUserID", this._dbUserID.ToString());
|
}
|
}
|
|
internal string InitialCatalog
|
{
|
get
|
{
|
return this._initialCatalog;
|
}
|
set
|
{
|
this._initialCatalog = value;
|
AppConfiguration.UpdateConfValue(AppFile, "InitialCatalog", this._initialCatalog.ToString());
|
}
|
}
|
|
public static SysConf Instance
|
{
|
get
|
{
|
if (_instance == null)
|
{
|
_instance = new SysConf();
|
_instance._spcode = AppConfiguration.GetConfValue(AppFile, "SPCODE");
|
_instance._spid = AppConfiguration.GetConfValue(AppFile, "SPID");
|
_instance._passwd = AppConfiguration.GetConfValue(AppFile, "PASSWD");
|
_instance._serverip = AppConfiguration.GetConfValue(AppFile, "ServerIP");
|
_instance._serverport = Utils.StrToInt(AppConfiguration.GetConfValue(AppFile, "ServerPort"), 0);
|
_instance._dbSource = AppConfiguration.GetConfValue(AppFile, "DBSource");
|
_instance._initialCatalog = AppConfiguration.GetConfValue(AppFile, "InitialCatalog");
|
_instance._dbUserID = AppConfiguration.GetConfValue(AppFile, "DBUserID");
|
_instance._dbPassWD = AppConfiguration.GetConfValue(AppFile, "DBPassWD");
|
_instance._msgListBoxMaxRow = Utils.StrToInt(AppConfiguration.GetConfValue(AppFile, "MsgListBoxMaxRow"), 100);
|
_instance._mtLimit = Utils.StrToInt(AppConfiguration.GetConfValue(AppFile, "MTLimit"), 10);
|
_instance._currentMsgLevel = Utils.StrToInt(AppConfiguration.GetConfValue(AppFile, "CurrentMsgLevel"), 2);
|
_instance._slidingWindowSize = Utils.StrToInt(AppConfiguration.GetConfValue(AppFile, "SlidingWindowSize"), 10);
|
_instance._reSubmitInterval = Utils.StrToInt(AppConfiguration.GetConfValue(AppFile, "ReSubmitInterval"), 30);
|
_instance._activeTestInterval = Utils.StrToInt(AppConfiguration.GetConfValue(AppFile, "ActiveTestInterval"), 30);
|
_instance._autoConnection = true;
|
if (AppConfiguration.GetConfValue(AppFile, "AutoConnection").ToUpper() == "FALSE")
|
{
|
_instance._autoConnection = false;
|
}
|
_instance._programId = AppConfiguration.GetConfValue(AppFile, "ProgramID");
|
if (_instance._programId.Length <= 0)
|
{
|
_instance._programId = "1";
|
}
|
}
|
return _instance;
|
}
|
}
|
|
internal int MsgListBoxMaxRow
|
{
|
get
|
{
|
return this._msgListBoxMaxRow;
|
}
|
set
|
{
|
this._msgListBoxMaxRow = value;
|
AppConfiguration.UpdateConfValue(AppFile, "MsgListBoxMaxRow", this._msgListBoxMaxRow.ToString());
|
}
|
}
|
|
internal int MTLimit
|
{
|
get
|
{
|
return this._mtLimit;
|
}
|
set
|
{
|
this._mtLimit = value;
|
AppConfiguration.UpdateConfValue(AppFile, "MTLimit", this._mtLimit.ToString());
|
}
|
}
|
|
public string PASSWD
|
{
|
get
|
{
|
return this._passwd;
|
}
|
set
|
{
|
this._passwd = value;
|
AppConfiguration.UpdateConfValue(AppFile, "PASSWD", this._passwd);
|
}
|
}
|
|
internal string ProgramID
|
{
|
get
|
{
|
return this._programId;
|
}
|
set
|
{
|
this._programId = value;
|
AppConfiguration.UpdateConfValue(AppFile, "ProgramID", this._programId);
|
}
|
}
|
|
public int ReSubmitInterval
|
{
|
get
|
{
|
return this._reSubmitInterval;
|
}
|
set
|
{
|
this._reSubmitInterval = value;
|
AppConfiguration.UpdateConfValue(AppFile, "ReSubmitInterval", this._reSubmitInterval.ToString());
|
}
|
}
|
|
public string ServerIP
|
{
|
get
|
{
|
return this._serverip;
|
}
|
set
|
{
|
this._serverip = value;
|
AppConfiguration.UpdateConfValue(AppFile, "ServerIP", this._serverip);
|
}
|
}
|
|
public int ServerPort
|
{
|
get
|
{
|
return this._serverport;
|
}
|
set
|
{
|
this._serverport = value;
|
AppConfiguration.UpdateConfValue(AppFile, "ServerPort", this._serverport.ToString());
|
}
|
}
|
|
public int SlidingWindowSize
|
{
|
get
|
{
|
return this._slidingWindowSize;
|
}
|
set
|
{
|
this._slidingWindowSize = value;
|
AppConfiguration.UpdateConfValue(AppFile, "SlidingWindowSize", this._slidingWindowSize.ToString());
|
}
|
}
|
|
public string SpCode
|
{
|
get
|
{
|
return this._spcode;
|
}
|
set
|
{
|
this._spcode = value;
|
AppConfiguration.UpdateConfValue(AppFile, "SPCODE", this._spcode);
|
}
|
}
|
|
public string SPID
|
{
|
get
|
{
|
return this._spid;
|
}
|
set
|
{
|
this._spid = value;
|
AppConfiguration.UpdateConfValue(AppFile, "SPID", this._spid);
|
}
|
}
|
}
|
}
|