OTSGeneralParam.cs 12 KB

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