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

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_VehicleUnApply : 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_VehicleUnApply");
  43.         if (!IsPostBack)
  44.         {
  45.             //TiaoJian = "SYZT = '未准'";
  46.             TiaoJian = "SYZT = '" + States.SupplyState_No + "'";
  47.             MyDataBind(1);
  48.         }
  49.     }
  50.     /// <summary>
  51.     /// 获取信息
  52.     /// </summary>
  53.     /// <param name="pidx">页号</param>
  54.     public void MyDataBind(int pidx)
  55.     {
  56.         AspNetPager1.RecordCount = BC.GetCount(TiaoJian);
  57.         List<Model.CarUse> LRData = BC.GetPageList(20, pidx, "KSSJ", false, TiaoJian);
  58.         if (LRData.Count == 0)
  59.         {
  60.             Model.CarUse MC = new Model.CarUse();
  61.             LRData.Add(MC);
  62.         }
  63.         GridView1.DataSource = LRData;
  64.         GridView1.DataBind();
  65.     }
  66.     /// <summary>
  67.     /// 车辆类型
  68.     /// </summary>
  69.     /// <returns></returns>
  70.     public string CPH()
  71.     {
  72.         int id = 0;
  73.         if (BC.GetCount(TiaoJian) > 0)
  74.         {
  75.             id = int.Parse(Eval("CPH").ToString());
  76.         }
  77.         return EnumGet.GetCarNumberName(id);
  78.     }
  79.     /// <summary>
  80.     /// 操作
  81.     /// </summary>
  82.     /// <returns></returns>
  83.     public string CaoZuo()
  84.     {
  85.         string Rtstr = "";
  86.         if (BC.GetCount(TiaoJian) > 0)
  87.         {
  88.             string Id = Eval("Id").ToString();
  89.             Rtstr = "<a href='" + "ApplyDetail.aspx?id=" + Id + "'>详细信息</a>&nbsp;&nbsp;";
  90.         }
  91.         else
  92.         {
  93.             Rtstr = "还没有未准的车辆!";
  94.         }
  95.         return Rtstr;
  96.     }
  97.     protected void AspNetPager1_PageChanging(object src, Wuqi.Webdiyer.PageChangingEventArgs e)
  98.     {
  99.         MyDataBind(e.NewPageIndex);
  100.     }
  101.     protected void GridView1_RowDataBound(object sender, GridViewRowEventArgs e)
  102.     {
  103.         for (int i = 0; i < GridView1.Rows.Count; i++)
  104.         {
  105.             //首先判断是否是数据行
  106.             if (e.Row.RowType == DataControlRowType.DataRow)
  107.             {
  108.                 //当鼠标停留时更改背景色
  109.                 e.Row.Attributes.Add("onmouseover", "c=this.style.backgroundColor;this.style.backgroundColor='#F0F0F0'");
  110.                 //当鼠标移开时还原背景色
  111.                 e.Row.Attributes.Add("onmouseout", "this.style.backgroundColor=c");
  112.             }
  113.         }
  114.     }
  115. }