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

.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 WorkFlowStart : System.Web.UI.Page
  14. {
  15.     protected System.Web.UI.WebControls.TextBox LinkTextBoxNewPage;
  16.     protected int iEmpDI = -1;
  17.     protected void Page_Load(object sender, EventArgs e)
  18.     {
  19.         
  20.         try
  21.         {
  22.             CheckUserInfo RoInfo = (CheckUserInfo)Session["checkuserinfo"];
  23.             iEmpDI = RoInfo.EmpID;
  24.         }
  25.         catch
  26.         {
  27.             ClientScript.RegisterStartupScript(this.GetType(), "", "<script>alert('系统提示:您尚未登录或您登录已超时,请重新登录');location.href='../../login.aspx'</script>");
  28.             return;
  29.         }
  30.         if (!IsPostBack)
  31.         {
  32.             EtongFlyChouWF WFFly = new EtongFlyChouWF();
  33.             DataView dv = new DataView();
  34.             dv = WFFly.GetWFStartData(iEmpDI);
  35.             //this.DataGrid1.DataSource = dv;
  36.             //this.DataGrid1.DataBind();
  37.             try
  38.             {
  39.                 this.GridView1.PageSize = Convert.ToInt32(System.Configuration.ConfigurationManager.AppSettings["MorePageNum"]);
  40.             }
  41.             catch
  42.             {
  43.                 this.GridView1.PageSize = 10;
  44.             }
  45.             this.GridView1.DataSource = dv;
  46.             this.GridView1.DataBind();
  47.         }
  48.     }
  49.     protected string FormatStr(object Objval)
  50.     {
  51.         string retval,strval;
  52.         strval = Convert.ToString(Objval);
  53.     if (strval=="1") retval="已启用";
  54.     else if(strval=="0") retval="已停用";
  55.     else retval="未知状态";
  56.     return retval; 
  57.     }
  58.     protected void GridView1_PageIndexChanging(object sender, GridViewPageEventArgs e)
  59.     {
  60.         int currentpageindex;
  61.         currentpageindex =Convert.ToInt32(e.NewPageIndex);
  62.         if (currentpageindex == -2)
  63.         {
  64.             TextBox txtNewPageIndex;
  65.             txtNewPageIndex = GridView1.BottomPagerRow.FindControl("LinkTextBoxNewPage") as TextBox;
  66.             if (txtNewPageIndex != null)
  67.             {
  68.                 try
  69.                 {
  70.                     currentpageindex = Convert.ToInt32(txtNewPageIndex.Text) - 1;
  71.                 }
  72.                 catch
  73.                 {
  74.                     currentpageindex = 0;
  75.                 }
  76.                 
  77.             }
  78.         }
  79.         currentpageindex = currentpageindex < 0 ? 0 : currentpageindex;
  80.         currentpageindex = currentpageindex >= GridView1.PageCount ? GridView1.PageCount - 1 : currentpageindex;
  81.         GridView1.PageIndex = currentpageindex;
  82.         EtongFlyChouWF WFFly = new EtongFlyChouWF();
  83.         DataView dv = new DataView();
  84.         //dv = WFFly.ReadEmpData();
  85.         dv = WFFly.GetWFStartData(iEmpDI);
  86.         GridView1.DataSource = dv;
  87.         GridView1.DataBind();
  88.         //GridView theGrid = sender as GridView; // refer to the GridView
  89.         //int newPageIndex = 0;
  90.         //if (-2 == e.NewPageIndex)
  91.         //{ // when click the "GO" Button
  92.         //    TextBox txtNewPageIndex = null;
  93.         //    //GridViewRow pagerRow = theGrid.Controls[0].Controls[theGrid.Controls[0].Controls.Count - 1] as GridViewRow; // refer to PagerTemplate
  94.         //    GridViewRow pagerRow = theGrid.BottomPagerRow; //GridView较DataGrid提供了更多的API,获取分页块可以使用BottomPagerRow 或者TopPagerRow,当然还增加了HeaderRow和FooterRow
  95.         //    //updated at 2006年月日:15:33
  96.         //    if (null != pagerRow)
  97.         //    {
  98.         //        txtNewPageIndex = pagerRow.FindControl("txtNewPageIndex") as TextBox;   // refer to the TextBox with the NewPageIndex value
  99.         //    }
  100.         //    if (null != txtNewPageIndex)
  101.         //    {
  102.         //        newPageIndex = int.Parse(txtNewPageIndex.Text) - 1; // get the NewPageIndex
  103.         //    }
  104.         //}
  105.         //else
  106.         //{ // when click the first, last, previous and next Button
  107.         //    newPageIndex = e.NewPageIndex;
  108.         //}
  109.         //// check to prevent form the NewPageIndex out of the range
  110.         //newPageIndex = newPageIndex < 0 ? 0 : newPageIndex;
  111.         //newPageIndex = newPageIndex >= theGrid.PageCount ? theGrid.PageCount - 1 : newPageIndex;
  112.         //// specify the NewPageIndex
  113.         //theGrid.PageIndex = newPageIndex;
  114.         //// rebind the control
  115.         //// in this case of retrieving the data using the xxxDataSoucr control,
  116.         //// just do nothing, because the asp.net engine binds the data automatically
  117.     }
  118.     //protected void Go_Click(object sender, EventArgs e)
  119.     //{
  120.     //    int newPageIndex;
  121.     //    TextBox txtNewPageIndex;
  122.     //    txtNewPageIndex = GridView1.Page.TemplateControl.FindControl("LinkTextBoxNewPage") as TextBox;
  123.     //    if (txtNewPageIndex != null)
  124.     //    {
  125.     //        newPageIndex = Convert.ToInt32(txtNewPageIndex.Text);
  126.     //        int currentpageindex = newPageIndex;
  127.     //        currentpageindex = currentpageindex < 0 ? 0 : currentpageindex;
  128.     //        currentpageindex = currentpageindex >= GridView1.PageCount ? GridView1.PageCount - 1 : currentpageindex;
  129.     //        GridView1.PageIndex = currentpageindex;
  130.     //        EtongFlyChouWF WFFly = new EtongFlyChouWF();
  131.     //        DataView dv = new DataView();
  132.     //        dv = WFFly.ReadEmpData();
  133.     //        GridView1.DataSource = dv;
  134.     //        GridView1.DataBind();
  135.     //    }
  136.     //}
  137.     protected void GridView1_RowDataBound(object sender, GridViewRowEventArgs e)
  138.     {
  139.         if (e.Row.RowType == DataControlRowType.DataRow)
  140.         {
  141.             int iRow;
  142.             iRow = e.Row.DataItemIndex;
  143.             iRow = iRow % 2;
  144.             if (iRow > 0)
  145.                 e.Row.Attributes.Add("OnMouseOut", "this.style.backgroundColor='#f0f0f0';");
  146.             else
  147.                 e.Row.Attributes.Add("OnMouseOut", "this.style.backgroundColor='White';");
  148.             e.Row.Attributes.Add("OnMouseOver", "this.style.backgroundColor='#E8F2FA';");
  149.             ((HyperLink)(e.Row.FindControl("HyperLink1"))).NavigateUrl = Convert.ToString(DataBinder.Eval(e.Row.DataItem, "PageUrl")) + "?&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, "WFID")) + "&WFInstanceID=-1"; 
  150.         }
  151.     }
  152.   
  153. }