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.

171 lines
6.0 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_Authorize
  12. /// </summary>
  13. public partial class OTB_SYS_Authorize
  14. {
  15. private readonly IOTB_SYS_Authorize dal = DataAccess.Create<IOTB_SYS_Authorize>("OTB_SYS_Authorize");
  16. private readonly string _strUseWebservice = ConfigurationManager.AppSettings["UseWebservice"].ToString();
  17. private readonly string _strWebserviceUrl = ConfigurationManager.AppSettings["WebserviceUrl"].ToString() + "OTB_SYS_Authorize.asmx";
  18. public OTB_SYS_Authorize()
  19. { }
  20. #region Method
  21. /// <summary>
  22. /// 是否存在該記錄
  23. /// </summary>
  24. public bool Exists( string RuleID, string ProgramID)
  25. {
  26. if (string.IsNullOrEmpty(_strUseWebservice) || _strUseWebservice.ToLower().Equals("false"))
  27. {
  28. return dal.Exists( RuleID, ProgramID);
  29. }
  30. else
  31. {
  32. string[] aryParam = new string[2];
  33. aryParam[0] = RuleID;
  34. aryParam[1] = ProgramID;
  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_Authorize 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_Authorize 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( string RuleID, string ProgramID)
  74. {
  75. if (string.IsNullOrEmpty(_strUseWebservice) || _strUseWebservice.ToLower().Equals("false"))
  76. {
  77. return dal.Delete( RuleID, ProgramID);
  78. }
  79. else
  80. {
  81. string[] aryParam = new string[2];
  82. aryParam[0] = RuleID;
  83. aryParam[1] = ProgramID;
  84. return (bool)OT.BLL.Common.WebServiceHelper.InvokeWebService(_strWebserviceUrl, "WS_Delete", aryParam);
  85. }
  86. }
  87. /// <summary>
  88. /// 得到一個對象實體
  89. /// </summary>
  90. public OT.Model.OTB_SYS_Authorize GetModel( string RuleID, string ProgramID)
  91. {
  92. if (string.IsNullOrEmpty(_strUseWebservice) || _strUseWebservice.ToLower().Equals("false"))
  93. {
  94. return dal.GetModel( RuleID, ProgramID);
  95. }
  96. else
  97. {
  98. string[] aryParam = new string[2];
  99. aryParam[0] = RuleID;
  100. aryParam[1] = ProgramID;
  101. return (OT.Model.OTB_SYS_Authorize)Common.ObjDeserialize.Deserialize(OT.BLL.Common.WebServiceHelper.InvokeWebService(_strWebserviceUrl, "WS_GetModel", aryParam).ToString(), typeof(OT.Model.OTB_SYS_Authorize));
  102. }
  103. }
  104. /// <summary>
  105. /// 儲存權限表
  106. /// </summary>
  107. public bool Save(OT.Model.OTB_SYS_Authorize model)
  108. {
  109. if (string.IsNullOrEmpty(_strUseWebservice) || _strUseWebservice.ToLower().Equals("false"))
  110. {
  111. return dal.Save(model);
  112. }
  113. else
  114. {
  115. string[] aryParam = new string[1];
  116. aryParam[0] = Common.ObjSerialize.Serialize(model);
  117. return (bool)OT.BLL.Common.WebServiceHelper.InvokeWebService(_strWebserviceUrl, "WS_Save", aryParam);
  118. }
  119. }
  120. /// <summary>
  121. /// 複製權限
  122. /// </summary>
  123. public bool GetDirectRoleByRoleSource(string strRoleSource, string strRoleDirect, string CreateUser)
  124. {
  125. if (string.IsNullOrEmpty(_strUseWebservice) || _strUseWebservice.ToLower().Equals("false"))
  126. {
  127. return dal.GetDirectRoleByRoleSource(strRoleSource, strRoleDirect, CreateUser);
  128. }
  129. else
  130. {
  131. string[] aryParam = new string[3];
  132. aryParam[0] = strRoleSource;
  133. aryParam[1] = strRoleDirect;
  134. aryParam[2] = CreateUser;
  135. return (bool)OT.BLL.Common.WebServiceHelper.InvokeWebService(_strWebserviceUrl, "WS_GetDirectRoleByRoleSource", aryParam);
  136. }
  137. }
  138. /// <summary>
  139. /// 根據登入者判斷權限大小
  140. /// </summary>
  141. public DataSet GetListByRuleID(string strMemberID)
  142. {
  143. if (string.IsNullOrEmpty(_strUseWebservice) || _strUseWebservice.ToLower().Equals("false"))
  144. {
  145. return dal.GetListByRuleID(strMemberID);
  146. }
  147. else
  148. {
  149. string[] aryParam = new string[1];
  150. aryParam[0] = strMemberID;
  151. return (DataSet)OT.BLL.Common.WebServiceHelper.InvokeWebService(_strWebserviceUrl, "WS_GetListByRuleID", aryParam);
  152. }
  153. }
  154. #endregion Method
  155. }
  156. }