StructureStatusSearch.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.user;
  12. using com.etong.DAL;
  13. public partial class Workflow_StructureStatusSearch : System.Web.UI.Page
  14. {
  15.     protected void Page_Load(object sender, EventArgs e)
  16.     {
  17.         if (!IsPostBack)
  18.         {
  19.             ProjectImplment pi = new ProjectImplment();
  20.             DataView dv = pi.GetStructureStatus();
  21.             this.GridView1.DataSource = dv;
  22.             this.GridView1.DataBind();
  23.             //GridView1.Columns[6].Visible = false;
  24.         }
  25.     }
  26.     protected void GridView1_PageIndexChanging(object sender, GridViewPageEventArgs e)
  27.     {
  28.         int currentpageindex;
  29.         currentpageindex = Convert.ToInt32(e.NewPageIndex);
  30.         if (currentpageindex == -2)
  31.         {
  32.             TextBox txtNewPageIndex;
  33.             txtNewPageIndex = GridView1.BottomPagerRow.FindControl("LinkTextBoxNewPage") as TextBox;
  34.             if (txtNewPageIndex != null)
  35.             {
  36.                 try
  37.                 {
  38.                     currentpageindex = Convert.ToInt32(txtNewPageIndex.Text) - 1;
  39.                 }
  40.                 catch
  41.                 {
  42.                     currentpageindex = 0;
  43.                 }
  44.             }
  45.         }
  46.         currentpageindex = currentpageindex < 0 ? 0 : currentpageindex;
  47.         currentpageindex = currentpageindex >= GridView1.PageCount ? GridView1.PageCount - 1 : currentpageindex;
  48.         GridView1.PageIndex = currentpageindex;
  49.         ProjectImplment pi = new ProjectImplment();
  50.         DataView dv = pi.GetStructureStatus();
  51.         dv.Sort = (string)ViewState["sortFieldName"];
  52.         this.GridView1.DataSource = dv;
  53.         this.GridView1.DataBind();
  54.     }
  55.     protected void GridView1_RowDataBound(object sender, GridViewRowEventArgs e)
  56.     {
  57.         if (e.Row.RowType == DataControlRowType.DataRow)
  58.         {
  59.             int iRow;
  60.             iRow = e.Row.DataItemIndex;
  61.             iRow = iRow % 2;
  62.             if (iRow > 0)
  63.                 e.Row.Attributes.Add("OnMouseOut", "this.style.backgroundColor='#f0f0f0';");
  64.             else
  65.                 e.Row.Attributes.Add("OnMouseOut", "this.style.backgroundColor='White';");
  66.             e.Row.Attributes.Add("OnMouseOver", "this.style.backgroundColor='#E8F2FA';");
  67.             int state;
  68.             int userid;
  69.             //e.Row.Cells[0].Visible = true;
  70.             //HiddenField hid = (HiddenField)e.Row.FindControl("hid");
  71.             //if (hid.Value != null || hid.Value != "")
  72.             //{
  73.             //    try
  74.             //    {
  75.             //        state = Convert.ToInt32(hid.Value);
  76.             //    }
  77.             //    catch
  78.             //    {
  79.             //        state = -1;
  80.             //    }
  81.             //    switch (state)
  82.             //    {
  83.             //        case 0:
  84.             //            ((Image)e.Row.FindControl("Image1")).ImageUrl = "Images/green2.gif";
  85.             //            break;
  86.             //        case 1:
  87.             //            ((Image)e.Row.FindControl("Image1")).ImageUrl = "Images/cengse.gif";
  88.             //            break;
  89.             //        case 2:
  90.             //            ((Image)e.Row.FindControl("Image1")).ImageUrl = "Images/zise.gif";
  91.             //            break;
  92.             //        case 3:
  93.             //            ((Image)e.Row.FindControl("Image1")).ImageUrl = "Images/blue.gif";
  94.             //            break;
  95.             //        case 4:
  96.             //            ((Image)e.Row.FindControl("Image1")).ImageUrl = "Images/green.gif";
  97.             //            break;
  98.             //        case 5:
  99.             //            ((Image)e.Row.FindControl("Image1")).ImageUrl = "Images/yellow.gif";
  100.             //            break;
  101.             //        case 6:
  102.             //            ((Image)e.Row.FindControl("Image1")).ImageUrl = "Images/pink.gif";
  103.             //            break;
  104.             //        case 7:
  105.             //            ((Image)e.Row.FindControl("Image1")).ImageUrl = "Images/red.gif";
  106.             //            break;
  107.             //        case 8:
  108.             //            ((Image)e.Row.FindControl("Image1")).ImageUrl = "Images/Dep1.gif";
  109.             //            break;
  110.             //        case 9:
  111.             //            ((Image)e.Row.FindControl("Image1")).ImageUrl = "Images/Dep3.gif";
  112.             //            break;
  113.             //        default:
  114.             //            ((Image)e.Row.FindControl("Image1")).ImageUrl = "Images/rizhi.gif";
  115.             //            break;
  116.             //    }
  117.             //}
  118.             if (e.Row.Cells[4].Text != null || e.Row.Cells[4].Text != "")
  119.             {
  120.                 try
  121.                 {
  122.                     state = Convert.ToInt32(e.Row.Cells[4].Text);
  123.                 }
  124.                 catch
  125.                 {
  126.                     state = -1;
  127.                 }
  128.                 switch (state)
  129.                 {
  130.                     //case 0:
  131.                     //    e.Row.Cells[4].Text = "正常";
  132.                     //    break;
  133.                     case 1:
  134.                         e.Row.Cells[4].Text = "正常流转";
  135.                         break;
  136.                     case 2:
  137.                         e.Row.Cells[4].Text = "结束";
  138.                         break;
  139.                     case 3:
  140.                         e.Row.Cells[4].Text = "作废";
  141.                         break;
  142.                     //case 4:
  143.                     //    e.Row.Cells[4].Text = "竣工";
  144.                     //    break;
  145.                     //case 5:
  146.                     //    e.Row.Cells[4].Text = "完成";
  147.                     //    break;
  148.                     default:
  149.                         e.Row.Cells[4].Text = "未知状态";
  150.                         break;
  151.                 }
  152.             }
  153.             if (e.Row.Cells[2].Text != null || e.Row.Cells[2].Text != "")
  154.             {
  155.                 try
  156.                 {
  157.                     userid = Convert.ToInt32(e.Row.Cells[2].Text);
  158.                 }
  159.                 catch
  160.                 {
  161.                     userid = -1;
  162.                 }
  163.                 Notice user = new Notice();
  164.                 string empname = user.GetEmpName(userid);
  165.                 e.Row.Cells[2].Text = empname;
  166.             }
  167.         }
  168.     }
  169.     protected void GridView1_RowCommand(object sender, GridViewCommandEventArgs e)
  170.     {
  171.         if (e.CommandName == "save")
  172.         {
  173.             DataKey key = GridView1.DataKeys[Convert.ToInt32(e.CommandArgument)];
  174.             int ConID = Convert.ToInt32(key.Value.ToString());
  175.             string sURL = "StructureAllStatus.aspx?ConID=" + ConID.ToString();
  176.             Response.Redirect(sURL);
  177.             //Session["projectid"] = projectid.ToString();
  178.             //EtongFlyChouWFPrj project = new EtongFlyChouWFPrj();
  179.             //bool returnvalue = etongzwf.UserPwdUpdata(userid);
  180.             //ClientScript.RegisterStartupScript(this.GetType(), "", "<script> window.location.href='AllStatus.aspx?ProjectID=" + projectid + "';</script>");
  181.             //ClientScript.RegisterStartupScript(this.GetType(), "", "<script>alert('系统提示:密码重置成功,\n          密码为:111111');</script>");
  182.         }
  183.     }  
  184. }