Modify.aspx.cs 4.8 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071727374757677787980818283848586878889909192939495
  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 Modify : System.Web.UI.Page
  12. {
  13. LYS.UserData1 myud = new LYS.UserData1();
  14. protected void Page_Load(object sender, EventArgs e)
  15. {
  16. //用Session保存当前页
  17. if (Session["Username"] == null)
  18. { Response.Redirect("LoginNew.aspx"); }
  19. TextBox1.Text = Session["Username"].ToString();
  20. int ID = 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.GetFieldValue(4, ID, "TKJL").ToString();
  30. ZJ.Text = Convert.ToDateTime(myud.GetFieldValue(5, ID, "TKJL").ToString()).ToShortDateString();
  31. DD.Text = myud.GetFieldValue(9, ID, "TKJL").ToString();
  32. JSXM.Text = myud.GetFieldValue(1, ID, "TKJL").ToString();
  33. XB.Text = myud.GetFieldValue(2, ID, "TKJL").ToString();
  34. KM.Text = myud.GetFieldValue(3, ID, "TKJL").ToString();
  35. BJ.Text = myud.GetFieldValue(6, ID, "TKJL").ToString();
  36. XQ.Text = myud.GetFieldValue(7, ID, "TKJL").ToString();
  37. TextBox2.Text = myud.GetFieldValue(10, ID, "TKJL").ToString();
  38. JC.Text = myud.GetFieldValue(8, ID, "TKJL").ToString();
  39. PF.Text = myud.GetFieldValue(13, ID, "TKJL").ToString();
  40. PJ.Text = myud.GetFieldValue(11, ID, "TKJL").ToString();
  41. }
  42. }
  43. protected void Button1_Click(object sender, EventArgs e)
  44. { int ID =Convert.ToInt16(Request.QueryString["ID"].ToString());
  45. if (DD.Text.Trim().Length == 0 || JSXM.Text.Trim().Length == 0 || BJ.Text.Trim().Length == 0 || KM.Text.Trim().Length == 0 || PF.Text.Trim().Length == 0)
  46. { Response.Write("<script>alert('请检查听课地点、教师姓名、授课班级、课程名称、评价分等内容是否填写完整!!');</script>"); }
  47. else
  48. {
  49. //string connectionString = "Provider=Microsoft.Jet.OLEDB.4.0;Data Source=" + HttpContext.Current.Server.MapPath("~\\App_Data\\ZY.mdb");
  50. string connectionString = myud.ConnString();
  51. //检查是否有同样sql="SELECT * FROM Pengfeng where csid="&request.Form("CSID")&" and 评价人='"&request.Form("MyName1")&"' and 评价组='"&request.Form("MyName2")&"'"
  52. string sql = "select * from TKJL where 督导姓名='" + TextBox1.Text.Trim() + "' and 课程名='" + KM.Text.Trim() + "' and 教师姓名='" + JSXM.Text.Trim() + "' and 听课日期=#" + Convert.ToDateTime(ZJ.Text.Trim()).ToShortDateString() + "#";
  53. string sql1 ="select * from TKJL where id=" + Convert.ToInt16(Request.QueryString["ID"].ToString());
  54. myud.UpdateStringFieldValue("TKJL", "教师姓名", JSXM.Text, ID);
  55. myud.UpdateStringFieldValue("TKJL", "系部", XB.Text, ID);
  56. myud.UpdateStringFieldValue("TKJL", "课程名", KM.Text, ID);
  57. myud.UpdateStringFieldValue("TKJL", "督导姓名", TextBox1.Text, ID);
  58. myud.UpdateStringFieldValue("TKJL", "听课日期", ZJ.Text, ID);
  59. myud.UpdateStringFieldValue("TKJL", "班级", BJ.Text, ID);
  60. myud.UpdateStringFieldValue("TKJL", "星期", XQ.Text, ID);
  61. myud.UpdateStringFieldValue("TKJL", "节次", JC.Text, ID);
  62. myud.UpdateStringFieldValue("TKJL", "上课地点", DD.Text, ID);
  63. myud.UpdateStringFieldValue("TKJL", "情况记录", TextBox2.Text, ID);
  64. myud.UpdateStringFieldValue("TKJL", "点评评价", PJ.Text, ID);
  65. myud.UpdateStringFieldValue("TKJL", "总评分", PF.Text, ID);
  66. Response.Write("<script>alert('修改成功!!')</script>");
  67. //ZJ.Text = Convert.ToDateTime(myud.GetFieldValue(5, ID, "TKJL").ToString()).ToShortDateString();
  68. //DD.Text = myud.GetFieldValue(9, ID, "TKJL").ToString();
  69. //JSXM.Text = myud.GetFieldValue(1, ID, "TKJL").ToString();
  70. //XB.Text = myud.GetFieldValue(2, ID, "TKJL").ToString();
  71. //KM.Text = myud.GetFieldValue(3, ID, "TKJL").ToString();
  72. //BJ.Text = myud.GetFieldValue(6, ID, "TKJL").ToString();
  73. //XQ.Text = myud.GetFieldValue(7, ID, "TKJL").ToString();
  74. //JC.Text = myud.GetFieldValue(8, ID, "TKJL").ToString();
  75. //PF.Text = myud.GetFieldValue(28, ID, "TKJL").ToString();
  76. //PJ.Text = myud.GetFieldValue(26, ID, "TKJL").ToString();
  77. }
  78. }
  79. }