/// <summary> /// 查询事件 /// </summary> public void ButQuery_Event(object sender, DirectEventArgs e) { //if (string.IsNullOrEmpty(start.InnerText) || string.IsNullOrEmpty(end.InnerText)) //{ // Notice("提示", "请选择要查询的开始时间和结束时间"); // return; //} if (string.IsNullOrEmpty(CmbPlateType.Text) && string.IsNullOrEmpty(cboplate.VehicleText) && string.IsNullOrEmpty(txtplate.Text) ) { DateTime start = Convert.ToDateTime(startdate); DateTime end = Convert.ToDateTime(enddate); TimeSpan sp = end.Subtract(start); if (sp.TotalMinutes > 120) { Notice(GetLangStr("FisrtIntoCity29", "信息提示"), GetLangStr("FisrtIntoCity30", "只能选择两个小时之内的时间!")); this.lblCurpage.Text = "1"; this.lblAllpage.Text = "0"; this.lblRealcount.Text = "0"; ButLast.Disabled = true; ButNext.Disabled = true; StorePeccancy.DataSource = new DataTable(); StorePeccancy.DataBind(); return; } } int allCount = GetFirstIntoCount(); if (allCount > 0) { realCount.Value = allCount; pageCount = (int)Math.Ceiling((allCount / 15.0)); allPage.Value = pageCount; curpage.Value = "1"; QueryFirstIndo(1); } else { //this.FormPanelFisrt.Title = "查询结果:当前查询出符合条件的记录0条,当前显示0条"; //this.LabNum.Text = "当前0页,共0页"; this.lblCurpage.Text = "1"; this.lblAllpage.Text = "0"; this.lblRealcount.Text = "0"; ButEnd.Disabled = true; ButFisrt.Disabled = true; ButLast.Disabled = true; ButNext.Disabled = true; StorePeccancy.DataSource = new DataTable(); StorePeccancy.DataBind(); Notice(GetLangStr("FisrtIntoCity29", "信息提示"), GetLangStr("FisrtIntoCity31", "当前没数据")); return; } }
/// <summary> /// 查询方法 /// </summary> /// <param name="pageIndex"></param> public void QueryFirstIndo(int pageIndex) { try { string hphm = ""; if (cktype.Checked) { if (!string.IsNullOrEmpty(cboplate.VehicleText)) { hphm = cboplate.VehicleText; hphm = hphm + (string.IsNullOrEmpty(haopai_name1.Value) ? "" : haopai_name1.Value) + (string.IsNullOrEmpty(haopai_name2.Value) ? "" : haopai_name2.Value) + (string.IsNullOrEmpty(haopai_name3.Value) ? "_" : haopai_name3.Value) + (string.IsNullOrEmpty(haopai_name4.Value) ? "_" : haopai_name4.Value) + (string.IsNullOrEmpty(haopai_name5.Value) ? "_" : haopai_name5.Value) + (string.IsNullOrEmpty(haopai_name6.Value) ? "_" : haopai_name6.Value) + "%"; } else { hphm = "%" + (string.IsNullOrEmpty(haopai_name1.Value) ? "" : haopai_name1.Value) + (string.IsNullOrEmpty(haopai_name2.Value) ? "" : haopai_name2.Value) + (string.IsNullOrEmpty(haopai_name3.Value) ? "" : haopai_name3.Value) + (string.IsNullOrEmpty(haopai_name4.Value) ? "" : haopai_name4.Value) + (string.IsNullOrEmpty(haopai_name5.Value) ? "" : haopai_name5.Value) + (string.IsNullOrEmpty(haopai_name6.Value) ? "" : haopai_name6.Value) + "%"; } } else { hphm = cboplate.VehicleText + txtplate.Text; } string hpzl = ""; if (CmbPlateType.SelectedIndex != -1) { hpzl = CmbPlateType.SelectedItem.Value; } //string QueryHphm = string.Empty; //if (!string.IsNullOrEmpty(cboplate.VehicleText)) //{ // QueryHphm = cboplate.VehicleText + txtplate.Text; //} //else //{ // QueryHphm = txtplate.Text; //} DataTable dt = null; if (cktype.Checked) { dt = bll.GetFisrtIntoData(startdate, enddate, hphm, hpzl, pageIndex, 1); } else { dt = bll.GetFisrtIntoData(startdate, enddate, hphm, hpzl, pageIndex, 0); } if (dt != null && dt.Rows.Count > 0) { if (dt.Rows.Count.Equals(15)) // 有数据 且够50条 { this.lblCurpage.Text = curpage.Value.ToString(); this.lblAllpage.Text = allPage.Value.ToString(); this.lblRealcount.Text = realCount.Value.ToString(); // this.FormPanelFisrt.Title = "查询结果:共计查询出符合条件的记录" + realCount.Value.ToString() + "条,现在显示" + startNum + " - " + realnum + "条"; } else { this.lblCurpage.Text = curpage.Value.ToString(); this.lblAllpage.Text = allPage.Value.ToString(); this.lblRealcount.Text = realCount.Value.ToString(); //this.FormPanelFisrt.Title = "查询结果:当前查询出符合条件的记录" + realCount.Value.ToString() + "条,现在显示" + startNum + " - " + realCount.Value.ToString() + "条"; } StorePeccancy.DataSource = dt; StorePeccancy.DataBind(); SetButState(pageIndex); } else { //this.FormPanelFisrt.Title = "查询结果:当前查询出符合条件的记录0条,当前显示0条"; //this.LabNum.Text = "当前0页,共0页"; this.lblCurpage.Text = "1"; this.lblAllpage.Text = "0"; this.lblRealcount.Text = "0"; ButLast.Disabled = true; ButNext.Disabled = true; Notice(GetLangStr("FisrtIntoCity29", "信息提示"), GetLangStr("FisrtIntoCity31", "当前没数据")); return; } } catch (Exception ex) { ILog.WriteErrorLog(ex); logManager.InsertLogError("FisrtIntoCity.aspx-FisrtIntoCity", ex.Message + ";" + ex.StackTrace, "FisrtIntoCity has an exception"); } }