Files
thinkyu/教育訓練系統/Web/Forms/辦訓狀況/缺席查詢.aspx.cs
T
sryang 577060bc78 chore: 首次簽入 Thinkyu ASP.NET 專案
- 加入 Visual Studio / ASP.NET .gitignore
- 排除建置輸出、IDE 設定、NuGet packages、大型 MSI 安裝檔
2026-09-10 09:42:37 +08:00

116 lines
3.7 KiB
C#
Raw Blame History

This file contains ambiguous Unicode characters
This file contains Unicode characters that might be confused with other characters. If you think that this is intentional, you can safely ignore this warning. Use the Escape button to reveal them.
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 WebLib;
namespace Education.Forms.辦訓狀況
{
public partial class 缺席查詢 : FormBase
{
protected void Page_Load(object sender, EventArgs e)
{
FunctionName = "學員缺席查詢";
if (IsPostBack)
{
gv上課紀錄.DataBind();
}
else
{
txt訓練年度_Search.Text = DateTime.UtcNow.AddHours(8).Date.ToString("yyyy");
}
}
protected void btnSearch_Click(object sender, EventArgs e)
{
gv上課紀錄.PageIndex = 0;
gv上課紀錄.DataBind();
}
protected void ds選課_ObjectCreating(object sender, ObjectDataSourceEventArgs e)
{
e.ObjectInstance = Dao課程報名;
}
private void BindListBox()
{
gv上課紀錄.Visible = false;
cbSelectAll_1.Checked = true;
cbSelectAll_2.Checked = true;
cbl訓練企劃.Items.Clear();
cbl計畫別.Items.Clear();
foreach (object o in ds訓練企劃.Select())
{
訓練課程企劃 d = o as 訓練課程企劃;
cbl訓練企劃.Items.Add(new ListItem(String.Format("[{0}] [{1:yyyy-MM-dd}] {2}", d.顯示編號, d.訓練日期, d.訓練名稱), d.編號.ToString()) { Selected = true });
}
DataTable t = new DAC_BPAA().GetBpaaWithTY(DAC.GetInt32(txt訓練年度_Search.Text) - 1911, CompanyId);
foreach (DataRow r in t.Rows)
{
cbl計畫別.Items.Add(new ListItem(DAC.GetString(r["BPPYM"]), DAC.GetString(r["BPPYN"])) { Selected = true });
}
}
protected void dsGrid_ObjectCreating(object sender, ObjectDataSourceEventArgs e)
{
e.ObjectInstance = Dao訓練課程企劃;
}
protected void LinkButton1_Click(object sender, EventArgs e)
{
BindListBox();
if (cbl訓練企劃.Items.Count > 0 || cbl計畫別.Items.Count > 0)
{
pnlStep2.Visible = true;
pnlSearch.Visible = true;
}
else
{
pnlStep2.Visible = false;
pnlSearch.Visible = false;
}
lbMessage.Text = "";
if (cbl訓練企劃.Items.Count == 0)
lbMessage.Text += "沒有合乎條件的訓練課程企劃";
if (cbl計畫別.Items.Count == 0)
lbMessage.Text += lbMessage.Text.Length == 0 ? "" : "" + "沒有合乎條件的計畫別";
}
protected void ds選課_Selecting(object sender, ObjectDataSourceSelectingEventArgs e)
{
List<string> 訓練企劃編號List = new List<string>();
List<string> 計畫年度編號List = new List<string>();
foreach (ListItem item in cbl訓練企劃.Items)
{
if (item.Selected)
訓練企劃編號List.Add(item.Value);
}
foreach (ListItem item in cbl計畫別.Items)
{
if (item.Selected)
計畫年度編號List.Add("'" + item.Value + "'");
}
e.InputParameters["公司別"] = CompanyId;
e.InputParameters["訓練企劃編號"] = 訓練企劃編號List;
e.InputParameters["計畫年度編號"] = 計畫年度編號List;
}
protected void gv上課紀錄_DataBound(object sender, EventArgs e)
{
gv上課紀錄.Visible = gv上課紀錄.Rows.Count > 0;
}
}
}