meetingfind.aspx.cs

来自「会议室管理系统,本系统是我大学毕业时候的毕业设计,一次通过的!」· CS 代码 · 共 108 行

CS
108
字号
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 meetingfind : System.Web.UI.Page
{
    SqlConnection cn;
    DataSet ds = new DataSet();

    protected void Page_Load(object sender, EventArgs e)
    {
    }
    public static string pagecount;
    private void databindfindmeetinginfo()
    {
        int countpage = Convert.ToInt32(this.Labelye.Text);
        cn = new SqlConnection(System.Configuration.ConfigurationManager.AppSettings["cn"]);
        cn.Open();
        SqlDataAdapter da = new SqlDataAdapter("select* from meeting where builder='" + Convert.ToString(Session["username"]) + "'and name='"+this.txtname .Text .Trim ()+"'and addr='"+this.ddlroompos .SelectedItem .Value .ToString ()+"'and attr='"+this.ddlattr .SelectedItem .Value .ToString ()+"' order by id desc", cn);
        da.Fill(ds, "Result");
        System.Web.UI.WebControls.PagedDataSource ps = new PagedDataSource();
        ps.DataSource = ds.Tables["Result"].DefaultView;
        ps.AllowPaging = true;
        ps.PageSize = 12;
        ps.CurrentPageIndex = countpage - 1;
        this.lblPageCount.Text = Convert.ToString(ps.PageCount);

        this.Button2.Enabled = true;
        this.Button3.Enabled = true;

        if (countpage == 1)
        {
            this.Button2.Enabled = false;
        }
        if (countpage == ps.PageCount)
        {
            this.Button3.Enabled = false;
        }
        this.gvmyjionmeeting.DataSource = ps;
        this.gvmyjionmeeting.DataBind();
        if (this.gvmyjionmeeting.Rows.Count == 0)
        {
            this.Panel1.Visible = false;
            this.Labmessage.Text = "温馨的提示:没有找到要搜索的会议内容!";
        }
        else
        {
            this.Panel1.Visible = true;
        }

       SqlCommand cmd = new SqlCommand ("select count(*) from meeting where builder='" + Convert.ToString(Session["username"]) + "'and name='" + this.txtname.Text.Trim() + "'and addr='" + this.ddlroompos.SelectedItem.Value.ToString() + "'and attr='" + this.ddlattr.SelectedItem.Value.ToString() + "'", cn);
        this.lblRecordCount.Text = Convert.ToString(cmd.ExecuteScalar());
        pagecount = Convert.ToString(ps.PageCount);
        cn.Close();
    }
    protected void Button1_Click(object sender, EventArgs e)
    {
        this.Labelye.Text = "1";
        this.databindfindmeetinginfo();

    }
    protected void Button2_Click(object sender, EventArgs e)
    {
        this.Labelye.Text = Convert.ToString(Convert.ToInt32(this.Labelye.Text) - 1);
        this.databindfindmeetinginfo();

    }
    protected void Button3_Click(object sender, EventArgs e)
    {
        this.Labelye.Text = Convert.ToString(Convert.ToInt32(this.Labelye.Text) + 1);
        this.databindfindmeetinginfo();
    }
    protected void Button4_Click(object sender, EventArgs e)
    {
        this.Labelye.Text = pagecount;
        this.databindfindmeetinginfo();

    }
    protected void gvmyjionmeeting_RowCreated(object sender, GridViewRowEventArgs e)
    {
        if (e.Row.RowType == DataControlRowType.DataRow)
        {
            e.Row.Attributes.Add("onmouseover", "c=this.style.backgroundColor;this.style.backgroundColor='#ffffff';");
            e.Row.Attributes.Add("onmouseout", "this.style.backgroundColor=c;");
        }
    }
    protected void Button5_Click(object sender, EventArgs e)
    {
        if (this.IsValid)
        {
            this.databindfindmeetinginfo();
        }
    }
    protected void Button6_Click(object sender, EventArgs e)
    {
        this.Labmessage.Text = "";
        this.Panel1.Visible = false;
    }
}

⌨️ 快捷键说明

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