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_MembersToRule /// public partial class OTB_SYS_MembersToRule { private readonly IOTB_SYS_MembersToRule dal = DataAccess.Create("OTB_SYS_MembersToRule"); private readonly string _strUseWebservice = ConfigurationManager.AppSettings["UseWebservice"].ToString(); private readonly string _strWebserviceUrl = ConfigurationManager.AppSettings["WebserviceUrl"].ToString() + "OTB_SYS_MembersToRule.asmx"; public OTB_SYS_MembersToRule() { } #region Method /// /// 是否存在該記錄 /// public bool Exists(string MemberID, string RuleID) { if (string.IsNullOrEmpty(_strUseWebservice) || _strUseWebservice.ToLower().Equals("false")) { return dal.Exists( MemberID, RuleID); } else { string[] aryParam = new string[2]; aryParam[0] = MemberID; aryParam[1] = RuleID; return (bool)OT.BLL.Common.WebServiceHelper.InvokeWebService(_strWebserviceUrl, "WS_Exists", aryParam); } } /// /// 增加一條資料 /// public bool Add(OT.Model.OTB_SYS_MembersToRule 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_MembersToRule 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 MemberID, string RuleID) { if (string.IsNullOrEmpty(_strUseWebservice) || _strUseWebservice.ToLower().Equals("false")) { return dal.Delete( MemberID, RuleID); } else { string[] aryParam = new string[2]; aryParam[0] = MemberID; aryParam[1] = RuleID; return (bool)OT.BLL.Common.WebServiceHelper.InvokeWebService(_strWebserviceUrl, "WS_Delete", aryParam); } } /// /// 得到一個對象實體 /// public OT.Model.OTB_SYS_MembersToRule GetModel(string MemberID, string RuleID) { if (string.IsNullOrEmpty(_strUseWebservice) || _strUseWebservice.ToLower().Equals("false")) { return dal.GetModel( MemberID, RuleID); } else { string[] aryParam = new string[2]; aryParam[0] = MemberID; aryParam[1] = RuleID; return (OT.Model.OTB_SYS_MembersToRule)Common.ObjDeserialize.Deserialize(OT.BLL.Common.WebServiceHelper.InvokeWebService(_strWebserviceUrl, "WS_GetModel", aryParam).ToString(), typeof(OT.Model.OTB_SYS_MembersToRule)); } } #endregion Method } }