OTSGeneralParam.cs 11 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314
  1. using OTSDataType;
  2. using System;
  3. using System.Collections.Generic;
  4. using System.Linq;
  5. using System.Text;
  6. using System.Threading.Tasks;
  7. using System.Xml;
  8. namespace OTSModelSharp
  9. {
  10. public class COTSGeneralParam : ISlo
  11. {
  12. //--------------------definition-------------
  13. double m_dDefaultArea;
  14. int m_nPropertyDisplayMode;
  15. bool m_bMeasSwitch;
  16. string m_strDefaultSampleName;
  17. string m_strMeasParamFileFolderName;
  18. string m_strPartSTDLibFolderName;
  19. string m_strLaboratoty;
  20. string m_strAnalysisReferenceNumber;
  21. string m_strCustomerName;
  22. string m_strSampleDescription;
  23. string m_strOperatorName;
  24. string m_strComment;
  25. bool m_bSysSTD;
  26. int m_steelTechnologyl;
  27. string m_sSTDSelect;
  28. otsdataconst.DOMAIN_SHAPE m_nDefaultShape;
  29. otsdataconst.MEMBRANE_TYPE m_DefaultmembraneType;
  30. bool m_AutoBeamOff;
  31. /// <summary>
  32. /// AutoBeamOff:自动关高压开关
  33. /// </summary>
  34. public bool AutoBeamOff
  35. {
  36. set
  37. {
  38. m_AutoBeamOff = value;
  39. }
  40. get
  41. {
  42. return m_AutoBeamOff;
  43. }
  44. }
  45. //--------------------public-----------------
  46. public COTSGeneralParam()
  47. {
  48. Init();
  49. }
  50. public COTSGeneralParam(COTSGeneralParam a_oSource)
  51. {
  52. // can't copy itself
  53. if (a_oSource == this)
  54. {
  55. return;
  56. }
  57. // copy data over
  58. Duplicate(a_oSource);
  59. }
  60. public bool Equals(COTSGeneralParam a_oSource)
  61. {
  62. // return test result
  63. return ((m_strDefaultSampleName.ToLower().IndexOf(a_oSource.m_strDefaultSampleName) == 0) &&
  64. (m_bMeasSwitch == a_oSource.m_bMeasSwitch) &&
  65. (m_strMeasParamFileFolderName.ToLower().IndexOf(a_oSource.m_strMeasParamFileFolderName) == 0) &&
  66. (m_strPartSTDLibFolderName.ToLower().IndexOf(a_oSource.m_strPartSTDLibFolderName) == 0)) &&
  67. (m_DefaultmembraneType == a_oSource.m_DefaultmembraneType) &&
  68. (m_nDefaultShape == a_oSource.m_nDefaultShape) &&
  69. (m_dDefaultArea == a_oSource.m_dDefaultArea) &&
  70. (m_nPropertyDisplayMode == a_oSource.m_nPropertyDisplayMode);
  71. }
  72. public string GetSampleName()
  73. {
  74. return m_strDefaultSampleName;
  75. }
  76. public void SetSampleName(string a_strDefaultSampleName)
  77. {
  78. m_strDefaultSampleName = a_strDefaultSampleName;
  79. }
  80. public bool GetMeasurementSwitch()
  81. {
  82. return m_bMeasSwitch;
  83. }
  84. public void SetMeasurementSwitch(bool a_bSwitch)
  85. {
  86. m_bMeasSwitch = a_bSwitch;
  87. }
  88. public string GetMsrParamFileFolderName()
  89. {
  90. return m_strMeasParamFileFolderName;
  91. }
  92. public void SetMsrParamFileFolderName(string a_sMeasParamFileFolderName)
  93. {
  94. m_strMeasParamFileFolderName = a_sMeasParamFileFolderName;
  95. }
  96. public string GetPartSTDLibFolderName()
  97. {
  98. return m_strPartSTDLibFolderName;
  99. }
  100. public void SetPartSTDLibFolderName(string a_strPartSTDLibFolderName)
  101. {
  102. m_strPartSTDLibFolderName = a_strPartSTDLibFolderName;
  103. }
  104. public int PropertyDisplayMode()
  105. {
  106. return m_nPropertyDisplayMode;
  107. }
  108. public string GetLaboratoty()
  109. {
  110. return m_strLaboratoty;
  111. }
  112. public void SetLaboratoty(string a_Laboratoty)
  113. {
  114. m_strLaboratoty = a_Laboratoty;
  115. }
  116. public string GetAnalysisReferenceNumber()
  117. {
  118. return m_strAnalysisReferenceNumber;
  119. }
  120. public void SetAnalysisReferenceNumber(string a_AnalysisReferenceNumber)
  121. {
  122. m_strAnalysisReferenceNumber = a_AnalysisReferenceNumber;
  123. }
  124. public string GetCustomerName()
  125. {
  126. return m_strCustomerName;
  127. }
  128. public void SetCustomerName(string a_CustomerName)
  129. {
  130. m_strCustomerName = a_CustomerName;
  131. }
  132. public string GetSampleDescription()
  133. {
  134. return m_strSampleDescription;
  135. }
  136. public void SetSampleDescription(string a_SampleDescription)
  137. {
  138. m_strSampleDescription = a_SampleDescription;
  139. }
  140. public string GetOperatorName()
  141. {
  142. return m_strOperatorName;
  143. }
  144. public void SetOperatorName(string a_OperatorName)
  145. {
  146. m_strOperatorName = a_OperatorName;
  147. }
  148. public string GetComment()
  149. {
  150. return m_strComment;
  151. }
  152. public void SetComment(string a_Comment)
  153. {
  154. m_strComment = a_Comment;
  155. }
  156. // measure area shape
  157. public otsdataconst.DOMAIN_SHAPE GetShape()
  158. {
  159. return m_nDefaultShape;
  160. }
  161. public void SetShape(otsdataconst.DOMAIN_SHAPE a_nShape)
  162. {
  163. m_nDefaultShape = a_nShape;
  164. }
  165. // measure default value
  166. public double GetArea()
  167. {
  168. return m_dDefaultArea;
  169. }
  170. public void SetArea(double a_dArea)
  171. {
  172. m_dDefaultArea = a_dArea;
  173. }
  174. public otsdataconst.MEMBRANE_TYPE GetMembraneType()
  175. {
  176. return m_DefaultmembraneType;
  177. }
  178. public void GetMembraneType(otsdataconst.MEMBRANE_TYPE val)
  179. {
  180. m_DefaultmembraneType = val;
  181. }
  182. public bool GetSysSTD() { return m_bSysSTD; }
  183. public void SetSysSTD(bool a_bSysSTD) { m_bSysSTD = a_bSysSTD; }
  184. public int GetSteelTechnology() { return m_steelTechnologyl; }
  185. public void SetSteelTechnology(int a_steelTechnology) { m_steelTechnologyl = a_steelTechnology; }
  186. public string GetSTDSelect() { return m_sSTDSelect; }
  187. public void SetSTDSelect(string a_sSTDSelect) { m_sSTDSelect = a_sSTDSelect; }
  188. //--------------------protected--------------
  189. // initialization
  190. protected void Init()
  191. {
  192. m_strDefaultSampleName = ("");
  193. m_bMeasSwitch = true;
  194. m_strMeasParamFileFolderName = ("");
  195. m_strPartSTDLibFolderName = ("");
  196. m_DefaultmembraneType = otsdataconst.MEMBRANE_TYPE.Abrasive;
  197. m_nDefaultShape = (otsdataconst.DOMAIN_SHAPE)(-1);
  198. m_dDefaultArea = 0;
  199. m_nPropertyDisplayMode = 0;
  200. m_strLaboratoty = ("");
  201. m_strAnalysisReferenceNumber = ("");
  202. m_strCustomerName = ("");
  203. m_strSampleDescription = ("");
  204. m_strOperatorName = ("");
  205. m_strComment = ("");
  206. m_bSysSTD = false;
  207. m_steelTechnologyl = 0;
  208. m_sSTDSelect = ("");
  209. m_AutoBeamOff = false;
  210. }
  211. protected void Duplicate(COTSGeneralParam a_oSource)
  212. {
  213. // initialization
  214. Init();
  215. // copy data over
  216. m_strDefaultSampleName = a_oSource.m_strDefaultSampleName;
  217. m_bMeasSwitch = a_oSource.m_bMeasSwitch;
  218. m_strMeasParamFileFolderName = a_oSource.m_strMeasParamFileFolderName;
  219. m_strPartSTDLibFolderName = a_oSource.m_strPartSTDLibFolderName;
  220. m_DefaultmembraneType = a_oSource.m_DefaultmembraneType;
  221. m_nDefaultShape = a_oSource.m_nDefaultShape;
  222. m_dDefaultArea = a_oSource.m_dDefaultArea;
  223. m_nPropertyDisplayMode = a_oSource.m_nPropertyDisplayMode;
  224. m_strLaboratoty = a_oSource.m_strLaboratoty;
  225. m_strAnalysisReferenceNumber = a_oSource.m_strAnalysisReferenceNumber;
  226. m_strCustomerName = a_oSource.m_strCustomerName;
  227. m_strSampleDescription = a_oSource.m_strSampleDescription;
  228. m_strOperatorName = a_oSource.m_strOperatorName;
  229. m_strComment = a_oSource.m_strComment;
  230. m_bSysSTD = a_oSource.m_bSysSTD;
  231. m_steelTechnologyl = a_oSource.m_steelTechnologyl;
  232. m_sSTDSelect = a_oSource.m_sSTDSelect;
  233. }
  234. public override void Serialize(bool isStoring, XmlDocument classDoc, XmlNode rootNode)
  235. {
  236. xString xstrDefaultSampleName = new xString();
  237. xBool xbMeasSwitch = new xBool();
  238. xString xstrMeasParamFileFolderName = new xString();
  239. xString xstrPartSTDLibFolderName = new xString();
  240. xString xstrSTDSelect = new xString();
  241. xInt xnStdLibTypeIndex = new xInt();
  242. xInt xnSteelTechnology = new xInt();
  243. xInt xnDefaultShape = new xInt();
  244. xBool xbUseSysSTD = new xBool();
  245. xDouble xbDefaultArea = new xDouble();
  246. xInt xnPropertyDisplayMode = new xInt();
  247. Slo slo = new Slo();
  248. slo.Register("DefaultSampleName", xstrDefaultSampleName);
  249. slo.Register("MeasSwitch", xbMeasSwitch);
  250. slo.Register("MeasParamFileFolderName", xstrMeasParamFileFolderName);
  251. slo.Register("PartSTDLibFolderName", xstrPartSTDLibFolderName);
  252. slo.Register("StdLibFileName", xstrSTDSelect);
  253. slo.Register("SteelTechnology", xnSteelTechnology);
  254. slo.Register("DefaultShape", xnDefaultShape);
  255. slo.Register("UseSysSTD", xbUseSysSTD);
  256. slo.Register("DefaultArea", xbDefaultArea);
  257. slo.Register("PropertyDisplayMode", xnPropertyDisplayMode);
  258. if (isStoring)
  259. {
  260. xstrDefaultSampleName.AssignValue(m_strDefaultSampleName);
  261. xbMeasSwitch.AssignValue(m_bMeasSwitch);
  262. xstrMeasParamFileFolderName.AssignValue(m_strMeasParamFileFolderName);
  263. xstrPartSTDLibFolderName.AssignValue(m_strPartSTDLibFolderName);
  264. xstrSTDSelect.AssignValue(m_sSTDSelect);
  265. xnSteelTechnology.AssignValue(m_steelTechnologyl);
  266. xnDefaultShape.AssignValue((int)m_nDefaultShape);
  267. xbUseSysSTD.AssignValue(m_bSysSTD);
  268. xbDefaultArea.AssignValue(m_dDefaultArea);
  269. xnPropertyDisplayMode.AssignValue(m_nPropertyDisplayMode);
  270. slo.Serialize(true, classDoc, rootNode);
  271. }
  272. else
  273. {
  274. slo.Serialize(false, classDoc, rootNode);
  275. m_strDefaultSampleName = xstrDefaultSampleName.value();
  276. m_bMeasSwitch = Convert.ToBoolean(xbMeasSwitch.toString());
  277. m_strMeasParamFileFolderName = xstrMeasParamFileFolderName.value();
  278. m_strPartSTDLibFolderName = xstrPartSTDLibFolderName.value();
  279. m_sSTDSelect = xstrSTDSelect.value();
  280. m_steelTechnologyl = xnSteelTechnology.value();
  281. m_nDefaultShape = (otsdataconst.DOMAIN_SHAPE)xnDefaultShape.value();
  282. m_bSysSTD =Convert.ToBoolean(xbUseSysSTD.toString());
  283. m_dDefaultArea = xbDefaultArea.value();
  284. m_nPropertyDisplayMode= xnPropertyDisplayMode.value();
  285. }
  286. }
  287. }
  288. }