611 lines
25 KiB
C#
611 lines
25 KiB
C#
using System;
|
||
using System.Collections.Generic;
|
||
using System.Web;
|
||
using System.Web.UI;
|
||
using System.Web.UI.WebControls;
|
||
using System.IO;
|
||
using WebLib;
|
||
using System.Linq;
|
||
|
||
namespace Education.Forms.基本資料
|
||
{
|
||
public partial class 講師基本資料 : FormBase
|
||
{
|
||
private bool fileOK = false;
|
||
private int 新編號;
|
||
private string 圖檔儲存路徑;
|
||
private string 授課區域;
|
||
|
||
protected string 目前講師編號;
|
||
protected string 目前講師姓名;
|
||
|
||
private bool canExport = false;
|
||
|
||
|
||
protected void Page_Load(object sender, EventArgs e)
|
||
{
|
||
FunctionName = "講師基本資料";
|
||
圖檔儲存路徑 = Server.MapPath(Education.PublicVariable.講師照片路徑);
|
||
|
||
Form_View = FormView1;
|
||
Grid_View = GridView1;
|
||
FormView_DataSource = dsForm;
|
||
GridView_DataSource = dsGrid;
|
||
|
||
AddTabButton(MultiView1, 0, btnTab1);
|
||
AddTabButton(MultiView1, 1, btnTab2);
|
||
AddTabButton(MultiView1, 2, btnTab3);
|
||
AddTabButton(MultiView1, 3, btnTab4);
|
||
|
||
RegisterPostbackTrigger(btnExport);
|
||
|
||
InitJSVar();
|
||
GetRights();
|
||
|
||
if (!IsPostBack)
|
||
{
|
||
ActivateTab(MultiView1, 0);
|
||
}
|
||
else
|
||
{
|
||
Grid_View.DataBind();
|
||
Form_View.DataBind();
|
||
gv講師外訓滿意度.DataBind();
|
||
}
|
||
}
|
||
|
||
protected void GetRights()
|
||
{
|
||
canExport = new MWEB().CheckRight(ProgramID.匯出基本資料, WRightName.Execute, UserId);
|
||
hfCanExport.Value = (canExport ? "Y" : "");
|
||
}
|
||
|
||
protected string Process授課區域(object o)
|
||
{
|
||
string[] arr = DAC.GetString(o).Split(',');
|
||
string result = "";
|
||
foreach (string s in arr)
|
||
{
|
||
if (s != null && s.Length > 0)
|
||
result += Get類別名稱("授課區域", s) + "/";
|
||
}
|
||
if (result.Length > 0)
|
||
result = result.Remove(result.Length - 1);
|
||
return result;
|
||
}
|
||
|
||
protected override void FormView_DataBinding(object sender, EventArgs e)
|
||
{
|
||
base.FormView_DataBinding(sender, e);
|
||
|
||
if (Form_View.CurrentMode == FormViewMode.Insert)
|
||
{
|
||
//AddPostbackTrigger("UpdatePanel1", Form_View.FindControl("btnSave"));
|
||
}
|
||
|
||
if (Form_View.CurrentMode == FormViewMode.Edit)
|
||
{
|
||
//AddPostbackTrigger("UpdatePanel1", Form_View.FindControl("btnSave"));
|
||
}
|
||
}
|
||
|
||
protected override void FormView_InsertDataBound(object sender, EventArgs e)
|
||
{
|
||
RegisterPostbackTrigger(Form_View.FindControl("btnSave"));
|
||
base.FormView_InsertDataBound(sender, e);
|
||
FindControl<DateTextBox>(Form_View, "txt出生日期").Value = new DateTime(1980, 1, 1);
|
||
}
|
||
|
||
protected override void FormView_ReadOnlyDataBound(object sender, EventArgs e)
|
||
{
|
||
base.FormView_ReadOnlyDataBound(sender, e);
|
||
int 編號 = 0;
|
||
Label lb編號 = FindControl<Label>(Form_View, "lb編號");
|
||
if (lb編號 != null)
|
||
編號 = DAC.GetInt32(lb編號.Text);
|
||
|
||
Image image1 = FindControl<Image>(Form_View, "Image1");
|
||
if (image1 != null)
|
||
{
|
||
string[] tmp = image1.ImageUrl.Split('?');
|
||
if (tmp.Length > 0 && !File.Exists(Server.MapPath(tmp[0])))
|
||
{
|
||
image1.ImageUrl = "~/picture/nopicture.jpg";
|
||
image1.Attributes.Remove("onclick");
|
||
image1.Style.Remove("cursor");
|
||
}
|
||
else
|
||
{
|
||
image1.Attributes.Add("onclick", GetOpenWindowJS("../Common/ShowLargePicture.aspx", "_picture", "pic",
|
||
String.Format(Education.PublicVariable.講師照片路徑 + "{0:000000}.jpg", 編號)));
|
||
image1.Style.Add("cursor", "pointer");
|
||
}
|
||
}
|
||
|
||
System.Data.DataTable 滿意度 = Dao講師.Select滿意度統計(編號);
|
||
if (Form_View.CurrentMode == FormViewMode.ReadOnly)
|
||
{
|
||
if (滿意度.Rows.Count > 0)
|
||
{
|
||
Label lb授課5分 = FindControl<Label>(Form_View, "lb授課5分");
|
||
Label lb授課4分 = FindControl<Label>(Form_View, "lb授課4分");
|
||
Label lb授課3分 = FindControl<Label>(Form_View, "lb授課3分");
|
||
Label lb授課2分 = FindControl<Label>(Form_View, "lb授課2分");
|
||
Label lb授課1分 = FindControl<Label>(Form_View, "lb授課1分");
|
||
Label lb授課總分 = FindControl<Label>(Form_View, "lb授課總分");
|
||
Label lb專業5分 = FindControl<Label>(Form_View, "lb專業5分");
|
||
Label lb專業4分 = FindControl<Label>(Form_View, "lb專業4分");
|
||
Label lb專業3分 = FindControl<Label>(Form_View, "lb專業3分");
|
||
Label lb專業2分 = FindControl<Label>(Form_View, "lb專業2分");
|
||
Label lb專業1分 = FindControl<Label>(Form_View, "lb專業1分");
|
||
Label lb專業總分 = FindControl<Label>(Form_View, "lb專業總分");
|
||
Label lb總分 = FindControl<Label>(Form_View, "lb總分");
|
||
|
||
if (lb授課5分 != null)
|
||
lb授課5分.Text = DAC.GetString(滿意度.Rows[0]["授課滿意度5"]);
|
||
if (lb授課4分 != null)
|
||
lb授課4分.Text = DAC.GetString(滿意度.Rows[0]["授課滿意度4"]);
|
||
if (lb授課3分 != null)
|
||
lb授課3分.Text = DAC.GetString(滿意度.Rows[0]["授課滿意度3"]);
|
||
if (lb授課2分 != null)
|
||
lb授課2分.Text = DAC.GetString(滿意度.Rows[0]["授課滿意度2"]);
|
||
if (lb授課1分 != null)
|
||
lb授課1分.Text = DAC.GetString(滿意度.Rows[0]["授課滿意度1"]);
|
||
if (lb授課總分 != null)
|
||
lb授課總分.Text = String.Format("{0:##0.00}", 滿意度.Rows[0]["授課滿意度總分"]);
|
||
|
||
if (lb專業5分 != null)
|
||
lb專業5分.Text = DAC.GetString(滿意度.Rows[0]["專業滿意度5"]);
|
||
if (lb專業4分 != null)
|
||
lb專業4分.Text = DAC.GetString(滿意度.Rows[0]["專業滿意度4"]);
|
||
if (lb專業3分 != null)
|
||
lb專業3分.Text = DAC.GetString(滿意度.Rows[0]["專業滿意度3"]);
|
||
if (lb專業2分 != null)
|
||
lb專業2分.Text = DAC.GetString(滿意度.Rows[0]["專業滿意度2"]);
|
||
if (lb專業1分 != null)
|
||
lb專業1分.Text = DAC.GetString(滿意度.Rows[0]["專業滿意度1"]);
|
||
if (lb專業總分 != null)
|
||
lb專業總分.Text = String.Format("{0:##0.00}", 滿意度.Rows[0]["專業滿意度總分"]);
|
||
|
||
if (lb總分 != null)
|
||
lb總分.Text = String.Format("{0:##0.00}", (DAC.GetDouble(滿意度.Rows[0]["授課滿意度總分"]) + DAC.GetDouble(滿意度.Rows[0]["專業滿意度總分"])) / 2);
|
||
}
|
||
|
||
System.Data.DataTable 講師評鑑 = Dao講師.Select講師評鑑統計(編號);
|
||
if (講師評鑑.Rows.Count > 0)
|
||
{
|
||
Label lb講師評鑑_專業度 = FindControl<Label>(Form_View, "lb講師評鑑_專業度");
|
||
Label lb講師評鑑_授課技巧 = FindControl<Label>(Form_View, "lb講師評鑑_授課技巧");
|
||
Label lb講師評鑑_互動氛圍 = FindControl<Label>(Form_View, "lb講師評鑑_互動氛圍");
|
||
Label lb講師評鑑_內容切題 = FindControl<Label>(Form_View, "lb講師評鑑_內容切題");
|
||
Label lb講師評鑑_配合度 = FindControl<Label>(Form_View, "lb講師評鑑_配合度");
|
||
Label lb講師評鑑_總分 = FindControl<Label>(Form_View, "lb講師評鑑_總分");
|
||
Label lb講師評鑑_學員滿意度 = FindControl<Label>(Form_View, "lb講師評鑑_學員滿意度");
|
||
|
||
if (lb講師評鑑_專業度 != null)
|
||
lb講師評鑑_專業度.Text = string.Format("{0:###.00}", 講師評鑑.Rows[0]["專業度"]);
|
||
if (lb講師評鑑_授課技巧 != null)
|
||
lb講師評鑑_授課技巧.Text = string.Format("{0:###.00}", 講師評鑑.Rows[0]["授課技巧"]);
|
||
if (lb講師評鑑_互動氛圍 != null)
|
||
lb講師評鑑_互動氛圍.Text = string.Format("{0:###.00}", 講師評鑑.Rows[0]["互動氛圍"]);
|
||
if (lb講師評鑑_內容切題 != null)
|
||
lb講師評鑑_內容切題.Text = string.Format("{0:###.00}", 講師評鑑.Rows[0]["內容切題"]);
|
||
if (lb講師評鑑_配合度 != null)
|
||
lb講師評鑑_配合度.Text = string.Format("{0:###.00}", 講師評鑑.Rows[0]["配合度"]);
|
||
if (lb講師評鑑_總分 != null)
|
||
lb講師評鑑_總分.Text = string.Format("{0:###.00}", 講師評鑑.Rows[0]["總分"]);
|
||
if (lb講師評鑑_學員滿意度 != null)
|
||
lb講師評鑑_學員滿意度.Text = string.Format("{0:###.00}", 講師評鑑.Rows[0]["學員滿意度"]);
|
||
}
|
||
}
|
||
RegisterPostbackTrigger(Form_View.FindControl("btnUploadPhoto"));
|
||
}
|
||
|
||
protected override void FormView_EditDataBound(object sender, EventArgs e)
|
||
{
|
||
RegisterPostbackTrigger(Form_View.FindControl("btnSave"));
|
||
base.FormView_EditDataBound(sender, e);
|
||
CheckBoxList cbl授課區域 = FindControl<CheckBoxList>(Form_View, "cbl授課區域");
|
||
|
||
List<string> 授課區域s = new List<string>(DAC.GetString((Form_View.DataItem as 講師).授課區域).Split(','));
|
||
foreach (ListItem item in cbl授課區域.Items)
|
||
{
|
||
item.Selected = 授課區域s.Contains(item.Value);
|
||
}
|
||
}
|
||
|
||
protected override void FormView_ItemInserting(object sender, FormViewInsertEventArgs e)
|
||
{
|
||
base.FormView_ItemInserting(sender, e);
|
||
Get授課區域();
|
||
}
|
||
|
||
private void Get授課區域()
|
||
{
|
||
CheckBoxList cbl授課區域 = FindControl<CheckBoxList>(Form_View, "cbl授課區域");
|
||
|
||
授課區域 = "";
|
||
foreach (ListItem item in cbl授課區域.Items)
|
||
{
|
||
if (item.Selected)
|
||
授課區域 += item.Value + ",";
|
||
}
|
||
if (授課區域.Length > 0)
|
||
授課區域 = 授課區域.Remove(授課區域.Length - 1);
|
||
}
|
||
|
||
protected override void FormView_ItemInserted(object sender, FormViewInsertedEventArgs e)
|
||
{
|
||
base.FormView_ItemInserted(sender, e);
|
||
//FileUpload fu = Form_View.FindControl("fu照片") as FileUpload;
|
||
//儲存照片與縮圖(fu, 新編號);
|
||
}
|
||
|
||
protected override void FormView_ItemUpdating(object sender, FormViewUpdateEventArgs e)
|
||
{
|
||
base.FormView_ItemUpdating(sender, e);
|
||
Get授課區域();
|
||
}
|
||
|
||
protected override void FormView_ItemUpdated(object sender, FormViewUpdatedEventArgs e)
|
||
{
|
||
base.FormView_ItemUpdated(sender, e);
|
||
//FileUpload fu = Form_View.FindControl("fu照片") as FileUpload;
|
||
//儲存照片與縮圖(fu, DAC.GetInt32(e.Keys["編號"]));
|
||
}
|
||
|
||
protected override void FormView_ItemDeleting(object sender, FormViewDeleteEventArgs e)
|
||
{
|
||
base.FormView_ItemDeleting(sender, e);
|
||
|
||
if (Dao講師.IsOccipued(DAC.GetInt32(e.Keys["編號"])))
|
||
{
|
||
e.Cancel = true;
|
||
ClientShowMessage("此講師已經選用過,不可刪除!");
|
||
}
|
||
}
|
||
|
||
protected override void FormView_ItemDeleted(object sender, FormViewDeletedEventArgs e)
|
||
{
|
||
base.FormView_ItemDeleted(sender, e);
|
||
// 刪除縮圖
|
||
string s = String.Format("{0}T_{1:000000}.jpg", 圖檔儲存路徑, e.Keys["編號"]);
|
||
if (File.Exists(s))
|
||
File.Delete(s);
|
||
}
|
||
|
||
protected override void FormView_DataSource_Inserting(object sender, ObjectDataSourceMethodEventArgs e)
|
||
{
|
||
base.FormView_DataSource_Inserting(sender, e);
|
||
(e.InputParameters["Value"] as 講師).授課區域 = 授課區域;
|
||
}
|
||
|
||
protected override void FormView_DataSource_Inserted(object sender, ObjectDataSourceStatusEventArgs e)
|
||
{
|
||
base.FormView_DataSource_Inserted(sender, e);
|
||
新編號 = (e.ReturnValue as 講師).編號;
|
||
}
|
||
|
||
protected override void FormView_DataSource_Updating(object sender, ObjectDataSourceMethodEventArgs e)
|
||
{
|
||
base.FormView_DataSource_Updating(sender, e);
|
||
(e.InputParameters["Value"] as 講師).授課區域 = 授課區域;
|
||
}
|
||
|
||
protected override void GridView_DataSource_Selected(object sender, ObjectDataSourceStatusEventArgs e)
|
||
{
|
||
base.GridView_DataSource_Selected(sender, e);
|
||
|
||
if (MultiView1.ActiveViewIndex == 0)
|
||
{
|
||
if (e.ReturnValue is 講師List list)
|
||
if (list.Count > 0)
|
||
lbMessage.Text = "";
|
||
else
|
||
lbMessage.Text = "找不到合乎條件的資料,請更改條件重新查詢。";
|
||
}
|
||
}
|
||
|
||
protected override void GridView_SelectedIndexChanged(object sender, EventArgs e)
|
||
{
|
||
base.GridView_SelectedIndexChanged(sender, e);
|
||
ActivateTab(MultiView1, 1);
|
||
}
|
||
|
||
protected void 儲存照片與縮圖(FileUpload fu, int 編號)
|
||
{
|
||
if (fileOK)
|
||
{
|
||
try
|
||
{
|
||
string tFullName = String.Format("{0}T_{1:000000}.jpg", 圖檔儲存路徑, 編號);
|
||
MemoryStream ms = PictureProcess.縮圖(fu.PostedFile.InputStream, 300, 300);
|
||
File.WriteAllBytes(tFullName, ms.ToArray());
|
||
ms.Dispose();
|
||
|
||
tFullName = String.Format("{0}{1:000000}.jpg", 圖檔儲存路徑, 編號);
|
||
ms = PictureProcess.縮圖(fu.PostedFile.InputStream, 1200, 1200);
|
||
File.WriteAllBytes(tFullName, ms.ToArray());
|
||
ms.Dispose();
|
||
}
|
||
catch
|
||
{
|
||
throw;
|
||
}
|
||
}
|
||
}
|
||
|
||
private void 檢查上傳照片()
|
||
{
|
||
// 處理上傳照片
|
||
string ext = "";
|
||
FileUpload fu = FindControl<FileUpload>(Form_View, "fu照片");
|
||
|
||
if (fu.HasFile && fu.PostedFile.ContentType.ToLower().IndexOf("image") >= 0)
|
||
{
|
||
// 檢查副檔名
|
||
ext = Path.GetExtension(fu.FileName).ToLower();
|
||
String[] allowedExt = { ".gif", ".jpeg", ".jpg", ".png" };
|
||
for (int i = 0; i < allowedExt.Length; i++)
|
||
{
|
||
if (ext == allowedExt[i])
|
||
{
|
||
fileOK = true;
|
||
}
|
||
}
|
||
|
||
// 檢查檔案大小
|
||
if (fileOK && fu.PostedFile.ContentLength < 5242880)
|
||
fileOK = true;
|
||
else
|
||
fileOK = false;
|
||
}
|
||
else
|
||
{
|
||
fileOK = false;
|
||
}
|
||
}
|
||
|
||
protected void btnSearch_Click(object sender, EventArgs e)
|
||
{
|
||
Grid_View.PageIndex = 0;
|
||
Grid_View.DataBind();
|
||
}
|
||
|
||
protected void btnClear_Click(object sender, EventArgs e)
|
||
{
|
||
lbMessage.Text = "";
|
||
txt講師姓名.Text = "";
|
||
ddl講師地區.SelectedValue = "";
|
||
ddl講師學歷.SelectedValue = "";
|
||
// txt講師滿意度1.Text = "";
|
||
// txt講師滿意度2.Text = "";
|
||
ddl合作狀態_search.SelectedValue = "";
|
||
ddl授課專長領域Search.SelectedValue = "";
|
||
ddl推薦授課主題Search.SelectedValue = "";
|
||
txt關鍵字.Text = "";
|
||
txt講師評鑑1.Text = "";
|
||
txt講師評鑑2.Text = "";
|
||
for (var i = 0; i < cbl關鍵字.Items.Count; i++)
|
||
{
|
||
cbl關鍵字.Items[i].Selected = true;
|
||
}
|
||
}
|
||
|
||
protected void btnInsert_Click(object sender, EventArgs e)
|
||
{
|
||
ActivateTab(MultiView1, 1);
|
||
Form_View.ChangeMode(FormViewMode.Insert);
|
||
}
|
||
|
||
protected void dsForm_ObjectCreating(object sender, ObjectDataSourceEventArgs e)
|
||
{
|
||
e.ObjectInstance = Dao講師;
|
||
}
|
||
|
||
protected void FormView1_ItemCommand(object sender, FormViewCommandEventArgs e)
|
||
{
|
||
if (e.CommandName == "刪除照片")
|
||
{
|
||
string fileName = String.Format("{0}T_{1:000000}.jpg", 圖檔儲存路徑, DAC.GetInt32(e.CommandArgument));
|
||
if (File.Exists(fileName))
|
||
File.Delete(fileName);
|
||
fileName = String.Format("{0}{1:000000}.jpg", 圖檔儲存路徑, DAC.GetInt32(e.CommandArgument));
|
||
if (File.Exists(fileName))
|
||
File.Delete(fileName);
|
||
|
||
Form_View.DataBind();
|
||
}
|
||
|
||
if (e.CommandName == "上傳照片")
|
||
{
|
||
FileUpload fuFile = FindControl<FileUpload>(Form_View, "fu照片");
|
||
|
||
if (fuFile.HasFile)
|
||
{
|
||
檢查上傳照片();
|
||
儲存照片與縮圖(fuFile, DAC.GetInt32(e.CommandArgument));
|
||
Form_View.DataBind();
|
||
}
|
||
}
|
||
|
||
if (e.CommandName == "Cancel")
|
||
{
|
||
if (Form_View.CurrentMode == FormViewMode.Insert)
|
||
{
|
||
ActivateTab(MultiView1, 0);
|
||
}
|
||
}
|
||
}
|
||
|
||
protected void cv授課區域_ServerValidate(object source, ServerValidateEventArgs args)
|
||
{
|
||
Get授課區域();
|
||
args.IsValid = 授課區域.Trim().Length > 0;
|
||
}
|
||
|
||
protected override void FormView_ModeChanged(object sender, EventArgs e)
|
||
{
|
||
base.FormView_ModeChanged(sender, e);
|
||
Grid_View.Visible = true;
|
||
}
|
||
|
||
protected void dsGrid_Selecting(object sender, ObjectDataSourceSelectingEventArgs e)
|
||
{
|
||
e.InputParameters["關鍵字欄位"] = Get關鍵字欄位String();
|
||
}
|
||
|
||
private string Get關鍵字欄位String()
|
||
{
|
||
var 關鍵字欄位 = new List<string>();
|
||
for (var i = 0; i < cbl關鍵字.Items.Count; i++)
|
||
{
|
||
if (cbl關鍵字.Items[i].Selected)
|
||
關鍵字欄位.Add(cbl關鍵字.Items[i].Value);
|
||
}
|
||
return string.Join("|", 關鍵字欄位.ToArray());
|
||
}
|
||
|
||
protected void btnExport_Click(object sender, EventArgs e)
|
||
{
|
||
if (!canExport)
|
||
{
|
||
return;
|
||
}
|
||
|
||
var export_columns = new List<string>();
|
||
for (var i = 0; i < cblExport.Items.Count; i++)
|
||
{
|
||
if (cblExport.Items[i].Selected)
|
||
export_columns.Add(cblExport.Items[i].Value);
|
||
}
|
||
|
||
var report = new Report.講師匯出()
|
||
{
|
||
data = Dao講師.查詢作業(true, 0, Int32.MaxValue,
|
||
txt講師姓名.Text, ddl講師地區.SelectedValue,
|
||
ddl授課專長領域Search.SelectedValue, ddl講師學歷.SelectedValue,
|
||
0, 0, ddl合作狀態_search.SelectedValue,
|
||
txt關鍵字.Text, Get關鍵字欄位String(), ddl推薦授課主題Search.SelectedValue,
|
||
DAC.GetInt32(txt講師評鑑1.Text), DAC.GetInt32(txt講師評鑑2.Text)),
|
||
export_columns = export_columns
|
||
};
|
||
MemoryStream ms = report.DoReport();
|
||
ResponseWriteStream(ms, String.Format("{0:yyyyMMdd_HHmmss}_講師資料匯出.xlsx", PublicVariable.TaiwanNow));
|
||
}
|
||
|
||
protected void btn講師評鑑查詢_Click(object sender, EventArgs e)
|
||
{
|
||
gv講師外訓滿意度.PageIndex = 0;
|
||
gv講師外訓滿意度.DataBind();
|
||
}
|
||
|
||
protected void btn講師評鑑查詢清除_Click(object sender, EventArgs e)
|
||
{
|
||
lbMessageEval.Text = "";
|
||
txt日期_1_Search.Text = "";
|
||
txt日期_2_Search.Text = "";
|
||
txt地點_Search.Text = "";
|
||
txt人數_1_Search.Text = "";
|
||
txt人數_2_Search.Text = "";
|
||
txt對象_Search.Text = "";
|
||
txt課程名稱_Search.Text = "";
|
||
|
||
gv講師外訓滿意度.PageIndex = 0;
|
||
gv講師外訓滿意度.DataBind();
|
||
}
|
||
|
||
protected void gv講師外訓滿意度_DataBound(object sender, EventArgs e)
|
||
{
|
||
if (gv講師外訓滿意度.Rows.Count == 0 && gv講師外訓滿意度.PageCount > 0)
|
||
{
|
||
gv講師外訓滿意度.PageIndex = gv講師外訓滿意度.PageCount - 1;
|
||
gv講師外訓滿意度.DataBind();
|
||
}
|
||
}
|
||
|
||
protected void ds講師外訓滿意度Grid_Selected(object sender, ObjectDataSourceStatusEventArgs e)
|
||
{
|
||
//if (MultiView1.ActiveViewIndex == 2)
|
||
//{
|
||
if (e.ReturnValue is 講師外訓滿意度List list)
|
||
{
|
||
var count = list.Count;
|
||
if (count == 0)
|
||
lbMessageEval.Text = "找不到合乎條件的資料";
|
||
else
|
||
lbMessageEval.Text = "";
|
||
|
||
|
||
double tot專業度 = 0;
|
||
double tot授課技巧 = 0;
|
||
double tot互動氛圍 = 0;
|
||
double tot內容切題 = 0;
|
||
double tot配合度 = 0;
|
||
double tot合計 = 0;
|
||
double tot學員滿意度 = 0;
|
||
|
||
foreach (var row in list)
|
||
{
|
||
tot專業度 += (double)row.專業度 ;
|
||
tot授課技巧 += (double)row.授課技巧 ;
|
||
tot互動氛圍 += (double)row.互動氛圍 ;
|
||
tot內容切題 += (double)row.內容切題 ;
|
||
tot配合度 += (double)row.配合度 ;
|
||
tot合計 += (double)row.合計 ;
|
||
tot學員滿意度 += (double)row.學員滿意度;
|
||
}
|
||
|
||
if (count > 0)
|
||
{
|
||
avg專業度 = Math.Round(tot專業度 / count, 2);
|
||
avg授課技巧 = Math.Round(tot授課技巧 / count, 2);
|
||
avg互動氛圍 = Math.Round(tot互動氛圍 / count, 2);
|
||
avg內容切題 = Math.Round(tot內容切題 / count, 2);
|
||
avg配合度 = Math.Round(tot配合度 / count, 2);
|
||
avg合計 = Math.Round(tot合計 / count, 2);
|
||
avg學員滿意度 = Math.Round(tot學員滿意度 / count, 2);
|
||
}
|
||
else
|
||
{
|
||
avg專業度 = 0;
|
||
avg授課技巧 = 0;
|
||
avg互動氛圍 = 0;
|
||
avg內容切題 = 0;
|
||
avg配合度 = 0;
|
||
avg合計 = 0;
|
||
avg學員滿意度 = 0;
|
||
}
|
||
}
|
||
//}
|
||
}
|
||
|
||
protected double avg專業度, avg授課技巧, avg互動氛圍, avg內容切題, avg配合度, avg合計, avg學員滿意度;
|
||
|
||
protected void cv身份證字號_ServerValidate(object source, ServerValidateEventArgs args)
|
||
{
|
||
var 編號 = Form_View.DataItem == null ? 0 : DAC.GetInt32((Form_View.DataItem as 講師).編號);
|
||
args.IsValid = !Dao講師.Is身份證字號Dulicate(編號, args.Value);
|
||
}
|
||
|
||
protected override void AfterChangeTab()
|
||
{
|
||
base.AfterChangeTab();
|
||
InitJSVar();
|
||
}
|
||
|
||
private void InitJSVar()
|
||
{
|
||
if (Grid_View.SelectedDataKey != null)
|
||
{
|
||
var 講師編號 = DAC.GetInt32(Grid_View.SelectedDataKey["編號"]);
|
||
var 講師姓名 = string.Empty;
|
||
var 講師 = Dao講師.SelectOne(講師編號).FirstOrDefault();
|
||
if (講師 != null) 講師姓名 = 講師.姓名;
|
||
ScriptManager.RegisterClientScriptBlock(Page, Page.GetType(), "Init",
|
||
$@"V人員類別 = '講師'; V講師編號 = 'T{講師編號:0000}'; V講師姓名 = '{講師姓名}';", true);
|
||
}
|
||
}
|
||
}
|
||
}
|