using System;
using System.Collections.Generic;
namespace TProduct.Model
{
///
/// 测试方法
///
public class WorkBenchMethod4Pump
{
public WorkBenchMethod4Pump()
{
}
public WorkBenchMethod4Pump(string jsonString)
{
FromJsonString(jsonString);
}
public WorkBenchMethod4Pump(WorkBenchMethod4Pump rhs)
{
this.Power = rhs.Power;
this.Press = rhs.Press;
this.Torque = rhs.Torque;
this.Npsh = rhs.Npsh;
this.InletIsUseWaterLevel = rhs.InletIsUseWaterLevel;
}
public string ToJsonString()
{
Dictionary dict = new Dictionary();
if (this.Power != null)
dict["Power"] = ((int)this.Power.Value).ToString();
if (this.Press != null)
dict["Press"] = ((int)this.Press.Value).ToString();
if (this.Torque != null)
dict["Torque"] = ((int)this.Torque.Value).ToString();
if (this.Npsh != null)
dict["Npsh"] = ((int)this.Npsh.Value).ToString();
dict["IIWL"] = this.InletIsUseWaterLevel.ToString();
string json = (new System.Web.Script.Serialization.JavaScriptSerializer()).Serialize(dict);
return json;
}
public void FromJsonString(string jsonString)
{
if (string.IsNullOrEmpty(jsonString))
return;
Dictionary dict = (new System.Web.Script.Serialization.JavaScriptSerializer()).Deserialize(jsonString, typeof(Dictionary)) as Dictionary;
if (dict.ContainsKey("Power"))
this.Power = (ePowerTestMethod)int.Parse(dict["Power"]);
if (dict.ContainsKey("Press"))
this.Press = (ePressTestMethod)int.Parse(dict["Press"]);
if (dict.ContainsKey("Torque"))
this.Torque = (eTorqueTestMethod)int.Parse(dict["Torque"]);
if (dict.ContainsKey("Npsh"))
this.Npsh = (eNpshTestMethod)int.Parse(dict["Npsh"]);
if (dict.ContainsKey("IIWL"))
this.InletIsUseWaterLevel = Convert.ToInt32(dict["IIWL"]);
}
#region Model
///
/// 功率测试法
///
public ePowerTestMethod? Power { get; set; }
///
/// 压力测试法
///
public ePressTestMethod? Press { get; set; }
///
/// 扭矩测试法
///
public eTorqueTestMethod? Torque { get; set; }
///
/// 汽蚀测试法
///
public eNpshTestMethod? Npsh { get; set; }
///
/// 进口压力用清水池代替
///
public int InletIsUseWaterLevel { get; set; } = 0;
#endregion Model
}
}