CheStatusSearch.aspx.cs
上传用户:tiancihang
上传日期:2014-03-12
资源大小:21387k
文件大小:9k
- 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.user;
- public partial class SearchP_Status : System.Web.UI.Page
- {
- protected void Page_Load(object sender, EventArgs e)
- {
- if (!IsPostBack)
- {
- Status project = new Status();
- DataView dv = project.StatusSearch1();
- this.GridView1.DataSource = dv;
- this.GridView1.DataBind();
- //GridView1.Columns[6].Visible = false;
- }
- }
- 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;
- Status project = new Status();
- DataView dv = project.StatusSearch1();
- dv.Sort = (string)ViewState["sortFieldName"];
- this.GridView1.DataSource = dv;
- this.GridView1.DataBind();
-
- }
- protected void GridView1_RowDataBound(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';");
- int state = -1;
- int userid;
- //e.Row.Cells[0].Visible = true;
- //HiddenField hid = (HiddenField)e.Row.FindControl("hid");
- //if (hid.Value!=null||hid.Value!="")
- //{
- // try
- // {
- // state = Convert.ToInt32(hid.Value);
- // }
- // catch
- // {
- // state = -1;
- // }
- // switch (state)
- // {
- // case 0:
- // ((Image)e.Row.FindControl("Image1")).ImageUrl = "Images/green2.gif";
- // break;
- // case 1:
- // ((Image)e.Row.FindControl("Image1")).ImageUrl = "Images/cengse.gif";
- // break;
- // case 2:
- // ((Image)e.Row.FindControl("Image1")).ImageUrl = "Images/zise.gif";
- // break;
- // case 3:
- // ((Image)e.Row.FindControl("Image1")).ImageUrl = "Images/blue.gif";
- // break;
- // case 4:
- // ((Image)e.Row.FindControl("Image1")).ImageUrl = "Images/green.gif";
- // break;
- // case 5:
- // ((Image)e.Row.FindControl("Image1")).ImageUrl = "Images/yellow.gif";
- // break;
- // case 6:
- // ((Image)e.Row.FindControl("Image1")).ImageUrl = "Images/pink.gif";
- // break;
- // case 7:
- // ((Image)e.Row.FindControl("Image1")).ImageUrl = "Images/red.gif";
- // break;
- // case 8:
- // ((Image)e.Row.FindControl("Image1")).ImageUrl = "Images/Dep1.gif";
- // break;
- // case 9:
- // ((Image)e.Row.FindControl("Image1")).ImageUrl = "Images/Dep3.gif";
- // break;
- // default:
- // ((Image)e.Row.FindControl("Image1")).ImageUrl = "Images/rizhi.gif";
- // break;
- // }
- //if (e.Row.Cells[5].Text != null || e.Row.Cells[5].Text != "")
- //{
- // try
- // {
- // state = Convert.ToInt32(e.Row.Cells[5].Text);
- // }
- // catch
- // {
- // state = -1;
- // }
- // switch (state)
- // {
- // case 0:
- // e.Row.Cells[6].Text = "正常";
- // break;
- // case 1:
- // e.Row.Cells[6].Text = "项目申请完成";
- // break;
- // case 2:
- // e.Row.Cells[6].Text = "作废";
- // break;
- // case 3:
- // e.Row.Cells[6].Text = "施工";
- // break;
- // case 4:
- // e.Row.Cells[6].Text = "竣工";
- // break;
- // case 5:
- // e.Row.Cells[6].Text = "完成";
- // break;
- // default:
- // e.Row.Cells[6].Text = "未知状态";
- // break;
- // }
- //}
- if (e.Row.Cells[4].Text != null || e.Row.Cells[4].Text != "")
- {
- try
- {
- state = Convert.ToInt32(e.Row.Cells[4].Text);
- }
- catch
- {
- state = -1;
- }
- switch (state)
- {
- case 0:
- e.Row.Cells[4].Text = "正常";
- break;
- case 1:
- e.Row.Cells[4].Text = "项目申请完成";
- break;
- case 2:
- e.Row.Cells[4].Text = "作废";
- break;
- case 3:
- e.Row.Cells[4].Text = "施工";
- break;
- case 4:
- e.Row.Cells[4].Text = "竣工";
- break;
- case 5:
- e.Row.Cells[4].Text = "完成";
- break;
- default:
- e.Row.Cells[4].Text = "未知状态";
- break;
- }
- }
- if (e.Row.Cells[2].Text != null || e.Row.Cells[2].Text != "")
- {
- try
- {
- userid = Convert.ToInt32(e.Row.Cells[2].Text);
- }
- catch
- {
- userid = -1;
- }
- Notice user = new Notice();
- string empname = user.GetEmpName(userid);
- e.Row.Cells[2].Text = empname;
- }
- }
- }
-
- protected void GridView1_RowCommand(object sender, GridViewCommandEventArgs e)
- {
- if (e.CommandName == "save")
- {
- DataKey key = GridView1.DataKeys[Convert.ToInt32(e.CommandArgument)];
- int projectid = Convert.ToInt32(key.Value.ToString());
- string sURL = "CheAllStatus.aspx?ProjectID=" + projectid.ToString();
- Response.Redirect(sURL);
- //Session["projectid"] = projectid.ToString();
- //EtongFlyChouWFPrj project = new EtongFlyChouWFPrj();
- //bool returnvalue = etongzwf.UserPwdUpdata(userid);
- //ClientScript.RegisterStartupScript(this.GetType(), "", "<script> window.location.href='AllStatus.aspx?ProjectID=" + projectid + "';</script>");
- //ClientScript.RegisterStartupScript(this.GetType(), "", "<script>alert('系统提示:密码重置成功,\n 密码为:111111');</script>");
- }
- }
- }