📄 archivelist.aspx.cs
字号:
/******************************************************************
* Source File Name : ArchiveList *
* Project Name: OI.csproj *
* Engineer: 黎斌 *
* Date Generated: 2003/12/16 *
* Last Revision Date : *
* Brief Description : 存档公文信息列表 *
******************************************************************/
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 ZHENGYI;
namespace OI.Archives
{
/// <summary>
/// ArchiveList 的摘要说明。
/// </summary>
public class ArchiveList : OI.PageBase
{
protected System.Web.UI.WebControls.TextBox TextBoxSearch;
protected System.Web.UI.WebControls.ImageButton ImageButton1;
protected System.Web.UI.WebControls.DataGrid DataGrid1;
protected DataGridNavigation divepage ;
protected System.Web.UI.WebControls.Label LabelTitle;
protected string szWhere="";
private string EditType;
public string editType
{
get{
return EditType;
}
}
private void Page_Load(object sender, System.EventArgs e)
{
// 在此处放置用户代码以初始化页面
if (Session["userid"]==null)
{
Response.Write ("<script>alert('超时,请重新登录');top.location.href='../userpass.aspx';</script>");
return ;
}
if(Request["edittype"]=="0")
{
LabelTitle.Text="查看公文档案记录";
EditType=Request["edittype"].ToString();
}
else
{
LabelTitle.Text="查看公文草稿记录";
EditType=Request["edittype"].ToString();
}
SetDivePage();
if (Session["userid"] == null)
{
Response.Write("<script>window.location.href='../userpass.aspx'</script>");
return;
}
if (!IsPostBack)
{
BindData();
}
}
private void BindData()
{
OI.DatabaseOper.DatabaseConnect oConn = new OI.DatabaseOper.DatabaseConnect();
string cSearchKey = TextBoxSearch.Text.Trim().Replace ("'","''");
if(cSearchKey!="")
{
szWhere = " and title like '%"+cSearchKey+"%'" ;
//" and ( Stream like '%"+cSearchKey+"%' or Title like '%"+cSearchKey+"%' or DocumentTypeName like '%"+cSearchKey+"%' or ExigenceDegreeName like '%"+cSearchKey+"%' or SecretGreadName like '%"+cSearchKey+"%' or DraftDepartment like '%"+cSearchKey+"%' or Author like '%"+cSearchKey+"%')";
}
string szSql = "select * from V_document where ( currentstepid = 2 or CompleteSign=1) "+szWhere;
DataSet ds = oConn.getBinding(szSql,"Temp");
DataGrid1.DataSource = ds.Tables["Temp"];
DataGrid1.DataBind();
}
#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.DataGrid1.ItemDataBound += new System.Web.UI.WebControls.DataGridItemEventHandler(this.DataGrid1_ItemDataBound);
this.Load += new System.EventHandler(this.Page_Load);
}
#endregion
private void ImageButton1_Click(object sender, System.Web.UI.ImageClickEventArgs e)
{
// string szSqlWhere="";
// string cSearchKey = TextBoxSearch.Text.Trim().Replace ("'","''");
// if(cSearchKey!="")
// {
// szWhere = " and title like '%"+cSearchKey+"%'" ;
// //" and ( Stream like '%"+cSearchKey+"%' or Title like '%"+cSearchKey+"%' or DocumentTypeName like '%"+cSearchKey+"%' or ExigenceDegreeName like '%"+cSearchKey+"%' or SecretGreadName like '%"+cSearchKey+"%' or DraftDepartment like '%"+cSearchKey+"%' or Author like '%"+cSearchKey+"%')";
// }
BindData();
}
private void SetDivePage()
{
DataGrid1.AllowPaging =true;
DataGrid1.PageSize =15;
ZHENGYI.BindDataDelegate f =new ZHENGYI.BindDataDelegate (BindData);//修改这个dataBind,让f 指向你的方法。
divepage.SetTarget(DataGrid1,f,15);
}
private void DataGrid1_ItemDataBound(object sender, System.Web.UI.WebControls.DataGridItemEventArgs e)
{
if (e.Item .ItemType ==ListItemType.Item || e.Item .ItemType ==ListItemType.AlternatingItem )
{
e.Item .Cells [1].Text ="<a href =ArchiveDetail.aspx?DocumentID="+ e.Item .Cells[0].Text+"&edittype="+ EditType +">"+e.Item .Cells[1].Text +"</a>";
}
}
}
}
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -