OTSGeneralParam.cs 12 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315
  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 int GetPartStdLibTypeIndex()
  93. {
  94. return m_StdLibTypeIndex;
  95. }
  96. public void SetPartStdLibTypeIndex(int a_index)
  97. {
  98. m_StdLibTypeIndex = a_index;
  99. }
  100. public int PropertyDisplayMode()
  101. {
  102. return m_nPropertyDisplayMode;
  103. }
  104. public void SetPropertyDisplayMode(int a_PropertyDisplayMode)
  105. {
  106. m_nPropertyDisplayMode = a_PropertyDisplayMode;
  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 CSampleParam GetMsrParam()
  175. //{
  176. // return m_DefaultMsrParam;
  177. //}
  178. //public void SetMsrParam(CSampleParam val)
  179. //{
  180. // m_DefaultMsrParam = val;
  181. //}
  182. public otsdataconst.MEMBRANE_TYPE GetMembraneType()
  183. {
  184. return m_DefaultmembraneType;
  185. }
  186. public void GetMembraneType(otsdataconst.MEMBRANE_TYPE val)
  187. {
  188. m_DefaultmembraneType = val;
  189. }
  190. public bool GetSysSTD() { return m_bSysSTD; }
  191. public void SetSysSTD(bool a_bSysSTD) { m_bSysSTD = a_bSysSTD; }
  192. public int GetSteelTechnology() { return m_steelTechnologyl; }
  193. public void SetSteelTechnology(int a_steelTechnology) { m_steelTechnologyl = a_steelTechnology; }
  194. public string GetSTDSelect() { return m_sSTDSelect; }
  195. public void SetSTDSelect(string a_sSTDSelect) { m_sSTDSelect = a_sSTDSelect; }
  196. //--------------------protected--------------
  197. // initialization
  198. protected void Init()
  199. {
  200. m_strDefaultSampleName = ("");
  201. m_bMeasSwitch = true;
  202. m_strMeasParamFileFolderName = ("");
  203. m_strPartSTDLibFolderName = ("");
  204. m_StdLibTypeIndex = 0;
  205. m_DefaultmembraneType = otsdataconst.MEMBRANE_TYPE.Abrasive;
  206. m_nDefaultShape = otsdataconst.DOMAIN_SHAPE.INVALID;
  207. m_dDefaultArea = 0;
  208. //m_DefaultMsrParam = new CSampleParam();
  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. }
  220. protected void Duplicate(COTSGeneralParam a_oSource)
  221. {
  222. // initialization
  223. Init();
  224. // copy data over
  225. m_strDefaultSampleName = a_oSource.m_strDefaultSampleName;
  226. m_bMeasSwitch = a_oSource.m_bMeasSwitch;
  227. m_strMeasParamFileFolderName = a_oSource.m_strMeasParamFileFolderName;
  228. m_strPartSTDLibFolderName = a_oSource.m_strPartSTDLibFolderName;
  229. m_StdLibTypeIndex = a_oSource.m_StdLibTypeIndex;
  230. m_DefaultmembraneType = a_oSource.m_DefaultmembraneType;
  231. m_nDefaultShape = a_oSource.m_nDefaultShape;
  232. m_dDefaultArea = a_oSource.m_dDefaultArea;
  233. m_nPropertyDisplayMode = a_oSource.m_nPropertyDisplayMode;
  234. m_strLaboratoty = a_oSource.m_strLaboratoty;
  235. m_strAnalysisReferenceNumber = a_oSource.m_strAnalysisReferenceNumber;
  236. m_strCustomerName = a_oSource.m_strCustomerName;
  237. m_strSampleDescription = a_oSource.m_strSampleDescription;
  238. m_strOperatorName = a_oSource.m_strOperatorName;
  239. m_strComment = a_oSource.m_strComment;
  240. m_bSysSTD = a_oSource.m_bSysSTD;
  241. m_steelTechnologyl = a_oSource.m_steelTechnologyl;
  242. m_sSTDSelect = a_oSource.m_sSTDSelect;
  243. }
  244. public override void Serialize(bool isStoring, XmlDocument classDoc, XmlNode rootNode)
  245. {
  246. xString xstrDefaultSampleName = new xString();
  247. xBool xbMeasSwitch = new xBool();
  248. xString xstrMeasParamFileFolderName = new xString();
  249. xString xstrPartSTDLibFolderName = new xString();
  250. xString xstrSTDSelect = new xString();
  251. xInt xnStdLibTypeIndex = new xInt();
  252. xInt xnSteelTechnology = new xInt();
  253. xInt xnDefaultShape = new xInt();
  254. xBool xbUseSysSTD = new xBool();
  255. xDouble xbDefaultArea = new xDouble();
  256. xInt xnPropertyDisplayMode = new xInt();
  257. Slo slo = new Slo();
  258. slo.Register("DefaultSampleName", xstrDefaultSampleName);
  259. slo.Register("MeasSwitch", xbMeasSwitch);
  260. slo.Register("MeasParamFileFolderName", xstrMeasParamFileFolderName);
  261. slo.Register("PartSTDLibFolderName", xstrPartSTDLibFolderName);
  262. slo.Register("StdLibTypeIndex", xnStdLibTypeIndex);
  263. slo.Register("StdLibFileName", xstrSTDSelect);
  264. slo.Register("SteelTechnology", xnSteelTechnology);
  265. slo.Register("DefaultShape", xnDefaultShape);
  266. slo.Register("UseSysSTD", xbUseSysSTD);
  267. slo.Register("DefaultArea", xbDefaultArea);
  268. slo.Register("PropertyDisplayMode", xnPropertyDisplayMode);
  269. if (isStoring)
  270. {
  271. xstrDefaultSampleName.AssignValue(m_strDefaultSampleName);
  272. xbMeasSwitch.AssignValue(m_bMeasSwitch);
  273. xstrMeasParamFileFolderName.AssignValue(m_strMeasParamFileFolderName);
  274. xstrPartSTDLibFolderName.AssignValue(m_strPartSTDLibFolderName);
  275. xstrSTDSelect.AssignValue(m_sSTDSelect);
  276. xnStdLibTypeIndex.AssignValue(m_StdLibTypeIndex);
  277. xnSteelTechnology.AssignValue(m_steelTechnologyl);
  278. xnDefaultShape.AssignValue((int)m_nDefaultShape);
  279. xbUseSysSTD.AssignValue(m_bSysSTD);
  280. xbDefaultArea.AssignValue(m_dDefaultArea);
  281. xnPropertyDisplayMode.AssignValue(m_nPropertyDisplayMode);
  282. slo.Serialize(true, classDoc, rootNode);
  283. }
  284. else
  285. {
  286. slo.Serialize(false, classDoc, rootNode);
  287. m_strDefaultSampleName = xstrDefaultSampleName.value();
  288. m_bMeasSwitch = Convert.ToBoolean(xbMeasSwitch.toString());
  289. m_strMeasParamFileFolderName = xstrMeasParamFileFolderName.value();
  290. m_strPartSTDLibFolderName = xstrPartSTDLibFolderName.value();
  291. m_sSTDSelect = xstrSTDSelect.value();
  292. m_StdLibTypeIndex = xnStdLibTypeIndex.value();
  293. m_steelTechnologyl = xnSteelTechnology.value();
  294. m_nDefaultShape = (otsdataconst.DOMAIN_SHAPE)xnDefaultShape.value();
  295. m_bSysSTD =Convert.ToBoolean(xbUseSysSTD.toString());
  296. m_dDefaultArea = xbDefaultArea.value();
  297. m_nPropertyDisplayMode= xnPropertyDisplayMode.value();
  298. }
  299. }
  300. }
  301. }