📄 streamlist.aspx.cs
字号:
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;
namespace OI.Stream
{
/// <summary>
/// StremList 的摘要说明。
/// </summary>
public class StremList :OI.PageBase
{
protected System.Web.UI.WebControls.Label LabelContent;
protected System.Web.UI.WebControls.Label LabelPageBar;
protected System.Web.UI.HtmlControls.HtmlForm Form1;
protected OI.DatabaseOper .DatabaseConnect Dbc=new OI.DatabaseOper.DatabaseConnect ();
public string type;
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(!Page.IsPostBack )
{
// DstclassBind();
try
{
ViewState["type"]=Request.Params["type"].ToString ();
}
catch
{
ViewState["type"]="";
}
}
type=ViewState["type"].ToString ();
if(this.IsPostBack)
return;
int pageNum=1;
try
{
pageNum=System.Int32.Parse(Request.QueryString["PageNum"]);
}
catch
{
pageNum=1;
}
this.initData(pageNum);
}
// private void DstclassBind()
// {
// string sql=" select id,classtitle from streamclass";
// DataSet ds=new DataSet ();
// ds=Dbc.getBinding (sql,"t");
// if (ds.Tables[0].Rows .Count < 1)
// {
// Response.Write ("请先定义流程类别!");
// Response.End ();
// }
// Dstclass.DataSource =ds.Tables[0];
// Dstclass.DataTextField =ds.Tables[0].Columns["classtitle"].ToString ();
// Dstclass.DataValueField =ds.Tables[0].Columns ["id"].ToString ();
// Dstclass.DataBind ();
// }
private ArrayList al=new ArrayList();//保存部门节点的和其子节点的所有departmentid值
private void SelectDepartmentID(string parentid)
{
string sql="select departmentid from departments where parentdepartmentid='"+parentid+"'";
ArrayList aldepartmentid=Dbc.getData(sql);
for(int i=0;i<aldepartmentid.Count;i++)
{
al.Add(aldepartmentid[i].ToString());
SelectDepartmentID(aldepartmentid[i].ToString());
}
}
private void initData(int pageNum)
{
//al.Add(Session["departmentid"].ToString());
//SelectDepartmentID(Session["departmentid"].ToString());//获得部门节点的和其子节点的所有departmentid值
string str;
// for(int i=0;i<al.Count;i++)
// {
// if(i!=al.Count-1)
// str+=al[i].ToString()+",";
// else
// str+=al[i].ToString();
//
// }
if (ViewState["type"].ToString ()=="admin")
{
str ="( 0,"+Session["departmentid"].ToString ()+") ";
}
else
{
str ="("+Session["departmentid"].ToString () +")";
}
OI.Data.Streams oStreams=new OI.Data.Streams();
oStreams.PageSize=20;
oStreams.PageNum=pageNum;
oStreams.GetData(str);
//oStreams.GetData()
if(oStreams.RecordCount==0)
this.LabelContent.Text="<tr ><td colspan=\"4\"><font color=red>目前没有工作流</font></td></tr>";
else
this.LabelContent.Text="";
int j=1;
foreach(OI.Data.Streams.Stream oStream in oStreams)
{
if(j%2==0) {
this.LabelContent.Text+="<tr >\n";
this.LabelContent.Text+=" <td bgcolor=FloralWhite>"+oStream.StreamName+" </td>\n";
this.LabelContent.Text+=" <td bgcolor=FloralWhite align=\"center\">"+oStream.LastEditDate.ToShortDateString()+"</td>\n";
this.LabelContent.Text+=" <td bgcolor=FloralWhite align=\"center\">\n";
this.LabelContent.Text+=" <a href=\"EditStreamFirst.aspx?StreamID="+oStream.StreamID.ToString()+"&type="+ViewState["type"].ToString()+"\"><img src='../images/edit.gif' alt=\"\" border=\"0\"></a>\n";
this.LabelContent.Text+=" </td>\n";
this.LabelContent.Text+=" <td bgcolor=FloralWhite align=\"center\">\n";
//this.LabelContent.Text+=" <a href=\"#\" onclick=\"javascript:deleteStream('"+oStream.StreamID.ToString()+"');\"><img border=\"0\" src='../images/delete.gif' alt=''></a>\n";
this.LabelContent.Text+=" <img border=\"0\" src='../images/delete.gif' onclick=deleteStream('"+oStream.StreamID.ToString()+"') alt=''style='cursor:hand'> \n";
this.LabelContent.Text+=" </td>\n";
this.LabelContent.Text+="</tr>\n";
}
else {
this.LabelContent.Text+="<tr >\n";
this.LabelContent.Text+=" <td >"+oStream.StreamName+" </td>\n";
this.LabelContent.Text+=" <td align=\"center\">"+oStream.LastEditDate.ToShortDateString()+"</td>\n";
this.LabelContent.Text+=" <td align=\"center\">\n";
this.LabelContent.Text+=" <a href=\"EditStreamFirst.aspx?StreamID="+oStream.StreamID.ToString()+"&type="+ViewState["type"].ToString()+"\"><img src='../images/edit.gif' alt=\"\" border=\"0\"></a>\n";
this.LabelContent.Text+=" </td>\n";
this.LabelContent.Text+=" <td align=\"center\">\n";
//this.LabelContent.Text+=" <a href=\"#\" onclick=\"javascript:deleteStream('"+oStream.StreamID.ToString()+"');\"><img border=\"0\" src='../images/delete.gif' alt='' ></a>\n";
this.LabelContent.Text+=" <img border=\"0\" src='../images/delete.gif' onclick=deleteStream('"+oStream.StreamID.ToString()+"') alt=''style='cursor:hand'> \n";
this.LabelContent.Text+=" </td>\n";
this.LabelContent.Text+="</tr>\n";
}
j++;
}
oStreams.Disponse();
string url="StreamList.aspx?type="+ViewState["type"].ToString ();
this.LabelPageBar.Text=OI.Modules.PageBar.GenPageBar(oStreams.PageCount,oStreams.PageNum,url );
}
#region Web 窗体设计器生成的代码
override protected void OnInit(EventArgs e)
{
//
// CODEGEN: 该调用是 ASP.NET Web 窗体设计器所必需的。
//
InitializeComponent();
base.OnInit(e);
}
/// <summary>
/// 设计器支持所需的方法 - 不要使用代码编辑器修改
/// 此方法的内容。
/// </summary>
private void InitializeComponent()
{
this.Load += new System.EventHandler(this.Page_Load);
}
#endregion
// private void Dstclass_SelectedIndexChanged(object sender, System.EventArgs e)
// {
//
// int pageNum=1;
// try
// {
// pageNum=System.Int32.Parse(Request.QueryString["PageNum"]);
// }
// catch
// {
// pageNum=1;
// }
// this.initData(pageNum);
//
// }
}
}
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -