|
|
using System; using System.Data; using System.Web; using System.Configuration; using System.Collections.Generic; using OT.Model; using OT.DALFactory; using OT.IDAL; namespace OT.BLL { /// <summary>
/// OTB_SYS_Attachments
/// </summary>
public partial class OTB_SYS_Attachments { private readonly IOTB_SYS_Attachments dal = DataAccess.Create<IOTB_SYS_Attachments>("OTB_SYS_Attachments"); private readonly string _strUseWebservice = ConfigurationManager.AppSettings["UseWebservice"].ToString(); private readonly string _strWebserviceUrl = ConfigurationManager.AppSettings["WebserviceUrl"].ToString() + "OTB_SYS_Attachments.asmx"; public OTB_SYS_Attachments() { } #region Method
/// <summary>
/// 是否存在該記錄
/// </summary>
public bool Exists(string TargetRelationID) { if (string.IsNullOrEmpty(_strUseWebservice) || _strUseWebservice.ToLower().Equals("false")) { return dal.Exists(TargetRelationID); } else { string[] aryParam = new string[1]; aryParam[0] = TargetRelationID; return (bool)OT.BLL.Common.WebServiceHelper.InvokeWebService(_strWebserviceUrl, "WS_Exists", aryParam); } }
/// <summary>
/// 增加一條資料
/// </summary>
public bool Add(OT.Model.OTB_SYS_Attachments 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_Attachments 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 TargetRelationID) {
if (string.IsNullOrEmpty(_strUseWebservice) || _strUseWebservice.ToLower().Equals("false")) { List<OT.Model.OTB_SYS_Attachments> List = dal.GetModelListBySourceRelationID(TargetRelationID); foreach (OT.Model.OTB_SYS_Attachments o_SYS_Attachments_Model in List) { string strFileFullName = o_SYS_Attachments_Model.FilePath; if (System.IO.File.Exists(HttpContext.Current.Server.MapPath(strFileFullName))) { System.IO.File.Delete(HttpContext.Current.Server.MapPath(strFileFullName)); }
}
return dal.Delete(TargetRelationID); } else { string[] aryParam = new string[1]; aryParam[0] = TargetRelationID; return (bool)OT.BLL.Common.WebServiceHelper.InvokeWebService(_strWebserviceUrl, "WS_Delete", aryParam); } } /// <summary>
/// 刪除一條資料
/// </summary>
public bool DeleteList(string TargetRelationIDlist) { if (string.IsNullOrEmpty(_strUseWebservice) || _strUseWebservice.ToLower().Equals("false")) { return dal.DeleteList(TargetRelationIDlist); } else { string[] aryParam = new string[1]; aryParam[0] = TargetRelationIDlist; return (bool)OT.BLL.Common.WebServiceHelper.InvokeWebService(_strWebserviceUrl, "WS_DeleteList", aryParam); } }
/// <summary>
/// 得到一個對象實體
/// </summary>
public OT.Model.OTB_SYS_Attachments GetModel(string TargetRelationID) {
if (string.IsNullOrEmpty(_strUseWebservice) || _strUseWebservice.ToLower().Equals("false")) { return dal.GetModel(TargetRelationID); } else { string[] aryParam = new string[1]; aryParam[0] = TargetRelationID; return (OT.Model.OTB_SYS_Attachments)Common.ObjDeserialize.Deserialize(OT.BLL.Common.WebServiceHelper.InvokeWebService(_strWebserviceUrl, "WS_GetModel", aryParam).ToString(), typeof(OT.Model.OTB_SYS_Attachments)); } }
#endregion Method
/// <summary>
/// 得到一個對象實體集合
/// </summary>
public List<OT.Model.OTB_SYS_Attachments> GetModelListBySourceRelationID(string SourceRelationID) { if (string.IsNullOrEmpty(_strUseWebservice) || _strUseWebservice.ToLower().Equals("false")) { return dal.GetModelListBySourceRelationID(SourceRelationID); } else { string[] aryParam = new string[1]; aryParam[0] = SourceRelationID; return (List<OT.Model.OTB_SYS_Attachments>)Common.ObjDeserialize.Deserialize(OT.BLL.Common.WebServiceHelper.InvokeWebService(_strWebserviceUrl, "WS_GetModelListBySourceRelationID", aryParam).ToString(), typeof(List<OT.Model.OTB_SYS_Attachments>)); } } /// <summary>
/// 獲得資料列表
/// </summary>
public DataSet GetList(int StartRecordIndex, int EndRecordIndex, string SourceRelationID, string SortExpression) { if (string.IsNullOrEmpty(_strUseWebservice) || _strUseWebservice.ToLower().Equals("false")) { return dal.GetList(StartRecordIndex, EndRecordIndex, SourceRelationID, SortExpression); } else { string[] aryParam = new string[4]; aryParam[0] = StartRecordIndex.ToString(); aryParam[1] = EndRecordIndex.ToString(); aryParam[2] = SourceRelationID; aryParam[3] = SortExpression; return (DataSet)OT.BLL.Common.WebServiceHelper.InvokeWebService(_strWebserviceUrl, "WS_GetList", aryParam); } }
/// <summary>
/// 獲得資料總筆數
/// </summary>
public int GetListCount(string SourceRelationID) { if (string.IsNullOrEmpty(_strUseWebservice) || _strUseWebservice.ToLower().Equals("false")) { return dal.GetListCount(SourceRelationID); } else { string[] aryParam = new string[1]; aryParam[0] = SourceRelationID; return (int)OT.BLL.Common.WebServiceHelper.InvokeWebService(_strWebserviceUrl, "WS_GetListCount", aryParam); } }
/// <summary>
/// 獲取園區地圖圖示名稱和坐標列表
/// </summary>
public DataSet GetPlaceImgFileNameList() { if (string.IsNullOrEmpty(_strUseWebservice) || _strUseWebservice.ToLower().Equals("false")) { return dal.GetPlaceImgFileNameList(); } else { string[] aryParam = new string[0]; return (DataSet)OT.BLL.Common.WebServiceHelper.InvokeWebService(_strWebserviceUrl, "WS_GetPlaceImgFileNameList", aryParam); } }
/// <summary>
/// 更新類別欄位
/// </summary>
public bool UpdateFileType(string TargetRelationID, string FileType, string ModifyUser) { if (string.IsNullOrEmpty(_strUseWebservice) || _strUseWebservice.ToLower().Equals("false")) { return dal.UpdateFileType(TargetRelationID, FileType, ModifyUser); } else { string[] aryParam = new string[3]; aryParam[0] = TargetRelationID; aryParam[1] = FileType; aryParam[2] = ModifyUser; return (bool)OT.BLL.Common.WebServiceHelper.InvokeWebService(_strWebserviceUrl, "WS_UpdateFileType", aryParam); } }
/// <summary>
/// 更新對內公開欄位
/// </summary>
public bool UpdateIsProtected(string TargetRelationID, string IsProtected, string ModifyUser) { if (string.IsNullOrEmpty(_strUseWebservice) || _strUseWebservice.ToLower().Equals("false")) { return dal.UpdateIsProtected(TargetRelationID, IsProtected, ModifyUser); } else { string[] aryParam = new string[3]; aryParam[0] = TargetRelationID; aryParam[1] = IsProtected; aryParam[2] = ModifyUser; return (bool)OT.BLL.Common.WebServiceHelper.InvokeWebService(_strWebserviceUrl, "WS_UpdateIsProtected", aryParam); } }
/// <summary>
/// 更新對外公開欄位
/// </summary>
public bool UpdateIsPublic(string TargetRelationID, string IsPublic, string ModifyUser) { if (string.IsNullOrEmpty(_strUseWebservice) || _strUseWebservice.ToLower().Equals("false")) { return dal.UpdateIsPublic(TargetRelationID, IsPublic, ModifyUser); } else { string[] aryParam = new string[3]; aryParam[0] = TargetRelationID; aryParam[1] = IsPublic; aryParam[2] = ModifyUser; return (bool)OT.BLL.Common.WebServiceHelper.InvokeWebService(_strWebserviceUrl, "WS_UpdateIsPublic", aryParam); } }
/// <summary>
/// 更新對外公開欄位
/// </summary>
public bool UpdateIsTitlePage(string TargetRelationID, string IsTitlePage, string ModifyUser) { if (string.IsNullOrEmpty(_strUseWebservice) || _strUseWebservice.ToLower().Equals("false")) { return dal.UpdateIsTitlePage(TargetRelationID, IsTitlePage, ModifyUser); } else { string[] aryParam = new string[3]; aryParam[0] = TargetRelationID; aryParam[1] = IsTitlePage; aryParam[2] = ModifyUser; return (bool)OT.BLL.Common.WebServiceHelper.InvokeWebService(_strWebserviceUrl, "WS_UpdateIsTitlePage", aryParam); } }
public bool ChangeMemo(string strFileGuid, string strFileMemo, string ModifyUser) { if (string.IsNullOrEmpty(_strUseWebservice) || _strUseWebservice.ToLower().Equals("false")) { return dal.ChangeMemo(strFileGuid, strFileMemo, ModifyUser); } else { string[] aryParam = new string[3]; aryParam[0] = strFileGuid; aryParam[1] = strFileMemo; aryParam[2] = ModifyUser; return (bool)OT.BLL.Common.WebServiceHelper.InvokeWebService(_strWebserviceUrl, "WS_ChangeMemo", aryParam); } } } }
|