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

.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_EqFeeCheck : System.Web.UI.Page
  13. {
  14.     protected void Page_Load(object sender, EventArgs e)
  15.     {
  16.         if (!IsPostBack)
  17.         {
  18.             EtongFlyChouWFNM EFlyNM = new EtongFlyChouWFNM();
  19.             try
  20.             {
  21.                 EFlyNM.Prj = Convert.ToInt32(Request.QueryString["sPrjID"]);
  22.             }
  23.             catch
  24.             {
  25.                 this.ClientScript.RegisterStartupScript(this.GetType(), "", "alert('系统提示:参数错误!');window.location.href('ProjectCheck.aspx')", true);
  26.                 return;
  27.             }
  28.             try
  29.             {
  30.                 GridView1.PageSize = Convert.ToInt32(System.Configuration.ConfigurationManager.AppSettings["MorePageNum"]);
  31.             }
  32.             catch
  33.             {
  34.                 GridView1.PageSize = 10;
  35.             }
  36.             DataView dv = EFlyNM.ProEquGetDataByPrj();
  37.             GridView1.DataSource = dv;
  38.             GridView1.DataBind();
  39.         }
  40.     }
  41.     protected void GridView1_PageIndexChanging(object sender, GridViewPageEventArgs e)
  42.     {
  43.         int currentpageindex;
  44.         currentpageindex = Convert.ToInt32(e.NewPageIndex);
  45.         if (currentpageindex == -2)
  46.         {
  47.             TextBox txtNewPageIndex;
  48.             txtNewPageIndex = GridView1.BottomPagerRow.FindControl("LinkTextBoxNewPage") as TextBox;
  49.             if (txtNewPageIndex != null)
  50.             {
  51.                 try
  52.                 {
  53.                     currentpageindex = Convert.ToInt32(txtNewPageIndex.Text) - 1;
  54.                 }
  55.                 catch
  56.                 {
  57.                     currentpageindex = 0;
  58.                 }
  59.             }
  60.         }
  61.         currentpageindex = currentpageindex < 0 ? 0 : currentpageindex;
  62.         currentpageindex = currentpageindex >= GridView1.PageCount ? GridView1.PageCount - 1 : currentpageindex;
  63.         GridView1.PageIndex = currentpageindex;
  64.         EtongFlyChouWFNM EFlyNM = new EtongFlyChouWFNM();
  65.         try
  66.         {
  67.             EFlyNM.Prj = Convert.ToInt32(Request.QueryString["sPrjID"]);
  68.         }
  69.         catch
  70.         {
  71.             this.ClientScript.RegisterStartupScript(this.GetType(), "", "alert('系统提示:参数错误!');window.location.href('ProjectCheck.aspx')", true);
  72.             return;
  73.         }
  74.         DataView dv = EFlyNM.ProEquGetDataByPrj();
  75.         this.GridView1.DataSource = dv;
  76.         this.GridView1.DataBind();
  77.     }
  78.     protected void GridView1_DataBound(object sender, GridViewRowEventArgs e)
  79.     {
  80.         if (e.Row.RowType == DataControlRowType.DataRow)
  81.         {
  82.             int iRow;
  83.             iRow = e.Row.DataItemIndex;
  84.             iRow = iRow % 2;
  85.             if (iRow > 0)
  86.                 e.Row.Attributes.Add("OnMouseOut", "this.style.backgroundColor='#f0f0f0';");
  87.             else
  88.                 e.Row.Attributes.Add("OnMouseOut", "this.style.backgroundColor='White';");
  89.             e.Row.Attributes.Add("OnMouseOver", "this.style.backgroundColor='#E8F2FA';");
  90.             e.Row.Cells[6].Text = GetStatus(e.Row.Cells[6].Text);
  91.             e.Row.Cells[7].Text = GetSstatus(e.Row.Cells[7].Text);
  92.         }
  93.     }
  94.     protected string GetStatus(string status)
  95.     {
  96.         string s="";
  97.         switch (status)
  98.         {
  99.             case "1":
  100.                 s="新增";
  101.                 break;
  102.             case "2":
  103.                 s = "修改";
  104.                 break;
  105.             case "3":
  106.                 s = "删除";
  107.                 break;
  108.             default:
  109.                 s = "未知";
  110.                 break;
  111.         }
  112.         return s;
  113.     }
  114.     protected string GetSstatus(string status)
  115.     {
  116.         string s = "";
  117.         switch (status)
  118.         {
  119.             case "1":
  120.                 s = "在用";
  121.                 break;
  122.             case "2":
  123.                 s = "废弃";
  124.                 break;
  125.             default:
  126.                 s = "未知";
  127.                 break;
  128.         }
  129.         return s;
  130.     }
  131. }