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.
190 lines
6.7 KiB
190 lines
6.7 KiB
using System;
|
|
using System.Data;
|
|
using System.Configuration;
|
|
using System.Collections.Generic;
|
|
using OT.Model;
|
|
using OT.DALFactory;
|
|
using OT.IDAL;
|
|
namespace OT.BLL
|
|
{
|
|
/// <summary>
|
|
/// OTB_SYS_ProgramList
|
|
/// </summary>
|
|
public partial class OTB_SYS_ProgramList
|
|
{
|
|
private readonly IOTB_SYS_ProgramList dal = DataAccess.Create<IOTB_SYS_ProgramList>("OTB_SYS_ProgramList");
|
|
private readonly string _strUseWebservice = ConfigurationManager.AppSettings["UseWebservice"].ToString();
|
|
private readonly string _strWebserviceUrl = ConfigurationManager.AppSettings["WebserviceUrl"].ToString() + "OTB_SYS_ProgramList.asmx";
|
|
public OTB_SYS_ProgramList()
|
|
{ }
|
|
#region Method
|
|
/// <summary>
|
|
/// 是否存在該記錄
|
|
/// </summary>
|
|
public bool Exists(string ProgramID)
|
|
{
|
|
if (string.IsNullOrEmpty(_strUseWebservice) || _strUseWebservice.ToLower().Equals("false"))
|
|
{
|
|
return dal.Exists( ProgramID);
|
|
}
|
|
else
|
|
{
|
|
string[] aryParam = new string[1];
|
|
aryParam[0] = ProgramID;
|
|
return (bool)OT.BLL.Common.WebServiceHelper.InvokeWebService(_strWebserviceUrl, "WS_Exists", aryParam);
|
|
}
|
|
}
|
|
|
|
/// <summary>
|
|
/// 增加一條資料
|
|
/// </summary>
|
|
public bool Add(OT.Model.OTB_SYS_ProgramList 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);
|
|
}
|
|
}
|
|
|
|
/// <summary>
|
|
/// 更新一條資料
|
|
/// </summary>
|
|
public bool Update(OT.Model.OTB_SYS_ProgramList 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);
|
|
}
|
|
}
|
|
|
|
/// <summary>
|
|
/// 刪除一條資料
|
|
/// </summary>
|
|
public bool Delete(string ProgramID)
|
|
{
|
|
|
|
if (string.IsNullOrEmpty(_strUseWebservice) || _strUseWebservice.ToLower().Equals("false"))
|
|
{
|
|
return dal.Delete( ProgramID);
|
|
}
|
|
else
|
|
{
|
|
string[] aryParam = new string[1];
|
|
|
|
aryParam[0] = ProgramID;
|
|
|
|
return (bool)OT.BLL.Common.WebServiceHelper.InvokeWebService(_strWebserviceUrl, "WS_Delete", aryParam);
|
|
}
|
|
}
|
|
|
|
/// <summary>
|
|
/// 得到一個對象實體
|
|
/// </summary>
|
|
public OT.Model.OTB_SYS_ProgramList GetModel( string ProgramID)
|
|
{
|
|
|
|
if (string.IsNullOrEmpty(_strUseWebservice) || _strUseWebservice.ToLower().Equals("false"))
|
|
{
|
|
return dal.GetModel( ProgramID);
|
|
}
|
|
else
|
|
{
|
|
string[] aryParam = new string[1];
|
|
|
|
aryParam[0] = ProgramID;
|
|
|
|
return (OT.Model.OTB_SYS_ProgramList)Common.ObjDeserialize.Deserialize(OT.BLL.Common.WebServiceHelper.InvokeWebService(_strWebserviceUrl, "WS_GetModel", aryParam).ToString(), typeof(OT.Model.OTB_SYS_ProgramList));
|
|
}
|
|
}
|
|
|
|
//=====Create By Ted 2014/5/13=====
|
|
/// <summary>
|
|
/// 獲得資料列表
|
|
/// </summary>
|
|
public DataSet GetList(int StartRecordIndex, int EndRecordIndex, string ModuleID, string ProgramName, string Effective, string SortExpression)
|
|
{
|
|
if (string.IsNullOrEmpty(_strUseWebservice) || _strUseWebservice.ToLower().Equals("false"))
|
|
{
|
|
return dal.GetList(StartRecordIndex, EndRecordIndex, ModuleID, ProgramName, Effective, SortExpression);
|
|
}
|
|
else
|
|
{
|
|
string[] aryParam = new string[6];
|
|
aryParam[0] = StartRecordIndex.ToString();
|
|
aryParam[1] = EndRecordIndex.ToString();
|
|
aryParam[2] = ModuleID;
|
|
aryParam[3] = "%" + ProgramName + "%";
|
|
aryParam[4] = Effective;
|
|
aryParam[5] = SortExpression;
|
|
return (DataSet)OT.BLL.Common.WebServiceHelper.InvokeWebService(_strWebserviceUrl, "WS_GetList", aryParam);
|
|
}
|
|
}
|
|
|
|
/// <summary>
|
|
/// 獲得資料總筆數
|
|
/// </summary>
|
|
public int GetListCount(string ModuleID, string ProgramName, string Effective)
|
|
{
|
|
if (string.IsNullOrEmpty(_strUseWebservice) || _strUseWebservice.ToLower().Equals("false"))
|
|
{
|
|
return dal.GetListCount(ModuleID, ProgramName, Effective);
|
|
}
|
|
else
|
|
{
|
|
string[] aryParam = new string[3];
|
|
aryParam[0] = ModuleID;
|
|
aryParam[1] = ProgramName;
|
|
aryParam[2] = Effective;
|
|
return (int)OT.BLL.Common.WebServiceHelper.InvokeWebService(_strWebserviceUrl, "WS_GetListCount", aryParam);
|
|
}
|
|
}
|
|
|
|
|
|
public bool ExistsModuleID(string strModuleID)
|
|
{
|
|
if (string.IsNullOrEmpty(_strUseWebservice) || _strUseWebservice.ToLower().Equals("false"))
|
|
{
|
|
return dal.ExistsModuleID(strModuleID);
|
|
}
|
|
else
|
|
{
|
|
string[] aryParam = new string[1];
|
|
aryParam[0] = strModuleID;
|
|
|
|
return (bool)OT.BLL.Common.WebServiceHelper.InvokeWebService(_strWebserviceUrl, "WS_ExistsModuleID", aryParam);
|
|
}
|
|
}
|
|
|
|
|
|
/// <summary>
|
|
/// 獲得全部資料列表
|
|
/// </summary>
|
|
public DataSet GetAllList()
|
|
{
|
|
if (string.IsNullOrEmpty(_strUseWebservice) || _strUseWebservice.ToLower().Equals("false"))
|
|
{
|
|
return dal.GetAllList();
|
|
}
|
|
else
|
|
{
|
|
string[] aryParam = new string[0];
|
|
return (DataSet)OT.BLL.Common.WebServiceHelper.InvokeWebService(_strWebserviceUrl, "WS_GetAllList", aryParam);
|
|
}
|
|
}
|
|
|
|
#endregion Method
|
|
}
|
|
}
|
|
|