WorkFlowWait.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. using com.etong.Inform;
  13. public partial class WorkFlow_WorkFlowWait : System.Web.UI.Page
  14. {
  15.     protected void Page_Load(object sender, EventArgs e)
  16.     {
  17.         if (!IsPostBack)
  18.         {
  19.             EtongFlyChouWF WFFly = new EtongFlyChouWF();
  20.             DataView dv = new DataView();
  21.             CheckUserInfo UInfo = new CheckUserInfo();
  22.             UInfo = (CheckUserInfo)Session["checkuserinfo"];
  23.             int iUserID;
  24.             try
  25.             {
  26.                 iUserID = Convert.ToInt32(UInfo.UserID);
  27.             }
  28.             catch
  29.             {
  30.                 iUserID = -1;
  31.             }
  32.             int iEmpID;
  33.             try
  34.             {
  35.                 iEmpID = Convert.ToInt32(UInfo.EmpID);
  36.             }
  37.             catch
  38.             {
  39.                 iEmpID = -1;
  40.             }
  41.             EtongFlyChou EFly = new EtongFlyChou();
  42.             int iEmpType = EFly.GetEmpTypeEmp(iEmpID);
  43.             dv = WFFly.GetWFWaitData(iUserID, iUserID, 2, 0, 2,iEmpType);//(iUserID, 1);
  44.             int PageNums;
  45.             try
  46.             {
  47.                 PageNums = Convert.ToInt32(System.Configuration.ConfigurationManager.AppSettings["PageNum"]);
  48.             }
  49.             catch
  50.             {
  51.                 PageNums = 5;
  52.             }
  53.             this.GridView1.PageSize = PageNums; 
  54.             this.GridView1.DataSource = dv;
  55.             this.GridView1.DataBind();
  56.             dv = WFFly.GetWFWaitData(-1, iUserID, -1, 0, 2,iEmpType);
  57.             this.GridView2.PageSize = PageNums;
  58.             this.GridView2.DataSource = dv;
  59.             this.GridView2.DataBind();
  60.         }
  61.     }
  62.     protected string FormatStr(object Objval)
  63.     {
  64.         string retval, strval;
  65.         strval = Convert.ToString(Objval);
  66.         if (strval == "1") retval = "已启用";
  67.         else if (strval == "0") retval = "已停用";
  68.         else retval = "未知状态";
  69.         return retval;
  70.     }
  71.     protected void GridView1_PageIndexChanging(object sender, GridViewPageEventArgs e)
  72.     {
  73.         int currentpageindex;
  74.         currentpageindex = Convert.ToInt32(e.NewPageIndex);
  75.         if (currentpageindex == -2)
  76.         {
  77.             TextBox txtNewPageIndex;
  78.             txtNewPageIndex = GridView1.BottomPagerRow.FindControl("LinkTextBoxNewPage") as TextBox;
  79.             if (txtNewPageIndex != null)
  80.             {
  81.                 try
  82.                 {
  83.                     currentpageindex = Convert.ToInt32(txtNewPageIndex.Text) - 1;
  84.                 }
  85.                 catch
  86.                 {
  87.                     currentpageindex = 0;
  88.                 }
  89.             }
  90.         }
  91.         currentpageindex = currentpageindex < 0 ? 0 : currentpageindex;
  92.         currentpageindex = currentpageindex >= GridView1.PageCount ? GridView1.PageCount - 1 : currentpageindex;
  93.         GridView1.PageIndex = currentpageindex;
  94.         EtongFlyChouWF WFFly = new EtongFlyChouWF();
  95.         DataView dv = new DataView();
  96.         CheckUserInfo UInfo = new CheckUserInfo();
  97.         UInfo = (CheckUserInfo)Session["checkuserinfo"];
  98.         int iUserID;
  99.         try
  100.         {
  101.             iUserID = Convert.ToInt32(UInfo.UserID);
  102.         }
  103.         catch
  104.         {
  105.             iUserID = -1;
  106.         }
  107.         int iEmpID;
  108.         try
  109.         {
  110.             iEmpID = Convert.ToInt32(UInfo.EmpID);
  111.         }
  112.         catch
  113.         {
  114.             iEmpID = -1;
  115.         }
  116.         EtongFlyChou EFly = new EtongFlyChou();
  117.         int iEmpType = EFly.GetEmpTypeEmp(iEmpID);
  118.         dv = WFFly.GetWFWaitData(iUserID, iUserID, 2, 0, 2,iEmpType);
  119.         GridView1.DataSource = dv;
  120.         GridView1.DataBind();
  121.      }
  122.     protected void GridView2_PageIndexChanging(object sender, GridViewPageEventArgs e)
  123.     {
  124.         int currentpageindex;
  125.         currentpageindex = Convert.ToInt32(e.NewPageIndex);
  126.         if (currentpageindex == -2)
  127.         {
  128.             TextBox txtNewPageIndex;
  129.             txtNewPageIndex = GridView2.BottomPagerRow.FindControl("LinkTextBoxNewPage") as TextBox;
  130.             if (txtNewPageIndex != null)
  131.             {
  132.                 try
  133.                 {
  134.                     currentpageindex = Convert.ToInt32(txtNewPageIndex.Text) - 1;
  135.                 }
  136.                 catch
  137.                 {
  138.                     currentpageindex = 0;
  139.                 }
  140.             }
  141.         }
  142.         currentpageindex = currentpageindex < 0 ? 0 : currentpageindex;
  143.         currentpageindex = currentpageindex >= GridView2.PageCount ? GridView2.PageCount - 1 : currentpageindex;
  144.         GridView2.PageIndex = currentpageindex;
  145.         EtongFlyChouWF WFFly = new EtongFlyChouWF();
  146.         DataView dv = new DataView();
  147.         CheckUserInfo UInfo = new CheckUserInfo();
  148.         UInfo = (CheckUserInfo)Session["checkuserinfo"];
  149.         int iUserID;
  150.         try
  151.         {
  152.             iUserID = Convert.ToInt32(UInfo.UserID);
  153.         }
  154.         catch
  155.         {
  156.             iUserID = -1;
  157.         }
  158.         int iEmpID;
  159.         try
  160.         {
  161.             iEmpID = Convert.ToInt32(UInfo.EmpID);
  162.         }
  163.         catch
  164.         {
  165.             iEmpID = -1;
  166.         }
  167.         EtongFlyChou EFly = new EtongFlyChou();
  168.         int iEmpType = EFly.GetEmpTypeEmp(iEmpID);
  169.         dv = WFFly.GetWFWaitData(-1, iUserID, 2, 0, 2,iEmpType);
  170.         GridView2.DataSource = dv;
  171.         GridView2.DataBind();
  172.     }
  173.     protected void GridView1_RowDataBound(object sender, GridViewRowEventArgs e)
  174.     {
  175.         if (e.Row.RowType == DataControlRowType.DataRow)
  176.         {
  177.             int iRow;
  178.             iRow = e.Row.DataItemIndex;
  179.             iRow = iRow % 2;
  180.             if (iRow > 0)
  181.                 e.Row.Attributes.Add("OnMouseOut", "this.style.backgroundColor='#f0f0f0';");
  182.             else
  183.                 e.Row.Attributes.Add("OnMouseOut", "this.style.backgroundColor='White';");
  184.             e.Row.Attributes.Add("OnMouseOver", "this.style.backgroundColor='#E8F2FA';");
  185.             ((HyperLink)(e.Row.FindControl("HyperLink1"))).NavigateUrl = Convert.ToString(DataBinder.Eval(e.Row.DataItem, "PageUrl")).Trim() + "?MustChooseItem=" + Convert.ToString(DataBinder.Eval(e.Row.DataItem, "MustChooseItem")) + "&ActivityID=" + Convert.ToString(DataBinder.Eval(e.Row.DataItem, "ActivityID")) + "&WFID=" + Convert.ToString(DataBinder.Eval(e.Row.DataItem, "WorkFlowID")) +
  186.                 "&WFInstanceID=" + Convert.ToString(DataBinder.Eval(e.Row.DataItem, "WFInstanceID")) + "&ActID=" + Convert.ToString(DataBinder.Eval(e.Row.DataItem, "ActID"));
  187.   }//NavigateUrl='WFTaskBrowse.aspx?AssID=<%# DataBinder.Eval(Container,"DataItem.AssID") %>'
  188.     }
  189.     protected void GridView2_RowDataBound(object sender, GridViewRowEventArgs e)
  190.     {
  191.         if (e.Row.RowType == DataControlRowType.DataRow)
  192.         {
  193.             int iRow;
  194.             iRow = e.Row.DataItemIndex;
  195.             iRow = iRow % 2;
  196.             if (iRow>0)
  197.                 e.Row.Attributes.Add("OnMouseOut", "this.style.backgroundColor='#f0f0f0';");
  198.             else
  199.                 e.Row.Attributes.Add("OnMouseOut", "this.style.backgroundColor='White';");
  200.             e.Row.Attributes.Add("OnMouseOver", "this.style.backgroundColor='#E8F2FA';");
  201.             ((HyperLink)(e.Row.FindControl("HyperLink1"))).NavigateUrl = Convert.ToString(DataBinder.Eval(e.Row.DataItem, "PageUrl")).Trim() + "?MustChooseItem=" + Convert.ToString(DataBinder.Eval(e.Row.DataItem, "MustChooseItem")) + "&ActivityID=" + Convert.ToString(DataBinder.Eval(e.Row.DataItem, "ActivityID")) + "&WFID=" + Convert.ToString(DataBinder.Eval(e.Row.DataItem, "WorkFlowID")) +
  202.                 "&WFInstanceID=" + Convert.ToString(DataBinder.Eval(e.Row.DataItem, "WFInstanceID")) + "&ActID=" + Convert.ToString(DataBinder.Eval(e.Row.DataItem, "ActID"));
  203.         }
  204.     }
  205.     //protected void Go_Click(object sender, EventArgs e)
  206.     //{
  207.     //    int newPageIndex;
  208.     //    TextBox txtNewPageIndex;
  209.     //    txtNewPageIndex = GridView1.Page.TemplateControl.FindControl("LinkTextBoxNewPage") as TextBox;
  210.     //    if (txtNewPageIndex != null)
  211.     //    {
  212.     //        newPageIndex = Convert.ToInt32(txtNewPageIndex.Text);
  213.     //        int currentpageindex = newPageIndex;
  214.     //        currentpageindex = currentpageindex < 0 ? 0 : currentpageindex;
  215.     //        currentpageindex = currentpageindex >= GridView1.PageCount ? GridView1.PageCount - 1 : currentpageindex;
  216.     //        GridView1.PageIndex = currentpageindex;
  217.     //        EtongFlyChouWF WFFly = new EtongFlyChouWF();
  218.     //        DataView dv = new DataView();
  219.     //        dv = WFFly.ReadEmpData();
  220.     //        GridView1.DataSource = dv;
  221.     //        GridView1.DataBind();
  222.     //    }
  223.     //}
  224.  
  225. }