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

📄 allot.aspx.cs

📁 基于C#语言的一个企业客户管理数据库系统开发案例的源代码 ,很实用
💻 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;

public partial class allot : System.Web.UI.Page
{
    
    protected void Page_Load(object sender, EventArgs e)
    {
        if (Session["Flag"] == null)
        {
            Response.Redirect("../Login.aspx");
        }
        if (!IsPostBack)
        {
            this.Bindgv();
            this.Bindddl();
            this.Panel1.Visible = true;
            this.Panel2.Visible = false;
        }
    }
    public void Bindgv()
    {
        DataSet ds = Operation.ReDataSet("SelectRecords");
        this.gvReRecordInfo.DataSource = ds;
        this.gvReRecordInfo.DataKeyNames = new string[] { "RecordID" };
        this.gvReRecordInfo.DataBind();
    }



    protected void gvReRecordInfo_PageIndexChanging(object sender, GridViewPageEventArgs e)
    {
        this.gvReRecordInfo.PageIndex = e.NewPageIndex;
        this.Bindgv();
    }
    protected void gvReRecordInfo_RowDeleting(object sender, GridViewDeleteEventArgs e)
    {
        int ID = Convert.ToInt32(this.gvReRecordInfo.DataKeys[e.RowIndex].Value.ToString());//取得在GridWiew中选中行的id
        Operation.ExSql("DelRecords", ID);
        this.Bindgv();
    }
   
    protected void gvReRecordInfo_SelectedIndexChanging(object sender, GridViewSelectEventArgs e)
    {
        int ID = Convert.ToInt32(this.gvReRecordInfo.DataKeys[e.NewSelectedIndex].Value.ToString());
        Records Re = new Records();
        if (Operation.ReDataReader(ID, Re))
        {
            this.labID.Text =Convert.ToString(ID);
            this.labTitle.Text = Re.RecordTitle;
            this.txtContent.Text = Re.RecordDetails;
            this.labDateTime.Text = Convert.ToString(Re.CreateDate);
            this.labUserName.Text = Re.UserName;
            this.Panel2.Visible = true;
        }     
    }
    public void Bindddl()
    {
        DataSet ds = Operation.ReDataSet("SelRecords");
        this.ddlEngineer.DataSource = ds;
        this.ddlEngineer.DataTextField = "UserName";
        this.ddlEngineer.DataBind();
    }
    protected void gvReRecordInfo_RowDataBound(object sender, GridViewRowEventArgs e)
    {
        if (e.Row.RowType == DataControlRowType.DataRow)
        {
            ((LinkButton)(e.Row.Cells[5].Controls[0])).Attributes.Add("onclick", "return confirm('确定删除吗?')");
        }
    }
    protected void btnClickOK_Click(object sender, EventArgs e)
    {
        int ID = Convert.ToInt32(this.labID.Text);
        string EngineerName = this.ddlEngineer.SelectedValue.ToString();
        if (Operation.updateRecords(ID, EngineerName))
        {
            Response.Write("<script>alert('分配成功!');location='allot.aspx'</script>");
            this.Bindgv();

        }
        else
        {
            Response.Write("<script>alert('分配失败!');location='allot.aspx'</script>");
        }
    }
    protected void btnBack_Click(object sender, EventArgs e)
    {
        this.Panel1.Visible = true;
        this.Panel2.Visible = false;
    }
}

⌨️ 快捷键说明

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