WorkFlowConfigure.aspx.cs
上传用户:tiancihang
上传日期:2014-03-12
资源大小:21387k
文件大小:8k
- 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_WorkFlowConfigure : System.Web.UI.Page
- {
- protected void Page_Load(object sender, EventArgs e)
- {
- if (!IsPostBack)
- {
- EtongFlyChouWF WFFly = new EtongFlyChouWF();
- DataView dv = new DataView();
- dv = WFFly.GetWFNewData();
- try
- {
- this.GridView1.PageSize = Convert.ToInt32(System.Configuration.ConfigurationManager.AppSettings["MorePageNum"]);
- }
- catch
- {
- this.GridView1.PageSize = 10;
- }
- this.GridView1.DataSource = dv;
- this.GridView1.DataBind();
- //btnDeleteProcess.Attributes.Add("onclick", "javascript:return confirm('确定要删除吗?');");
- }
- }
- protected string FormatStr(object Objval)
- {
- string retval, strval;
- strval = Convert.ToString(Objval);
- if (strval == "1") retval = "已启用";
- else if (strval == "0") retval = "已停用";
- else retval = "未知状态";
- return retval;
- }
- protected void GridView1_PageIndexChanging(object sender, GridViewPageEventArgs e)
- {
- int currentpageindex;
- currentpageindex = Convert.ToInt32(e.NewPageIndex);
- if (currentpageindex == -2)
- {
- TextBox txtNewPageIndex;
- txtNewPageIndex = GridView1.BottomPagerRow.FindControl("LinkTextBoxNewPage") as TextBox;
- if (txtNewPageIndex != null)
- {
- try
- {
- currentpageindex = Convert.ToInt32(txtNewPageIndex.Text) - 1;
- }
- catch
- {
- currentpageindex = 0;
- }
- }
- }
- currentpageindex = currentpageindex < 0 ? 0 : currentpageindex;
- currentpageindex = currentpageindex >= GridView1.PageCount ? GridView1.PageCount - 1 : currentpageindex;
- GridView1.PageIndex = currentpageindex;
- EtongFlyChouWF WFFly = new EtongFlyChouWF();
- DataView dv = new DataView();
- dv = WFFly.GetWFNewData();
- GridView1.DataSource = dv;
- GridView1.DataBind();
- }
- protected void GridView1_RowDataBound(object sender, GridViewRowEventArgs e)
- {
- if (e.Row.RowType == DataControlRowType.DataRow)
- {
- int iRow;
- iRow = e.Row.DataItemIndex;
- iRow = iRow % 2;
- if (iRow > 0)
- e.Row.Attributes.Add("OnMouseOut", "this.style.backgroundColor='#f0f0f0';");
- else
- e.Row.Attributes.Add("OnMouseOut", "this.style.backgroundColor='White';");
- e.Row.Attributes.Add("OnMouseOver", "this.style.backgroundColor='#E8F2FA';");
- }
- }
- protected void btnAddProcess_Click(object sender, EventArgs e)
- {
- Response.Redirect("WorkFlowConfigureENew.aspx?StrM=N");
- }
- protected void GridView1_SelectedIndexChanged(object sender, EventArgs e)
- {
- string sSelectedIndex;
- int iSelectedIndex=0;
- sSelectedIndex = TB_SelectedIndex.Value;
- if (sSelectedIndex.Trim() == "" || sSelectedIndex == null)
- {
- }
- else
- {
- try
- {
- iSelectedIndex = Convert.ToInt32(sSelectedIndex);
- }
- catch
- {
- iSelectedIndex = -1;
- }
- if (iSelectedIndex != -1)
- {
- ImageButton imgbtselected;
- imgbtselected = this.GridView1.Rows[iSelectedIndex].FindControl("IB_Del") as ImageButton;
- imgbtselected.Visible = false;
- }
- }
- int i= GridView1.SelectedIndex;
- TB_SelectName.Value = GridView1.SelectedRow.Cells[1].Text;
- TB_SelectedIndex.Value = Convert.ToString(i);
- ImageButton imgbt;
- imgbt = this.GridView1.SelectedRow.FindControl("IB_Del") as ImageButton;
- imgbt.Visible = true;
- this.GridView1.SelectedRow.HorizontalAlign = HorizontalAlign.Center;
- TB_SelectedKey.Value=this.GridView1.DataKeys[i].Value.ToString();
- //TB_SelectName.Value = this.GridView1.SelectedRow.Cells[1].Text;
- //imgbt = this.GridView1.TemplateControl.FindControl("IB_Del") as ImageButton;
- }
- protected void btnModifyProcess_Click(object sender, EventArgs e)
- {
- int i;
- try
- {
- i= Convert.ToInt32(TB_SelectedKey.Value);
- }
- catch
- {
- i =-1;
- }
- if (i==-1)
- {
- this.ClientScript.RegisterStartupScript(this.GetType(),"","alert('系统提示:请选择工作流!');",true);
- return;
- }
- Response.Redirect("WorkFlowConfigureENew.aspx?StrM=M&StrN="+i);
- }
- protected void btnDeleteProcess_Click(object sender, EventArgs e)
- {
- }
- protected void btnTaskManage_Click(object sender, EventArgs e)
- {
- int i;
- try
- {
- i = Convert.ToInt32(TB_SelectedKey.Value);
- }
- catch
- {
- i = -1;
- }
- if (i == -1)
- {
- this.ClientScript.RegisterStartupScript(this.GetType(), "", "alert('系统提示:请选择工作流!');", true);
- return;
- }
- string strName = TB_SelectName.Value;
- Response.Redirect("WorkFlowTaskSession.aspx?StrM=M&StrN="+i+"&StrNM="+strName);
- }
- protected void btnRouteManage_Click(object sender, EventArgs e)
- {
- int i;
- try
- {
- i = Convert.ToInt32(TB_SelectedKey.Value);
- }
- catch
- {
- i = -1;
- }
- if (i == -1)
- {
- this.ClientScript.RegisterStartupScript(this.GetType(), "", "alert('系统提示:请选择工作流!');", true);
- return;
- }
- Response.Redirect("WorkFlowImage.aspx?PID=" +i);
- }
- protected void btnDeleteProcess_Click1(object sender, EventArgs e)
- {
- int iWFID;
- try
- {
- iWFID = Convert.ToInt32(TB_SelectedKey.Value);
- }
- catch
- {
- iWFID = -1;
- }
- if (iWFID == -1)
- {
- this.ClientScript.RegisterStartupScript(this.GetType(), "", "alert('系统提示:请选择工作流!');", true);
- return;
- }
- try
- {
- EtongFlyChouWFNTask tsk = new EtongFlyChouWFNTask();
- //tsk.CreateNewTask();
- tsk.TaskWFID = iWFID;
- if (tsk.IsCanWFDelete() == false)
- {
- this.ClientScript.RegisterStartupScript(this.GetType(), "", "alert('系统提示:该工作流正被任务活动使用,无法删除!欲删除该工作流,请先删除与该工作流关联的活动。')", true);
- return;
- }
- tsk.WFDelete();
- this.ClientScript.RegisterStartupScript(this.GetType(), "", "alert('系统提示:工作流删除成功!');window.location.replace(window.location.href);", true);
- }
- catch (Exception ex)
- {
- this.ClientScript.RegisterStartupScript(this.GetType(),"", "<script>alert('" + ex.Message.Replace("'", "").Replace("n", "") + "');</script>");
- }
- }
- }