using System; using System.Data; using System.Configuration; using System.Collections.Generic; using OT.Model; using OT.DALFactory; using OT.IDAL; namespace OT.BLL { /// /// OTB_SYS_Authorize /// public partial class OTB_SYS_Authorize { private readonly IOTB_SYS_Authorize dal = DataAccess.Create("OTB_SYS_Authorize"); private readonly string _strUseWebservice = ConfigurationManager.AppSettings["UseWebservice"].ToString(); private readonly string _strWebserviceUrl = ConfigurationManager.AppSettings["WebserviceUrl"].ToString() + "OTB_SYS_Authorize.asmx"; public OTB_SYS_Authorize() { } #region Method /// /// 是否存在該記錄 /// public bool Exists( string RuleID, string ProgramID) { if (string.IsNullOrEmpty(_strUseWebservice) || _strUseWebservice.ToLower().Equals("false")) { return dal.Exists( RuleID, ProgramID); } else { string[] aryParam = new string[2]; aryParam[0] = RuleID; aryParam[1] = ProgramID; return (bool)OT.BLL.Common.WebServiceHelper.InvokeWebService(_strWebserviceUrl, "WS_Exists", aryParam); } } /// /// 增加一條資料 /// public bool Add(OT.Model.OTB_SYS_Authorize model) { if (string.IsNullOrEmpty(_strUseWebservice) || _strUseWebservice.ToLower().Equals("false")) { return dal.Add(model); } else { string[] aryParam = new string[1]; aryParam[0] = Common.ObjSerialize.Serialize(model); return (bool)OT.BLL.Common.WebServiceHelper.InvokeWebService(_strWebserviceUrl, "WS_Add", aryParam); } } /// /// 更新一條資料 /// public bool Update(OT.Model.OTB_SYS_Authorize model) { if (string.IsNullOrEmpty(_strUseWebservice) || _strUseWebservice.ToLower().Equals("false")) { return dal.Update(model); } else { string[] aryParam = new string[1]; aryParam[0] = Common.ObjSerialize.Serialize(model); return (bool)OT.BLL.Common.WebServiceHelper.InvokeWebService(_strWebserviceUrl, "WS_Update", aryParam); } } /// /// 刪除一條資料 /// public bool Delete( string RuleID, string ProgramID) { if (string.IsNullOrEmpty(_strUseWebservice) || _strUseWebservice.ToLower().Equals("false")) { return dal.Delete( RuleID, ProgramID); } else { string[] aryParam = new string[2]; aryParam[0] = RuleID; aryParam[1] = ProgramID; return (bool)OT.BLL.Common.WebServiceHelper.InvokeWebService(_strWebserviceUrl, "WS_Delete", aryParam); } } /// /// 得到一個對象實體 /// public OT.Model.OTB_SYS_Authorize GetModel( string RuleID, string ProgramID) { if (string.IsNullOrEmpty(_strUseWebservice) || _strUseWebservice.ToLower().Equals("false")) { return dal.GetModel( RuleID, ProgramID); } else { string[] aryParam = new string[2]; aryParam[0] = RuleID; aryParam[1] = ProgramID; 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)); } } /// /// 儲存權限表 /// public bool Save(OT.Model.OTB_SYS_Authorize model) { if (string.IsNullOrEmpty(_strUseWebservice) || _strUseWebservice.ToLower().Equals("false")) { return dal.Save(model); } else { string[] aryParam = new string[1]; aryParam[0] = Common.ObjSerialize.Serialize(model); return (bool)OT.BLL.Common.WebServiceHelper.InvokeWebService(_strWebserviceUrl, "WS_Save", aryParam); } } /// /// 複製權限 /// public bool GetDirectRoleByRoleSource(string strRoleSource, string strRoleDirect, string CreateUser) { if (string.IsNullOrEmpty(_strUseWebservice) || _strUseWebservice.ToLower().Equals("false")) { return dal.GetDirectRoleByRoleSource(strRoleSource, strRoleDirect, CreateUser); } else { string[] aryParam = new string[3]; aryParam[0] = strRoleSource; aryParam[1] = strRoleDirect; aryParam[2] = CreateUser; return (bool)OT.BLL.Common.WebServiceHelper.InvokeWebService(_strWebserviceUrl, "WS_GetDirectRoleByRoleSource", aryParam); } } /// /// 根據登入者判斷權限大小 /// public DataSet GetListByRuleID(string strMemberID) { if (string.IsNullOrEmpty(_strUseWebservice) || _strUseWebservice.ToLower().Equals("false")) { return dal.GetListByRuleID(strMemberID); } else { string[] aryParam = new string[1]; aryParam[0] = strMemberID; return (DataSet)OT.BLL.Common.WebServiceHelper.InvokeWebService(_strWebserviceUrl, "WS_GetListByRuleID", aryParam); } } #endregion Method } }