Exemple #1
0
        /// <summary>
        /// 移除数据列表
        /// </summary>
        /// <param name="sender"></param>
        /// <param name="e"></param>
        public bool DeleteDataList(object data)
        {
            bool flag = true;

            // 所有列表处理
            if (data.GetType() == typeof(COperatorDto))
            {
                COperatorDto dto = (COperatorDto)data;
                flag = m_lstOperator.RemoveAll(s => s.optcode == dto.optcode) > 0 ? true : false;
            }
            else if (data.GetType() == typeof(struCustomerInfo))
            {
                struCustomerInfo dto = (struCustomerInfo)data;
                flag = m_lstStruCUSTInfo.RemoveAll(s => s.strICCardID == dto.strICCardID && s.strName == dto.strName) > 0 ? true : false;
            }
            else if (data.GetType() == typeof(CSoundDto))
            {
                CSoundDto dto = (CSoundDto)data;
                flag = m_lstSound.RemoveAll(s => s.soundcode == dto.soundcode) > 0 ? true : false;
            }
            else if (data.GetType() == typeof(CLedContentDto))
            {
                CLedContentDto dto = (CLedContentDto)data;
                flag = m_lstLedContent.RemoveAll(s => s.id == dto.id) > 0 ? true : false;
            }
            else if (data.GetType() == typeof(CICCardLogDto))
            {
                CICCardLogDto dto = (CICCardLogDto)data;
                flag = m_lstICCardLog.RemoveAll(s => s.id == dto.id) > 0 ? true : false;
            }
            else if (data.GetType() == typeof(CSystemLogDto))
            {
                CSystemLogDto dto = (CSystemLogDto)data;
                flag = m_lstSystemLog.RemoveAll(s => s.logid == dto.logid) > 0 ? true : false;
            }
            else if (data.GetType() == typeof(CTelegramLogDto))
            {
                CTelegramLogDto dto = (CTelegramLogDto)data;
                flag = m_lstTelegramLog.RemoveAll(s => s.id == dto.id) > 0 ? true : false;
            }
            else if (data.GetType() == typeof(CDeviceFaultLogDto))
            {
                CDeviceFaultLogDto dto = (CDeviceFaultLogDto)data;
                flag = m_lstDeviceFaultLog.RemoveAll(s => s.id == dto.id) > 0 ? true : false;
            }
            else if (data.GetType() == typeof(CDeviceStatusLogDto))
            {
                CDeviceStatusLogDto dto = (CDeviceStatusLogDto)data;
                flag = m_lstDeviceStatusLog.RemoveAll(s => s.id == dto.id) > 0 ? true : false;
            }
            else if (data.GetType() == typeof(CTariffDto))
            {
                CTariffDto dto = (CTariffDto)data;
                flag = m_lstTariff.RemoveAll(s => s.id == dto.id) > 0 ? true : false;
            }

            return(flag);
        }
        /// <summary>
        /// 禁用
        /// </summary>
        /// <param name="sender"></param>
        /// <param name="e"></param>
        private void BtnDisable_Click(object sender, EventArgs e)
        {
            if (!CStaticClass.CheckPushService())
            {// 检查服务
                return;
            }

            QueryServiceClient proxy = new QueryServiceClient();
            PushServiceClient  push  = new PushServiceClient(new System.ServiceModel.InstanceContext(CStaticClass.myCallback));

            try
            {
                if (string.IsNullOrEmpty(this.CboEquipWareHouse.Text) || string.IsNullOrEmpty(this.CboEquipID.Text))
                {
                    MessageBox.Show("库区,设备都不能为空!", "警告", MessageBoxButtons.OK, MessageBoxIcon.Warning);
                    return;
                }

                int nEquipID   = CStaticClass.ConvertETVDescp(this.CboEquipID.Text);
                int nWareHouse = CStaticClass.ConvertWareHouse(this.CboEquipWareHouse.Text);
                CarLocationPanelLib.PushService.EnmFaultType type = push.SetDeviceMode(nWareHouse, nEquipID, 0);

                switch (type)
                {
                case CarLocationPanelLib.PushService.EnmFaultType.Success:
                {
                    CSystemLogDto log = new CSystemLogDto();
                    log.curtime  = CStaticClass.CurruntDateTime();
                    log.logdescp = "禁用设备成功:设备号-" + nEquipID + " 库号-" + nWareHouse;
                    log.optcode  = CStaticClass.myOperator.optcode;
                    log.optname  = CStaticClass.myOperator.optname;
                    proxy.InsertSysLog(log);
                    MessageBox.Show("禁用设备成功!", "成功", MessageBoxButtons.OK, MessageBoxIcon.Asterisk);
                    break;
                }

                case CarLocationPanelLib.PushService.EnmFaultType.NotFoundEquip:
                {
                    MessageBox.Show("没有找到指定设备!", "警告", MessageBoxButtons.OK, MessageBoxIcon.Warning);
                    break;
                }

                case CarLocationPanelLib.PushService.EnmFaultType.NotAllowed:
                {
                    MessageBox.Show("设备当前状态与要修改的状态相同!", "警告", MessageBoxButtons.OK, MessageBoxIcon.Warning);
                    break;
                }

                case CarLocationPanelLib.PushService.EnmFaultType.FailToUpdate:
                {
                    MessageBox.Show("更新数据库失败!", "警告", MessageBoxButtons.OK, MessageBoxIcon.Warning);
                    break;
                }

                case CarLocationPanelLib.PushService.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();
            push.Close();
        }
        /// <summary>
        /// 启用
        /// </summary>
        /// <param name="sender"></param>
        /// <param name="e"></param>
        private void BtnEnable_Click(object sender, EventArgs e)
        {
            if (!CStaticClass.CheckPushService())
            {// 检查服务
                return;
            }

            QueryServiceClient proxy = new QueryServiceClient();
            PushServiceClient  push  = new PushServiceClient(new System.ServiceModel.InstanceContext(CStaticClass.myCallback));

            try
            {
                if (string.IsNullOrEmpty(this.CboEquipWareHouse.Text) || string.IsNullOrEmpty(this.CboEquipID.Text))
                {
                    MessageBox.Show("库区,设备都不能为空!", "警告", MessageBoxButtons.OK, MessageBoxIcon.Warning);
                    return;
                }

                DialogResult dr = MessageBox.Show("确认启用?", "提示", MessageBoxButtons.OKCancel, MessageBoxIcon.Asterisk);

                if (dr == DialogResult.Cancel)
                {
                    return;
                }

                int nEquipID   = CStaticClass.ConvertETVDescp(this.CboEquipID.Text);
                int nWareHouse = CStaticClass.ConvertWareHouse(this.CboEquipWareHouse.Text);
                CarLocationPanelLib.PushService.EnmFaultType type = push.SetDeviceMode(nWareHouse, nEquipID, 1);

                switch (type)
                {
                case CarLocationPanelLib.PushService.EnmFaultType.Success:
                {
                    CSystemLogDto log = new CSystemLogDto();
                    log.curtime  = CStaticClass.CurruntDateTime();
                    log.logdescp = "启用设备成功:设备号-" + nEquipID + " 库号-" + nWareHouse;
                    log.optcode  = CStaticClass.myOperator.optcode;
                    log.optname  = CStaticClass.myOperator.optname;
                    proxy.InsertSysLog(log);
                    MessageBox.Show("启用设备成功!", "成功", MessageBoxButtons.OK, MessageBoxIcon.Asterisk);
                    break;
                }

                case CarLocationPanelLib.PushService.EnmFaultType.NotFoundEquip:
                {
                    MessageBox.Show("没有找到指定设备!", "警告", MessageBoxButtons.OK, MessageBoxIcon.Warning);
                    break;
                }

                case CarLocationPanelLib.PushService.EnmFaultType.NotAutomatic:
                {
                    MessageBox.Show("设备非全自动模式不能启用!", "警告", MessageBoxButtons.OK, MessageBoxIcon.Warning);
                    break;
                }

                case CarLocationPanelLib.PushService.EnmFaultType.NotAllowed:
                {
                    MessageBox.Show("设备当前状态与要修改的状态相同!", "警告", MessageBoxButtons.OK, MessageBoxIcon.Warning);
                    break;
                }

                case CarLocationPanelLib.PushService.EnmFaultType.FailToUpdate:
                {
                    MessageBox.Show("更新数据库失败!", "警告", MessageBoxButtons.OK, MessageBoxIcon.Warning);
                    break;
                }

                case CarLocationPanelLib.PushService.EnmFaultType.InvalidWareHouseID:
                {
                    MessageBox.Show("无效库区号!", "警告", MessageBoxButtons.OK, MessageBoxIcon.Warning);
                    break;
                }

                case CarLocationPanelLib.PushService.EnmFaultType.Null:
                {        //下一取车队列的传入的参数卡号为空
                    MessageBox.Show("无取车排队队列!", "警告", MessageBoxButtons.OK, MessageBoxIcon.Warning);
                    break;
                }

                case CarLocationPanelLib.PushService.EnmFaultType.NoICCardInfo:
                {
                    MessageBox.Show("下一取车队列的IC卡没有制卡!", "警告", MessageBoxButtons.OK, MessageBoxIcon.Warning);
                    break;
                }

                case CarLocationPanelLib.PushService.EnmFaultType.LossORCancel:
                {
                    MessageBox.Show("下一取车队列的IC卡注销或挂失!", "警告", MessageBoxButtons.OK, MessageBoxIcon.Warning);
                    break;
                }

                case CarLocationPanelLib.PushService.EnmFaultType.NotMatch:
                {
                    MessageBox.Show("下一取车队列的IC卡类型不正确!", "警告", MessageBoxButtons.OK, MessageBoxIcon.Warning);
                    break;
                }

                case CarLocationPanelLib.PushService.EnmFaultType.NoCarInGarage:
                {
                    MessageBox.Show("下一取车队列的用户没有车存在库内!", "警告", MessageBoxButtons.OK, MessageBoxIcon.Warning);
                    break;
                }

                case CarLocationPanelLib.PushService.EnmFaultType.FailToSendTelegram:
                {
                    MessageBox.Show("下一取车队列发送报文失败, 请重新刷卡取车!", "警告", MessageBoxButtons.OK, MessageBoxIcon.Warning);
                    break;
                }

                case CarLocationPanelLib.PushService.EnmFaultType.WorkQueueNotEmpty:
                {
                    CSystemLogDto log = new CSystemLogDto();
                    log.curtime  = CStaticClass.CurruntDateTime();
                    log.logdescp = "启用成功,正在为取车排队的车主取车,请稍后片刻:设备号-" + nEquipID + " 库号-" + nWareHouse;
                    log.optcode  = CStaticClass.myOperator.optcode;
                    log.optname  = CStaticClass.myOperator.optname;
                    proxy.InsertSysLog(log);
                    MessageBox.Show("启用成功,正在为取车排队的车主取车,请稍后片刻!", "警告", MessageBoxButtons.OK, MessageBoxIcon.Warning);
                    break;
                }

                case CarLocationPanelLib.PushService.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();
            push.Close();
        }
Exemple #4
0
        /// <summary>
        /// 修改数据项
        /// </summary>
        /// <param name="sender"></param>
        /// <param name="e"></param>
        public void ModifyDataItem(object data)
        {
            // 所有列表处理
            if (data.GetType() == typeof(COperatorDto))
            {
                COperatorDto dto   = (COperatorDto)data;
                int          index = m_lstOperator.FindIndex(s => s.optcode == dto.optcode);
                if (-1 == index)
                {
                    m_lstOperator.Add(dto);
                }
                else
                {
                    m_lstOperator.RemoveAt(index);
                    m_lstOperator.Insert(index, dto);
                }
            }
            else if (data.GetType() == typeof(struCustomerInfo))
            {
                struCustomerInfo dto = (struCustomerInfo)data;
                int index            = m_lstStruCUSTInfo.FindIndex(s => s.strICCardID == dto.strICCardID);
                if (-1 == index)
                {
                    m_lstStruCUSTInfo.Add(dto);
                }
                else
                {
                    m_lstStruCUSTInfo.RemoveAt(index);
                    m_lstStruCUSTInfo.Insert(index, dto);
                }
            }
            else if (data.GetType() == typeof(CSoundDto))
            {
                CSoundDto dto   = (CSoundDto)data;
                int       index = m_lstSound.FindIndex(s => s.soundcode == dto.soundcode);
                if (-1 == index)
                {
                    m_lstSound.Add(dto);
                }
                else
                {
                    m_lstSound.RemoveAt(index);
                    m_lstSound.Insert(index, dto);
                }
            }
            else if (data.GetType() == typeof(CLedContentDto))
            {
                CLedContentDto dto   = (CLedContentDto)data;
                int            index = m_lstLedContent.FindIndex(s => s.id == dto.id);
                if (-1 == index)
                {
                    m_lstLedContent.Add(dto);
                }
                else
                {
                    m_lstLedContent.RemoveAt(index);
                    m_lstLedContent.Insert(index, dto);
                }
            }
            else if (data.GetType() == typeof(CICCardLogDto))
            {
                CICCardLogDto dto   = (CICCardLogDto)data;
                int           index = m_lstICCardLog.FindIndex(s => s.id == dto.id);
                if (-1 == index)
                {
                    m_lstICCardLog.Add(dto);
                }
                else
                {
                    m_lstICCardLog.RemoveAt(index);
                    m_lstICCardLog.Insert(index, dto);
                }
            }
            else if (data.GetType() == typeof(CSystemLogDto))
            {
                CSystemLogDto dto   = (CSystemLogDto)data;
                int           index = m_lstSystemLog.FindIndex(s => s.logid == dto.logid);
                if (-1 == index)
                {
                    m_lstSystemLog.Add(dto);
                }
                else
                {
                    m_lstSystemLog.RemoveAt(index);
                    m_lstSystemLog.Insert(index, dto);
                }
            }
            else if (data.GetType() == typeof(CTelegramLogDto))
            {
                CTelegramLogDto dto   = (CTelegramLogDto)data;
                int             index = m_lstTelegramLog.FindIndex(s => s.id == dto.id);
                if (-1 == index)
                {
                    m_lstTelegramLog.Add(dto);
                }
                else
                {
                    m_lstTelegramLog.RemoveAt(index);
                    m_lstTelegramLog.Insert(index, dto);
                }
            }
            else if (data.GetType() == typeof(CDeviceFaultLogDto))
            {
                CDeviceFaultLogDto dto = (CDeviceFaultLogDto)data;
                int index = m_lstDeviceFaultLog.FindIndex(s => s.id == dto.id);
                if (-1 == index)
                {
                    m_lstDeviceFaultLog.Add(dto);
                }
                else
                {
                    m_lstDeviceFaultLog.RemoveAt(index);
                    m_lstDeviceFaultLog.Insert(index, dto);
                }
            }
            else if (data.GetType() == typeof(CDeviceStatusLogDto))
            {
                CDeviceStatusLogDto dto = (CDeviceStatusLogDto)data;
                int index = m_lstDeviceStatusLog.FindIndex(s => s.id == dto.id);
                if (-1 == index)
                {
                    m_lstDeviceStatusLog.Add(dto);
                }
                else
                {
                    m_lstDeviceStatusLog.RemoveAt(index);
                    m_lstDeviceStatusLog.Insert(index, dto);
                }
            }
            else if (data.GetType() == typeof(CTariffDto))
            {
                CTariffDto dto   = (CTariffDto)data;
                int        index = m_lstTariff.FindIndex(s => s.id == dto.id);
                if (-1 == index)
                {
                    m_lstTariff.Add(dto);
                }
                else
                {
                    m_lstTariff.RemoveAt(index);
                    m_lstTariff.Insert(index, dto);
                }
            }

            UpdatePages();
        }