AllStatus.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.BusinessRule.Zwf;
  13. public partial class SearchP_AllStatus : System.Web.UI.Page
  14. {
  15.     protected void Page_Load(object sender, EventArgs e)
  16.     {
  17.         if (!IsPostBack)
  18.         {
  19.             GridViewDateBind();
  20.         }
  21.     }
  22.     protected void GridViewDateBind()
  23.     {
  24.         int PrjID = -1;
  25.         int TypeID = -1;
  26.         try
  27.         {
  28.             PrjID = Convert.ToInt32(Request.QueryString["projectid"]);
  29.             TypeID = Convert.ToInt32(Request.QueryString["typeid"]);
  30.         }
  31.         catch
  32.         {
  33.             ClientScript.RegisterStartupScript(this.GetType(), "", "<script>alert('系统提示:参数传递失败,请重试!');</script>");
  34.             return;
  35.         }
  36.         DataView dv = null;
  37.         EtongZwf etongzwf = new EtongZwf();
  38.      
  39.         switch (TypeID)
  40.         {
  41.             case 1:         //项目计划
  42.                 dv = etongzwf.AllStatusSearch(PrjID);
  43.                 if (dv.Count > 0)
  44.                 {
  45.                     if (dv[0]["WFName"].ToString().Trim() != "")
  46.                     {
  47.                         LB_NowWF.Text = dv[0]["WFName"].ToString();
  48.                     }
  49.                     if (dv[0]["ProjectName"].ToString().Trim() != "")
  50.                     {
  51.                         LB_PrjName.Text = dv[0]["ProjectName"].ToString();
  52.                     }
  53.                 }
  54.                 break;
  55.             case 2:         //变更
  56.                 dv = etongzwf.AllStatusSearchPrjAlert(PrjID);
  57.                 if (dv.Count > 0)
  58.                 {
  59.                     if (dv[0]["WFName"].ToString().Trim() != "")
  60.                     {
  61.                         LB_NowWF.Text = dv[0]["WFName"].ToString();
  62.                     }
  63.                     if (dv[0]["AlertName"].ToString().Trim() != "")
  64.                     {
  65.                         LB_PrjName.Text = dv[0]["AlertName"].ToString();
  66.                     }
  67.                 }
  68.                 break;
  69.             default:
  70.                 break;
  71.         }
  72.         dv.Sort = (string)ViewState["sortFieldName"];
  73.         this.GridView1.DataSource = dv;
  74.         this.GridView1.DataBind();
  75.     }
  76.     protected void GridView1_PageIndexChanging(object sender, GridViewPageEventArgs e)
  77.     {
  78.         int currentpageindex;
  79.         currentpageindex = Convert.ToInt32(e.NewPageIndex);
  80.         if (currentpageindex == -2)
  81.         {
  82.             TextBox txtNewPageIndex;
  83.             txtNewPageIndex = GridView1.BottomPagerRow.FindControl("LinkTextBoxNewPage") as TextBox;
  84.             if (txtNewPageIndex != null)
  85.             {
  86.                 try
  87.                 {
  88.                     currentpageindex = Convert.ToInt32(txtNewPageIndex.Text) - 1;
  89.                 }
  90.                 catch
  91.                 {
  92.                     currentpageindex = 0;
  93.                 }
  94.             }
  95.         }
  96.         currentpageindex = currentpageindex < 0 ? 0 : currentpageindex;
  97.         currentpageindex = currentpageindex >= GridView1.PageCount ? GridView1.PageCount - 1 : currentpageindex;
  98.         GridView1.PageIndex = currentpageindex;
  99.         //int PrjID = Convert.ToInt32(Request.QueryString["projectid"]);
  100.        // Status project = new Status();
  101.        // DataSet ds = project.AllStatusSearch(PrjID);
  102.        // DataView dv = ds.Tables[0].DefaultView;
  103.         GridViewDateBind();
  104.       
  105.     }
  106.     protected void GridView1_RowDataBound(object sender, GridViewRowEventArgs e)
  107.     {
  108.         if (e.Row.RowType == DataControlRowType.DataRow)
  109.         {
  110.             int iRow;
  111.             iRow = e.Row.DataItemIndex;
  112.             iRow = iRow % 2;
  113.             if (iRow > 0)
  114.                 e.Row.Attributes.Add("OnMouseOut", "this.style.backgroundColor='#f0f0f0';");
  115.             else
  116.                 e.Row.Attributes.Add("OnMouseOut", "this.style.backgroundColor='White';");
  117.             e.Row.Attributes.Add("OnMouseOver", "this.style.backgroundColor='#E8F2FA';");
  118.             int state;
  119.             int userid;
  120.             //e.Row.Cells[0].Visible = true;
  121.             //HiddenField hid = (HiddenField)e.Row.FindControl("hid");
  122.             if (e.Row.Cells[3].Text!=null||e.Row.Cells[3].Text!="")
  123.             {
  124.                 try
  125.                 {
  126.                     state = Convert.ToInt32(e.Row.Cells[3].Text);
  127.                 }
  128.                 catch
  129.                 {
  130.                     state = -1;
  131.                 }
  132.                 switch (state)
  133.                 {
  134.                     case 0:
  135.                         e.Row.Cells[3].Text="未决策";
  136.                         break;
  137.                     case 1:
  138.                         e.Row.Cells[3].Text="审核通过";
  139.                         break;
  140.                     case 2:
  141.                         e.Row.Cells[3].Text="回退";
  142.                         break;
  143.                     case 3:
  144.                         e.Row.Cells[3].Text = "审核通过";
  145.                         break;
  146.                     case 4:
  147.                         e.Row.Cells[3].Text = "作废 ";
  148.                         break;
  149.                     default:
  150.                         e.Row.Cells[3].Text = "未知";
  151.                         break;
  152.                 }
  153.             }
  154.             //e.Row.Cells[0].Visible = false;
  155.             if (e.Row.Cells[1].Text != null || e.Row.Cells[1].Text != "")
  156.             {
  157.                 try
  158.                 {
  159.                     userid = Convert.ToInt32(e.Row.Cells[1].Text);
  160.                 }
  161.                 catch
  162.                 {
  163.                     userid = -1;
  164.                 }
  165.                 Notice user = new Notice();
  166.                 string empname = user.GetEmpName(userid);
  167.                 e.Row.Cells[1].Text = empname;
  168.             }
  169.         }
  170.     }
  171.     protected void GridView1_RowCommand(object sender, GridViewCommandEventArgs e)
  172.     {
  173.         //if (e.CommandName == "save")
  174.         //{
  175.         //    DataKey key = GridView1.DataKeys[Convert.ToInt32(e.CommandArgument)];
  176.         //    int projectid = Convert.ToInt32(key.Value.ToString());
  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. }