using System; using System.Collections.Generic; using System.Linq; using System.Web; using System.Web.UI; using System.Web.UI.WebControls; using System.ComponentModel; namespace Education.Forms.辦訓狀況 { public partial class UC出席狀況 : System.Web.UI.UserControl { protected void Page_Load(object sender, EventArgs e) { } [Bindable(true)] private string _學員編號; public string 學員編號 { get { return _學員編號; } set { ds出席.SelectParameters["學員編號"].DefaultValue = value; _學員編號 = value; } } [Bindable(true)] private int _訓練課程編號; public int 訓練課程編號 { get { return _訓練課程編號; } set { ds出席.SelectParameters["訓練課程編號"].DefaultValue = value.ToString(); _訓練課程編號 = value; } } protected string Get出席狀況Text(string 出席狀況) { switch (出席狀況) { case "Y": return "出席"; case "N": return "缺席"; case "L": return "請假"; default: return ""; } } protected System.Drawing.Color Get出席狀況Color(string 出席狀況) { switch (出席狀況) { case "Y": return System.Drawing.Color.Green; case "N": return System.Drawing.Color.Red; case "L": return System.Drawing.Color.Magenta; default: return System.Drawing.Color.Black; } } protected void ds出席_Selected(object sender, ObjectDataSourceStatusEventArgs e) { lb未填寫.Visible = false; if (e.ReturnValue is 學員出席List list && list.Count == 0) { lb未填寫.Visible = true; } } } }