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("");
yn = false;
Response.Write("");
}
if (TextBox2.Text.Trim().Length < 60)
{
Response.Write("");
yn = false;
Response.Write("");
}
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("");
yn = false;
Response.Write("");
}
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("");
//Response.Write("");
}
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("");
}
}
}
}