📄 departmentsearch.aspx.cs
字号:
/*
* 作者:吴高发
* 日期:03-11-12
* 修改者:
* 修改模块:
*/
using System;
using System.Collections;
using System.ComponentModel;
using System.Data;
using System.Drawing;
using System.Web;
using System.Web.SessionState;
using System.Web.UI;
using System.Web.UI.WebControls;
using System.Web.UI.HtmlControls;
using OI.DatabaseOper ;
namespace OI.IndividualArrange
{
/// <summary>
/// DepartmentSearch 的摘要说明。
/// </summary>
public class DepartmentSearch : OI.PageBase
{
protected System.Web.UI.WebControls.TextBox TextBoxName;
protected System.Web.UI.WebControls.DataGrid DataGridPlan;
protected System.Web.UI.WebControls.ImageButton ImageButton1;
private DatabaseOper.DatabaseConnect dc;
protected ZHENGYI.DataGridNavigation divepage;
private void Page_Load(object sender, System.EventArgs e)
{
// 在此处放置用户代码以初始化页面
if (Session["userid"]==null)
{
Response.Write ("<script>alert('超时,请重新登录');top.location.href='../userpass.aspx';</script>");
return ;
}
dc=new DatabaseConnect ();
SetDivePage();
if(!this.IsPostBack )
{
this.bindPlan ();
}
}
#region Web 窗体设计器生成的代码
override protected void OnInit(EventArgs e)
{
//
// CODEGEN: 该调用是 ASP.NET Web 窗体设计器所必需的。
//
InitializeComponent();
base.OnInit(e);
}
/// <summary>
/// 设计器支持所需的方法 - 不要使用代码编辑器修改
/// 此方法的内容。
/// </summary>
private void InitializeComponent()
{
this.ImageButton1.Click += new System.Web.UI.ImageClickEventHandler(this.ImageButton1_Click);
this.Load += new System.EventHandler(this.Page_Load);
}
#endregion
private void ButtonSearch_Click(object sender, System.EventArgs e)
{
}
private void bindPlan()
{
string searchName=TextBoxName.Text .Trim ();
if(Session["userid"]==null||Session["userid"].ToString ()=="")
{
Page.RegisterStartupScript ("","<script>alert(\"操作时间过长,请重新登录\")</script>");
return;
}
string sql="SELECT Title,SelfPlan.Content,BeginDate,EndDate,UserName AS Name From SelfPlan,Accounts_Users "+
"WHERE SelfPlan.UserID=Accounts_Users.UserID AND Accounts_Users.DepartmentID IN"+
" (SELECT TOP 1 DepartmentID FROM Accounts_Users WHERE UserID='"+Session["userID"]+"' ) "+//Session["userID"]
" AND Accounts_Users.UserName LIKE '"+"%"+searchName.Trim ()+"%"+"'"+
" ORDER BY Accounts_Users.UserName,SelfPlan.BeginDate";
DataSet ds=dc.getBinding (sql,"tempTable");
DataGridPlan.DataSource =ds.Tables ["tempTable"].DefaultView ;
DataGridPlan.DataBind ();
}
private void ImageButton1_Click(object sender, System.Web.UI.ImageClickEventArgs e) {
this.bindPlan ();
}
private void SetDivePage()
{
//DataGridPlan.AllowPaging =true;
//DataGridPlan.PageSize =10;
ZHENGYI.BindDataDelegate f =new ZHENGYI.BindDataDelegate (bindPlan);//修改这个dataBind,让f 指向你的方法。
divepage.SetTarget(DataGridPlan,f,20);
}
}
}
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -