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