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

.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_WorkFlowConfigureENew : System.Web.UI.Page
  13. {
  14.     protected void Page_Load(object sender, EventArgs e)
  15.     {
  16.         if (!IsPostBack)
  17.         {
  18.             EtongFlyChouWF EFlyWF = new EtongFlyChouWF();
  19.             DataView dv = new DataView();
  20.             dv=EFlyWF.GetWFKind();
  21.             txtKind.DataSource = dv;
  22.             txtKind.DataTextField = "KindName";
  23.             txtKind.DataValueField = "KindID";
  24.             txtKind.DataBind();
  25.             EtongFlyChouWFPrj EFlyPrj = new EtongFlyChouWFPrj();
  26.             dv =EFlyPrj.GetAllOpRole();
  27.             DLstType.DataTextField = "OpName";
  28.             DLstType.DataValueField = "OpID";
  29.             DLstType.DataSource = dv;
  30.             DLstType.DataBind();
  31.             string strM;
  32.             strM = Request.QueryString["StrM"];
  33.             //修改
  34.             if (strM == "M")
  35.             {
  36.                 int iWFID=0;
  37.                 try
  38.                 {
  39.                     iWFID = Convert.ToInt32(Request.QueryString["StrN"]);
  40.                 }
  41.                 catch
  42.                 {
  43.                     iWFID = -1;
  44.                 }
  45.                 if (iWFID == -1)
  46.                 {
  47.                     this.ClientScript.RegisterStartupScript(this.GetType(), "", "alert('系统提示:参数错误!');window.location.href('WorkFlowConfigure.aspx')", true);
  48.                 }
  49.                 else
  50.                 {
  51.                     dv = EFlyWF.GetWFOldData(iWFID);
  52.                     WFName.Text = dv.Table.Rows[0][2].ToString();
  53.                     txtUnit.Text = dv.Table.Rows[0][5].ToString();
  54.                     txtStatus.SelectedIndex = Convert.ToInt32(dv.Table.Rows[0][4].ToString());
  55.                     txtKind.Text = dv.Table.Rows[0][1].ToString();
  56.                     DLstType.Items.FindByValue(DLstType.SelectedValue).Selected = false;
  57.                     try
  58.                     {
  59.                         DLstType.Items.FindByValue(dv.Table.Rows[0][6].ToString()).Selected = true;
  60.                     }
  61.                     catch
  62.                     {
  63.                     }
  64.                     //txtType.SelectedIndex = Convert.ToInt32(dv.Table.Rows[0][6].ToString());
  65.                     //EFlyPrj.wID = iWFID;
  66.                     //try
  67.                     //{
  68.                     //    DataView wdv = EFlyPrj.GetWFAssignOpRole();
  69.                     //    for (int k = 0; k < wdv.Table.Rows.Count; k++)
  70.                     //    {
  71.                     //        for (int j = 0; j < ChLst.Items.Count; j++)
  72.                     //        {
  73.                     //            if (ChLst.Items[j].Value.ToString().Trim() == wdv.Table.Rows[k]["OpID"].ToString().Trim())
  74.                     //            {
  75.                     //                ChLst.Items[j].Selected = true;
  76.                     //                break;
  77.                     //            }
  78.                     //        }
  79.                     //    }
  80.                     //}
  81.                     //catch (Exception ex)
  82.                     //{
  83.                     //    this.ClientScript.RegisterStartupScript(this.GetType(), "", "<script>alert('" + ex.Message.Replace("'", "").Replace("rn", "").Replace("n", "") + "');</script>");
  84.                     //    return;
  85.                     //}
  86.                     txtDesc.Text = dv.Table.Rows[0][3].ToString();
  87.                     string sTables;
  88.                     sTables = dv.Table.Rows[0][9].ToString();
  89.                     ListValue.Value = sTables;
  90.                     string sValue;
  91.                     int iValue;
  92.                     int i = sTables.Split('|').Length;
  93.                     DataView dv1 = new DataView();
  94.                     ListItem LtItem = new ListItem();
  95.                     for (int j = 0; j < i; j++)
  96.                     {
  97.                         sValue = sTables.Split('|').GetValue(j).ToString();
  98.                         try 
  99.                         {
  100.                             iValue =Convert.ToInt32(sValue);
  101.                         }
  102.                         catch 
  103.                         {
  104.                             iValue =-1;
  105.                         }
  106.                         if (iValue != -1)
  107.                         {
  108.                             dv1 = EFlyWF.GetWFOldTable(iValue, "1");
  109.                             if (dv1.Table.Rows.Count > 0)
  110.                             {
  111.                                 LtItem.Value=sValue;
  112.                                 LtItem.Text=dv1.Table.Rows[0][1].ToString();
  113.                                 lbTables.Items.Add(LtItem);
  114.                                 //lbTables.
  115.                             }
  116.                         }
  117.                     }
  118.                     //for (i = 0; i < sTables.Length; i++)
  119.                     //{
  120.                         //sValue = sTables.Substring(i, sTables.Split('|').Length);
  121.                     //}
  122.                     //lbTables
  123.                 }
  124.             }
  125.             else if (strM == "N")
  126.             {
  127.                
  128.             }
  129.             else
  130.             {
  131.                 this.ClientScript.RegisterStartupScript(this.GetType(), "", "alert('系统提示:参数错误!');window.location.href('WorkFlowConfigure.aspx')", true);
  132.             }
  133.         }
  134.     }
  135.     protected void ImageButton1_Click(object sender, ImageClickEventArgs e)
  136.     {
  137.         //string strSelect="";
  138.         //this.ClientScript.RegisterStartupScript(this.GetType(), "", "window.showModalDialog('WorkFlowSelectTable.aspx','','help=0;dialogWidth=450px;dialogHeight=350px;status=no;status=no;')", true);
  139.         
  140.     }
  141.     protected void ImgSave_Click(object sender, ImageClickEventArgs e)
  142.     {
  143.         string sWFName,sUnit,sStatus,sKind,sType,sTable,sDecs;
  144.         int iStatus,iKind,iType;
  145.         sWFName = WFName.Text;
  146.         sUnit = txtUnit.Text;
  147.         sStatus = txtStatus.SelectedValue;
  148.         sKind = txtKind.SelectedValue;
  149.         sType = DLstType.SelectedValue;
  150.         sTable = ListValue.Value;
  151.         //for (i = 0; i < lbTables.Items.Count; i++)
  152.         //{
  153.         //    if (i == 0)
  154.         //    {
  155.         //        sTable = lbTables.Items[i].Value;
  156.         //    }
  157.         //    else
  158.         //    {
  159.         //        sTable = sTable + "," + lbTables.Items[i].Value;
  160.         //    }
  161.         //}
  162.         sDecs = txtDesc.Text;
  163.         try 
  164.         {
  165.             iStatus = Convert.ToInt32(sStatus);
  166.         }
  167.         catch 
  168.         {
  169.             iStatus=0;
  170.         }
  171.         try 
  172.         {
  173.             iKind = Convert.ToInt32(sKind);
  174.         }
  175.         catch 
  176.         {
  177.             iKind =0;
  178.         }
  179.         try 
  180.         {
  181.             iType = Convert.ToInt32(sType);
  182.         }
  183.         catch 
  184.         {
  185.             iType=0;
  186.         }
  187.         EtongFlyChouWF EFlyWF = new EtongFlyChouWF();
  188.         string strM;
  189.         strM = Request.QueryString["StrM"];
  190.         if (strM == "M")
  191.         {
  192.             int iWFID=0;
  193.             try
  194.             {
  195.                 iWFID = Convert.ToInt32(Request.QueryString["StrN"]);
  196.             }
  197.             catch
  198.             {
  199.                 iWFID = -1;
  200.             }
  201.             if (EFlyWF.InsertUpWF(iWFID, sDecs, sWFName, iStatus, sUnit, iKind, -1, sTable, iType, -1, 0) == true)
  202.             {
  203.                 this.ClientScript.RegisterStartupScript(this.GetType(), "", "alert('系统提示:工作流修改成功!');window.location.href('WorkFlowConfigure.aspx');", true);
  204.             }
  205.             else
  206.             {
  207.                 this.ClientScript.RegisterStartupScript(this.GetType(), "", "alert('系统提示:工作流修改失败!');", true);
  208.             }
  209.         }
  210.         else if (strM == "N")
  211.         {
  212.             if (EFlyWF.InsertUpWF(-1, sDecs, sWFName, iStatus, sUnit, iKind, -1, sTable, iType, -1, 0) == true)
  213.             {
  214.                 this.ClientScript.RegisterStartupScript(this.GetType(), "", "alert('系统提示:工作流新增成功!');window.location.href('WorkFlowConfigure.aspx');", true);
  215.             }
  216.             else
  217.             {
  218.                 this.ClientScript.RegisterStartupScript(this.GetType(), "", "alert('系统提示:工作流新增失败!');", true);
  219.             }
  220.             //this.ClientScript.RegisterStartupScript(this.GetType(), "", "alert(' aaaa ')", true);
  221.         }
  222.         else
  223.         {
  224.             this.ClientScript.RegisterStartupScript(this.GetType(), "", "alert('系统提示:系统参数错!');", true);
  225.         }
  226.     }
  227. }