/// <summary> /// 查询操作日志 /// </summary> /// <param name="sender"></param> /// <param name="e"></param> private void BtnDoFind_Click(object sender, EventArgs e) { if (!CStaticClass.CheckPushService()) {// 检查服务 return; } QueryServiceClient proxy = new QueryServiceClient(); try { int nIndex = this.CboDoCondition.SelectedIndex; if (0 > nIndex || (string.IsNullOrEmpty(this.TxtDoContent.Text) && this.TxtDoContent.Enabled)) { MessageBox.Show("查询条件和关键字不能为空!", "警告", MessageBoxButtons.OK, MessageBoxIcon.Warning); return; } string strContent = this.TxtDoContent.Text.Trim(); DateTime dtStart = this.DtpDoStart.Value; // 起始日期 DateTime dtEnd = this.DtpDoEnd.Value; // 截止日期 // 获取所有系统日志列表(根据查询条件查询) List <CSystemLogDto> lstLogDto = proxy.GetSystemLogListByContent(nIndex, dtStart, dtEnd, strContent); //// 根据查询条件查询 //switch (nIndex) //{ // case 0:// 根据描述关键字查询 // { // lstLogDto = lstLogDto.FindAll(s => CompareDateTime(s.curtime, dtStart, dtEnd) && s.logdescp.Contains(strContent)); // break; // } // case 1:// 根据操作员 // { // lstLogDto = lstLogDto.FindAll(s => CompareDateTime(s.curtime, dtStart, dtEnd) && s.optcode == strContent); // break; // } // default: // { // lstLogDto = lstLogDto.FindAll(s => CompareDateTime(s.curtime, dtStart, dtEnd)); // break; // } //} m_lstSystemLog = lstLogDto; this.DgvDo.DataSource = new BindingList <CSystemLogDto>(lstLogDto); if (null == lstLogDto || 0 == lstLogDto.Count) { MessageBox.Show("抱歉,没有找到符合条件的记录!", "警告", MessageBoxButtons.OK, MessageBoxIcon.Warning); return; } } catch (TimeoutException) { MessageBox.Show("The service operation timed out. ", "超时", MessageBoxButtons.OK, MessageBoxIcon.Error); } catch (FaultException exception) { MessageBox.Show(CStaticClass.GetExceptionInfo(exception), "SOAP错误", MessageBoxButtons.OK, MessageBoxIcon.Error); } catch (CommunicationException exception) { MessageBox.Show("There was a communication problem. " + CStaticClass.GetExceptionInfo(exception), "通信错误", MessageBoxButtons.OK, MessageBoxIcon.Error); } catch (Exception exception) { MessageBox.Show(CStaticClass.GetExceptionInfo(exception), "应用程序异常", MessageBoxButtons.OK, MessageBoxIcon.Error); } proxy.Close(); }