ApplyDetail.aspx.cs
上传用户:simon2hong
上传日期:2021-11-18
资源大小:16746k
文件大小:8k
- 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 System.Text;
- public partial class Vehicles_ApplyDetail : System.Web.UI.Page
- {
- /// <summary>
- /// 车牌号
- /// </summary>
- public string StrHtmlCPH = "";
- /// <summary>
- /// 厂牌型号
- /// </summary>
- public string StrHtmlCPXH = "";
- /// <summary>
- /// 车辆类型
- /// </summary>
- public string StrHtmlCLLX = "";
- /// <summary>
- /// 驾驶员
- /// </summary>
- public string StrHtmlJSY = "";
- /// <summary>
- /// 预定情况
- /// </summary>
- public string StrHtmlYDQK = "";
- /// <summary>
- /// 当前状态
- /// </summary>
- public string StrHtmlDQZT = "";
- /// <summary>
- /// 图片
- /// </summary>
- public string StrHtmlCLTPPath = "<center>暂无照片</center>";
- //模板
- Model.CarUse MCU = new Model.CarUse();
- Model.Cars MC = new Model.Cars();
- //业务
- BLL.CarUse BCU = new BLL.CarUse();
- BLL.Cars BC = new BLL.Cars();
- protected void Page_Load(object sender, EventArgs e)
- {
- LoginLogic.MatchLoad("../", "Vehicles_ApplyDetail");
- if (!IsPostBack)
- {
- object objid = Request.QueryString["id"];
- if (objid != null)
- {
- int ri = int.Parse(objid.ToString());
- MCU = BCU.GetModel(ri);
- DropLoadSet();
- KeyValue_CPH.SelectedValue = MCU.CPH;
- KeyValue_YCR.Text = MCU.YCR;
- KeyValue_SY.Text = MCU.SY;
- KeyValue_KSSJ.Text = MCU.KSSJ.ToString();
- KeyValue_JSSJ.Text = MCU.JSSJ.ToString();
- KeyValue_BZ.Text = MCU.BZ;
- KeyValue_MDD.Text = MCU.MDD;
- KeyValue_LC.Text = MCU.LC.ToString();
- KeyValue_SJ.Text = MCU.SJ;
- KeyValue_YCBM.SelectedValue = MCU.YCBM.ToString();
- KeyValue_SQR.Text = MCU.SQR;
- KeyValue_DDY.SelectedValue = MCU.DDY;
- }
- Forbidden();
- }
- }
- /// <summary>
- /// 禁用控件
- /// </summary>
- public void Forbidden()
- {
- KeyValue_CPH.Enabled = false;
- KeyValue_YCR.Enabled = false;
- KeyValue_SY.Enabled = false;
- KeyValue_KSSJ.Enabled = false;
- KeyValue_JSSJ.Enabled = false;
- KeyValue_BZ.Enabled = false;
- KeyValue_MDD.Enabled = false;
- KeyValue_LC.Enabled = false;
- KeyValue_SJ.Enabled = false;
- KeyValue_YCBM.Enabled = false;
- KeyValue_SQR.Enabled = false;
- KeyValue_DDY.Enabled = false;
- }
- /// <summary>
- /// 数据绑定
- /// </summary>
- public void DropLoadSet()
- {
- #region 车牌号
- KeyValue_CPH.DataTextField = "CPH";
- KeyValue_CPH.DataValueField = "Id";
- KeyValue_CPH.DataSource = EnumGet.CarNumberGetEnum();
- KeyValue_CPH.DataBind();
- ListItem linone = new ListItem();
- linone.Text = "--请选择--";
- linone.Value = "0";
- KeyValue_CPH.Items.Add(linone);
- KeyValue_CPH.SelectedIndex = KeyValue_CPH.Items.Count - 1;
- #endregion
- #region 用车部门
- KeyValue_YCBM.DataTextField = "DeptName";
- KeyValue_YCBM.DataValueField = "Id";
- KeyValue_YCBM.DataSource = EnumGet.DepartmentGetEnum();
- KeyValue_YCBM.DataBind();
- ListItem linone2 = new ListItem();
- linone2.Text = "--请选择--";
- linone2.Value = "0";
- KeyValue_YCBM.Items.Add(linone2);
- KeyValue_YCBM.SelectedIndex = KeyValue_YCBM.Items.Count - 1;
- #endregion
- #region 调度员
- KeyValue_DDY.DataTextField = "DDY";
- KeyValue_DDY.DataValueField = "Id";
- KeyValue_DDY.DataSource = EnumGet.DiaoDuYuanGetEnum();
- KeyValue_DDY.DataBind();
- ListItem linone3 = new ListItem();
- linone3.Text = "--请选择--";
- linone3.Value = "0";
- KeyValue_DDY.Items.Add(linone3);
- KeyValue_DDY.SelectedIndex = KeyValue_DDY.Items.Count - 1;
- #endregion
- }
- public void DropLoadSet(int Id)
- {
- if (Id > 0)
- {
- MC = BC.GetModel(Id);
- StrHtmlCPH = EnumGet.GetCarNumberName(Id);
- StrHtmlCPXH = MC.CPXH;
- StrHtmlCLLX = EnumGet.GetCarTypeName(MC.CLLX);
- StrHtmlJSY = MC.JSY;
- StrHtmlYDQK = YDXX(Id);
- #region 当前状态
- //string condition = "CPH = 'lvs' and SYZT = '已准' and convert(varchar(10),KSSJ,120) = '今天' and (KSSJ < '现在时间' and JSSJ > '现在时间')";
- string condition = "CPH = '" + Id.ToString() + "' and SYZT = '" + States.SupplyState_Agree + "' and convert(varchar(10),KSSJ,120) = '" + DateTime.Now.ToString("yyyy-MM-dd") + "' and (KSSJ < '" + DateTime.Now.ToString() + "' and JSSJ > '" + DateTime.Now.ToString() + "')";
- if (BCU.GetCount(condition) > 0)
- {
- StrHtmlDQZT = States.UseState_Busy;
- }
- else
- {
- StrHtmlDQZT = States.UseState_Free;
- }
- #endregion
- #region 图片加载
- StringBuilder sb = new StringBuilder();
- if (BC.GetCount("CLTPPath = '" + MC.CLTPPath + "' and ID = " + Id.ToString()) <= 0)
- {
- sb.Append("<center>暂无照片</center>");
- StrHtmlCLTPPath = sb.ToString();
- }
- if (String.IsNullOrEmpty(MC.CLTPPath))
- {
- sb.Append("<center>暂无照片</center>");
- StrHtmlCLTPPath = sb.ToString();
- }
- else
- {
- sb.Append("<img src='upload/" + MC.CLTPPath + "' width='250' height='150' />");
- StrHtmlCLTPPath = sb.ToString();
- }
- #endregion
- }
- }
- /// <summary>
- /// 预定情况
- /// </summary>
- /// <param name="Id">车牌号ID</param>
- /// <returns></returns>
- public string YDXX(int Id)
- {
- StringBuilder sb = new StringBuilder();
- if (Id > 0)
- {
- //string condtion = "CPH = 'lvs' and SYZT = '待批' and convert(varchar(10),KSSJ,120) = '今天'";
- string condition = "CPH = '" + Id.ToString() + "' and SYZT = '" + States.SupplyState_Wait + "' and convert(varchar(10),KSSJ,120) = '" + DateTime.Now.ToString("yyyy-MM-dd") + "'";
- //(1)string condition = "CPH = '" + Id + "'";
- //string condition = "SYZT='" + States.SupplyState_Wait + "'";
- string Rtstr = "当前共 " + BCU.GetCount(condition).ToString() + " 条预定信息";
- condition = Server.UrlEncode(condition);
- //sb.Append("<a href='VehicleWait.aspx?TiaoJian=" + condition + "' title='点击查看详情'><span style='color: #0000ff; text-decoration: underline'>" + Rtstr + "</span></a>");
- sb.Append("<a href='#' title='点击查看详情'><span style='color: #0000ff; text-decoration: underline'>" + Rtstr + "</span></a>");
- }
- else
- {
- sb.Append("");
- }
- return sb.ToString();
- }
- protected void KeyValue_CPH_SelectedIndexChanged(object sender, EventArgs e)
- {
- DropLoadSet(int.Parse(KeyValue_CPH.SelectedValue));
- }
- protected void Button1_Click(object sender, EventArgs e)
- {
- DropLoadSet(int.Parse(KeyValue_CPH.SelectedValue));
- }
- }