|
123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778 |
- using CnasSynchronousCommon;
- using CnasSynchronusDAL;
- using CnasSynchronusIDAL;
- using CnasSynchrousModel;
- using System;
- using System.Collections.Generic;
- using System.Data;
- using System.Linq;
- using System.Text;
-
- namespace CnasSynchronusClient
- {
- public class InstrumentDescribeZH
- {
- public InstrumentDescribeZH(InstrumentType instrumentType, string TableName)
- {
- this.instrumentType = instrumentType;
- this.TableName = TableName;
- }
-
- public InstrumentType instrumentType { get; set; }
-
- public string TableName { get; set; }
-
- public Dictionary<string,string> DictField { get; set; }
-
- public IExcelService excelDataBaseService { get { return new ExcelDBService(); } }
-
- //根据仪器类型获取字段中文描述
- public void GetFieldDescribe()
- {
- //1.获得存放文件名
- DictField = new Dictionary<string, string>();
- string strFileName = "";
- switch (instrumentType)
- {
- case InstrumentType.AshMeltingPoint:
- strFileName = "AshMeltingPoint.xls";
- break;
- case InstrumentType.ElementalAnalyzer:
- strFileName = "ElementalAnalyzer.xls";
- break;
- case InstrumentType.IndustrialAnalyzer:
- strFileName = "IndustrialAnalyzer.xls";
- break;
- case InstrumentType.InfraredSulfurMeter:
- strFileName = "InfraredSulfurMeter.xls";
- break;
- case InstrumentType.MoistureMeter:
- strFileName = "MoistureMeter.xls";
- break;
- case InstrumentType.SulphurMeter:
- strFileName = "SulphurMeter.xls";
- break;
- case InstrumentType.CalorimetricApparatus:
- strFileName = "CalorimetricApparatus.xls";
- break;
- }
- if (strFileName == "") return;
-
- //根据文件名和表名,读取该文件中表
- string strPath = FileHelper.getBasePath() + "Document\\" + strFileName;
- DataTable dt = excelDataBaseService.GetDataByTableName(new ExcelOpenParams { StrPath = strPath }, new ConditionParams { TableName = TableName });
-
- if (dt == null || dt.Rows.Count == 0) return;
-
- //整理数据
- foreach (DataRow dr in dt.Rows)
- {
- string strColumnName = dr[0].ToString();
- string strColumnDetail = dr[3].ToString();
-
- if (!DictField.ContainsKey(strColumnName))
- DictField.Add(strColumnName.ToUpper(), strColumnDetail);
- }
- }
- }
- }
|