chore: 首次簽入 Thinkyu ASP.NET 專案
- 加入 Visual Studio / ASP.NET .gitignore - 排除建置輸出、IDE 設定、NuGet packages、大型 MSI 安裝檔
This commit is contained in:
@@ -0,0 +1,212 @@
|
||||
//
|
||||
// 這個檔案是 數位課程 資料表的資料存取類別 檔案二
|
||||
// 您可以修改這個檔案,加入您自訂的屬性與方法
|
||||
//
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Text;
|
||||
using System.ComponentModel;
|
||||
using System.Data;
|
||||
using System.Data.Common;
|
||||
using WebLib;
|
||||
using System.Data.SqlClient;
|
||||
|
||||
namespace Education
|
||||
{
|
||||
///<summary>
|
||||
/// 數位課程 資料存取類別
|
||||
///</summary>
|
||||
public partial class DAC_數位課程 : WebLib.DAC
|
||||
{
|
||||
#region 自動產生的資料存取方法
|
||||
///<summary>
|
||||
/// 給查詢畫面用的 Select 方法
|
||||
///</summary>
|
||||
[DataObjectMethod(DataObjectMethodType.Select)]
|
||||
public 數位課程List Select(bool noInputReturnAll, string 課程名稱, string 課程類別, string 講師, string 課程簡介)
|
||||
{
|
||||
數位課程List result = new 數位課程List();
|
||||
bool noInput = true;
|
||||
IDataList list = result as IDataList;
|
||||
DbCommand cmdSelect = NewCommand();
|
||||
cmdSelect.CommandText = _select + _from + _where;
|
||||
|
||||
if (課程名稱 != null && 課程名稱.Length > 0)
|
||||
{
|
||||
noInput = false;
|
||||
cmdSelect.CommandText += " and 課程名稱 like @課程名稱 ";
|
||||
AddParam(cmdSelect, "課程名稱", 課程名稱 + "%");
|
||||
}
|
||||
|
||||
if (課程類別 != null && 課程類別.Length > 0)
|
||||
{
|
||||
noInput = false;
|
||||
cmdSelect.CommandText += " and 課程類別 like @課程類別 ";
|
||||
AddParam(cmdSelect, "課程類別", 課程類別 + "%");
|
||||
}
|
||||
|
||||
if (講師 != null && 講師.Length > 0)
|
||||
{
|
||||
noInput = false;
|
||||
cmdSelect.CommandText += " and 講師 like @講師 ";
|
||||
AddParam(cmdSelect, "講師", 講師 + "%");
|
||||
}
|
||||
|
||||
if (課程簡介 != null && 課程簡介.Length > 0)
|
||||
{
|
||||
noInput = false;
|
||||
cmdSelect.CommandText += " and 課程簡介 like @課程簡介 ";
|
||||
AddParam(cmdSelect, "課程簡介", 課程簡介 + "%");
|
||||
}
|
||||
|
||||
cmdSelect.CommandText += _order;
|
||||
|
||||
if (!noInputReturnAll && noInput)
|
||||
return result;
|
||||
|
||||
Select(cmdSelect, ref list);
|
||||
return result;
|
||||
}
|
||||
|
||||
///<summary>
|
||||
/// InsertOne 之前會執行此方法
|
||||
/// 在這裡可以做一些檢查或是自動編號等動作
|
||||
/// 回傳 false 會打斷 InsertOne 的執行
|
||||
///</summary>
|
||||
protected virtual bool BeforeInsertOne(數位課程 value)
|
||||
{
|
||||
return true;
|
||||
}
|
||||
|
||||
///<summary>
|
||||
/// InsertOne 之後會執行此方法
|
||||
///</summary>
|
||||
protected virtual void AfterInsertOne(數位課程 value)
|
||||
{
|
||||
}
|
||||
|
||||
///<summary>
|
||||
/// InsertOne 發生錯誤時會執行此方法
|
||||
///</summary>
|
||||
///<param name="handled">錯誤是否已經處理妥當</param>
|
||||
protected virtual void OnInsertOneError(Exception error, out bool handled)
|
||||
{
|
||||
handled = false;
|
||||
}
|
||||
|
||||
///<summary>
|
||||
/// UpdateOne 之前會執行此方法
|
||||
/// 在這裡可以做一些檢查
|
||||
/// 回傳 false 會打斷 UpdateOne 的執行
|
||||
///</summary>
|
||||
protected virtual bool BeforeUpdateOne(數位課程 value)
|
||||
{
|
||||
return true;
|
||||
}
|
||||
|
||||
///<summary>
|
||||
/// UpdateOne 之後會執行此方法
|
||||
///</summary>
|
||||
protected virtual void AfterUpdateOne(數位課程 value)
|
||||
{
|
||||
}
|
||||
|
||||
///<summary>
|
||||
/// UpdateOne 發生錯誤時會執行此方法
|
||||
///</summary>
|
||||
///<param name="handled">錯誤是否已經處理妥當</param>
|
||||
protected virtual void OnUpdateOneError(Exception error, out bool handled)
|
||||
{
|
||||
handled = false;
|
||||
}
|
||||
|
||||
///<summary>
|
||||
/// DeleteOne 之前會執行此方法
|
||||
/// 在這裡可以做一些檢查
|
||||
/// 回傳 false 會打斷 DeleteOne 的執行
|
||||
///</summary>
|
||||
protected virtual bool BeforeDeleteOne(數位課程 value)
|
||||
{
|
||||
return true;
|
||||
}
|
||||
|
||||
///<summary>
|
||||
/// DeleteOne 之後會執行此方法
|
||||
///</summary>
|
||||
protected virtual void AfterDeleteOne(數位課程 value)
|
||||
{
|
||||
}
|
||||
|
||||
///<summary>
|
||||
/// DeleteOne 之前會執行此方法
|
||||
/// 在這裡可以做一些檢查
|
||||
/// 回傳 false 會打斷 DeleteOne 的執行
|
||||
///</summary>
|
||||
protected virtual bool BeforeDeleteOne(int 課程編號, int DB_APPNO)
|
||||
{
|
||||
return true;
|
||||
}
|
||||
|
||||
///<summary>
|
||||
/// DeleteOne 之後會執行此方法
|
||||
///</summary>
|
||||
protected virtual void AfterDeleteOne(int 課程編號, int DB_APPNO)
|
||||
{
|
||||
}
|
||||
|
||||
///<summary>
|
||||
/// DeleteOne 發生錯誤時會執行此方法
|
||||
///</summary>
|
||||
///<param name="handled">錯誤是否已經處理妥當</param>
|
||||
protected virtual void OnDeleteOneError(Exception error, out bool handled)
|
||||
{
|
||||
handled = false;
|
||||
}
|
||||
|
||||
#endregion
|
||||
// 有另外加上去的屬性及方法,請加在這裡
|
||||
[DataObjectMethod(DataObjectMethodType.Select)]
|
||||
public 數位課程List Select可看課程(string 學員編號)
|
||||
{
|
||||
數位課程List result = new 數位課程List();
|
||||
IDataList list = result as IDataList;
|
||||
DbCommand cmdSelect = NewCommand();
|
||||
cmdSelect.CommandText = _select + _from + _where
|
||||
+ @" and 開放觀看 = 'Y'
|
||||
or exists (select 1 from 數位課程觀看紀錄 where 數位課程.課程編號 = 數位課程觀看紀錄.課程編號 and 數位課程觀看紀錄.學員編號 = @學員編號)
|
||||
order by 課程編號";
|
||||
AddParam(cmdSelect, "學員編號", 學員編號);
|
||||
Select(cmdSelect, ref list);
|
||||
return result;
|
||||
}
|
||||
|
||||
[DataObjectMethod(DataObjectMethodType.Select)]
|
||||
public 數位課程List Select非開放課程()
|
||||
{
|
||||
數位課程List result = new 數位課程List();
|
||||
IDataList list = result as IDataList;
|
||||
DbCommand cmdSelect = NewCommand();
|
||||
cmdSelect.CommandText = _select + _from + _where
|
||||
+ @" and 開放觀看 <> 'Y'
|
||||
order by 課程編號";
|
||||
Select(cmdSelect, ref list);
|
||||
return result;
|
||||
}
|
||||
}
|
||||
|
||||
///<summary>
|
||||
/// 數位課程 資料集合類別
|
||||
///</summary>
|
||||
public partial class 數位課程List : List<數位課程>
|
||||
{
|
||||
// 有另外加上去的屬性及方法,請加在這裡
|
||||
}
|
||||
|
||||
///<summary>
|
||||
/// 數位課程 資料紀錄類別
|
||||
///</summary>
|
||||
public partial class 數位課程
|
||||
{
|
||||
// 有另外加上去的屬性及方法,請加在這裡
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user