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_Arguments /// public partial class OTB_SYS_Arguments { private readonly IOTB_SYS_Arguments dal = DataAccess.Create("OTB_SYS_Arguments"); private readonly string _strUseWebservice = ConfigurationManager.AppSettings["UseWebservice"].ToString(); private readonly string _strWebserviceUrl = ConfigurationManager.AppSettings["WebserviceUrl"].ToString() + "OTB_SYS_Arguments.asmx"; public OTB_SYS_Arguments() { } #region Method /// /// 是否存在該記錄 /// public bool Exists(string ArgumentClassID, string ArgumentID) { if (string.IsNullOrEmpty(_strUseWebservice) || _strUseWebservice.ToLower().Equals("false")) { return dal.Exists( ArgumentClassID, ArgumentID); } else { string[] aryParam = new string[2]; aryParam[0] = ArgumentClassID; aryParam[1] = ArgumentID; return (bool)OT.BLL.Common.WebServiceHelper.InvokeWebService(_strWebserviceUrl, "WS_Exists", aryParam); } } /// /// 增加一條資料 /// public bool Add(OT.Model.OTB_SYS_Arguments 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_Arguments 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(OT.Model.OTB_SYS_Arguments model) { if (string.IsNullOrEmpty(_strUseWebservice) || _strUseWebservice.ToLower().Equals("false")) { return dal.Delete(model); } else { string[] aryParam = new string[1]; aryParam[0] = Common.ObjSerialize.Serialize(model); return (bool)OT.BLL.Common.WebServiceHelper.InvokeWebService(_strWebserviceUrl, "WS_Delete", aryParam); } } /// /// 得到一個對象實體 /// public OT.Model.OTB_SYS_Arguments GetModel( string ArgumentClassID, string ArgumentID) { if (string.IsNullOrEmpty(_strUseWebservice) || _strUseWebservice.ToLower().Equals("false")) { return dal.GetModel( ArgumentClassID, ArgumentID); } else { string[] aryParam = new string[2]; aryParam[0] = ArgumentClassID; aryParam[1] = ArgumentID; 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)); } } /// /// 獲得資料列表 /// public DataSet GetList(int StartRecordIndex, int EndRecordIndex, string ArgumentClassID, string ArgumentID, string ArgumentValue, string Effective, string SortExpression) { if (string.IsNullOrEmpty(_strUseWebservice) || _strUseWebservice.ToLower().Equals("false")) { return dal.GetList(StartRecordIndex, EndRecordIndex, ArgumentClassID, ArgumentID, ArgumentValue, Effective, SortExpression); } else { string[] aryParam = new string[7]; aryParam[0] = StartRecordIndex.ToString(); aryParam[1] = EndRecordIndex.ToString(); aryParam[2] = ArgumentClassID; aryParam[3] = ArgumentID; aryParam[4] = ArgumentValue; aryParam[5] = Effective; aryParam[6] = SortExpression; return (DataSet)OT.BLL.Common.WebServiceHelper.InvokeWebService(_strWebserviceUrl, "WS_GetList", aryParam); } } /// /// 獲得資料總筆數 /// public int GetListCount(string ArgumentClassID, string ArgumentID, string ArgumentValue, string Effective) { if (string.IsNullOrEmpty(_strUseWebservice) || _strUseWebservice.ToLower().Equals("false")) { return dal.GetListCount(ArgumentClassID, ArgumentID, ArgumentValue, Effective); } else { string[] aryParam = new string[4]; aryParam[0] = ArgumentClassID; aryParam[1] = ArgumentID; aryParam[2] = ArgumentValue; aryParam[3] = Effective; return (int)OT.BLL.Common.WebServiceHelper.InvokeWebService(_strWebserviceUrl, "WS_GetListCount", aryParam); } } #endregion Method } }