📄 lookflow.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;
using System.Data.SqlClient;
using OfficeAuto.Components;
namespace OfficeAuto.DesktopModules.DocumentFlow
{
/// <summary>
/// LookFlow 的摘要说明。
/// </summary>
public class LookFlow : System.Web.UI.Page
{
protected System.Web.UI.WebControls.Label Label1;
protected System.Web.UI.WebControls.TextBox FlowName;
protected System.Web.UI.WebControls.RequiredFieldValidator rfFN;
protected System.Web.UI.WebControls.Label Label3;
protected System.Web.UI.WebControls.DropDownList FlowMethodList;
protected System.Web.UI.WebControls.Label Label2;
protected System.Web.UI.WebControls.TextBox FlowDesn;
protected System.Web.UI.WebControls.Label Label4;
protected System.Web.UI.WebControls.ListBox DocList;
protected System.Web.UI.WebControls.Label Label5;
protected System.Web.UI.WebControls.Button CloseBtn;
protected System.Web.UI.WebControls.ListBox ReceiverList;
private int nDocFlowID = 0;
private void Page_Load(object sender, System.EventArgs e)
{
///判断用户是否登录,否则跳转到登录页面
if(Session["UserID"] == null)
{
Response.Redirect("~/Default.aspx");
}
if(Request.Params["FlowID"] != null)
{
nDocFlowID = Int32.Parse(Request.Params["FlowID"].ToString());
}
if(!Page.IsPostBack)
{
///绑定控件的数据
BindFlowMethodData();
if(nDocFlowID > 0)
{
///显示流转的相关信息
BindDocFlowData(nDocFlowID);
///绑定当前流转的文档数据
BindFlowDocData(nDocFlowID);
///绑定当前流转的接收人数据
BindFlowReceiverData(nDocFlowID);
}
}
}
private void BindFlowMethodData()
{
///获取数据
FlowMethod method = new FlowMethod();
SqlDataReader recm = method.GetFlowMethods();
///绑定数据
FlowMethodList.DataSource = recm;
FlowMethodList.DataTextField = "MethodName";
FlowMethodList.DataValueField = "FlowMethodID";
FlowMethodList.DataBind();
recm.Close();
}
private void BindDocFlowData(int nDocFlowID)
{
DocFlow flow = new DocFlow();
SqlDataReader recf = flow.GetSingleDocFlow(nDocFlowID);
if(recf.Read())
{
FlowName.Text = recf["FlowName"].ToString();
FlowDesn.Text = recf["FlowDesn"].ToString();
///设置流转方式
SetFlowMethod(recf["FlowMethodID"].ToString());
}
recf.Close();
}
private void BindFlowDocData(int nDocFlowID)
{
///获取数据
OfficeAuto.Components.FlowDocument flowDoc = new OfficeAuto.Components.FlowDocument();
SqlDataReader recfd = flowDoc.GetDocumentByFlow(nDocFlowID);
///绑定数据
DocList.DataSource = recfd;
DocList.DataTextField = "Title";
DocList.DataValueField = "DocumentID";
DocList.DataBind();
recfd.Close();
}
private void BindFlowReceiverData(int nDocFlowID)
{
///获取数据
OfficeAuto.Components.FlowReceiver flowRece = new OfficeAuto.Components.FlowReceiver();
SqlDataReader recfR = flowRece.GetReceiverByFlow(nDocFlowID);
///绑定数据
ReceiverList.DataSource = recfR;
ReceiverList.DataTextField = "RealName";
ReceiverList.DataValueField = "ReceiverID";
ReceiverList.DataBind();
recfR.Close();
}
private void CloseBtn_Click(object sender, System.EventArgs e)
{
///关闭窗口
Response.Write("<script>window.close();</script>");
}
private void SetFlowMethod(string nFlowMethodID)
{
foreach(ListItem item in FlowMethodList.Items)
{
if(item.Value == nFlowMethodID)
{
item.Selected = true;
break;
}
}
}
#region Web 窗体设计器生成的代码
override protected void OnInit(EventArgs e)
{
//
// CODEGEN: 该调用是 ASP.NET Web 窗体设计器所必需的。
//
InitializeComponent();
base.OnInit(e);
}
/// <summary>
/// 设计器支持所需的方法 - 不要使用代码编辑器修改
/// 此方法的内容。
/// </summary>
private void InitializeComponent()
{
this.CloseBtn.Click += new System.EventHandler(this.CloseBtn_Click);
this.Load += new System.EventHandler(this.Page_Load);
}
#endregion
}
}
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -