📄 editflow.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>
/// EditFlow 的摘要说明。
/// </summary>
public class EditFlow : 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.Button NextBtn;
protected System.Web.UI.WebControls.Button CancelBtn;
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);
}
}
}
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);
///保存公文流转修改前的数据
DocFlowDetails flowDetails = new DocFlowDetails();
if(recf.Read())
{
flowDetails.FlowName = FlowName.Text = recf["FlowName"].ToString();
flowDetails.FlowDesn = FlowDesn.Text = recf["FlowDesn"].ToString();
///设置流转方式
SetFlowMethod(recf["FlowMethodID"].ToString());
flowDetails.FlowMethodID = Int32.Parse(recf["FlowMethodID"].ToString());
///添加数据到Session中
Session[Session.SessionID + DocFlowDetails.DocFlowDetail] = flowDetails;
}
recf.Close();
}
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.NextBtn.Click += new System.EventHandler(this.NextBtn_Click);
this.CancelBtn.Click += new System.EventHandler(this.CancelBtn_Click);
this.Load += new System.EventHandler(this.Page_Load);
}
#endregion
private void NextBtn_Click(object sender, System.EventArgs e)
{
if(FlowName.Text.Trim().Length > 0)
{
///保存公文流转的当前数据
DocFlowDetails flowDetails = new DocFlowDetails();
flowDetails.FlowName = FlowName.Text.Trim();
flowDetails.FlowDesn = FlowDesn.Text.Trim();
flowDetails.SenderID = Int32.Parse(Session["UserID"].ToString());
flowDetails.FlowMethodID = Int32.Parse(FlowMethodList.SelectedValue);
///添加数据到Session中
Session[Session.SessionID + DocFlowDetails.DocFlowDetailEdit] = flowDetails;
///下一步
Response.Redirect("FlowEditDocument.aspx?FlowID=" + nDocFlowID.ToString());
}
}
private void CancelBtn_Click(object sender, System.EventArgs e)
{
///返回到创建公文流转的起始页面
Response.Redirect("ViewFlow.aspx");
}
}
}
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -