215 lines
7.5 KiB
C#
215 lines
7.5 KiB
C#
//
|
|
// 這個檔案是 滿意度調查 資料表的資料存取類別 檔案二
|
|
// 您可以修改這個檔案,加入您自訂的屬性與方法
|
|
//
|
|
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>
|
|
/// 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 訓練課程企劃編號, string 學員編號, int 課程序號, int 題目編號, int DB_APPNO)
|
|
{
|
|
return true;
|
|
}
|
|
|
|
///<summary>
|
|
/// DeleteOne 之後會執行此方法
|
|
///</summary>
|
|
protected virtual void AfterDeleteOne(int 訓練課程企劃編號, string 學員編號, int 課程序號, int 題目編號, int DB_APPNO)
|
|
{
|
|
}
|
|
|
|
///<summary>
|
|
/// DeleteOne 發生錯誤時會執行此方法
|
|
///</summary>
|
|
///<param name="handled">錯誤是否已經處理妥當</param>
|
|
protected virtual void OnDeleteOneError(Exception error, out bool handled)
|
|
{
|
|
handled = false;
|
|
}
|
|
|
|
#endregion
|
|
// 有另外加上去的屬性及方法,請加在這裡
|
|
public void Update(int 訓練課程企劃編號, string 學員編號, int 課程序號, int 題目編號, int 分數, string UserId)
|
|
{
|
|
滿意度調查List d = SelectOne(訓練課程企劃編號, 學員編號, 課程序號, 題目編號);
|
|
if (d.Count == 0)
|
|
{
|
|
滿意度調查 newValue = new 滿意度調查();
|
|
newValue.訓練課程企劃編號 = 訓練課程企劃編號;
|
|
newValue.學員編號 = 學員編號;
|
|
newValue.課程序號 = 課程序號;
|
|
newValue.題目編號 = 題目編號;
|
|
newValue.分數 = 分數;
|
|
newValue.DB_CRUSR = UserId;
|
|
InsertOne(newValue);
|
|
}
|
|
else
|
|
{
|
|
d[0].分數 = 分數;
|
|
d[0].DB_TRUSR = UserId;
|
|
UpdateOne(d[0]);
|
|
}
|
|
}
|
|
|
|
[DataObjectMethod(DataObjectMethodType.Select)]
|
|
public 滿意度調查List Select(int 訓練課程企劃編號)
|
|
{
|
|
滿意度調查List result = new 滿意度調查List();
|
|
IDataList list = result as IDataList;
|
|
DbCommand cmdSelect = NewCommand();
|
|
cmdSelect.CommandText = _select + _from + _where
|
|
+ " and 訓練課程企劃編號 = @訓練課程企劃編號 "
|
|
;
|
|
AddParam(cmdSelect, "訓練課程企劃編號", 訓練課程企劃編號);
|
|
Select(cmdSelect, ref list);
|
|
return result;
|
|
}
|
|
|
|
[DataObjectMethod(DataObjectMethodType.Select)]
|
|
public 滿意度調查List Select(int 訓練課程企劃編號, string 學員編號)
|
|
{
|
|
滿意度調查List result = new 滿意度調查List();
|
|
IDataList list = result as IDataList;
|
|
DbCommand cmdSelect = NewCommand();
|
|
cmdSelect.CommandText = _select + _from + _where
|
|
+ " and 訓練課程企劃編號 = @訓練課程企劃編號 "
|
|
+ " and 學員編號 = @學員編號 "
|
|
;
|
|
AddParam(cmdSelect, "訓練課程企劃編號", 訓練課程企劃編號);
|
|
AddParam(cmdSelect, "學員編號", 學員編號);
|
|
Select(cmdSelect, ref list);
|
|
return result;
|
|
}
|
|
|
|
[DataObjectMethod(DataObjectMethodType.Select)]
|
|
public void Delete(int 訓練課程企劃編號, string 學員編號)
|
|
{
|
|
DbCommand cmdDelete = NewCommand();
|
|
cmdDelete.CommandText = "delete from " + _tableName
|
|
+ " where 訓練課程企劃編號 = @訓練課程企劃編號 "
|
|
+ " and 學員編號 = @學員編號 "
|
|
;
|
|
AddParam(cmdDelete, "訓練課程企劃編號", 訓練課程企劃編號);
|
|
AddParam(cmdDelete, "學員編號", 學員編號);
|
|
ExecuteNonQuery(cmdDelete);
|
|
}
|
|
|
|
[DataObjectMethod(DataObjectMethodType.Select)]
|
|
public DataTable Select滿意度分析(int 訓練課程企劃編號, int 課程序號)
|
|
{
|
|
DbCommand cmdSelect = NewCommand();
|
|
cmdSelect.CommandText = "select * from 滿意度分析View "
|
|
+ " where 訓練課程企劃編號 = @訓練課程企劃編號 "
|
|
+ " and 課程序號 = @課程序號 "
|
|
;
|
|
AddParam(cmdSelect, "訓練課程企劃編號", 訓練課程企劃編號);
|
|
AddParam(cmdSelect, "課程序號", 課程序號);
|
|
return Select(cmdSelect);
|
|
}
|
|
|
|
}
|
|
|
|
///<summary>
|
|
/// 滿意度調查 資料集合類別
|
|
///</summary>
|
|
public partial class 滿意度調查List : List<滿意度調查>
|
|
{
|
|
// 有另外加上去的屬性及方法,請加在這裡
|
|
}
|
|
|
|
///<summary>
|
|
/// 滿意度調查 資料紀錄類別
|
|
///</summary>
|
|
public partial class 滿意度調查
|
|
{
|
|
// 有另外加上去的屬性及方法,請加在這裡
|
|
}
|
|
}
|