178 lines
5.1 KiB
C#
178 lines
5.1 KiB
C#
using Newtonsoft.Json;
|
|
using System;
|
|
using System.Collections.Generic;
|
|
using System.Linq;
|
|
using System.Text;
|
|
using System.Threading.Tasks;
|
|
using System.Xml.Serialization;
|
|
|
|
|
|
namespace KMBIM.Revit.Tools.Cmd.Assembly
|
|
{
|
|
public class AssemDataStorage
|
|
{
|
|
//public string strType { get; set; }
|
|
//public string strLaggingType { get; set; }
|
|
//public double dblLaggingThickness { get; set; }
|
|
|
|
public List<AssemblyData> MainAssemLst { get; set; }
|
|
public List<AssemblyData> SubAssemLst { get; set; }
|
|
public double dblMain2SubDist { get; set; }
|
|
public double dblSubPipeDia { get; set; }
|
|
public string AssemName { get; set; }
|
|
|
|
public AssemDataStorage()
|
|
{
|
|
AssemName = string.Empty;
|
|
MainAssemLst = new List<AssemblyData>();
|
|
SubAssemLst = new List<AssemblyData>();
|
|
dblMain2SubDist = 0;
|
|
dblSubPipeDia = 0;
|
|
|
|
}
|
|
//public DataStorage(string Type, string laggingType, double laggingThickness, bool isNew)
|
|
public AssemDataStorage(string AssemName, List<AssemblyData> MainLst, List<AssemblyData> SubLst, double Main2SubDist, double SubPipeDia)
|
|
{
|
|
this.AssemName = AssemName;
|
|
MainAssemLst = MainLst;
|
|
SubAssemLst = SubLst;
|
|
dblMain2SubDist = Main2SubDist;
|
|
dblSubPipeDia = SubPipeDia;
|
|
}
|
|
}
|
|
|
|
[XmlInclude(typeof(AssemDataStorage))]
|
|
public class AssemTblDataStorage
|
|
{
|
|
[XmlArray(ElementName = "DataStorage_List")]
|
|
[XmlArrayItem(ElementName = "DataStorage")]
|
|
public List<AssemDataStorage> m_table = null;
|
|
public AssemTblDataStorage()
|
|
{
|
|
m_table = new List<AssemDataStorage>();
|
|
}
|
|
|
|
//public void Add(string strCategoryName, bool bisPipe, string pipeType, string laggingType, double laggingThickness, bool isNew = false)
|
|
public void Add(string AssemName, List<AssemblyData> MainDataLst, List<AssemblyData> SubDataLst, double Main2SubDst, double SubPipeDia)
|
|
{
|
|
m_table.Add(new AssemDataStorage(AssemName, MainDataLst, SubDataLst, Main2SubDst, SubPipeDia));
|
|
}
|
|
public AssemDataStorage Find(string strCategoryName, bool bisPipe, string Type)
|
|
{
|
|
return m_table.Find(x => x.AssemName == Type);
|
|
}
|
|
|
|
public void Remove(string Type)
|
|
{
|
|
m_table.Remove(m_table.Find(x => x.AssemName == Type));
|
|
}
|
|
public List<AssemDataStorage> GetTable()
|
|
{
|
|
return m_table;
|
|
}
|
|
|
|
public List<AssemDataStorage> GetTable(string strCategoryName, bool bisPipe)
|
|
{
|
|
return m_table;
|
|
}
|
|
public string toJson()
|
|
{
|
|
return JsonConvert.SerializeObject(m_table);
|
|
}
|
|
public void LoadJson(string json)
|
|
{
|
|
m_table = JsonConvert.DeserializeObject<List<AssemDataStorage>>(json);
|
|
}
|
|
|
|
public class InsulationType
|
|
{
|
|
public int index { get; set; }
|
|
public string strType { get; set; }
|
|
|
|
public InsulationType()
|
|
{
|
|
index = 0;
|
|
strType = string.Empty;
|
|
}
|
|
public InsulationType(int idx, string Type)
|
|
{
|
|
index = idx;
|
|
strType = Type;
|
|
}
|
|
|
|
}
|
|
public class TblInsulationType
|
|
{
|
|
int idx = 0;
|
|
private List<InsulationType> m_table = null;
|
|
public TblInsulationType()
|
|
{
|
|
m_table = new List<InsulationType>();
|
|
}
|
|
public void Add(string strType)
|
|
{
|
|
m_table.Add(new InsulationType(idx, strType));
|
|
idx++;
|
|
}
|
|
public void Remove(string pipeType)
|
|
{
|
|
//m_table.Remove();
|
|
}
|
|
|
|
public List<InsulationType> GetTable()
|
|
{
|
|
return m_table;
|
|
}
|
|
|
|
|
|
}
|
|
|
|
|
|
public class PipeDiameterOfThickness
|
|
{
|
|
public int nDiameter { get; set; }
|
|
public double dblThickness { get; set; }
|
|
|
|
public PipeDiameterOfThickness()
|
|
{
|
|
nDiameter = 0;
|
|
dblThickness = 0;
|
|
}
|
|
public PipeDiameterOfThickness(int ndia, int thick)
|
|
{
|
|
nDiameter = ndia;
|
|
dblThickness = thick;
|
|
}
|
|
|
|
}
|
|
public class TblPipeDiameterOfThickness
|
|
{
|
|
int idx = 0;
|
|
private List<PipeDiameterOfThickness> m_table = null;
|
|
public TblPipeDiameterOfThickness()
|
|
{
|
|
m_table = new List<PipeDiameterOfThickness>();
|
|
}
|
|
public void Add(int dia, int thick)
|
|
{
|
|
m_table.Add(new PipeDiameterOfThickness(dia, thick));
|
|
idx++;
|
|
}
|
|
public void Remove(string pipeType)
|
|
{
|
|
//m_table.Remove();
|
|
}
|
|
|
|
public List<PipeDiameterOfThickness> GetTable()
|
|
{
|
|
return m_table;
|
|
}
|
|
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
}
|