WorkFlowTaskSession.aspx.cs
上传用户:tiancihang
上传日期:2014-03-12
资源大小:21387k
文件大小:11k
源码类别:
.net编程
开发平台:
C#
- using System;
- using System.Data;
- using System.Configuration;
- using System.Collections;
- using System.Web;
- using System.Web.Security;
- using System.Web.UI;
- using System.Web.UI.WebControls;
- using System.Web.UI.WebControls.WebParts;
- using System.Web.UI.HtmlControls;
- using com.etong.DAL.FC;
- public partial class Workflow_WorkFlowTaskSession : System.Web.UI.Page
- {
- protected void Page_Load(object sender, EventArgs e)
- {
- if (!IsPostBack)
- {
- txtProcessName.Text = Request.QueryString["StrNM"];
- int iWFID, iPageNum;
- try
- {
- iWFID = Convert.ToInt32(Request.QueryString["StrN"]);
- }
- catch
- {
- iWFID = -1;
- this.ClientScript.RegisterStartupScript(this.GetType(), "", "alert('系统提示:参数错误!');window.location.href('WorkFlowConfigure.aspx')", true);
- }
- try
- {
- iPageNum = Convert.ToInt32(System.Configuration.ConfigurationManager.AppSettings["MorePageNum"]);
- }
- catch
- {
- iPageNum = 10;
- }
- dg_Main.PageSize = iPageNum;
- EtongFlyChouWF EFlyWF = new EtongFlyChouWF();
- DataView dv = new DataView();
- dv = EFlyWF.GetActivityContent(iWFID);
- dg_Main.DataSource = dv;
- dg_Main.DataBind();
- Pger.RecordCount = dv.Count;
- Pger.PageSize = dg_Main.PageSize;
- }
- }
- #region property
- private DataSet ds
- {
- get
- {
- return ViewState["ds"] as DataSet;
- }
- set
- {
- ViewState["ds"] = value;
- }
- }
- public string FilterExpression
- {
- get
- {
- if (this.ViewState["FilterExpression"] != null)
- return (string)this.ViewState["FilterExpression"];
- return string.Empty;
- }
- set
- {
- this.ViewState["FilterExpression"] = value;
- }
- }
- public string SortExpression
- {
- get
- {
- if (this.ViewState["SortExpression"] != null)
- return (string)this.ViewState["SortExpression"];
- return string.Empty;
- }
- set
- {
- this.ViewState["SortExpression"] = value;
- }
- }
- #endregion
- #region Web Form Designer generated code
- override protected void OnInit(EventArgs e)
- {
- //
- // CODEGEN: This call is required by the ASP.NET Web Form Designer.
- //
- InitializeComponent();
- base.OnInit(e);
- this.Pger.NavigationClick += new EventHandler(Pger_NavigationClick);
- }
- /// <summary>
- /// Required method for Designer support - do not modify
- /// the contents of this method with the code editor.
- /// </summary>
- private void InitializeComponent()
- {
- this.Load += new System.EventHandler(this.Page_Load);
- }
- #endregion
- private void Pger_NavigationClick(object sender, EventArgs e)
- {
- int iWFID;
- try
- {
- iWFID = Convert.ToInt32(Request.QueryString["StrN"]);
- }
- catch
- {
- iWFID = -1;
- this.ClientScript.RegisterStartupScript(this.GetType(), "", "alert('系统提示:参数错误!');window.location.href('WorkFlowConfigure.aspx')", true);
- }
- EtongFlyChouWF EFlyWF = new EtongFlyChouWF();
- DataView dv = new DataView();
- dv = EFlyWF.GetActivityContentPage(iWFID, Pger.CurrentPageIndex, Pger.PageSize);
- dg_Main.DataSource = dv;
- dg_Main.DataBind();
- }
- protected void dg_Main_ItemDataBound(object sender, System.Web.UI.WebControls.DataGridItemEventArgs e)
- {
- //System.Web.UI.WebControls.ImageButton img;
- EtongFlyChou EFly = new EtongFlyChou();
- EtongFlyChouWF EFlyWF = new EtongFlyChouWF();
- EtongFlyChouWFPrj EFlyPrj = new EtongFlyChouWFPrj();
- EtongFlyChouCode EFlyCode = new EtongFlyChouCode();
- if (e.Item.ItemType == ListItemType.Item || e.Item.ItemType==ListItemType.AlternatingItem)
- {
- if (e.Item.Cells[2].Text != null && e.Item.Cells[2].Text.Trim() != "")
- {
- int iAct;
- try
- {
- iAct = Convert.ToInt32(e.Item.Cells[2].Text);
- }
- catch
- {
- iAct = -2;
- }
- if (iAct >= 0)
- {
- e.Item.Cells[2].Text = EFlyWF.GetActivityName(iAct);
- }
- else if (iAct == -1)
- {
- e.Item.Cells[2].Text = "起始";
- }
- else
- {
- e.Item.Cells[2].Text = "未知";
- }
- }
- if (e.Item.Cells[3].Text != null && e.Item.Cells[3].Text.Trim() != "")
- {
- int iRole;
- try
- {
- iRole = Convert.ToInt32(e.Item.Cells[3].Text);
- }
- catch
- {
- iRole=-1;
- }
- //e.Item.Cells[3].Text = EFly.GetRoleName(iRole);
- EFlyPrj.OpID = iRole;
- try
- {
- EFlyPrj.GetOpName();
- }
- catch
- {
- EFlyPrj.OpName = "未知";
- }
- e.Item.Cells[3].Text = EFlyPrj.OpName;
- }
- switch (e.Item.Cells[4].Text)
- {
- case "0":
- e.Item.Cells[4].Text = "起始任务";
- break;
- case "1":
- e.Item.Cells[4].Text = "一般任务";
- break;
- case "2":
- e.Item.Cells[4].Text = "最终任务";
- break;
- default:
- e.Item.Cells[4].Text = "未知任务";
- break;
- }
- switch (e.Item.Cells[5].Text)
- {
- case "0":
- e.Item.Cells[5].Text = "非阻塞";
- break;
- case "1":
- e.Item.Cells[5].Text = "阻塞";
- break;
- default:
- e.Item.Cells[5].Text = "未知";
- break;
- }
- try
- {
- e.Item.Cells[6].Text = EFlyCode.GetShuntByID(Convert.ToInt32(e.Item.Cells[6].Text));
- }
- catch
- {
- e.Item.Cells[6].Text = "未知";
- }
- //switch (e.Item.Cells[6].Text)
- //{
- // try
- // {
- // e.Item.Cells[6].Text = EFlyCode.GetShuntByID(Convert.ToInt32(e.Item.Cells[6].Text));
- // }
- // case "0":
- // e.Item.Cells[6].Text = "非分流";
- // break;
- // case "1":
- // e.Item.Cells[6].Text = "自营";
- // break;
- // case "2":
- // e.Item.Cells[6].Text = "半委托";
- // break;
- // case "3":
- // e.Item.Cells[6].Text = "全委托";
- // break;
- // default:
- // e.Item.Cells[6].Text = "未知";
- // break;
- //}
- switch (e.Item.Cells[7].Text)
- {
- case "0":
- e.Item.Cells[7].Text = "抢先式";
- break;
- case "1":
- e.Item.Cells[7].Text = "并行式";
- break;
- default:
- e.Item.Cells[7].Text = "未知";
- break;
- }
- if (e.Item.Cells[9].Text != null && e.Item.Cells[9].Text.Trim() != "")
- {
- int iPage;
- try
- {
- iPage = Convert.ToInt32(e.Item.Cells[9].Text);
- }
- catch
- {
- iPage = -1;
- }
- e.Item.Cells[9].Text = EFlyWF.GetWFStaticPageName(iPage);
- }
- }
- //img = e.Item.FindControl("btnDeleteTask") as System.Web.UI.WebControls.ImageButton;
- //img.Attributes.Add("onclick", "javascript:return confirm('确定要删除任务『" + e.Item.Cells[1].Text + "』吗?');");
- //If e.Item.ItemType = ListItemType.Item Or e.Item.ItemType = ListItemType.AlternatingItem Then
- //e.Item.Cells(2).Text = IIf(e.Item.Cells(2).Text = "1", "一般任务", "起始任务")
- //e.Item.Cells(4).Text = IIf(e.Item.Cells(4).Text = "0", "", e.Item.Cells(4).Text)
- //e.Item.Cells(7).Text = IIf(e.Item.Cells(7).Text = "0", "指定", "默认")
- //e.Item.Cells(8).Text = IIf(e.Item.Cells(8).Text = "0", "抢先式", "并列式")
- //img = CType(e.Item.FindControl("btnDeleteTask"), System.Web.UI.WebControls.ImageButton)
- //img.Attributes.Add("onclick", "javascript:return confirm('确定要删除任务""" & e.Item.Cells(1).Text & """吗?');")
- }
- protected void dg_Main_ItemCommand(object sender, System.Web.UI.WebControls.DataGridCommandEventArgs e)
- {
- string WF=Request.QueryString["StrN"];
- if (e.CommandName == "Edit")
- {
- Response.Redirect("WorkFlowTaskEdit.aspx?StrM=M&StrN=" + WF + "&StrA=" + e.Item.Cells[0].Text);
- }
- else if (e.CommandName == "Delete")
- {
- int iWFID = Convert.ToInt32(WF);
- int iActID = Convert.ToInt32(e.Item.Cells[0].Text);
- EtongFlyChouWF EFlyWF = new EtongFlyChouWF();
- if (EFlyWF.BlTask(iActID, "ActivityID", "tb_WF_ActIns") == true)
- {
- this.ClientScript.RegisterStartupScript(this.GetType(), "", "alert('系统提示:本活动正在被使用,不允许删除!');", true);
- return;
- }
- //this.ClientScript.RegisterStartupScript(this.GetType(), "", "alert('系统提示:本活动正在被使用!');", true);
- //return;
- if (EFlyWF.DelActivity(iWFID, iActID) == true)
- {
- this.ClientScript.RegisterStartupScript(this.GetType(), "", "alert('系统提示:信息删除成功!');window.location.replace(window.location.href);", true);
- }
- else
- {
- this.ClientScript.RegisterStartupScript(this.GetType(), "", "alert('系统提示:信息删除失败!');", true);
- }
- }
- }
- protected void ImgAdd_Click(object sender, ImageClickEventArgs e)
- {
- string WF=Request.QueryString["StrN"];
- Response.Redirect("WorkFlowTaskEdit.aspx?StrM=N&StrN=" + WF);
- }
- }