using System;
|
using System.Collections.Generic;
|
|
namespace TProduct.Model
|
{
|
public class LinkInfo4Bench
|
{
|
public LinkInfo4Bench()
|
{
|
|
}
|
public LinkInfo4Bench(string jsonString)
|
{
|
FromJsonString(jsonString);
|
}
|
public LinkInfo4Bench(LinkInfo4Bench rhs)
|
{
|
this.ReceiveWaitTime = rhs.ReceiveWaitTime;
|
this.PollTime = rhs.PollTime;
|
}
|
|
public string ToJsonString()
|
{
|
Dictionary<string, string> dict = new Dictionary<string, string>();
|
if (this.ReceiveWaitTime > 0)
|
dict["RWT"] = this.ReceiveWaitTime.ToString();
|
if (this.PollTime > 0)
|
dict["POT"] = this.PollTime.ToString();
|
|
string json = (new System.Web.Script.Serialization.JavaScriptSerializer()).Serialize(dict);
|
|
return json;
|
}
|
|
public void FromJsonString(string jsonString)
|
{
|
if (string.IsNullOrEmpty(jsonString))
|
return;
|
Dictionary<string, string> dict = (new System.Web.Script.Serialization.JavaScriptSerializer()).Deserialize(jsonString, typeof(Dictionary<string, string>)) as Dictionary<string, string>;
|
if (dict.ContainsKey("RWT"))
|
this.ReceiveWaitTime = Convert.ToInt32(dict["RWT"]);
|
if (dict.ContainsKey("POT"))
|
this.PollTime = Convert.ToInt32(dict["POT"]);
|
|
}
|
|
|
|
#region Model
|
protected int _receiveWaitTime = 180;//发送查询,等待时间
|
public int ReceiveWaitTime { get { return _receiveWaitTime; } set { _receiveWaitTime = value; } }
|
|
protected int _pollTime = 300;//定时器轮询时间
|
public int PollTime { get { return _pollTime; } set { _pollTime = value; } }
|
#endregion Model
|
}
|
}
|