Beispiel #1
0
        /// <summary>
        /// 查询IC卡缴费日志
        /// </summary>
        /// <param name="sender"></param>
        /// <param name="e"></param>
        private void BtnICCardFind_Click(object sender, EventArgs e)
        {
            if (!CStaticClass.CheckPushService())
            {// 检查服务
                return;
            }

            QueryServiceClient proxy = new QueryServiceClient();

            try
            {
                int    nIndex     = this.CboICCardCondition.SelectedIndex;
                string strContent = "所有";
                if (this.TxtICCardContent.Visible && this.TxtICCardContent.Enabled)
                {
                    if (string.IsNullOrEmpty(this.TxtICCardContent.Text))
                    {
                        strContent = string.Empty;
                    }
                    else
                    {
                        strContent = this.TxtICCardContent.Text.Trim();
                    }
                }
                else if (this.CboICCardContent.Visible)
                {
                    if (string.IsNullOrEmpty(this.CboICCardContent.Text))
                    {
                        strContent = string.Empty;
                    }
                    else
                    {
                        strContent = this.CboICCardContent.Text.Trim();
                    }
                }

                if (0 > nIndex || string.IsNullOrEmpty(strContent))
                {
                    MessageBox.Show("查询条件和查询内容不能为空!", "警告", MessageBoxButtons.OK, MessageBoxIcon.Warning);
                    return;
                }

                DateTime dtStart = this.DtpICCardStart.Value; // 起始日期
                DateTime dtEnd   = this.DtpICCardEnd.Value;   // 截止日期

                if (1 == nIndex)
                {// 根据卡类型查询
                    strContent = ((int)CStaticClass.ConvertICCardType(strContent)).ToString();
                }

                // 获取所有IC卡缴费日志列表(根据查询条件查询)
                List <CICCardLogDto> lstLogDto = proxy.GetICCardLogListByContent(nIndex, dtStart, dtEnd, strContent);
                //// 根据查询条件查询
                //switch (nIndex)
                //{
                //    case 0:// 根据卡号查询
                //        {
                //            lstLogDto = lstLogDto.FindAll(s => CompareDateTime(s.paymenttime, dtStart, dtEnd) && s.iccode == strContent);
                //            break;
                //        }
                //    case 1:// 根据卡类型查询
                //        {
                //            lstLogDto = lstLogDto.FindAll(s => CompareDateTime(s.paymenttime, dtStart, dtEnd) && CStaticClass.ConvertICCardType(s.ictype) == strContent);
                //            break;
                //        }
                //    case 2:// 根据车主姓名查询
                //        {
                //            lstLogDto = lstLogDto.FindAll(s => CompareDateTime(s.paymenttime, dtStart, dtEnd) && s.username == strContent);
                //            break;
                //        }
                //    case 3:// 根据操作员
                //        {
                //            lstLogDto = lstLogDto.FindAll(s => CompareDateTime(s.paymenttime, dtStart, dtEnd) && s.optcode == strContent);
                //            break;
                //        }
                //    default:
                //        {
                //            lstLogDto = lstLogDto.FindAll(s => CompareDateTime(s.paymenttime, dtStart, dtEnd));
                //            break;
                //        }
                //}

                m_lstICCardLog            = lstLogDto;
                this.DgvICCard.DataSource = new BindingList <CICCardLogDto>(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();
        }