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

.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.user;
  12. using com.etong.DAL;
  13. public partial class SearchP_StructureAllStatus : System.Web.UI.Page
  14. {
  15.     protected void Page_Load(object sender, EventArgs e)
  16.     {
  17.         if (!IsPostBack)
  18.         {
  19.             int ConID = Convert.ToInt32(Request.QueryString["ConID"]);
  20.             ProjectImplment pi = new ProjectImplment();
  21.             //DataSet ds = project.AllStatusSearch(PrjID);
  22.             DataView dv = pi.GetStructureAllStatus(ConID);
  23.             this.GridView1.DataSource = dv;
  24.             this.GridView1.DataBind();
  25.             if (dv[0]["WFName"].ToString() != "")
  26.             {
  27.                 LB_NowWF.Text = dv[0]["WFName"].ToString();
  28.             }
  29.             if (dv[0]["ConName"].ToString() != "")
  30.             {
  31.                 LB_PrjName.Text = dv[0]["ConName"].ToString();
  32.             }
  33.             //if (ds.Tables[0].Rows[0]["EditUnit"] != "")
  34.             //{
  35.             //    LB_EditUnit.Text = ds.Tables[0].Rows[0]["EditUnit"].ToString();
  36.             //}
  37.             //if (ds.Tables[0].Rows[0]["ProjcetLsh"] != "")
  38.             //{
  39.             //    LB_PrjLsh.Text = ds.Tables[0].Rows[0]["ProjcetLsh"].ToString();
  40.             //}
  41.         }
  42.     }
  43.     protected void GridView1_PageIndexChanging(object sender, GridViewPageEventArgs e)
  44.     {
  45.         int currentpageindex;
  46.         currentpageindex = Convert.ToInt32(e.NewPageIndex);
  47.         if (currentpageindex == -2)
  48.         {
  49.             TextBox txtNewPageIndex;
  50.             txtNewPageIndex = GridView1.BottomPagerRow.FindControl("LinkTextBoxNewPage") as TextBox;
  51.             if (txtNewPageIndex != null)
  52.             {
  53.                 try
  54.                 {
  55.                     currentpageindex = Convert.ToInt32(txtNewPageIndex.Text) - 1;
  56.                 }
  57.                 catch
  58.                 {
  59.                     currentpageindex = 0;
  60.                 }
  61.             }
  62.         }
  63.         currentpageindex = currentpageindex < 0 ? 0 : currentpageindex;
  64.         currentpageindex = currentpageindex >= GridView1.PageCount ? GridView1.PageCount - 1 : currentpageindex;
  65.         GridView1.PageIndex = currentpageindex;
  66.         int ConID = Convert.ToInt32(Request.QueryString["ConID"]);
  67.         //Status project = new Status();
  68.        // DataSet ds = project.AllStatusSearch(PrjID);
  69.         ProjectImplment pi=new ProjectImplment ();
  70.         DataView dv = pi.GetStructureAllStatus(ConID);
  71.        // DataView dv = ds.Tables[0].DefaultView;
  72.         dv.Sort = (string)ViewState["sortFieldName"];
  73.         this.GridView1.DataSource = dv;
  74.         this.GridView1.DataBind();
  75.     }
  76.     protected void GridView1_RowDataBound(object sender, GridViewRowEventArgs e)
  77.     {
  78.         if (e.Row.RowType == DataControlRowType.DataRow)
  79.         {
  80.             int iRow;
  81.             iRow = e.Row.DataItemIndex;
  82.             iRow = iRow % 2;
  83.             if (iRow > 0)
  84.                 e.Row.Attributes.Add("OnMouseOut", "this.style.backgroundColor='#f0f0f0';");
  85.             else
  86.                 e.Row.Attributes.Add("OnMouseOut", "this.style.backgroundColor='White';");
  87.             e.Row.Attributes.Add("OnMouseOver", "this.style.backgroundColor='#E8F2FA';");
  88.             int state;
  89.             int userid;
  90.             //e.Row.Cells[0].Visible = true;
  91.             //HiddenField hid = (HiddenField)e.Row.FindControl("hid");
  92.             if (e.Row.Cells[3].Text != null || e.Row.Cells[3].Text != "")
  93.             {
  94.                 try
  95.                 {
  96.                     state = Convert.ToInt32(e.Row.Cells[3].Text);
  97.                 }
  98.                 catch
  99.                 {
  100.                     state = -1;
  101.                 }
  102.                 switch (state)
  103.                 {
  104.                     case 0:
  105.                         e.Row.Cells[3].Text = "未决策";
  106.                         break;
  107.                     case 1:
  108.                         e.Row.Cells[3].Text = "审核通过";
  109.                         break;
  110.                     case 2:
  111.                         e.Row.Cells[3].Text = "回退";
  112.                         break;
  113.                     case 3:
  114.                         e.Row.Cells[3].Text = "审核通过";
  115.                         break;
  116.                     case 4:
  117.                         e.Row.Cells[3].Text = "作废 ";
  118.                         break;
  119.                     default:
  120.                         e.Row.Cells[3].Text = "未知";
  121.                         break;
  122.                 }
  123.             }
  124.             //e.Row.Cells[0].Visible = false;
  125.             if (e.Row.Cells[1].Text != null || e.Row.Cells[1].Text != "")
  126.             {
  127.                 try
  128.                 {
  129.                     userid = Convert.ToInt32(e.Row.Cells[1].Text);
  130.                 }
  131.                 catch
  132.                 {
  133.                     userid = -1;
  134.                 }
  135.                 Notice user = new Notice();
  136.                 string empname = user.GetEmpName(userid);
  137.                 e.Row.Cells[1].Text = empname;
  138.             }
  139.         }
  140.     }
  141.     protected void GridView1_RowCommand(object sender, GridViewCommandEventArgs e)
  142.     {
  143.         //if (e.CommandName == "save")
  144.         //{
  145.         //    DataKey key = GridView1.DataKeys[Convert.ToInt32(e.CommandArgument)];
  146.         //    int projectid = Convert.ToInt32(key.Value.ToString());
  147.         //    //Session["projectid"] = projectid.ToString();
  148.         //    //EtongFlyChouWFPrj project = new EtongFlyChouWFPrj();
  149.         //    //bool returnvalue = etongzwf.UserPwdUpdata(userid);
  150.         //    ClientScript.RegisterStartupScript(this.GetType(), "", "<script> window.location.href='AllStatus.aspx?ProjectID=" + projectid + "';</script>");
  151.         //    //ClientScript.RegisterStartupScript(this.GetType(), "", "<script>alert('系统提示:密码重置成功,\n          密码为:111111');</script>");
  152.         //}
  153.     }  
  154. }