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_Jobtitle /// public partial class OTB_SYS_Jobtitle { private readonly IOTB_SYS_Jobtitle dal = DataAccess.Create("OTB_SYS_Jobtitle"); private readonly string _strUseWebservice = ConfigurationManager.AppSettings["UseWebservice"].ToString(); private readonly string _strWebserviceUrl = ConfigurationManager.AppSettings["WebserviceUrl"].ToString() + "OTB_SYS_Jobtitle.asmx"; public OTB_SYS_Jobtitle() { } #region Method /// /// 是否存在該記錄 /// public bool Exists(string JobtitleID) { if (string.IsNullOrEmpty(_strUseWebservice) || _strUseWebservice.ToLower().Equals("false")) { return dal.Exists(JobtitleID); } else { string[] aryParam = new string[1]; aryParam[0] = JobtitleID; return (bool)OT.BLL.Common.WebServiceHelper.InvokeWebService(_strWebserviceUrl, "WS_Exists", aryParam); } } /// /// 是否存在該記錄在人員表中 /// public bool ExistsByMember(string JobtitleID) { if (string.IsNullOrEmpty(_strUseWebservice) || _strUseWebservice.ToLower().Equals("false")) { return dal.ExistsByMember(JobtitleID); } else { string[] aryParam = new string[1]; aryParam[0] = JobtitleID; return (bool)OT.BLL.Common.WebServiceHelper.InvokeWebService(_strWebserviceUrl, "WS_ExistsByMember", aryParam); } } /// /// 增加一條資料 /// public bool Add(OT.Model.OTB_SYS_Jobtitle 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_Jobtitle 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 JobtitleID) { if (string.IsNullOrEmpty(_strUseWebservice) || _strUseWebservice.ToLower().Equals("false")) { return dal.Delete(JobtitleID); } else { string[] aryParam = new string[1]; aryParam[0] = JobtitleID; return (bool)OT.BLL.Common.WebServiceHelper.InvokeWebService(_strWebserviceUrl, "WS_Delete", aryParam); } } /// /// 刪除一條資料 /// public bool DeleteList(string JobtitleIDlist) { return dal.DeleteList(JobtitleIDlist); } /// /// 得到一個對象實體 /// public OT.Model.OTB_SYS_Jobtitle GetModel(string JobtitleID) { if (string.IsNullOrEmpty(_strUseWebservice) || _strUseWebservice.ToLower().Equals("false")) { return dal.GetModel(JobtitleID); } else { string[] aryParam = new string[1]; aryParam[0] = JobtitleID; return (OT.Model.OTB_SYS_Jobtitle)Common.ObjDeserialize.Deserialize(OT.BLL.Common.WebServiceHelper.InvokeWebService(_strWebserviceUrl, "WS_GetModel", aryParam).ToString(), typeof(OT.Model.OTB_SYS_Jobtitle)); } } /// /// 獲得資料列表 /// public DataSet GetList(int StartRecordIndex, int EndRecordIndex, string DepartID, string JobtitleID, string JobtitleName, string Effective, string SortExpression) { if (string.IsNullOrEmpty(_strUseWebservice) || _strUseWebservice.ToLower().Equals("false")) { return dal.GetList(StartRecordIndex, EndRecordIndex, DepartID, JobtitleID, JobtitleName, Effective, SortExpression); } else { string[] aryParam = new string[7]; aryParam[0] = StartRecordIndex.ToString(); aryParam[1] = EndRecordIndex.ToString(); aryParam[2] = DepartID; aryParam[3] = JobtitleID; aryParam[4] = JobtitleName; aryParam[5] = Effective; aryParam[6] = SortExpression; return (DataSet)OT.BLL.Common.WebServiceHelper.InvokeWebService(_strWebserviceUrl, "WS_GetList", aryParam); } } /// /// 獲得資料總筆數 /// public int GetListCount(string DepartID, string JobtitleID, string JobtitleName, string Effective) { if (string.IsNullOrEmpty(_strUseWebservice) || _strUseWebservice.ToLower().Equals("false")) { return dal.GetListCount(DepartID, JobtitleID, JobtitleName, Effective); } else { string[] aryParam = new string[4]; aryParam[0] = DepartID; aryParam[1] = JobtitleID; aryParam[2] = JobtitleName; aryParam[3] = Effective; return (int)OT.BLL.Common.WebServiceHelper.InvokeWebService(_strWebserviceUrl, "WS_GetListCount", aryParam); } } #endregion Method } }