chore: 首次簽入 Thinkyu ASP.NET 專案
- 加入 Visual Studio / ASP.NET .gitignore - 排除建置輸出、IDE 設定、NuGet packages、大型 MSI 安裝檔
This commit is contained in:
@@ -0,0 +1,192 @@
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Linq;
|
||||
using System.Web;
|
||||
using System.Web.UI;
|
||||
using System.Web.UI.WebControls;
|
||||
using System.Data;
|
||||
using System.IO;
|
||||
using System.Text;
|
||||
using WebLib;
|
||||
|
||||
namespace Education.Forms.辦訓狀況
|
||||
{
|
||||
public partial class 年度課程執行狀況 : FormBase
|
||||
{
|
||||
protected void Page_Init(object sender, EventArgs e)
|
||||
{
|
||||
FunctionName = "年度課程執行狀況";
|
||||
txtYear.Text = DateTime.UtcNow.AddHours(8).Date.Year.ToString();
|
||||
}
|
||||
|
||||
protected void Page_Load(object sender, EventArgs e)
|
||||
{
|
||||
Grid_View = gv訓練企劃;
|
||||
GridView_DataSource = ds訓練企劃;
|
||||
|
||||
AddTabButton(MultiView1, View1, btnPage1);
|
||||
AddTabButton(MultiView1, View2, btnPage2);
|
||||
AddTabButton(MultiView1, View3, btnPage3);
|
||||
AddTabButton(MultiView1, View4, btnPage4);
|
||||
AddTabButton(MultiView1, View5, btnPage5);
|
||||
|
||||
gv訓練企劃.DataBind();
|
||||
RefreshPage();
|
||||
|
||||
RegisterPostbackTrigger(btnPrint);
|
||||
}
|
||||
|
||||
protected override void GridView_SelectedIndexChanged(object sender, EventArgs e)
|
||||
{
|
||||
base.GridView_SelectedIndexChanged(sender, e);
|
||||
RefreshPage();
|
||||
}
|
||||
|
||||
protected override void GridView_PageIndexChanged(object sender, EventArgs e)
|
||||
{
|
||||
base.GridView_PageIndexChanged(sender, e);
|
||||
RefreshPage();
|
||||
}
|
||||
|
||||
protected override void AfterChangeTab()
|
||||
{
|
||||
base.AfterChangeTab();
|
||||
RefreshPage();
|
||||
}
|
||||
|
||||
private void RefreshPage()
|
||||
{
|
||||
pnlDetail.Visible = Grid_View.SelectedValue != null;
|
||||
|
||||
if (pnlDetail.Visible)
|
||||
{
|
||||
訓練課程企劃書View1.單號 = DAC.GetString(Grid_View.SelectedValue);
|
||||
訓練課程企劃書View1.DataBind();
|
||||
gv報名學員.DataBind();
|
||||
gv課程經費.DataBind();
|
||||
訓練檢討報告View1.DataBind();
|
||||
滿意度分析View1.DataBind();
|
||||
Bind教學日誌節次();
|
||||
}
|
||||
}
|
||||
|
||||
private void Bind教學日誌節次()
|
||||
{
|
||||
int 課程企劃 = DAC.GetInt32(Grid_View.SelectedValue);
|
||||
|
||||
ddl教學日誌節次.Items.Clear();
|
||||
|
||||
if (課程企劃 > 0)
|
||||
{
|
||||
DataTable dt = new DAC_教學日誌(conn).SelectBy課程企劃(課程企劃);
|
||||
HashSet<int> seen = new HashSet<int>();
|
||||
foreach (DataRow r in dt.Rows)
|
||||
{
|
||||
int 節次 = DAC.GetInt32(r["課程序號"]);
|
||||
if (seen.Add(節次))
|
||||
ddl教學日誌節次.Items.Add(new ListItem(DAC.GetString(r["節次"]), 節次.ToString()));
|
||||
}
|
||||
}
|
||||
|
||||
if (ddl教學日誌節次.Items.Count == 0)
|
||||
ddl教學日誌節次.Items.Add(new ListItem("尚無教學日誌資料", "0"));
|
||||
|
||||
string 選擇節次 = ViewState["教學日誌節次"] as string;
|
||||
if (!String.IsNullOrEmpty(選擇節次) && ddl教學日誌節次.Items.FindByValue(選擇節次) != null)
|
||||
ddl教學日誌節次.SelectedValue = 選擇節次;
|
||||
else
|
||||
ddl教學日誌節次.SelectedIndex = 0;
|
||||
|
||||
教學日誌暨異常狀況View1.單號 = String.Format("{0}|{1}", 課程企劃, ddl教學日誌節次.SelectedValue);
|
||||
教學日誌暨異常狀況View1.DataBind();
|
||||
}
|
||||
|
||||
protected void ddl教學日誌節次_SelectedIndexChanged(object sender, EventArgs e)
|
||||
{
|
||||
ViewState["教學日誌節次"] = ddl教學日誌節次.SelectedValue;
|
||||
Bind教學日誌節次();
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// 取得該課程企劃的異常情形彙整文字
|
||||
/// </summary>
|
||||
protected string Get異常情形(object 課程企劃編號)
|
||||
{
|
||||
int id = DAC.GetInt32(課程企劃編號);
|
||||
if (id == 0) return "";
|
||||
|
||||
DAC_教學日誌 dao = new DAC_教學日誌(conn);
|
||||
DataTable dt = dao.SelectBy課程企劃(id);
|
||||
StringBuilder sb = new StringBuilder();
|
||||
foreach (DataRow row in dt.Rows)
|
||||
{
|
||||
string 有無異常 = DAC.GetString(row["有無異常事項"]);
|
||||
string 異常情形 = DAC.GetString(row["異常情形"]);
|
||||
if (有無異常 == "1" && !string.IsNullOrEmpty(異常情形))
|
||||
{
|
||||
if (sb.Length > 0) sb.Append("<hr style=\"border:none;border-top:1px dashed #ccc;margin:2px 0\">");
|
||||
sb.AppendFormat("[{0}] {1}", DAC.GetString(row["課程序號"]), 異常情形.Replace("\r\n", "<br>").Replace("\r", "<br>").Replace("\n", "<br>"));
|
||||
}
|
||||
}
|
||||
return sb.ToString();
|
||||
}
|
||||
|
||||
protected string Get支出合計()
|
||||
{
|
||||
int 支出 = 0;
|
||||
課程經費List d = ds課程經費.Select() as 課程經費List;
|
||||
foreach (課程經費 r in d)
|
||||
{
|
||||
if (r.收支 == "支")
|
||||
支出 += r.金額;
|
||||
}
|
||||
|
||||
return 支出.ToString("###,###,##0");
|
||||
}
|
||||
|
||||
protected void btnSearch_Click(object sender, EventArgs e)
|
||||
{
|
||||
gv訓練企劃.PageIndex = 0;
|
||||
gv訓練企劃.DataBind();
|
||||
RefreshPage();
|
||||
}
|
||||
|
||||
protected void btnPrint_Click(object sender, EventArgs e)
|
||||
{
|
||||
// 列印報表
|
||||
bool 包括未開課 = ddReport.SelectedValue == "2";
|
||||
DataTable reportData = Dao訓練課程企劃.Select年度課程執行狀況報表(DAC.GetString(Session[PublicVariable.CompanyId]),
|
||||
DAC.GetInt32(txtYear.Text), 包括未開課);
|
||||
|
||||
if (reportData.Rows.Count == 0)
|
||||
{
|
||||
lbMessage.Text = "沒有符合條件的資料!";
|
||||
}
|
||||
else
|
||||
{
|
||||
Report.年度課程執行狀況報表 report = new Report.年度課程執行狀況報表();
|
||||
report.data = reportData;
|
||||
report.年度 = DAC.GetInt32(txtYear.Text);
|
||||
report.公司名稱 = CompanyName;
|
||||
report.包含未開課 = 包括未開課;
|
||||
|
||||
MemoryStream ms = report.DoReport();
|
||||
|
||||
if (!包括未開課)
|
||||
ResponseWriteStream(ms, String.Format("{0}年度課程執行狀況報表.xlsx", txtYear.Text));
|
||||
else
|
||||
ResponseWriteStream(ms, String.Format("{0}年度課程報表.xlsx", txtYear.Text));
|
||||
}
|
||||
}
|
||||
|
||||
protected void ds訓練企劃_ObjectCreating(object sender, ObjectDataSourceEventArgs e)
|
||||
{
|
||||
e.ObjectInstance = Dao訓練課程企劃;
|
||||
}
|
||||
|
||||
protected void ds教學日誌_ObjectCreating(object sender, ObjectDataSourceEventArgs e)
|
||||
{
|
||||
e.ObjectInstance = new DAC_教學日誌(conn);
|
||||
}
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user