MatFeeCheck.aspx.cs
上传用户:tiancihang
上传日期:2014-03-12
资源大小:21387k
文件大小:4k
- using System;
- using System.Data;
- using System.Configuration;
- using System.Collections;
- using System.Web;
- using System.Web.Security;
- using System.Web.UI;
- using System.Web.UI.WebControls;
- using System.Web.UI.WebControls.WebParts;
- using System.Web.UI.HtmlControls;
- using com.etong.DAL.FC;
- public partial class Project_MatFeeCheck : System.Web.UI.Page
- {
- protected void Page_Load(object sender, EventArgs e)
- {
- if (!IsPostBack)
- {
- EtongFlyChouWFNM EFlyNM = new EtongFlyChouWFNM();
- try
- {
- EFlyNM.Prj = Convert.ToInt32(Request.QueryString["sPrjID"]);
- }
- catch
- {
- this.ClientScript.RegisterStartupScript(this.GetType(), "", "alert('系统提示:参数错误!');window.location.href('ProjectCheck.aspx')", true);
- return;
- }
- try
- {
- GridView1.PageSize = Convert.ToInt32(System.Configuration.ConfigurationManager.AppSettings["MorePageNum"]);
- }
- catch
- {
- GridView1.PageSize = 10;
- }
- DataView dv = EFlyNM.ProMaterialGetByPrj();
- GridView1.DataSource = dv;
- GridView1.DataBind();
- }
- }
- protected void GridView1_PageIndexChanging(object sender, GridViewPageEventArgs e)
- {
- int currentpageindex;
- currentpageindex = Convert.ToInt32(e.NewPageIndex);
- if (currentpageindex == -2)
- {
- TextBox txtNewPageIndex;
- txtNewPageIndex = GridView1.BottomPagerRow.FindControl("LinkTextBoxNewPage") as TextBox;
- if (txtNewPageIndex != null)
- {
- try
- {
- currentpageindex = Convert.ToInt32(txtNewPageIndex.Text) - 1;
- }
- catch
- {
- currentpageindex = 0;
- }
- }
- }
- currentpageindex = currentpageindex < 0 ? 0 : currentpageindex;
- currentpageindex = currentpageindex >= GridView1.PageCount ? GridView1.PageCount - 1 : currentpageindex;
- GridView1.PageIndex = currentpageindex;
- EtongFlyChouWFNM EFlyNM = new EtongFlyChouWFNM();
- try
- {
- EFlyNM.Prj = Convert.ToInt32(Request.QueryString["sPrjID"]);
- }
- catch
- {
- this.ClientScript.RegisterStartupScript(this.GetType(), "", "alert('系统提示:参数错误!');window.location.href('ProjectCheck.aspx')", true);
- return;
- }
- DataView dv = EFlyNM.ProMaterialGetByPrj();
- this.GridView1.DataSource = dv;
- this.GridView1.DataBind();
- }
- protected void GridView1_DataBound(object sender, GridViewRowEventArgs e)
- {
- if (e.Row.RowType == DataControlRowType.DataRow)
- {
- int iRow;
- iRow = e.Row.DataItemIndex;
- iRow = iRow % 2;
- if (iRow > 0)
- e.Row.Attributes.Add("OnMouseOut", "this.style.backgroundColor='#f0f0f0';");
- else
- e.Row.Attributes.Add("OnMouseOut", "this.style.backgroundColor='White';");
- e.Row.Attributes.Add("OnMouseOver", "this.style.backgroundColor='#E8F2FA';");
- e.Row.Cells[8].Text = GetStatus(e.Row.Cells[8].Text);
- e.Row.Cells[9].Text = GetSstatus(e.Row.Cells[9].Text);
- }
- }
- protected string GetStatus(string status)
- {
- string s = "";
- switch (status)
- {
- case "1":
- s = "新增";
- break;
- case "2":
- s = "修改";
- break;
- case "3":
- s = "删除";
- break;
- default:
- s = "未知";
- break;
- }
- return s;
- }
- protected string GetSstatus(string status)
- {
- string s = "";
- switch (status)
- {
- case "1":
- s = "在用";
- break;
- case "2":
- s = "废弃";
- break;
- default:
- s = "未知";
- break;
- }
- return s;
- }
- }