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 { protected DAC_心得報告 Dao心得報告; protected DAC_心得報告討論 Dao心得報告討論; protected int 心得報告id; protected void Page_Load(object sender, EventArgs e) { FunctionName = "課程心得報告討論"; Dao心得報告 = new DAC_心得報告(conn); Dao心得報告討論 = new DAC_心得報告討論(conn); 心得報告id = DAC.GetInt32(Request["id"]); 心得報告List d1 = Dao心得報告.SelectOne(心得報告id); if (d1.Count > 0) { lb樓主.Text = Get員工姓名(d1[0].學員編號); lb心得內容.Text = d1[0].心得.Replace("\r\n", "
").Replace("\n", "
").Replace("\r", "
").Replace(" ", " "); 訓練課程企劃List d2 = Dao訓練課程企劃.SelectOne(d1[0].訓練課程企劃編號); if (d2.Count > 0) { lb訓練課程.Text = d2[0].訓練名稱; 起訖日顯示.起日 = d2[0].訓練日期; 起訖日顯示.迄日 = d2[0].訓練日期迄; 起訖日顯示.DataBind(); } } if (IsPostBack) { dl回覆.DataBind(); } ClientScript.RegisterStartupScript(this.GetType(), "hfResponse", String.Format("var hfResponseId=\"{0}\";", hfResponse.ClientID), true); } protected void btnSave_Click(object sender, EventArgs e) { // 存檔 if (hfResponse.Value.Trim().Length == 0) { lbMessage.Text = "先說兩句再儲存好嗎?"; return; } 心得報告討論 newValue = new 心得報告討論(); newValue.心得報告編號 = 心得報告id; newValue.發表人 = UserId; newValue.發表日期 = DateTime.UtcNow.AddHours(8); newValue.內容 = hfResponse.Value.Trim(); newValue.DB_CRUSR = UserId; Dao心得報告討論.InsertOne(newValue); lbMessage.Text = "儲存成功!"; dl回覆.DataBind(); } } }