WorkFlowTaskSession.aspx.cs
上传用户:tiancihang
上传日期:2014-03-12
资源大小:21387k
文件大小:11k
源码类别:

.net编程

开发平台:

C#

  1. using System;
  2. using System.Data;
  3. using System.Configuration;
  4. using System.Collections;
  5. using System.Web;
  6. using System.Web.Security;
  7. using System.Web.UI;
  8. using System.Web.UI.WebControls;
  9. using System.Web.UI.WebControls.WebParts;
  10. using System.Web.UI.HtmlControls;
  11. using com.etong.DAL.FC;
  12. public partial class Workflow_WorkFlowTaskSession : System.Web.UI.Page
  13. {
  14.     protected void Page_Load(object sender, EventArgs e)
  15.     {
  16.         if (!IsPostBack)
  17.         {
  18.             txtProcessName.Text = Request.QueryString["StrNM"];
  19.             int iWFID, iPageNum;
  20.             try
  21.             {
  22.                 iWFID = Convert.ToInt32(Request.QueryString["StrN"]);
  23.             }
  24.             catch
  25.             {
  26.                 iWFID = -1;
  27.                 this.ClientScript.RegisterStartupScript(this.GetType(), "", "alert('系统提示:参数错误!');window.location.href('WorkFlowConfigure.aspx')", true);
  28.             }
  29.             try
  30.             {
  31.                 iPageNum = Convert.ToInt32(System.Configuration.ConfigurationManager.AppSettings["MorePageNum"]);
  32.             }
  33.             catch
  34.             {
  35.                 iPageNum = 10;
  36.             }
  37.             dg_Main.PageSize = iPageNum;
  38.             EtongFlyChouWF EFlyWF = new EtongFlyChouWF();
  39.             DataView dv = new DataView();
  40.             dv = EFlyWF.GetActivityContent(iWFID);
  41.             dg_Main.DataSource = dv;
  42.             dg_Main.DataBind();
  43.             Pger.RecordCount = dv.Count;
  44.             Pger.PageSize = dg_Main.PageSize;
  45.         }
  46.     }
  47.     #region property
  48.     private DataSet ds
  49.     {
  50.         get
  51.         {
  52.             return ViewState["ds"] as DataSet;
  53.         }
  54.         set
  55.         {
  56.             ViewState["ds"] = value;
  57.         }
  58.     }
  59.     public string FilterExpression
  60.     {
  61.         get
  62.         {
  63.             if (this.ViewState["FilterExpression"] != null)
  64.                 return (string)this.ViewState["FilterExpression"];
  65.             return string.Empty;
  66.         }
  67.         set
  68.         {
  69.             this.ViewState["FilterExpression"] = value;
  70.         }
  71.     }
  72.     public string SortExpression
  73.     {
  74.         get
  75.         {
  76.             if (this.ViewState["SortExpression"] != null)
  77.                 return (string)this.ViewState["SortExpression"];
  78.             return string.Empty;
  79.         }
  80.         set
  81.         {
  82.             this.ViewState["SortExpression"] = value;
  83.         }
  84.     }
  85.     #endregion
  86.     #region Web Form Designer generated code
  87.     override protected void OnInit(EventArgs e)
  88.     {
  89.         //
  90.         // CODEGEN: This call is required by the ASP.NET Web Form Designer.
  91.         //
  92.         InitializeComponent();
  93.         base.OnInit(e);
  94.         this.Pger.NavigationClick += new EventHandler(Pger_NavigationClick);
  95.     }
  96.     /// <summary>
  97.     /// Required method for Designer support - do not modify
  98.     /// the contents of this method with the code editor.
  99.     /// </summary>
  100.     private void InitializeComponent()
  101.     {
  102.         this.Load += new System.EventHandler(this.Page_Load);
  103.     }
  104.     #endregion
  105.     private void Pger_NavigationClick(object sender, EventArgs e)
  106.     {
  107.         int iWFID;
  108.         try
  109.         {
  110.             iWFID = Convert.ToInt32(Request.QueryString["StrN"]);
  111.         }
  112.         catch
  113.         {
  114.             iWFID = -1;
  115.             this.ClientScript.RegisterStartupScript(this.GetType(), "", "alert('系统提示:参数错误!');window.location.href('WorkFlowConfigure.aspx')", true);
  116.         }
  117.         EtongFlyChouWF EFlyWF = new EtongFlyChouWF();
  118.         DataView dv = new DataView();
  119.         dv = EFlyWF.GetActivityContentPage(iWFID, Pger.CurrentPageIndex, Pger.PageSize);
  120.         dg_Main.DataSource = dv;
  121.         dg_Main.DataBind();
  122.     }
  123.     protected void dg_Main_ItemDataBound(object sender, System.Web.UI.WebControls.DataGridItemEventArgs e) 
  124.      {
  125.          
  126.         //System.Web.UI.WebControls.ImageButton img;
  127.         EtongFlyChou EFly = new EtongFlyChou();
  128.         EtongFlyChouWF EFlyWF = new EtongFlyChouWF();
  129.         EtongFlyChouWFPrj EFlyPrj = new EtongFlyChouWFPrj();
  130.         EtongFlyChouCode EFlyCode = new EtongFlyChouCode();
  131.          if (e.Item.ItemType == ListItemType.Item || e.Item.ItemType==ListItemType.AlternatingItem)
  132.          {
  133.              if (e.Item.Cells[2].Text != null && e.Item.Cells[2].Text.Trim() != "")
  134.              {
  135.                  int iAct;
  136.                  try
  137.                  {
  138.                      iAct = Convert.ToInt32(e.Item.Cells[2].Text);
  139.                  }
  140.                  catch
  141.                  {
  142.                      iAct = -2;
  143.                  }
  144.                  if (iAct >= 0)
  145.                  {
  146.                      e.Item.Cells[2].Text = EFlyWF.GetActivityName(iAct);
  147.                  }
  148.                  else if (iAct == -1)
  149.                  {
  150.                      e.Item.Cells[2].Text = "起始";
  151.                  }
  152.                  else
  153.                  {
  154.                      e.Item.Cells[2].Text = "未知";
  155.                  }
  156.              }
  157.              if (e.Item.Cells[3].Text != null && e.Item.Cells[3].Text.Trim() != "")
  158.              {
  159.                  int iRole;
  160.                  try 
  161.                  {
  162.                     iRole = Convert.ToInt32(e.Item.Cells[3].Text);
  163.                  }
  164.                  catch 
  165.                  {
  166.                      iRole=-1;
  167.                  }
  168.                  //e.Item.Cells[3].Text = EFly.GetRoleName(iRole);
  169.                  EFlyPrj.OpID = iRole;
  170.                  try
  171.                  {
  172.                      EFlyPrj.GetOpName();
  173.                  }
  174.                  catch
  175.                  {
  176.                      EFlyPrj.OpName = "未知";
  177.                  }
  178.                  e.Item.Cells[3].Text = EFlyPrj.OpName;
  179.              }
  180.              switch (e.Item.Cells[4].Text)
  181.              {
  182.                  case "0":
  183.                      e.Item.Cells[4].Text = "起始任务";
  184.                      break;
  185.                  case "1":
  186.                      e.Item.Cells[4].Text = "一般任务";
  187.                      break;
  188.                  case "2":
  189.                      e.Item.Cells[4].Text = "最终任务";
  190.                      break;
  191.                  default:
  192.                      e.Item.Cells[4].Text = "未知任务";
  193.                      break;
  194.              }
  195.              switch (e.Item.Cells[5].Text)
  196.              {
  197.                  case "0":
  198.                      e.Item.Cells[5].Text = "非阻塞";
  199.                      break;
  200.                  case "1":
  201.                      e.Item.Cells[5].Text = "阻塞";
  202.                      break;
  203.                  default:
  204.                      e.Item.Cells[5].Text = "未知";
  205.                      break;
  206.              }
  207.              try
  208.              {
  209.                  e.Item.Cells[6].Text = EFlyCode.GetShuntByID(Convert.ToInt32(e.Item.Cells[6].Text));
  210.              }
  211.              catch
  212.              {
  213.                  e.Item.Cells[6].Text = "未知";
  214.              }
  215.              //switch (e.Item.Cells[6].Text)
  216.              //{
  217.              //        try 
  218.              //        {
  219.              //            e.Item.Cells[6].Text = EFlyCode.GetShuntByID(Convert.ToInt32(e.Item.Cells[6].Text));
  220.              //        }
  221.                     
  222.              //    case "0":
  223.              //        e.Item.Cells[6].Text = "非分流";
  224.              //        break;
  225.              //    case "1":
  226.              //        e.Item.Cells[6].Text = "自营";
  227.              //        break;
  228.              //    case "2":
  229.              //        e.Item.Cells[6].Text = "半委托";
  230.              //        break;
  231.              //    case "3":
  232.              //        e.Item.Cells[6].Text = "全委托";
  233.              //        break;
  234.              //    default:
  235.              //        e.Item.Cells[6].Text = "未知";
  236.              //        break;
  237.              //}
  238.              switch (e.Item.Cells[7].Text)
  239.              {
  240.                  case "0":
  241.                      e.Item.Cells[7].Text = "抢先式";
  242.                      break;
  243.                  case "1":
  244.                      e.Item.Cells[7].Text = "并行式";
  245.                      break;
  246.                  default:
  247.                      e.Item.Cells[7].Text = "未知";
  248.                      break;
  249.              }
  250.              if (e.Item.Cells[9].Text != null && e.Item.Cells[9].Text.Trim() != "")
  251.              {
  252.                  int iPage;
  253.                  try
  254.                  {
  255.                      iPage = Convert.ToInt32(e.Item.Cells[9].Text);
  256.                  }
  257.                  catch
  258.                  {
  259.                      iPage = -1;
  260.                  }
  261.                  e.Item.Cells[9].Text = EFlyWF.GetWFStaticPageName(iPage);
  262.              }
  263.          }
  264.          //img = e.Item.FindControl("btnDeleteTask") as System.Web.UI.WebControls.ImageButton;
  265.          //img.Attributes.Add("onclick", "javascript:return confirm('确定要删除任务『" + e.Item.Cells[1].Text + "』吗?');");
  266.              
  267.             //If e.Item.ItemType = ListItemType.Item Or e.Item.ItemType = ListItemType.AlternatingItem Then
  268.             //e.Item.Cells(2).Text = IIf(e.Item.Cells(2).Text = "1", "一般任务", "起始任务")
  269.             //e.Item.Cells(4).Text = IIf(e.Item.Cells(4).Text = "0", "", e.Item.Cells(4).Text)
  270.             //e.Item.Cells(7).Text = IIf(e.Item.Cells(7).Text = "0", "指定", "默认")
  271.             //e.Item.Cells(8).Text = IIf(e.Item.Cells(8).Text = "0", "抢先式", "并列式")
  272.             //img = CType(e.Item.FindControl("btnDeleteTask"), System.Web.UI.WebControls.ImageButton)
  273.             //img.Attributes.Add("onclick", "javascript:return confirm('确定要删除任务""" & e.Item.Cells(1).Text & """吗?');")
  274.      }
  275.     protected void dg_Main_ItemCommand(object sender, System.Web.UI.WebControls.DataGridCommandEventArgs e)
  276.     {
  277.         string WF=Request.QueryString["StrN"];
  278.         if (e.CommandName == "Edit")
  279.         {
  280.             Response.Redirect("WorkFlowTaskEdit.aspx?StrM=M&StrN=" + WF + "&StrA=" + e.Item.Cells[0].Text);
  281.         }
  282.         else if (e.CommandName == "Delete")
  283.         {
  284.             int iWFID = Convert.ToInt32(WF);
  285.             int iActID = Convert.ToInt32(e.Item.Cells[0].Text);
  286.             EtongFlyChouWF EFlyWF = new EtongFlyChouWF();
  287.             if (EFlyWF.BlTask(iActID, "ActivityID", "tb_WF_ActIns") == true)
  288.             {
  289.                 this.ClientScript.RegisterStartupScript(this.GetType(), "", "alert('系统提示:本活动正在被使用,不允许删除!');", true);
  290.                 return;
  291.             }
  292.             //this.ClientScript.RegisterStartupScript(this.GetType(), "", "alert('系统提示:本活动正在被使用!');", true);
  293.             //return;
  294.             if (EFlyWF.DelActivity(iWFID, iActID) == true)
  295.             {
  296.                 this.ClientScript.RegisterStartupScript(this.GetType(), "", "alert('系统提示:信息删除成功!');window.location.replace(window.location.href);", true);
  297.             }
  298.             else
  299.             {
  300.                 this.ClientScript.RegisterStartupScript(this.GetType(), "", "alert('系统提示:信息删除失败!');", true);
  301.             }
  302.         }
  303.     }
  304.  
  305.     protected void ImgAdd_Click(object sender, ImageClickEventArgs e)
  306.     {
  307.         string WF=Request.QueryString["StrN"];
  308.         Response.Redirect("WorkFlowTaskEdit.aspx?StrM=N&StrN=" + WF);
  309.     }
  310. }