123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122 |
- using System;
- using System.Collections.Generic;
- using System.Linq;
- using System.Web;
- using System.Web.UI;
- using System.Web.UI.WebControls;
- using System.Data;
- using System.Data.OleDb;
- using System.Data.Sql;
- using System.Data.SqlClient;
- public partial class _Default : System.Web.UI.Page
- {
- // UserData myud = new UserData();
- LYS.UserData1 myud = new LYS.UserData1();
- // int id;
- string connectionString ="data source=.\\SQLEXPRESS;Integrated Security=SSPI;AttachDBFilename=|DataDirectory|\\MYDBSQL.mdf;User Instance=true";
- protected void Page_Load(object sender, EventArgs e)
- {
- string myURL = myud.GetAddressUrl();
- // int i = 0;
- if (Session["Username"] == null)
- { Response.Redirect("LoginNew.aspx"); }
- string sql = "select * from DDTreeGJK where followid=0 Order by ID";
- TextBox1.Text = Session["Username"].ToString();
- ZJ.Text = DateTime.Now.ToLongDateString().ToString();
- //Literal1.Text = myud.DispNB("", "所属类别", "Select distinct 所属类别 from PY", 10, "Left").ToString();
- //Literal1.Text = myud.ViewInCurrentSWF("Select distinct(所属类别) from PY", 1).ToString();
- if (myURL.LastIndexOf("OP") < 0)
- {
- }
- else
- {
- if (Request.QueryString["OP"].ToString() == "auto")
- {
- Literal1.Text = myud.main8(sql).ToString();
- }
- }
-
- }
-
- protected void Button2_Click(object sender, EventArgs e)
- {
- Response.Redirect("DisplayPJ.aspx");
- }
- protected void Button1_Click(object sender, EventArgs e)
- {
- Boolean yn = true;
- if (TextBox5.Text.Trim().Length < 100)
- {
- Response.Write("<script>alert('评语太简单,字数不能少于100字!!');</script>");
-
- yn = false;
- Response.Write("<script>window.history.go(-1)</script>");
- }
- if (TextBox2.Text.Trim().Length < 60)
- {
- Response.Write("<script>alert('督导情况记录字数不能少于60字!!');</script>");
-
- yn = false;
- Response.Write("<script>window.history.go(-1)</script>");
- }
-
- 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)
- {
- Response.Write("<script>alert('请检查听课地点、教师姓名、授课班级、课程名称、评价分等内容是否填写完整!!');</script>");
- yn = false;
- Response.Write("<script>window.history.go(-1)</script>");
- }
- if(yn==true)
- {
-
- //检查是否有同样sql="SELECT * FROM Pengfeng where csid="&request.Form("CSID")&" and 评价人='"&request.Form("MyName1")&"' and 评价组='"&request.Form("MyName2")&"'"
- string sql = "select * from TKJL where 督导姓名='" + TextBox1.Text.Trim() + "' and 课程名='" + KM.Text.Trim() + "' and 教师姓名='" + JSXM.Text.Trim() + "' and 听课日期='" + Convert.ToDateTime(ZJ.Text.Trim()).ToShortDateString() + "'";
- //Response.Write(Convert.ToDateTime(ZJ.Text).ToShortDateString());
- //Response.Write(sql);
- //Response.End();
- if (myud.CheckRecord(sql))
- {
- Response.Write("<script>alert('您已经评价,不能重复对同一个人同一门课程,同一个时间进行评价!');</script>");
- //Response.Write("<script>window.history.back();</script>");
- }
- else
- {
- SqlConnection objConn = new SqlConnection(connectionString);
- objConn.Open();
- SqlDataAdapter objcmd = new SqlDataAdapter();
- objcmd.SelectCommand = new SqlCommand("select * from TKJL", objConn);
- SqlCommandBuilder objtable = new SqlCommandBuilder(objcmd);
- DataSet ds = new DataSet();
- objcmd.Fill(ds, "TKJL");
- objConn.Close();
- DataTable dt = ds.Tables["TKJL"];
- DataRow dtrow = dt.NewRow();
- // dtrow[0] = DBNull.Value;
- dtrow["教师姓名"] = JSXM.Text.ToString();//老师
- dtrow["系部"] = XB.Text; //系部
- dtrow["课程名"] = KM.Text; //课程名
- dtrow["督导姓名"] = TextBox1.Text; //督导姓名
- dtrow["听课日期"] = ZJ.Text; //听课日期
- dtrow["班级"] = BJ.Text; //班级
- dtrow["星期"] = XQ.Text; //星期
- dtrow["节次"] = JC.Text; //节次
- dtrow["上课地点"] = DD.Text; //上课地点
- dtrow["情况记录"] = TextBox2.Text; //督导姓名
- dtrow["点评评价"] = TextBox5.Text;//总评分
- dtrow["总评分"] = PF.Text;//总评分
- dt.Rows.Add(dtrow);
- objcmd.Update(ds, "TKJL");
- Response.Write("<script>alert('评价成功!')</script>");
- }
- }
- }
- }
|