private void GetData(int pageIndex) { int pageCount = 0; string filter = ""; //查询过滤条件 ObservableCollection <object> paras = new System.Collections.ObjectModel.ObservableCollection <object>(); //参数值 if (IsQuery) { string StrContent = ""; string StrStart = ""; string StrEnd = ""; StrStart = dpStart.Text.ToString(); StrEnd = dpEnd.Text.ToString(); DateTime DtStart = new DateTime(); DateTime DtEnd = new DateTime(); StrContent = this.txtConserVationContent.Text.ToString().Trim(); if (!string.IsNullOrEmpty(StrStart) && string.IsNullOrEmpty(StrEnd)) { Utility.ShowCustomMessage(MessageTypes.Message, Utility.GetResourceStr("WARING"), Utility.GetResourceStr("ENDTIMENOTNULL")); //MessageBox.Show("结束时间不能为空"); return; } if (string.IsNullOrEmpty(StrStart) && !string.IsNullOrEmpty(StrEnd)) { Utility.ShowCustomMessage(MessageTypes.Message, Utility.GetResourceStr("WARING"), Utility.GetResourceStr("STARTTIMENOTNULL")); //MessageBox.Show("开始时间不能为空"); return; } if (!string.IsNullOrEmpty(StrStart) && !string.IsNullOrEmpty(StrEnd)) { DtStart = System.Convert.ToDateTime(StrStart); DtEnd = System.Convert.ToDateTime(StrEnd + " 23:59:59"); if (DtStart > DtEnd) { Utility.ShowCustomMessage(MessageTypes.Message, Utility.GetResourceStr("WARING"), Utility.GetResourceStr("ERRORSTARTDATEGTENDDATE")); return; } else { if (!string.IsNullOrEmpty(filter)) { filter += " and "; } filter += "ACCIDENTDATE >=@" + paras.Count().ToString();//开始时间 paras.Add(DtStart); filter += " and "; filter += "ACCIDENTDATE <=@" + paras.Count().ToString();//结束时间 paras.Add(DtEnd); } } if (!string.IsNullOrEmpty(StrContent)) { if (!string.IsNullOrEmpty(filter)) { filter += " and "; } filter += "CONTENT ^@" + paras.Count().ToString();//类型名称 paras.Add(StrContent); } } loadbar.Start(); vehicleClient.GetAccidentRecordListAsync(pageIndex, dataPager.PageSize, "UPDATEDATE", filter, paras, pageCount, Common.CurrentLoginUserInfo.EmployeeID); }