You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

160 lines
5.9 KiB

  1. using System;
  2. using System.Data;
  3. using System.Configuration;
  4. using System.Collections.Generic;
  5. using OT.Model;
  6. using OT.DALFactory;
  7. using OT.IDAL;
  8. namespace OT.BLL
  9. {
  10. /// <summary>
  11. /// OTB_SYS_Arguments
  12. /// </summary>
  13. public partial class OTB_SYS_Arguments
  14. {
  15. private readonly IOTB_SYS_Arguments dal = DataAccess.Create<IOTB_SYS_Arguments>("OTB_SYS_Arguments");
  16. private readonly string _strUseWebservice = ConfigurationManager.AppSettings["UseWebservice"].ToString();
  17. private readonly string _strWebserviceUrl = ConfigurationManager.AppSettings["WebserviceUrl"].ToString() + "OTB_SYS_Arguments.asmx";
  18. public OTB_SYS_Arguments()
  19. { }
  20. #region Method
  21. /// <summary>
  22. /// 是否存在該記錄
  23. /// </summary>
  24. public bool Exists(string ArgumentClassID, string ArgumentID)
  25. {
  26. if (string.IsNullOrEmpty(_strUseWebservice) || _strUseWebservice.ToLower().Equals("false"))
  27. {
  28. return dal.Exists( ArgumentClassID, ArgumentID);
  29. }
  30. else
  31. {
  32. string[] aryParam = new string[2];
  33. aryParam[0] = ArgumentClassID;
  34. aryParam[1] = ArgumentID;
  35. return (bool)OT.BLL.Common.WebServiceHelper.InvokeWebService(_strWebserviceUrl, "WS_Exists", aryParam);
  36. }
  37. }
  38. /// <summary>
  39. /// 增加一條資料
  40. /// </summary>
  41. public bool Add(OT.Model.OTB_SYS_Arguments model)
  42. {
  43. if (string.IsNullOrEmpty(_strUseWebservice) || _strUseWebservice.ToLower().Equals("false"))
  44. {
  45. return dal.Add(model);
  46. }
  47. else
  48. {
  49. string[] aryParam = new string[1];
  50. aryParam[0] = Common.ObjSerialize.Serialize(model);
  51. return (bool)OT.BLL.Common.WebServiceHelper.InvokeWebService(_strWebserviceUrl, "WS_Add", aryParam);
  52. }
  53. }
  54. /// <summary>
  55. /// 更新一條資料
  56. /// </summary>
  57. public bool Update(OT.Model.OTB_SYS_Arguments model)
  58. {
  59. if (string.IsNullOrEmpty(_strUseWebservice) || _strUseWebservice.ToLower().Equals("false"))
  60. {
  61. return dal.Update(model);
  62. }
  63. else
  64. {
  65. string[] aryParam = new string[1];
  66. aryParam[0] = Common.ObjSerialize.Serialize(model);
  67. return (bool)OT.BLL.Common.WebServiceHelper.InvokeWebService(_strWebserviceUrl, "WS_Update", aryParam);
  68. }
  69. }
  70. /// <summary>
  71. /// 刪除一條資料
  72. /// </summary>
  73. public bool Delete(OT.Model.OTB_SYS_Arguments model)
  74. {
  75. if (string.IsNullOrEmpty(_strUseWebservice) || _strUseWebservice.ToLower().Equals("false"))
  76. {
  77. return dal.Delete(model);
  78. }
  79. else
  80. {
  81. string[] aryParam = new string[1];
  82. aryParam[0] = Common.ObjSerialize.Serialize(model);
  83. return (bool)OT.BLL.Common.WebServiceHelper.InvokeWebService(_strWebserviceUrl, "WS_Delete", aryParam);
  84. }
  85. }
  86. /// <summary>
  87. /// 得到一個對象實體
  88. /// </summary>
  89. public OT.Model.OTB_SYS_Arguments GetModel( string ArgumentClassID, string ArgumentID)
  90. {
  91. if (string.IsNullOrEmpty(_strUseWebservice) || _strUseWebservice.ToLower().Equals("false"))
  92. {
  93. return dal.GetModel( ArgumentClassID, ArgumentID);
  94. }
  95. else
  96. {
  97. string[] aryParam = new string[2];
  98. aryParam[0] = ArgumentClassID;
  99. aryParam[1] = ArgumentID;
  100. return (OT.Model.OTB_SYS_Arguments)Common.ObjDeserialize.Deserialize(OT.BLL.Common.WebServiceHelper.InvokeWebService(_strWebserviceUrl, "WS_GetModel", aryParam).ToString(), typeof(OT.Model.OTB_SYS_Arguments));
  101. }
  102. }
  103. /// <summary>
  104. /// 獲得資料列表
  105. /// </summary>
  106. public DataSet GetList(int StartRecordIndex, int EndRecordIndex, string ArgumentClassID, string ArgumentID, string ArgumentValue, string Effective, string SortExpression)
  107. {
  108. if (string.IsNullOrEmpty(_strUseWebservice) || _strUseWebservice.ToLower().Equals("false"))
  109. {
  110. return dal.GetList(StartRecordIndex, EndRecordIndex, ArgumentClassID, ArgumentID, ArgumentValue, Effective, SortExpression);
  111. }
  112. else
  113. {
  114. string[] aryParam = new string[7];
  115. aryParam[0] = StartRecordIndex.ToString();
  116. aryParam[1] = EndRecordIndex.ToString();
  117. aryParam[2] = ArgumentClassID;
  118. aryParam[3] = ArgumentID;
  119. aryParam[4] = ArgumentValue;
  120. aryParam[5] = Effective;
  121. aryParam[6] = SortExpression;
  122. return (DataSet)OT.BLL.Common.WebServiceHelper.InvokeWebService(_strWebserviceUrl, "WS_GetList", aryParam);
  123. }
  124. }
  125. /// <summary>
  126. /// 獲得資料總筆數
  127. /// </summary>
  128. public int GetListCount(string ArgumentClassID, string ArgumentID, string ArgumentValue, string Effective)
  129. {
  130. if (string.IsNullOrEmpty(_strUseWebservice) || _strUseWebservice.ToLower().Equals("false"))
  131. {
  132. return dal.GetListCount(ArgumentClassID, ArgumentID, ArgumentValue, Effective);
  133. }
  134. else
  135. {
  136. string[] aryParam = new string[4];
  137. aryParam[0] = ArgumentClassID;
  138. aryParam[1] = ArgumentID;
  139. aryParam[2] = ArgumentValue;
  140. aryParam[3] = Effective;
  141. return (int)OT.BLL.Common.WebServiceHelper.InvokeWebService(_strWebserviceUrl, "WS_GetListCount", aryParam);
  142. }
  143. }
  144. #endregion Method
  145. }
  146. }