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