ModifyOther.aspx.cs 5.0 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384
  1. using System;
  2. using System.Collections.Generic;
  3. using System.Linq;
  4. using System.Web;
  5. using System.Web.UI;
  6. using System.Web.UI.WebControls;
  7. using System.Data;
  8. using System.Data.OleDb;
  9. using System.Data.Sql;
  10. using System.Data.SqlClient;
  11. public partial class ModifyOther : System.Web.UI.Page
  12. {
  13. LYS.UserData1 myud = new LYS.UserData1();
  14. //int sID = 0;
  15. protected void Page_Load(object sender, EventArgs e)
  16. {
  17. //if (Session["Username"] == null)
  18. //{ Response.Redirect("LoginNew.aspx"); }
  19. TextBox1.Text = myud.ReadCookies("Username").ToString();
  20. int sID = Convert.ToInt16(Request.QueryString["ID"].ToString());
  21. string myURL = myud.GetAddressUrl().ToString();
  22. if (myURL.LastIndexOf("ID") < 0)
  23. {
  24. Response.Write("<script>alert('错误!非法调用!不能正常显示')</script>");
  25. Response.End();
  26. }
  27. if (!IsPostBack)
  28. {
  29. TextBox1.Text = myud.GetFieldValueFromFieldName("督导姓名",sID, "OthProg").ToString();
  30. ZJ.Text = Convert.ToDateTime(myud.GetFieldValueFromFieldName("督导时间", sID, "OthProg").ToString()).ToShortDateString();
  31. DD.Text = myud.GetFieldValueFromFieldName("督导地点", sID, "OthProg").ToString();
  32. XB.Text = myud.GetFieldValueFromFieldName("系部", sID, "OthProg").ToString();
  33. ZZT.Text = myud.GetFieldValueFromFieldName("督导项目名", sID, "OthProg").ToString();
  34. BJ.Text = myud.GetFieldValueFromFieldName("参与人员", sID, "OthProg").ToString();
  35. XQ.Text = myud.GetFieldValueFromFieldName("星期", sID, "OthProg").ToString();
  36. JC.Text = myud.GetFieldValueFromFieldName("节次", sID, "OthProg").ToString();
  37. PF.Text = myud.GetFieldValueFromFieldName("备注", sID, "OthProg").ToString();
  38. TextBox5.Text = myud.GetFieldValueFromFieldName("督导内容", sID, "OthProg").ToString();
  39. TextBox2.Text = myud.GetFieldValueFromFieldName("建议或结果", sID, "OthProg").ToString();
  40. FileAtt.Text = myud.GetFieldValueFromFieldName("文件附件", sID, "OthProg").ToString();
  41. Literal2.Text = "<img src=\"Upfiles\\" + myud.GetFieldValueFromFieldName("图片附件1", sID, "OthProg").ToString() + "\" width=\"150\" height=\"150\" />";
  42. Literal3.Text = "<img src=\"Upfiles\\" + myud.GetFieldValueFromFieldName("图片附件2", sID, "OthProg").ToString() + "\" width=\"150\" height=\"150\" />";
  43. }
  44. }
  45. protected void Button2_Click(object sender, EventArgs e)
  46. {
  47. Response.Redirect("DispUPlist.aspx");
  48. }
  49. protected void Button1_Click(object sender, EventArgs e)
  50. {
  51. int ID = Convert.ToInt16(Request.QueryString["ID"].ToString());
  52. if (DD.Text.Trim().Length == 0 || TextBox5.Text.Trim().Length == 0 || BJ.Text.Trim().Length == 0 || TextBox2.Text.Trim().Length == 0 || PF.Text.Trim().Length == 0)
  53. { Response.Write("<script>alert('请检内容是否填写完整!!');</script>"); }
  54. else
  55. {
  56. //string connectionString = "Provider=Microsoft.Jet.OLEDB.4.0;Data Source=" + HttpContext.Current.Server.MapPath("~\\App_Data\\ZY.mdb");
  57. //检查是否有同样sql="SELECT * FROM Pengfeng where csid="&request.Form("CSID")&" and 评价人='"&request.Form("MyName1")&"' and 评价组='"&request.Form("MyName2")&"'"
  58. //string sql = "select * from TKJL where 督导姓名='" + TextBox1.Text.Trim() + "' and 课程名='" + KM.Text.Trim() + "' and 教师姓名='" + JSXM.Text.Trim() + "' and 听课日期=#" + Convert.ToDateTime(ZJ.Text.Trim()).ToShortDateString() + "#";
  59. //string sql1 ="select * from TKJL where id=" + Convert.ToInt16(Request.QueryString["ID"].ToString());
  60. string connectionString = myud.ConnString();
  61. myud.UpdateStringFieldValue("OthProg", "督导姓名", TextBox1.Text, ID);
  62. myud.UpdateStringFieldValue("OthProg", "系部", XB.Text, ID);
  63. myud.UpdateStringFieldValue("OthProg", "督导时间", ZJ.Text, ID);
  64. myud.UpdateStringFieldValue("OthProg", "督导地点", DD.Text, ID);
  65. myud.UpdateStringFieldValue("OthProg", "督导项目名", ZZT.Text, ID);
  66. myud.UpdateStringFieldValue("OthProg", "参与人员", BJ.Text, ID);
  67. myud.UpdateStringFieldValue("OthProg", "星期", XQ.Text, ID);
  68. myud.UpdateStringFieldValue("OthProg", "节次", JC.Text, ID);
  69. myud.UpdateStringFieldValue("OthProg", "备注", PF.Text, ID);
  70. myud.UpdateStringFieldValue("OthProg", "督导内容", TextBox5.Text, ID);
  71. myud.UpdateStringFieldValue("OthProg", "建议或结果", TextBox2.Text, ID);
  72. myud.UpdateStringFieldValue("OthProg", "图片附件1", PIC1.Text, ID);
  73. myud.UpdateStringFieldValue("OthProg", "图片附件2", PIC2.Text, ID);
  74. myud.UpdateStringFieldValue("OthProg", "文件附件", FileAtt.Text, ID);
  75. Response.Write("<script>alert('修改成功!!')</script>");
  76. }
  77. }
  78. }