⭐ 欢迎来到虫虫下载站! | 📦 资源下载 📁 资源专辑 ℹ️ 关于我们
⭐ 虫虫下载站

📄 teacher_fblz.aspx.cs

📁 这是高校教师档案管理系统
💻 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_fblz : 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(3);
                prObj.GVBind(myCmd, gvList, "AJY");
            }
            else
            {
                SqlCommand myCmd = tsObj.GetSJYCmd(3, 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(3, 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();
        txtUStartEndTime.Text = ds.Tables["JYInfo"].Rows[0][2].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;
        txtAStartEndTime.Text = "";
    }
    //=============================================================
    // 事 件 名: 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 (txtAStartEndTime.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(), txtAStartEndTime.Text.Trim(), "", 3, Convert.ToInt32(ddlAName.SelectedValue), Convert.ToString(Session["Username"]), "", Convert.ToInt32(ddlAYearInfo.SelectedItem.ToString()),Convert.ToInt32(Session["UID"]));
                Response.Redirect("~/TeachStudy/Teacher_fblz.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 (txtUStartEndTime.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(), txtUStartEndTime.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 + -