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