using System; using System.Collections.Generic; using System.Linq; using System.Web; using System.Web.UI; using System.Web.UI.WebControls; using WebLib; namespace Education.Forms.辦訓狀況 { public partial class 訓練效益追蹤紀錄 : FormBase { private DAC_訓練效益 Dao訓練效益; private DAC_訓練效益個人 Dao訓練效益個人; protected void Page_Load(object sender, EventArgs e) { FunctionName = "教育訓練效益追蹤調查表"; Dao訓練效益 = new DAC_訓練效益(conn); Dao訓練效益個人 = new DAC_訓練效益個人(conn); Form_View = FormView1; Grid_View = GridView1; FormView_DataSource = ds調查表Form; GridView_DataSource = ds調查表Grid; Panel1.Visible = 訓練企劃搜尋.訓練企劃編號 > 0; if (IsPostBack) { if (Panel1.Visible) { Grid_View.DataBind(); Form_View.DataBind(); } } } protected void ds已上課_ObjectCreating(object sender, ObjectDataSourceEventArgs e) { e.ObjectInstance = Dao訓練課程企劃; } protected void ds調查表Form_ObjectCreating(object sender, ObjectDataSourceEventArgs e) { e.ObjectInstance = Dao訓練效益; } protected void ds調查表Grid_ObjectCreating(object sender, ObjectDataSourceEventArgs e) { e.ObjectInstance = Dao訓練效益; } protected void ds調查表個人_ObjectCreating(object sender, ObjectDataSourceEventArgs e) { e.ObjectInstance = Dao訓練效益個人; } protected void btn查詢1_Click(object sender, EventArgs e) { ds調查表Grid.DataBind(); } protected override void FormView_ItemInserting(object sender, FormViewInsertEventArgs e) { base.FormView_ItemInserting(sender, e); e.Values.Add("訓練課程企劃編號", 訓練企劃搜尋.訓練企劃編號); } protected override void FormView_ReadOnlyDataBound(object sender, EventArgs e) { base.FormView_ReadOnlyDataBound(sender, e); if (Form_View.SelectedValue != null) { 訓練課程企劃List d = Dao訓練課程企劃.SelectOne(訓練企劃搜尋.訓練企劃編號); 送簽1.表單ID = String.Format("{0}|{1}", Form_View.DataKey[0], Form_View.DataKey[1]); 送簽1.訓練課程企劃編號 = DAC.GetInt32(Form_View.DataKey[0]); 送簽1.編號2 = DAC.GetInt32(Form_View.DataKey[1]); 送簽1.表單ID格式 = String.Format("[{0}] {1}
{2} {3} {4}", d[0].顯示編號, d[0].訓練名稱, Dao站別.GetName((Form_View.DataItem as Education.訓練效益).填表人站別), (Form_View.DataItem as Education.訓練效益).填表人, (Form_View.DataItem as Education.訓練效益).填表人職稱); // 課程企劃的承辦人可送簽 送簽1.可送簽 = d[0].承辦.CompareTo(UserId) == 0; 送簽1.Refresh(); } 送簽1.Visible = Form_View.SelectedValue != null; } protected override void FormView_InsertDataBound(object sender, EventArgs e) { base.FormView_InsertDataBound(sender, e); (Form_View.FindControl("txt填表日期") as DateTextBox).Value = DateTime.UtcNow.AddHours(8).Date; Form_View.FindControl("txt填表人").Focus(); 送簽1.Visible = false; } protected override void FormView_EditDataBound(object sender, EventArgs e) { base.FormView_EditDataBound(sender, e); Form_View.FindControl("txt填表人").Focus(); 送簽1.Visible = false; } protected string Get站別(object 填表人站別) { NameValueList data = ds站別.Select() as NameValueList; return data.GetName(填表人站別); } } }