private void Show() { string sql = " 1=1 "; QuerySession.QueryUseCarDetail QueryUserDetail = new QuerySession.QueryUseCarDetail(); if (txtFrom.Text != "") { if (CommHelp.VerifesToDateTime(txtFrom.Text.Trim()) == false) { base.ClientScript.RegisterStartupScript(base.GetType(), null, "<script>alert('日期 格式错误!');</script>"); return; } sql += string.Format(" and AppTime>='{0} 00:00:00'", txtFrom.Text); QueryUserDetail.FromTime = txtFrom.Text; } if (txtTo.Text != "") { if (CommHelp.VerifesToDateTime(txtTo.Text.Trim()) == false) { base.ClientScript.RegisterStartupScript(base.GetType(), null, "<script>alert('日期 格式错误!');</script>"); return; } sql += string.Format(" and AppTime<='{0} 23:59:59'", txtTo.Text); QueryUserDetail.ToTime = txtTo.Text; } if (txtGuestName.Text != "") { sql += string.Format(" and GuestName like '%{0}%'", txtGuestName.Text); QueryUserDetail.Company = txtGuestName.Text; } if (txtDriver.Text != "") { sql += string.Format(" and Driver like '%{0}%'", txtDriver.Text); QueryUserDetail.Driver = txtDriver.Text; } if (txtAppName.Text != "") { sql += string.Format(" and LoginName like '%{0}%'", txtAppName.Text); QueryUserDetail.Apper = txtAppName.Text; } if (txtCarNo.Text != "") { sql += string.Format(" and CarNo like '%{0}%'", txtCarNo.Text); QueryUserDetail.CarNo = txtCarNo.Text; } if (txtProNo.Text.Trim() != "") { if (CheckProNo(txtProNo.Text.Trim()) == false) { return; } sql += string.Format(" and TB_UseCarDetail.ProNo like '%{0}%'", txtProNo.Text.Trim()); QueryUserDetail.ProNo = txtProNo.Text.Trim(); } sql += string.Format(@" and TB_UseCarDetail.id in (select allE_id from tb_EForm where proId in ( select pro_Id from A_ProInfo where pro_Type='用车明细表') and state='执行中')"); decimal Total = 0; decimal Total1 = 0; List <TB_UseCarDetail> UseCarServices = this.useCarSer.GetListArrayReps_1(sql, out Total, out Total1); Session[Query] = QueryUserDetail; // lblTotal.Text = Total.ToString(); this.gvList.DataSource = UseCarServices; this.gvList.DataBind(); }
protected void Page_Load(object sender, EventArgs e) { if (!base.IsPostBack) { WebQuerySessin Sess = new WebQuerySessin(Query); //加载SESSION中的数据 if (Session[Query] != null) { //QueryEForms QuerySession.QueryUseCarDetail QUseCarDetail = Session[Query] as QuerySession.QueryUseCarDetail; if (QUseCarDetail == null) { return; } if (QUseCarDetail.FromTime != "") { txtFrom.Text = QUseCarDetail.FromTime; } if (QUseCarDetail.ToTime != "") { txtTo.Text = QUseCarDetail.ToTime; } if (QUseCarDetail.Company != "") { txtGuestName.Text = QUseCarDetail.Company; } if (QUseCarDetail.Driver != "") { txtDriver.Text = QUseCarDetail.Driver; } if (QUseCarDetail.Apper != "") { txtAppName.Text = QUseCarDetail.Apper; } if (QUseCarDetail.CarNo != "") { txtCarNo.Text = QUseCarDetail.CarNo; } if (QUseCarDetail.ProNo != "") { txtProNo.Text = QUseCarDetail.ProNo; } Show(); } else { List <TB_UseCarDetail> UseCarServices = new List <TB_UseCarDetail>(); this.gvList.DataSource = UseCarServices; this.gvList.DataBind(); } } }