private void btnRdICCard_Click(object sender, EventArgs e) { CTxtSrcLocAddr.Clear(); string physCode = this.readIccard(); if (physCode == null) { return; } if (!CStaticClass.CheckPushService()) { return; } QueryServiceClient proxy = new QueryServiceClient(); try { string iccode = proxy.QueryICCodeByPhysic(physCode); if (iccode != null) { CarLocationPanelLib.QueryService.CCarLocationDto carLoc = null; CarLocationPanelLib.QueryService.EnmFaultType type = proxy.QueryCarPOSNByCardID(out carLoc, iccode); if (type == CarLocationPanelLib.QueryService.EnmFaultType.Success) { if (carLoc != null) { this.CTxtSrcLocAddr.Text = carLoc.carlocaddr; return; } } } } catch (Exception ex) { MessageBox.Show(ex.ToString()); } proxy.Close(); }
/// <summary> /// 系统登陆密码验证 /// </summary> /// <param name="sender"></param> /// <param name="e"></param> private void BtnOk_Click(object sender, EventArgs e) { if (!CStaticClass.CheckPushService()) {// 检查服务 return; } QueryServiceClient proxy = new QueryServiceClient(); try { if (string.IsNullOrEmpty(this.TxtName.Text) || string.IsNullOrEmpty(this.TxtPassWord.Text)) { MessageBox.Show("账户和密码都不能为空!", "警告", MessageBoxButtons.OK, MessageBoxIcon.Warning); return; } COperatorDto operatorTBL = new COperatorDto(); operatorTBL.optcode = this.TxtName.Text.Trim(); operatorTBL.optpassword = this.TxtPassWord.Text.Trim(); CarLocationPanelLib.QueryService.EnmFaultType type = proxy.CheckPassword(ref operatorTBL); switch (type) { case CarLocationPanelLib.QueryService.EnmFaultType.Success: { CStaticClass.myOperator = operatorTBL; this.Close(); this.DialogResult = DialogResult.Yes; this.timer1.Start(); break; } case CarLocationPanelLib.QueryService.EnmFaultType.UserNameError: { MessageBox.Show("账户错误,请重新输入!", "警告", MessageBoxButtons.OK, MessageBoxIcon.Warning); m_nlogNumb++; if (m_nlogNumb == 3) { this.Close(); } break; } case CarLocationPanelLib.QueryService.EnmFaultType.PasswordError: { MessageBox.Show("密码错误,请重新输入!", "警告", MessageBoxButtons.OK, MessageBoxIcon.Warning); m_nlogNumb++; if (m_nlogNumb == 3) { this.Close(); } 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(); }
/// <summary> /// 读取IC卡内存数据 /// </summary> /// <param name="sender"></param> /// <param name="e"></param> private void BtnReadICCardData_Click(object sender, EventArgs e) { if (!CStaticClass.CheckPushService()) {// 检查服务 return; } QueryServiceClient proxy = new QueryServiceClient(); try { struICCardData iccardData = new struICCardData(); CarLocationPanelLib.QueryService.EnmFaultType type = proxy.ReadICCardData(out iccardData); switch (type) { case CarLocationPanelLib.QueryService.EnmFaultType.Success: { this.TxtICCardID.Text = iccardData.strICCardID; this.TxtFeeType.Text = CStaticClass.ConvertFeeType((int)iccardData.enmFeeType); this.TxtFeeStartTime.Text = iccardData.dtFeeStartTime.ToString(); this.TxtFeeEndTime.Text = iccardData.dtFeeEndTime.ToString(); MessageBox.Show("读取IC卡内存数据成功", "成功", MessageBoxButtons.OK, MessageBoxIcon.Asterisk); break; } case CarLocationPanelLib.QueryService.EnmFaultType.FailConnection: { MessageBox.Show("连接刷卡器失败", "警告", MessageBoxButtons.OK, MessageBoxIcon.Warning); break; } case CarLocationPanelLib.QueryService.EnmFaultType.Fail: { 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("读取IC卡内存数据失败", "警告", 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(); }
/// <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(); }
/// <summary> /// LED修改关键字确认按钮 /// </summary> /// <param name="sender"></param> /// <param name="e"></param> private void BtnLEDOk_Click(object sender, EventArgs e) { if (!CStaticClass.CheckPushService()) {// 检查服务 return; } QueryServiceClient proxy = new QueryServiceClient(); try { if (string.IsNullOrEmpty(this.TxtLEDOld.Text) || string.IsNullOrEmpty(this.TxtLEDNew.Text)) { MessageBox.Show("关键字、修改后内容都不能为空!", "警告", MessageBoxButtons.OK, MessageBoxIcon.Warning); return; } CarLocationPanelLib.QueryService.EnmFaultType type = proxy.ModifyLEDContent(this.TxtLEDOld.Text.Trim(), this.TxtLEDNew.Text.Trim()); switch (type) { case CarLocationPanelLib.QueryService.EnmFaultType.Success: { MessageBox.Show("修改LED内容成功!", "成功", MessageBoxButtons.OK, MessageBoxIcon.Asterisk); break; } case CarLocationPanelLib.QueryService.EnmFaultType.Fail: { MessageBox.Show("LED文本未有当前关键字!", "警告", MessageBoxButtons.OK, MessageBoxIcon.Warning); break; } case CarLocationPanelLib.QueryService.EnmFaultType.FailToUpdate: { 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("修改LED内容失败!", "警告", 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(); }
/// <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 { if (string.IsNullOrEmpty(this.CTxtICCardIDFind.Text)) { m_icCardDto = null; ClearICCardControls(); MessageBox.Show("用户卡号不能为空!", "警告", MessageBoxButtons.OK, MessageBoxIcon.Warning); return; } string strICCardID = CStaticClass.ConvertICCardID(this.CTxtICCardIDFind.Text.Trim()); this.GbxICCardInfo.Enabled = true; CICCardDto icCardTable = new CICCardDto(); icCardTable.iccode = strICCardID; // 查询卡 CarLocationPanelLib.QueryService.EnmFaultType type = proxy.QueryICCardInfo(ref icCardTable); m_icCardDto = icCardTable; if (null != icCardTable && CarLocationPanelLib.QueryService.EnmFaultType.Success == type) { this.TxtICCardID.Text = icCardTable.iccode; this.TxtICCardType.Text = CStaticClass.ConvertICCardType(icCardTable.ictype); switch (icCardTable.icstatus) { case (int)EnmICCardStatus.Lost: { this.TxtICCardStatus.Text = "挂失"; this.BtnICCardLoss.Enabled = false; this.BtnICCardCancelLoss.Enabled = true; this.BtnICCardLogout.Enabled = true; break; } case (int)EnmICCardStatus.Normal: { this.TxtICCardStatus.Text = "正常"; this.BtnICCardLoss.Enabled = true; this.BtnICCardCancelLoss.Enabled = false; this.BtnICCardLogout.Enabled = true; break; } case (int)EnmICCardStatus.Disposed: { this.TxtICCardStatus.Text = "注销"; this.BtnICCardLoss.Enabled = false; this.BtnICCardCancelLoss.Enabled = false; this.BtnICCardLogout.Enabled = false; break; } default: { this.TxtICCardStatus.Text = ""; this.BtnICCardLoss.Enabled = true; this.BtnICCardCancelLoss.Enabled = false; this.BtnICCardLogout.Enabled = true; break; } } this.TxtICCardNewTime.Text = icCardTable.icnewtime.ToString(); this.TxtICCardLossTime.Text = icCardTable.iclosstime.ToString(); this.TxtICCardLogoutTime.Text = icCardTable.iclogouttime.ToString(); this.TxtCarLocAddr.Text = icCardTable.carlocaddr; this.TxtWareHouse.Text = icCardTable.warehouse.ToString(); MessageBox.Show("查询成功!", "成功", MessageBoxButtons.OK, MessageBoxIcon.Asterisk); } else { switch (type) { // 传入的参数卡号为空 case CarLocationPanelLib.QueryService.EnmFaultType.Null: { MessageBox.Show("传入的参数卡号为空!", "警告", MessageBoxButtons.OK, MessageBoxIcon.Warning); break; } // 当前IC卡未制卡 case CarLocationPanelLib.QueryService.EnmFaultType.NoICCardInfo: { MessageBox.Show("当前IC卡未制卡!", "警告", MessageBoxButtons.OK, MessageBoxIcon.Warning); break; } // IC卡注销或挂失 case CarLocationPanelLib.QueryService.EnmFaultType.LossORCancel: { MessageBox.Show("IC卡注销或挂失!", "警告", MessageBoxButtons.OK, MessageBoxIcon.Warning); break; } // IC卡类型不正确 case CarLocationPanelLib.QueryService.EnmFaultType.NotMatch: { MessageBox.Show("IC卡类型不正确!", "警告", MessageBoxButtons.OK, MessageBoxIcon.Warning); break; } case CarLocationPanelLib.QueryService.EnmFaultType.Exception: { MessageBox.Show(CStaticClass.GetExceptionInfo(null), "连接异常", MessageBoxButtons.OK, MessageBoxIcon.Error); break; } default: { MessageBox.Show("未查询到当前IC卡", "警告", 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(); }
/// <summary> /// IC卡信息制卡 /// </summary> /// <param name="sender"></param> /// <param name="e"></param> private void BtnICCardCreate_Click(object sender, EventArgs e) { if (!CStaticClass.CheckPushService()) {// 检查服务 return; } if (CTxtICCardIDFind.Text.Trim().Length != 4) { MessageBox.Show("请输入四位用户卡号!", "提示", MessageBoxButtons.OK, MessageBoxIcon.Asterisk); return; } QueryServiceClient proxy = new QueryServiceClient(); try { if (string.IsNullOrEmpty(this.TxtICCardPhy.Text) || string.IsNullOrEmpty(this.CTxtICCardIDFind.Text)) { MessageBox.Show("用户卡号、物理卡号都不能为空!", "警告", MessageBoxButtons.OK, MessageBoxIcon.Warning); return; } string strPhysicalCardID = this.TxtICCardPhy.Text.Trim(); string strICCardID = CStaticClass.ConvertICCardID(this.CTxtICCardIDFind.Text.Trim()); // 写入数据格式(最大可写入长度是15个字节):卡号 + 类型("1") + 制卡时间("yyyyMMdd") + 收费标准("01") // strData += "1" + CStaticClass.CurruntDateTime().ToString("yyyyMMdd") + "01"; CarLocationPanelLib.QueryService.EnmFaultType type = proxy.AddNewICCard(strPhysicalCardID, strICCardID); switch (type) { // 制卡成功 case CarLocationPanelLib.QueryService.EnmFaultType.Success: { if (CStaticClass.ConfigBillingFlag()) { MessageBox.Show("制卡成功!", "成功", MessageBoxButtons.OK, MessageBoxIcon.Asterisk); break; } ICCardCreateAddCustomer(strICCardID); this.TxtICCardPhy.Clear(); break; } // 当前IC卡已经制卡 case CarLocationPanelLib.QueryService.EnmFaultType.HasICCardInfo: { MessageBox.Show("当前IC卡已经制卡:" + strICCardID, "警告", MessageBoxButtons.OK, MessageBoxIcon.Warning); break; } // 逻辑卡号不一致确认是否修改逻辑卡号 case CarLocationPanelLib.QueryService.EnmFaultType.ModifyICCardID: { ModifyICCardID(strPhysicalCardID, strICCardID); break; } // 输入的逻辑卡号已经存在 case CarLocationPanelLib.QueryService.EnmFaultType.ICCardIDNotAllowed: { MessageBox.Show("输入的用户卡号已经存在", "警告", MessageBoxButtons.OK, MessageBoxIcon.Warning); break; } // 插入数据库失败 case CarLocationPanelLib.QueryService.EnmFaultType.FailToInsert: { MessageBox.Show("插入数据库失败", "警告", MessageBoxButtons.OK, MessageBoxIcon.Warning); break; } // 传入的物理卡号或逻辑卡号为空 case CarLocationPanelLib.QueryService.EnmFaultType.Fail: { MessageBox.Show("传入的物理卡号或逻辑卡号为空", "警告", MessageBoxButtons.OK, MessageBoxIcon.Warning); break; } case CarLocationPanelLib.QueryService.EnmFaultType.Exception: { MessageBox.Show(CStaticClass.GetExceptionInfo(null), "连接异常", MessageBoxButtons.OK, MessageBoxIcon.Error); break; } // 连接读卡器失败 // case EnmFaultType.FailConnection: // { // MessageBox.Show("连接读卡器失败", "警告", MessageBoxButtons.OK, MessageBoxIcon.Warning); // break; // } // // 写入IC卡失败 // case EnmFaultType.FailToWriteICCard: // { // MessageBox.Show("写入IC卡失败:" + strData, "警告", MessageBoxButtons.OK, MessageBoxIcon.Warning); // 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(); }
/// <summary> /// 根据逻辑卡号查询车位 /// </summary> /// <param name="strICCardID"></param> private void QueryCarPOSN(string strICCardID) { if (!CStaticClass.CheckPushService()) {// 检查服务 return; } QueryServiceClient proxy = new QueryServiceClient(); try { // 查询当前卡车位 CarLocationPanelLib.QueryService.CCarLocationDto carLoc = new CarLocationPanelLib.QueryService.CCarLocationDto(); CarLocationPanelLib.QueryService.EnmFaultType type = proxy.QueryCarPOSNByCardID(out carLoc, strICCardID); this.CboHallID.Text = null; // ""; this.CboWareHouse.Text = null; // ""; switch (type) { case CarLocationPanelLib.QueryService.EnmFaultType.Success: { if (null == carLoc) { MessageBox.Show("当前用户没有存车!", "警告", MessageBoxButtons.OK, MessageBoxIcon.Warning); } else if (carLoc.carloctype != (int)EnmLocationType.Normal || carLoc.carlocstatus != (int)CarLocationPanelLib.PushService.EnmLocationStatus.Occupy) { MessageBox.Show("该卡存车的车位非正常占用车位!", "警告", MessageBoxButtons.OK, MessageBoxIcon.Warning); } else { this.CboWareHouse.Text = CStaticClass.ConvertWareHouse(carLoc.warehouse); //.ToString(); MessageBox.Show("查询IC卡成功!", "成功", MessageBoxButtons.OK, MessageBoxIcon.Asterisk); } break; } // 获取的逻辑卡号是空值 case CarLocationPanelLib.QueryService.EnmFaultType.Null: { MessageBox.Show("传入的参数卡号为空", "警告", MessageBoxButtons.OK, MessageBoxIcon.Warning); break; } // 没有制卡 case CarLocationPanelLib.QueryService.EnmFaultType.NoICCardInfo: { MessageBox.Show("没有制卡", "警告", MessageBoxButtons.OK, MessageBoxIcon.Warning); break; } // IC卡注销或挂失 case CarLocationPanelLib.QueryService.EnmFaultType.LossORCancel: { MessageBox.Show("IC卡注销或挂失", "警告", MessageBoxButtons.OK, MessageBoxIcon.Warning); break; } // 当前IC卡没有存车 case CarLocationPanelLib.QueryService.EnmFaultType.NotFoundCarPOSN: { MessageBox.Show("当前IC卡没有存车", "警告", MessageBoxButtons.OK, MessageBoxIcon.Warning); break; } case CarLocationPanelLib.QueryService.EnmFaultType.Exception: { MessageBox.Show(CStaticClass.GetExceptionInfo(null), "连接异常", MessageBoxButtons.OK, MessageBoxIcon.Error); break; } default: { MessageBox.Show("查询IC卡失败!", "警告", 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(); }