VehicleWait.aspx.cs
上传用户:simon2hong
上传日期:2021-11-18
资源大小:16746k
文件大小:4k
- using System;
- using System.Data;
- using System.Configuration;
- using System.Collections;
- using System.Collections.Generic;
- 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;
- public partial class Vehicles_VehicleWait : System.Web.UI.Page
- {
- /// <summary>
- /// 模板
- /// </summary>
- Model.CarUse MC = new Model.CarUse();
- /// <summary>
- /// 业务
- /// </summary>
- BLL.CarUse BC = new BLL.CarUse();
- /// <summary>
- /// 查询条件
- /// </summary>
- public string TiaoJian
- {
- get
- {
- if (ViewState["UseThingsTiaoJian"] == null)
- {
- return "";
- }
- else
- {
- return ViewState["UseThingsTiaoJian"].ToString();
- }
- }
- set { ViewState["UseThingsTiaoJian"] = value; }
- }
- protected void Page_Load(object sender, EventArgs e)
- {
- LoginLogic.MatchLoad("../", "Vehicles_VehicleWait");
- if (!IsPostBack)
- {
- TiaoJian = "SYZT = '" + States.SupplyState_Wait + "'";
- //if (Request.QueryString["TiaoJian"] != null)
- //{
- // TiaoJian = Server.UrlDecode(Request.QueryString["TiaoJian"].ToString());
- //}
- object objid = Request.QueryString["id"];
- if (objid != null)
- {
- int ri = int.Parse(objid.ToString());
- TiaoJian += " and CPH = '" + ri.ToString() + "' and convert(varchar(10),KSSJ,120) = '" + DateTime.Now.ToString("yyyy-MM-dd") + "'";
- }
- MyDataBind(1);
- }
- }
- /// <summary>
- /// 获取信息
- /// </summary>
- /// <param name="pidx">页号</param>
- public void MyDataBind(int pidx)
- {
- AspNetPager1.RecordCount = BC.GetCount(TiaoJian);
- bool b_sort = false;
- if (Request.QueryString["id"] != null)
- {
- b_sort = true;
- }
- List<Model.CarUse> LRData = BC.GetPageList(20, pidx, "KSSJ", b_sort, TiaoJian);
- if (LRData.Count == 0)
- {
- Model.CarUse MC = new Model.CarUse();
- LRData.Add(MC);
- }
- GridView1.DataSource = LRData;
- GridView1.DataBind();
- }
- /// <summary>
- /// 车辆类型
- /// </summary>
- /// <returns></returns>
- public string CPH()
- {
- int id = 0;
- if (BC.GetCount(TiaoJian) > 0)
- {
- id = int.Parse(Eval("CPH").ToString());
- }
- return EnumGet.GetCarNumberName(id);
- }
- /// <summary>
- /// 操作
- /// </summary>
- /// <returns></returns>
- public string CaoZuo()
- {
- string Rtstr = "";
- if (BC.GetCount(TiaoJian) > 0)
- {
- string Id = Eval("Id").ToString();
- Rtstr = "<a href='" + "ApplyDetail.aspx?id=" + Id + "'>详细信息</a> ";
- }
- else
- {
- Rtstr = "还没有待批的车辆!";
- }
- return Rtstr;
- }
- protected void AspNetPager1_PageChanging(object src, Wuqi.Webdiyer.PageChangingEventArgs e)
- {
- MyDataBind(e.NewPageIndex);
- }
- protected void GridView1_RowDataBound(object sender, GridViewRowEventArgs e)
- {
- for (int i = 0; i < GridView1.Rows.Count; i++)
- {
- //首先判断是否是数据行
- if (e.Row.RowType == DataControlRowType.DataRow)
- {
- //当鼠标停留时更改背景色
- e.Row.Attributes.Add("onmouseover", "c=this.style.backgroundColor;this.style.backgroundColor='#F0F0F0'");
- //当鼠标移开时还原背景色
- e.Row.Attributes.Add("onmouseout", "this.style.backgroundColor=c");
- }
- }
- }
- }