?? teacher_fblw.aspx.cs
字號:
?using System;
using System.Data;
using System.Configuration;
using System.Collections;
using System.Web;
using System.Web.Security;
using System.Web.UI;
using System.Web.UI.WebControls;
using System.Web.UI.WebControls.WebParts;
using System.Web.UI.HtmlControls;
using System.Data.SqlClient;
public partial class TeachStudy_Teacher_fblw : System.Web.UI.Page
{
PersonRecordClass prObj = new PersonRecordClass();
TeachStudyClass tsObj = new TeachStudyClass();
protected void Page_Load(object sender, EventArgs e)
{
if (!IsPostBack)
{
if ((Session["isOpen"] == null) && (Session["Admin"] == null))
{
Response.Write("<script>parent.location='../Default.aspx';</script>");
}
else
{
tabList.Visible = false;
tabAdd.Visible = false;
tabUpdate.Visible = false;
btnAddList.Visible = false;
if (Convert.ToInt32(Session["isOpen"]) == 1 || Convert.ToInt32(Session["Admin"]) == 1)
{
tabList.Visible = true;
btnAddList.Visible = true;
gvListBind();
}
else
{
tabList.Visible = true;
btnAddList.Visible = false;
gvListBind();
gvList.Columns[0].Visible = false;
gvList.Columns[1].Visible = false;
}
}
}
}
//=============================================================
// 方 法 名: gvListBind()
// 功能描述: 對GridView進行綁定,顯示教學研究(發表論文)的資料
// 輸入參數: 無
// 返 回 值: 無
// ==============================================================
public void gvListBind()
{
if ((Session["isOpen"] == null) && (Session["Admin"] == null))
{
Response.Write("<script>parent.location='../Default.aspx';</script>");
}
else
{
if (Convert.ToInt32(Session["Admin"]) == 1)
{
SqlCommand myCmd = tsObj.GetAJYCmd(2);
prObj.GVBind(myCmd, gvList, "AJY");
}
else
{
SqlCommand myCmd = tsObj.GetSJYCmd(2, Convert.ToInt32(Session["UID"]));
prObj.GVBind(myCmd, gvList, "SJY");
}
}
}
//=============================================================
// 事 件 名: gvList_RowDeleting()
// 功能描述: 對GridView中的某行進行刪除
// ==============================================================
protected void gvList_RowDeleting(object sender, GridViewDeleteEventArgs e)
{
int P_Int_id = Convert.ToInt32(gvList.DataKeys[e.RowIndex].Value);
tsObj.DeleteJYInfo(P_Int_id);
gvListBind();
}
//=============================================================
// 事 件 名: gvList_RowUpdating()
// 功能描述: 對GridView中的某行進行修改時,修改表顯示其修改內容
// ==============================================================
protected void gvList_RowUpdating(object sender, GridViewUpdateEventArgs e)
{
tabUpdate.Visible = true;
tabList.Visible = false;
tabAdd.Visible = false;
prObj.DDLBind(ddlUYearInfo);
int P_Int_id = Convert.ToInt32(gvList.DataKeys[e.RowIndex].Value);
labValue.Text = P_Int_id.ToString();
DataSet ds = tsObj.ReturnJYDs(2, P_Int_id, "JYInfo");
txtName.Text = ds.Tables["JYInfo"].Rows[0][0].ToString();
txtUName.Text = ds.Tables["JYInfo"].Rows[0][1].ToString();
txtULessonName.Text = ds.Tables["JYInfo"].Rows[0][8].ToString();
txtUAuthor.Text = ds.Tables["JYInfo"].Rows[0][5].ToString();
txtUWorker.Text = ds.Tables["JYInfo"].Rows[0][6].ToString();
txtUFroming.Text = ds.Tables["JYInfo"].Rows[0][4].ToString();
ddlUYearInfo.SelectedItem.Text = ds.Tables["JYInfo"].Rows[0][7].ToString();
}
//=============================================================
// 事 件 名: btnReset_Click()
// 功能描述: 在添加表上,單擊重置按鈕時,重新填寫教師的教學研究資料
// ==============================================================
protected void btnReset_Click(object sender, EventArgs e)
{
txtAName.Text = "";
txtALessonName.Text = "";
txtAFroming.Text = "";
txtAAuthor.Text = "";
txtAWorker.Text = "";
ddlAYearInfo.SelectedIndex = 0;
}
//=============================================================
// 事 件 名: btnAdd_Click()
// 功能描述: 在添加表上,單擊添加按鈕時,將教學研究資料添加到表tb_jiaoyan中
// ==============================================================
protected void btnAdd_Click(object sender, EventArgs e)
{
if (Session["Username"] == null)
{
Response.Write("<script>parent.location='../Default.aspx';</script>");
}
else
{
if (ddlAName.SelectedIndex == 0)
{
Response.Write("<script>alert('請選擇需要添加資料的姓名!');</script>");
}
else if (txtAName.Text.Trim() == "")
{
Response.Write("<script>alert('請填寫論文題目!');</script>");
}
else if (txtALessonName.Text.Trim() == "")
{
Response.Write("<script>alert('請填寫發表刊物!');</script>");
}
else if (txtAAuthor.Text.Trim() == "")
{
Response.Write("<script>alert('請填寫第一作者!');</script>");
}
else if (txtAWorker.Text.Trim() == "")
{
Response.Write("<script>alert('請填寫合作者!');</script>");
}
else if (txtAFroming.Text.Trim() == "")
{
Response.Write("<script>alert('請填寫年.卷.期.頁碼!');</script>");
}
else if (ddlAYearInfo.SelectedIndex == 0)
{
Response.Write("<script>alert('請選擇填寫年度!');</script>");
}
else
{
tsObj.AddJYInfo(txtAName.Text.Trim(), txtALessonName.Text.Trim(), txtAAuthor.Text.Trim(), txtAWorker.Text.Trim(), txtAFroming.Text.Trim(), "","", 2, Convert.ToInt32(ddlAName.SelectedValue), Convert.ToString(Session["Username"]), "", Convert.ToInt32(ddlAYearInfo.SelectedItem.ToString()),Convert.ToInt32(Session["UID"]));
Response.Redirect("~/TeachStudy/Teacher_fblw.aspx");
}
}
}
//=============================================================
// 事 件 名: btnAddList_Click()
// 功能描述: 當用戶單擊添加按鈕,添加表顯示
// ==============================================================
protected void btnAddList_Click(object sender, EventArgs e)
{
tabAdd.Visible = true;
tabList.Visible = false;
tabUpdate.Visible = false;
prObj.DDLBind(ddlAYearInfo);
prObj.DDLNameBind(ddlAName, "userInfo");
if ((Session["isOpen"] == null) && (Session["Admin"] == null))
{
Response.Write("<script>parent.location='../Default.aspx';</script>");
}
else
{
if (Convert.ToInt32(Session["Admin"]) == 1)
{ }
else
{
ddlAName.SelectedValue = Convert.ToString(Session["UID"]);
ddlAName.Enabled = false;
}
}
}
//=============================================================
// 事 件 名: btnUpdate_Click()
// 功能描述: 在修改表上,單擊修改按鈕時,修改教師的教學研究資料
// ==============================================================
protected void btnUpdate_Click(object sender, EventArgs e)
{
if (Session["Username"] == null)
{
Response.Write("<script>parent.location='../Default.aspx';</script>");
}
else
{
if (txtUName.Text.Trim() == "")
{
Response.Write("<script>alert('請填寫論文題目!');</script>");
}
else if (txtULessonName.Text.Trim() == "")
{
Response.Write("<script>alert('請填寫發表刊物!');</script>");
}
else if (txtUAuthor.Text.Trim() == "")
{
Response.Write("<script>alert('請填寫第一作者!');</script>");
}
else if (txtUWorker.Text.Trim() == "")
{
Response.Write("<script>alert('請填寫合作者!');</script>");
}
else if (txtUFroming.Text.Trim() == "")
{
Response.Write("<script>alert('請填寫年.卷.期.頁碼!!');</script>");
}
else
{
tsObj.UpdateJYInfo(Convert.ToInt32(labValue.Text.Trim()), txtUName.Text.Trim(), txtULessonName.Text.Trim(), txtUAuthor.Text.Trim(), txtUWorker.Text.Trim(), txtUFroming.Text.Trim(), "", "", Convert.ToString(Session["Username"]), Convert.ToInt32(ddlUYearInfo.SelectedItem.ToString()), Convert.ToInt32(Session["UID"]));
Response.Redirect("~/TeachStudy/Teacher_fblw.aspx");
}
}
}
protected void gvList_PageIndexChanging(object sender, GridViewPageEventArgs e)
{
gvList.PageIndex = e.NewPageIndex;
gvListBind();
}
}
?? 快捷鍵說明
復制代碼
Ctrl + C
搜索代碼
Ctrl + F
全屏模式
F11
切換主題
Ctrl + Shift + D
顯示快捷鍵
?
增大字號
Ctrl + =
減小字號
Ctrl + -