WorkFlowStart.aspx.cs
上传用户:tiancihang
上传日期:2014-03-12
资源大小:21387k
文件大小:7k
- 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;
- using com.etong.Inform;
- public partial class WorkFlowStart : System.Web.UI.Page
- {
- protected System.Web.UI.WebControls.TextBox LinkTextBoxNewPage;
- protected int iEmpDI = -1;
- protected void Page_Load(object sender, EventArgs e)
- {
-
- try
- {
- CheckUserInfo RoInfo = (CheckUserInfo)Session["checkuserinfo"];
- iEmpDI = RoInfo.EmpID;
- }
- catch
- {
- ClientScript.RegisterStartupScript(this.GetType(), "", "<script>alert('系统提示:您尚未登录或您登录已超时,请重新登录');location.href='../../login.aspx'</script>");
- return;
- }
- if (!IsPostBack)
- {
- EtongFlyChouWF WFFly = new EtongFlyChouWF();
- DataView dv = new DataView();
- dv = WFFly.GetWFStartData(iEmpDI);
- //this.DataGrid1.DataSource = dv;
- //this.DataGrid1.DataBind();
- try
- {
- this.GridView1.PageSize = Convert.ToInt32(System.Configuration.ConfigurationManager.AppSettings["MorePageNum"]);
- }
- catch
- {
- this.GridView1.PageSize = 10;
- }
- this.GridView1.DataSource = dv;
- this.GridView1.DataBind();
- }
- }
- 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.ReadEmpData();
- dv = WFFly.GetWFStartData(iEmpDI);
- GridView1.DataSource = dv;
- GridView1.DataBind();
- //GridView theGrid = sender as GridView; // refer to the GridView
- //int newPageIndex = 0;
- //if (-2 == e.NewPageIndex)
- //{ // when click the "GO" Button
- // TextBox txtNewPageIndex = null;
- // //GridViewRow pagerRow = theGrid.Controls[0].Controls[theGrid.Controls[0].Controls.Count - 1] as GridViewRow; // refer to PagerTemplate
- // GridViewRow pagerRow = theGrid.BottomPagerRow; //GridView较DataGrid提供了更多的API,获取分页块可以使用BottomPagerRow 或者TopPagerRow,当然还增加了HeaderRow和FooterRow
- // //updated at 2006年月日:15:33
- // if (null != pagerRow)
- // {
- // txtNewPageIndex = pagerRow.FindControl("txtNewPageIndex") as TextBox; // refer to the TextBox with the NewPageIndex value
- // }
- // if (null != txtNewPageIndex)
- // {
- // newPageIndex = int.Parse(txtNewPageIndex.Text) - 1; // get the NewPageIndex
- // }
- //}
- //else
- //{ // when click the first, last, previous and next Button
- // newPageIndex = e.NewPageIndex;
- //}
- //// check to prevent form the NewPageIndex out of the range
- //newPageIndex = newPageIndex < 0 ? 0 : newPageIndex;
- //newPageIndex = newPageIndex >= theGrid.PageCount ? theGrid.PageCount - 1 : newPageIndex;
- //// specify the NewPageIndex
- //theGrid.PageIndex = newPageIndex;
- //// rebind the control
- //// in this case of retrieving the data using the xxxDataSoucr control,
- //// just do nothing, because the asp.net engine binds the data automatically
- }
- //protected void Go_Click(object sender, EventArgs e)
- //{
- // int newPageIndex;
- // TextBox txtNewPageIndex;
- // txtNewPageIndex = GridView1.Page.TemplateControl.FindControl("LinkTextBoxNewPage") as TextBox;
- // if (txtNewPageIndex != null)
- // {
- // newPageIndex = Convert.ToInt32(txtNewPageIndex.Text);
- // int currentpageindex = newPageIndex;
- // 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.ReadEmpData();
- // 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';");
- ((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";
- }
- }
-
- }