| 1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162 |
- /* ==============================================================================
- * 功能描述:组件编码
- * 创 建 者:Garrett
- * 创建日期:2019/1/17 10:11:41
- * ==============================================================================*/
- using System;
- using System.Collections.Generic;
- using System.Linq;
- using System.Text;
- using System.Threading.Tasks;
- using SAGA.DotNetUtils.Serializer;
- using SAGA.MBI.Common;
- using SAGA.MBI.FileStream;
- using SAGA.MBI.Model;
- namespace SAGA.MBI.DataArrange
- {
- /// <summary>
- /// DalEquipCode
- /// </summary>
- class DalInfoCode
- {
- /// <summary>
- /// 初始化组件对照表
- /// </summary>
- public static void Init()
- {
- var codes=new List<ComponentCodeToInputType>();
- codes.Add(new ComponentCodeToInputType(){ComponentCode = "A1",InputType = "TextBox_Double_A1" });
- codes.Add(new ComponentCodeToInputType() { ComponentCode = "A2", InputType = "Textbox_DoubleUnit_A2" });
- codes.Add(new ComponentCodeToInputType() { ComponentCode = "B1", InputType = "TextBox_String_B1" });
- codes.Add(new ComponentCodeToInputType() { ComponentCode = "C5", InputType = "DataTime_Date_C5" });
- codes.Add(new ComponentCodeToInputType() { ComponentCode = "D1", InputType = "Enum_D1" });
- string path = MBIConst.MBIDataDictionaryPath;
- string fileName = "ComponentCodeToInputType.xml";
- SerializerByXml.SerializeAndSave(path, fileName, codes);
- }
- /// <summary>
- /// 读取组件对照表
- /// </summary>
- /// <returns></returns>
- [CacheAspect]
- public static List<ComponentCodeToInputType> Read()
- {
- string path = MBIConst.MBIDataDictionaryPath;
- string fileName = "ComponentCodeToInputType.xml";
- return SerializerByXml.DeserializeList<ComponentCodeToInputType>(path, fileName);
- }
- /// <summary>
- /// 由组件编码获取Revit输入类型
- /// </summary>
- /// <param name="componentCode"></param>
- /// <returns></returns>
- public static string GetInputType(string componentCode)
- {
- var codes = Read();
- var item = codes.FirstOrDefault(t => t.ComponentCode == componentCode);
- return item?.InputType;
- }
- }
- }
|