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

📄 resume_work.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 PersonRecord_Resume_Work : System.Web.UI.Page
{
    PersonRecordClass prObj = new PersonRecordClass();
    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;
                btnListAdd.Visible = false;
                if (Convert.ToInt32(Session["isOpen"]) == 1 || Convert.ToInt32(Session["Admin"]) == 1)
                {
                    tabList.Visible = true;
                    btnListAdd.Visible = true;
                    gvListBind();


                }
                else
                {
                    tabList.Visible = true;
                    btnListAdd.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 = prObj.GetARICmd(2);
                prObj.GVBind(myCmd, gvList, "AResume");
            }
            else
            {
                SqlCommand myCmd = prObj.GetSRICmd(2, Convert.ToInt32(Session["UID"]));
                prObj.GVBind(myCmd, gvList, "SResume");
            }

        }

    }
    //=============================================================
    // 事 件 名: gvList_RowDeleting()
    // 功能描述: 对GridView中的某行进行删除
    // ==============================================================
    protected void gvList_RowDeleting(object sender, GridViewDeleteEventArgs e)
    {    
        int P_Int_id = Convert.ToInt32(gvList.DataKeys[e.RowIndex].Value);
        prObj.DeleteResumeInfo(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 = prObj.ReturnRIDs(2, P_Int_id, "ResumeInfo");
        txtName.Text= ds.Tables["ResumeInfo"].Rows[0][0].ToString ();
        txtUStartEndTime.Text = ds.Tables["ResumeInfo"].Rows[0][1].ToString(); 
        txtUWorkPlace.Text = ds.Tables["ResumeInfo"].Rows[0][2].ToString();
        txtUWorking.Text = ds.Tables["ResumeInfo"].Rows[0][3].ToString ();
        txtUDegree.Text = ds.Tables["ResumeInfo"].Rows[0][4].ToString();
        ddlUYearInfo.SelectedItem.Text = ds.Tables["ResumeInfo"].Rows[0][5].ToString();
        txtUStatus.Text = ds.Tables["ResumeInfo"].Rows[0][6].ToString();

    }
    //=============================================================
    // 事 件 名: btnUpdate_Click()
    // 功能描述: 在修改表上,单击修改按钮时,修改教师的教育背景和社会实践资料
    // ==============================================================
    protected void btnUpdate_Click(object sender, EventArgs e)
    {
        if (Session["Username"] == null)
        {
            Response.Write("<script>parent.location='../Default.aspx';</script>");
        }
        else
        {
             if (txtUStartEndTime.Text.Trim() == "")
            {
                Response.Write("<script>alert('请填写起止时间!');</script>");

            }
            else if (txtUWorkPlace.Text.Trim() == "")
            {
                Response.Write("<script>alert('请填写工作单位!');</script>");

            }
            else if (txtUWorking.Text.Trim() == "")
            {
                Response.Write("<script>alert('请填写职务!');</script>");

            }
            else if(txtUStatus.Text.Trim()=="")
            {
             Response.Write("<script>alert('请填写职称!');</script>");
            }
            else if (txtUDegree.Text.Trim() == "")
            {
                Response.Write("<script>alert('请填写在各级学术机构中的任职情况!');</script>");
            }
            else
            {
                prObj.UpdateResumeInfo(Convert.ToInt32(labValue.Text.Trim()), txtUStartEndTime.Text.Trim(), txtUWorkPlace.Text.Trim(), txtUWorking.Text.Trim(), txtUDegree.Text.Trim(),txtUStatus.Text.Trim(), 2, Convert.ToString(Session["Username"]), Convert.ToInt32(ddlUYearInfo.SelectedItem.ToString()),Convert.ToInt32(Session["UID"]));
                Response.Redirect("~/PersonRecord/Resume_Work.aspx");
            }
    }
    } 
    //=============================================================
    // 事 件 名: lnkbtnAdd_Click()
    // 功能描述: 当用户单击添加按钮,添加表显示
    // ==============================================================
    protected void btnListAdd_Click(object sender, EventArgs e)
    {
        tabAdd.Visible = true;
        tabList.Visible = false;
        tabUpdate.Visible = false;
        prObj.DDLBind(ddlAYearInfo);
        prObj.DDLNameBind(ddlName, "userInfo");
        if ((Session["isOpen"] == null) && (Session["Admin"] == null))
        {
            Response.Write("<script>parent.location='../Default.aspx';</script>");
        }
        else
        {
            if (Convert.ToInt32(Session["Admin"]) == 1)
            { }
            else
            {  
                ddlName.SelectedValue = Convert.ToString(Session["UID"]);
                ddlName.Enabled = false;
              
            }
        }
    }
    //=============================================================
    // 事 件 名: btnAAdd_Click()
    // 功能描述: 在添加表上,单击添加按钮时,将教师的教育背景和社会实践资料添加到表tb_Resume中
    // ==============================================================
    protected void btnAAdd_Click(object sender, EventArgs e)
    {
        if (Session["Username"] == null)
        {
            Response.Write("<script>parent.location='../Default.aspx';</script>");
        }
        else
        {
            if (ddlName.SelectedIndex == 0)
            {
                Response.Write("<script>alert('请选择需要添加资料的姓名!');</script>");
            }
            else if (txtAStartEndTime.Text.Trim() == "")
            {
                Response.Write("<script>alert('请填写起止时间!');</script>");

            }
            else if (txtAWorkPlace.Text.Trim() == "")
            {
                Response.Write("<script>alert('请填工作单位!');</script>");

            }
            else if (txtAWorking.Text.Trim() == "")
            {
                Response.Write("<script>alert('请填写职务!');</script>");

            }
            else if (txtADegree.Text.Trim() == "")
            {
                Response.Write("<script>alert('请填写职称!');</script>");
            }
            else if (ddlAYearInfo.SelectedIndex == 0)
            {
                Response.Write("<script>alert('请选择填写年度!');</script>");
            }
            else if (txtAStatus.Text.Trim() =="")
            {
                Response.Write("<script>alert('请填写在各级学术机构中的任职情况!');</script>");
            }
            else
            {
                prObj.AddResumeInfo(txtAStartEndTime.Text.Trim(), txtAWorkPlace.Text.Trim(), txtAWorking.Text.Trim(), txtADegree.Text.Trim(), txtAStatus.Text.Trim(), 2, Convert.ToInt32(ddlName.SelectedValue.ToString()), Convert.ToString(Session["Username"]), "", Convert.ToInt32(ddlAYearInfo.SelectedItem.ToString()),Convert.ToInt32(Session["UID"]));
                Response.Redirect("~/PersonRecord/Resume_Work.aspx");
            }
        }
    }
    //=============================================================
    // 事 件 名: btnAReset_Click()
    // 功能描述: 在添加表上,单击重置按钮时,重新填写教师的教育背景和社会实践资料
    // ==============================================================
    protected void btnAReset_Click(object sender, EventArgs e)
    {

        txtAStartEndTime.Text = "";
        txtAWorkPlace.Text = "";
        txtAWorking.Text = "";
        txtAStatus.Text = "";
        txtADegree.Text = "";
        ddlAYearInfo.SelectedIndex = 0;
    }
    protected void gvList_PageIndexChanging(object sender, GridViewPageEventArgs e)
    {
        gvList.PageIndex = e.NewPageIndex;
        gvListBind();
    }
}

⌨️ 快捷键说明

复制代码 Ctrl + C
搜索代码 Ctrl + F
全屏模式 F11
切换主题 Ctrl + Shift + D
显示快捷键 ?
增大字号 Ctrl + =
减小字号 Ctrl + -