ProjectCheck.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.DAL.FC;
  12. public partial class Project_ProjectCheck : System.Web.UI.Page
  13. {
  14.     protected void Page_Load(object sender, EventArgs e)
  15.     {
  16.         if (!IsPostBack)
  17.         {
  18.             try
  19.             {
  20.                 GridView1.PageSize = Convert.ToInt32(System.Configuration.ConfigurationManager.AppSettings["MorePageNum"]);
  21.             }
  22.             catch
  23.             {
  24.                 GridView1.PageSize = 10;
  25.             }
  26.             EtongFlyChouWFPrj EFlyPrj = new EtongFlyChouWFPrj();
  27.             EFlyPrj.PrjStatus = -1;
  28.             EFlyPrj.PrjType = -1;
  29.             DataView dv = EFlyPrj.PrjQuery();
  30.             GridView1.DataSource = dv;
  31.             GridView1.DataBind();
  32.         }
  33.     }
  34.     protected void GridView1_PageIndexChanging(object sender, GridViewPageEventArgs e)
  35.     {
  36.         int currentpageindex;
  37.         currentpageindex = Convert.ToInt32(e.NewPageIndex);
  38.         if (currentpageindex == -2)
  39.         {
  40.             TextBox txtNewPageIndex;
  41.             txtNewPageIndex = GridView1.BottomPagerRow.FindControl("LinkTextBoxNewPage") as TextBox;
  42.             if (txtNewPageIndex != null)
  43.             {
  44.                 try
  45.                 {
  46.                     currentpageindex = Convert.ToInt32(txtNewPageIndex.Text) - 1;
  47.                 }
  48.                 catch
  49.                 {
  50.                     currentpageindex = 0;
  51.                 }
  52.             }
  53.         }
  54.         currentpageindex = currentpageindex < 0 ? 0 : currentpageindex;
  55.         currentpageindex = currentpageindex >= GridView1.PageCount ? GridView1.PageCount - 1 : currentpageindex;
  56.         GridView1.PageIndex = currentpageindex;
  57.         EtongFlyChouWFPrj EFlyPrj = new EtongFlyChouWFPrj();
  58.         EFlyPrj.PrjType = Convert.ToInt32(this.RListType.SelectedValue.ToString());
  59.         EFlyPrj.PrjStatus = Convert.ToInt32(this.RListStatus.SelectedValue.ToString());
  60.         DataView dv = EFlyPrj.PrjQuery();
  61.         dv.Sort = (string)ViewState["sortFieldName"];
  62.         this.GridView1.DataSource = dv;
  63.         this.GridView1.DataBind();
  64.     }
  65.     protected void GridView1_RowDataBound(object sender, GridViewRowEventArgs e)
  66.     {
  67.         if (e.Row.RowType == DataControlRowType.DataRow)
  68.         {
  69.             int iRow;
  70.             iRow = e.Row.DataItemIndex;
  71.             iRow = iRow % 2;
  72.             if (iRow > 0)
  73.                 e.Row.Attributes.Add("OnMouseOut", "this.style.backgroundColor='#f0f0f0';");
  74.             else
  75.                 e.Row.Attributes.Add("OnMouseOut", "this.style.backgroundColor='White';");
  76.             e.Row.Attributes.Add("OnMouseOver", "this.style.backgroundColor='#E8F2FA';");
  77.             int state;
  78.             int projectsort;
  79.             if (e.Row.Cells[7].Text != null || e.Row.Cells[7].Text != "")
  80.             {
  81.                 try
  82.                 {
  83.                     state = Convert.ToInt32(e.Row.Cells[7].Text);
  84.                 }
  85.                 catch
  86.                 {
  87.                     state = -1;
  88.                 }
  89.                 switch (state)
  90.                 {
  91.                     case 0:
  92.                         e.Row.Cells[7].Text = "正常";
  93.                         break;
  94.                     case 1:
  95.                         e.Row.Cells[7].Text = "申请完成";
  96.                         break;
  97.                     case 2:
  98.                         e.Row.Cells[7].Text = "作废";
  99.                         break;
  100.                     case 3:
  101.                         e.Row.Cells[7].Text = "施工";
  102.                         break;
  103.                     case 4:
  104.                         e.Row.Cells[7].Text = "竣工";
  105.                         break;
  106.                     case 5:
  107.                         e.Row.Cells[7].Text = "完成";
  108.                         break;
  109.                     default:
  110.                         e.Row.Cells[7].Text = "未知";
  111.                         break;
  112.                 }
  113.                 try
  114.                 {
  115.                     projectsort = Convert.ToInt32(e.Row.Cells[3].Text);
  116.                 }
  117.                 catch
  118.                 {
  119.                     projectsort = -1;
  120.                 }
  121.                 switch (projectsort)
  122.                 {
  123.                     case 1:
  124.                         e.Row.Cells[3].Text = "生产类";
  125.                         break;
  126.                     case 2:
  127.                         e.Row.Cells[3].Text = "科技类";
  128.                         break;
  129.                     case 3:
  130.                         e.Row.Cells[3].Text = "营销类";
  131.                         break;
  132.                     default:
  133.                         e.Row.Cells[3].Text = "未知";
  134.                         break;
  135.                 }
  136.             }
  137.         }
  138.     }
  139.     protected void GridView1_RowCommand(object sender, GridViewCommandEventArgs e)
  140.     {
  141.         string sPrjID = Convert.ToString(e.CommandArgument);
  142.         string sURL;
  143.         if (e.CommandName == "Eq")
  144.         {
  145.             sURL = "EqFeeCheck.aspx?sPrjID=" + sPrjID;
  146.             Response.Redirect(sURL);
  147.         }
  148.         if (e.CommandName == "Mat")
  149.         {
  150.             sURL = "MatFeeCheck.aspx?sPrjID=" + sPrjID;
  151.             Response.Redirect(sURL);
  152.         }
  153.         if (e.CommandName == "Other")
  154.         {
  155.             sURL = "OtherFeeCheck.aspx?sPrjID=" + sPrjID;
  156.             Response.Redirect(sURL);
  157.         }
  158.     }
  159.     protected void imgSearch_Click(object sender, ImageClickEventArgs e)
  160.     {
  161.         EtongFlyChouWFPrj EFlyPrj = new EtongFlyChouWFPrj();
  162.         EFlyPrj.PrjStatus = Convert.ToInt32(RListStatus.SelectedValue);
  163.         EFlyPrj.PrjType = Convert.ToInt32(RListType.SelectedValue);
  164.         DataView dv = EFlyPrj.PrjQuery();
  165.         GridView1.DataSource = dv;
  166.         GridView1.DataBind();
  167.     }
  168. }