OTSGeneralParam.cs 11 KB

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