VehicleWait.aspx.cs
上传用户:simon2hong
上传日期:2021-11-18
资源大小:16746k
文件大小:4k
源码类别:

OA系统

开发平台:

C#

  1. using System;
  2. using System.Data;
  3. using System.Configuration;
  4. using System.Collections;
  5. using System.Collections.Generic;
  6. using System.Web;
  7. using System.Web.Security;
  8. using System.Web.UI;
  9. using System.Web.UI.WebControls;
  10. using System.Web.UI.WebControls.WebParts;
  11. using System.Web.UI.HtmlControls;
  12. public partial class Vehicles_VehicleWait : System.Web.UI.Page
  13. {
  14.     /// <summary>
  15.     /// 模板 
  16.     /// </summary>
  17.     Model.CarUse MC = new Model.CarUse();
  18.     /// <summary>
  19.     /// 业务
  20.     /// </summary>
  21.     BLL.CarUse BC = new BLL.CarUse();
  22.     /// <summary>
  23.     /// 查询条件
  24.     /// </summary>
  25.     public string TiaoJian
  26.     {
  27.         get
  28.         {
  29.             if (ViewState["UseThingsTiaoJian"] == null)
  30.             {
  31.                 return "";
  32.             }
  33.             else
  34.             {
  35.                 return ViewState["UseThingsTiaoJian"].ToString();
  36.             }
  37.         }
  38.         set { ViewState["UseThingsTiaoJian"] = value; }
  39.     }
  40.     protected void Page_Load(object sender, EventArgs e)
  41.     {
  42.         LoginLogic.MatchLoad("../", "Vehicles_VehicleWait");
  43.         if (!IsPostBack)
  44.         {
  45.             TiaoJian = "SYZT = '" + States.SupplyState_Wait + "'";
  46.             //if (Request.QueryString["TiaoJian"] != null)
  47.             //{
  48.             //    TiaoJian = Server.UrlDecode(Request.QueryString["TiaoJian"].ToString());
  49.             //}
  50.             object objid = Request.QueryString["id"];
  51.             if (objid != null)
  52.             {
  53.                 int ri = int.Parse(objid.ToString());
  54.                 TiaoJian += " and CPH = '" + ri.ToString() + "' and convert(varchar(10),KSSJ,120) = '" + DateTime.Now.ToString("yyyy-MM-dd") + "'";
  55.             }
  56.             MyDataBind(1);
  57.         }
  58.     }
  59.     /// <summary>
  60.     /// 获取信息
  61.     /// </summary>
  62.     /// <param name="pidx">页号</param>
  63.     public void MyDataBind(int pidx)
  64.     {
  65.         AspNetPager1.RecordCount = BC.GetCount(TiaoJian);
  66.         bool b_sort = false;
  67.         if (Request.QueryString["id"] != null)
  68.         {
  69.             b_sort = true;
  70.         }
  71.         List<Model.CarUse> LRData = BC.GetPageList(20, pidx, "KSSJ", b_sort, TiaoJian);
  72.         if (LRData.Count == 0)
  73.         {
  74.             Model.CarUse MC = new Model.CarUse();
  75.             LRData.Add(MC);
  76.         }
  77.         GridView1.DataSource = LRData;
  78.         GridView1.DataBind();
  79.     }
  80.     /// <summary>
  81.     /// 车辆类型
  82.     /// </summary>
  83.     /// <returns></returns>
  84.     public string CPH()
  85.     {
  86.         int id = 0;
  87.         if (BC.GetCount(TiaoJian) > 0)
  88.         {
  89.             id = int.Parse(Eval("CPH").ToString());
  90.         }
  91.         return EnumGet.GetCarNumberName(id);
  92.     }
  93.     /// <summary>
  94.     /// 操作
  95.     /// </summary>
  96.     /// <returns></returns>
  97.     public string CaoZuo()
  98.     {
  99.         string Rtstr = "";
  100.         if (BC.GetCount(TiaoJian) > 0)
  101.         {
  102.             string Id = Eval("Id").ToString();
  103.             Rtstr = "<a href='" + "ApplyDetail.aspx?id=" + Id + "'>详细信息</a>&nbsp;&nbsp;";
  104.         }
  105.         else
  106.         {
  107.             Rtstr = "还没有待批的车辆!";
  108.         }
  109.         return Rtstr;
  110.     }
  111.     protected void AspNetPager1_PageChanging(object src, Wuqi.Webdiyer.PageChangingEventArgs e)
  112.     {
  113.         MyDataBind(e.NewPageIndex);
  114.     }
  115.     protected void GridView1_RowDataBound(object sender, GridViewRowEventArgs e)
  116.     {
  117.         for (int i = 0; i < GridView1.Rows.Count; i++)
  118.         {
  119.             //首先判断是否是数据行
  120.             if (e.Row.RowType == DataControlRowType.DataRow)
  121.             {
  122.                 //当鼠标停留时更改背景色
  123.                 e.Row.Attributes.Add("onmouseover", "c=this.style.backgroundColor;this.style.backgroundColor='#F0F0F0'");
  124.                 //当鼠标移开时还原背景色
  125.                 e.Row.Attributes.Add("onmouseout", "this.style.backgroundColor=c");
  126.             }
  127.         }
  128.     }
  129. }