Ejemplo n.º 1
0
        /// <summary>
        /// 删除报文
        /// </summary>
        /// <param name="sender"></param>
        /// <param name="e"></param>
        private void BtnDelete_Click(object sender, EventArgs e)
        {
            if (!CStaticClass.CheckPushService())
            {// 检查服务
                return;
            }

            QueryServiceClient proxy = new QueryServiceClient();

            try
            {
                if (null == this.DgvQueue.CurrentRow)
                {
                    MessageBox.Show("作业不能为空", "警告", MessageBoxButtons.OK, MessageBoxIcon.Warning);
                    return;
                }

                // 删除数据库作业
                CWorkQueueDto workQueue = (CWorkQueueDto)this.DgvQueue.CurrentRow.DataBoundItem;
                CarLocationPanelLib.QueryService.EnmFaultType type = proxy.DeleteWorkQueueObject(workQueue.id);

                switch (type)
                {
                case CarLocationPanelLib.QueryService.EnmFaultType.Success:
                {
                    GetFindQueueLst(proxy);
                    MessageBox.Show("删除作业成功", "成功", MessageBoxButtons.OK, MessageBoxIcon.Asterisk);
                    break;
                }

                case CarLocationPanelLib.QueryService.EnmFaultType.NoICCardInfo:
                {
                    MessageBox.Show("没有刷卡信息", "警告", MessageBoxButtons.OK, MessageBoxIcon.Warning);
                    break;
                }

                case CarLocationPanelLib.QueryService.EnmFaultType.FailToDelete:
                {
                    MessageBox.Show("删除数据库失败", "警告", MessageBoxButtons.OK, MessageBoxIcon.Warning);
                    break;
                }

                case CarLocationPanelLib.QueryService.EnmFaultType.Exception:
                {
                    MessageBox.Show(CStaticClass.GetExceptionInfo(null), "连接异常", MessageBoxButtons.OK, MessageBoxIcon.Error);
                    break;
                }

                default:
                {
                    MessageBox.Show("删除作业失败", "警告", MessageBoxButtons.OK, MessageBoxIcon.Warning);
                    break;
                }
                }
            }
            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();
        }