Esempio n. 1
0
 private void btnWriteSection_Click(object sender, EventArgs e)
 {
     if (ucSection1.CheckInput())
     {
         List <byte[]> data = ucSection1.SectionData;
         if (data.Any(item => item != null))
         {
             bool success = true;
             for (int i = 0; i < data.Count; i++)
             {
                 if (data[i] != null && data[i].Length == 16)
                 {
                     CardOperationResultCode result = CardReaderManager.GetInstance(UserSetting.Current.WegenType).WriteSection(string.Empty, _CurrentSection, i, 1, data[i], GlobalVariables.ParkingKey, false, false);
                     success = success ? result == CardOperationResultCode.Success : success;
                 }
             }
             if (success)
             {
                 CardReaderManager.GetInstance(UserSetting.Current.WegenType).SucessBuz();
             }
         }
         else
         {
             MessageBox.Show("请选择块");
             ucSection1.Focus();
         }
     }
 }
Esempio n. 2
0
        private void FrmCardOut_FormClosing(object sender, FormClosingEventArgs e)
        {
            CardReaderManager.GetInstance(UserSetting.Current.WegenType).PopCardReadRequest(CardReadHandler);

            if (_OutCardsWitPark.Keys.Count > 0)
            {
                MessageBox.Show(Resource1.FrmCardOut_UpdateVacant);

                this.Cursor = Cursors.WaitCursor;
                foreach (ParkInfo park in _OutCardsWitPark.Keys)
                {
                    bool            ret = false;
                    IParkingAdapter pad = ParkingAdapterManager.Instance[park.ParkID];
                    if (pad != null)
                    {
                        ret = pad.ModifiedVacant(_OutCardsWitPark[park]);
                    }
                    //插入卡片直接出场报警记录,记录增加车位数
                    AlarmInfo alarm = new AlarmInfo();
                    alarm.AlarmDateTime = DateTime.Now;
                    alarm.AlarmType     = AlarmType.CardOutAnomaly;
                    alarm.OperatorID    = OperatorInfo.CurrentOperator.OperatorName;
                    alarm.AlarmDescr    = string.Format("[{0}] " + Resource1.FrmCardOut_OutCount + ":[{1}]," + Resource1.FrmCardOut_VacantCount + "[{2}]", park.ParkName, _OutCardsWitPark[park].ToString(), ret ? Resource1.Form_Success : Resource1.Form_Fail);
                    new AlarmBll(AppSettings.CurrentSetting.ParkConnect).Insert(alarm);
                    if (!ret)
                    {
                        this.Cursor = Cursors.Arrow;
                        MessageBox.Show(string.Format("{0} ,{1}", alarm.AlarmDescr, Resource1.FrmCardOut_VacantManual));
                        this.Cursor = Cursors.WaitCursor;
                    }
                }
                this.Cursor = Cursors.Arrow;
            }
        }
Esempio n. 3
0
        private void FrmCardPaying_FormClosed(object sender, FormClosedEventArgs e)
        {
            AppSettings.CurrentSetting.SaveConfig("PaymentPanelWidth", paymentPanel.Width.ToString());
            AppSettings.CurrentSetting.SaveConfig("VideoPanelHeight", videoPanel.Height.ToString());
            CardReaderManager.GetInstance(UserSetting.Current.WegenType).PopCardReadRequest(CardReadHandler);
            if (_TicketReader != null)
            {
                _TicketReader.Close();
            }
            if (_BillPrinter != null)
            {
                _BillPrinter.Close();
            }
            if (_YCTReader != null)
            {
                _YCTReader.Close();
            }
            if (_ChargeLed != null)
            {
                _ChargeLed.Close();
            }

            if (AppSettings.CurrentSetting.EnableZST)
            {
                FrmZSTSetting frm = FrmZSTSetting.GetInstance();
                frm.ZSTReader.MessageRecieved -= new EventHandler <ZSTReaderEventArgs>(ZSTReader_MessageRecieved);
            }
            this.ucVideoes.Clear();
            this._EnterVideoes.Clear();
        }
Esempio n. 4
0
 private void FrmCardChangeKey_Load(object sender, EventArgs e)
 {
     CardReaderManager.GetInstance(UserSetting.Current.WegenType).StopReadCard();
     this._ChangeKeyTimer.Interval = 1000;
     this._ChangeKeyTimer.Enabled  = false;
     this._ChangeKeyTimer.Tick    += ChangeKeyTimerHandler;
 }
Esempio n. 5
0
 private void ClearInput()
 {
     this.txtCardID.Text          = string.Empty;
     this.lblOwnerName.Text       = string.Empty;
     this.lblCarNum.Text          = string.Empty;
     this.lblEnterDateTime.Text   = string.Empty;
     this.lblExitDateTime.Text    = string.Empty;
     this.lblParkingTime.Text     = string.Empty;
     this.lblCardType.Text        = string.Empty;
     this.lblTariffType.Text      = string.Empty;
     this.lblLastTotalPaid.Text   = string.Empty;
     this.lblAccounts.Text        = string.Empty;
     this.lblLastWorkstation.Text = string.Empty;
     this.txtPaid.DecimalValue    = 0;
     this.lblDiscount.Text        = string.Empty;
     this.btnCancel.Enabled       = false;
     this.btnCash.Enabled         = false;
     this.btnYCT.Enabled          = false;
     this.btnRepay.Enabled        = false;
     this._cardInfo     = null;
     this._ChargeRecord = null;
     this.picIn.Clear();
     this.txtCardID.ReadOnly = false;
     this.txtMemo.Text       = string.Empty;
     CardReaderManager.GetInstance(UserSetting.Current.WegenType).BeginReadCard();
 }
Esempio n. 6
0
 private void FrmCardDisableEnable_FormClosing(object sender, FormClosingEventArgs e)
 {
     if (AppSettings.CurrentSetting.EnableWriteCard)
     {
         CardReaderManager.GetInstance(UserSetting.Current.WegenType).PopCardReadRequest(CardReadHandler);
     }
 }
Esempio n. 7
0
        private void FrmCardCharge_Load(object sender, EventArgs e)
        {
            this.chkWriteCard.Checked = AppSettings.CurrentSetting.EnableWriteCard; //写卡模式时默认选中
            this.chkWriteCard.Visible = AppSettings.CurrentSetting.EnableWriteCard; //写卡模式时显示

            this.ucCardInfo.Init();
            this.ucCardInfo.UseToShow();
            this.comPaymentMode.Init();
            this.comPaymentMode.SelectedPaymentMode = PaymentMode.Cash;
            if (ChargingCard != null)
            {
                this.ucCardInfo.Card = ChargingCard;
                if (ChargingCard.ValidDate > this.dtValidDate.MaxDate)
                {
                    this.dtValidDate.Value = this.dtValidDate.MaxDate;
                }
                else if (ChargingCard.ValidDate < this.dtValidDate.MinDate)
                {
                    this.dtValidDate.Value = this.dtValidDate.MinDate;
                }
                else
                {
                    this.dtValidDate.Value = ChargingCard.ValidDate;
                }
            }

            if (AppSettings.CurrentSetting.EnableWriteCard)
            {
                CardReaderManager.GetInstance(UserSetting.Current.WegenType).PushCardReadRequest(CardReadHandler);
            }
        }
Esempio n. 8
0
        private void btnRead_Click(object sender, EventArgs e)
        {
            _Card = null;
            ClearInput();
            ReadCardResult result = CardReaderManager.GetInstance(UserSetting.Current.WegenType).ReadSection(string.Empty, _CurrentSection, 0, 3, GlobalVariables.ParkingKey, true, true, false);

            if (CardOperationManager.Instance.ShowResultMessage(result.ResultCode))
            {
                this.txtCardID.Text = result.CardID;
                byte[] carddate = result[_CurrentSection];
                _Card = CardDateResolver.Instance.GetCardInfoFromData(result.CardID, carddate);
                List <byte[]> data = new List <byte[]>();
                if (carddate.Length == 16 * 3)
                {
                    for (int i = 0; i < 3; i++)
                    {
                        byte[] bytes = new byte[16];
                        Array.Copy(carddate, i * 16, bytes, 0, 16);
                        data.Add(bytes);
                    }
                    ucSection1.SectionData = data;
                }
            }
            if (_Card != null)
            {
                ShowCard(_Card);
            }
        }
 private void FrmHotelAuthorization_Activated(object sender, EventArgs e)
 {
     this.btnOK.Enabled       = OperatorInfo.CurrentOperator.Permit(Permission.FreeAuthorization);
     this.btnCheckOut.Enabled = OperatorInfo.CurrentOperator.Permit(Permission.FreeAuthorization);
     this.txtDays.Enabled     = OperatorInfo.CurrentOperator.Permit(Permission.EditFreeDays);
     CardReaderManager.GetInstance(UserSetting.Current.WegenType).PushCardReadRequest(CardReadHandler);
 }
Esempio n. 10
0
        private void ShowCardPaymentInfo(CardPaymentInfo cardPayment)
        {
            this.txtCardID.Text = cardPayment.CardID;
            this.txtCardID.SelectAll();
            this.lblOwnerName.Text     = cardPayment.OwnerName;
            this.lblCarNum.Text        = cardPayment.CarPlate;
            this.lblEnterDateTime.Text = cardPayment.EnterDateTime.Value.ToString("yyyy-MM-dd HH:mm:ss");
            this.lblExitDateTime.Text  = cardPayment.ChargeDateTime.ToString("yyyy-MM-dd HH:mm:ss");
            this.lblParkingTime.Text   = cardPayment.TimeInterval;
            this.lblCardType.Text      = cardPayment.CardType.ToString();
            this.lblTariffType.Text    = Ralid.Park.BusinessModel.Resouce.TariffTypeDescription.GetDescription(cardPayment.TariffType);
            //this.lblLastTotalPaid.Text = cardPayment.LastTotalPaid.ToString();
            this.lblLastTotalPaid.Text = _cardInfo.TotalPaidFee.ToString();
            //this.lblLastTotalDiscount.Text = cardPayment.LastTotalDiscount.ToString();
            this.lblAccounts.Text        = cardPayment.Accounts.ToString();
            this.lblLastWorkstation.Text = cardPayment.LastStationID;
            this.txtPaid.DecimalValue    = cardPayment.Accounts - cardPayment.Discount;
            this.lblDiscount.Text        = cardPayment.Discount.ToString();
            this.txtMemo.Text            = string.Empty;

            this.picIn.Clear();
            List <SnapShot> imgs = _SnapShotBll.GetSnapShots(cardPayment.EnterDateTime.Value, cardPayment.CardID);

            if (imgs != null && imgs.Count > 0)
            {
                this.picIn.ShowSnapShots(imgs);
            }

            string msg = string.Format(Resource1.FrmCardPaying_PayingSpeech, TariffSetting.Current.TariffOption.StrMoney(cardPayment.Accounts));

            this.carTypePanel1.SelectedCarType = cardPayment.CarType;
            this.btnCash.Enabled = true;
            this.btnCash.Focus();
            this.btnYCT.Enabled    = (_YCTReader != null) ? true : false;
            this.btnCancel.Enabled = true;
            this.btnRepay.Enabled  = _cardInfo.LastPayment != null || _cardInfo.IsCompletedPaid;

            if (_cardInfo.IsCompletedPaid && TariffSetting.Current.IsInFreeTime(_cardInfo.PaidDateTime.Value, cardPayment.ChargeDateTime))
            {
                //已缴费,并且未过免费时间
                msg = string.Format(Resource1.FrmCardCenterCharge_FreeRemain, TariffSetting.Current.FreeTimeRemaining(_cardInfo.PaidDateTime.Value, cardPayment.ChargeDateTime));
                this.eventList.InsertMessage(msg);
                this.txtMemo.Text = msg;
                //不允许缴费
                this.btnCash.Enabled = false;
                this.btnYCT.Enabled  = false;
            }

            if (_ChargeLed != null)
            {
                _ChargeLed.DisplayMsg(msg);
            }
            if (AppSettings.CurrentSetting.EnableTTS)
            {
                TTSSpeech.Instance.Speek(msg);
            }

            CardReaderManager.GetInstance(UserSetting.Current.WegenType).StopReadCard();
        }
Esempio n. 11
0
        private void FrmPaying_Load(object sender, EventArgs e)
        {
            this.carTypePanel1.Init();
            ClearInput();

            CardReaderManager.GetInstance(UserSetting.Current.WegenType).PushCardReadRequest(CardReadHandler);

            if (AppSettings.CurrentSetting.TicketReaderCOMPort > 0)
            {
                _TicketReader              = new BarCodeReader(AppSettings.CurrentSetting.TicketReaderCOMPort);
                _TicketReader.BarCodeRead += new BarCodeReadEventHandler(TicketReader_BarCodeRead);
                _TicketReader.Open();
            }
            if (AppSettings.CurrentSetting.ParkFeeLedCOMPort > 0)
            {
                if (AppSettings.CurrentSetting.ParkFeeLedType == 0)
                {
                    _ChargeLed = new ZhongKuangLed(AppSettings.CurrentSetting.ParkFeeLedCOMPort);
                }
                else
                {
                    _ChargeLed = new YanseDesktopLed(AppSettings.CurrentSetting.ParkFeeLedCOMPort);
                }
                _ChargeLed.Open();
                _ChargeLed.PermanentSentence = Resource1.FrmCardPaying_CentralCharge;
            }
            if (AppSettings.CurrentSetting.BillPrinterCOMPort > 0)
            {
                _BillPrinter = new EpsonmodePrinter(AppSettings.CurrentSetting.BillPrinterCOMPort, 9600);
                _BillPrinter.Open();
            }
            if (AppSettings.CurrentSetting.YCTReaderCOMPort > 0)
            {
                _YCTReader = new YangChengTongReader(AppSettings.CurrentSetting.YCTReaderCOMPort, 1);
                _YCTReader.Open();
            }

            this.txtMemo.Items.Clear();
            if (UserSetting.Current.PaymentComments != null && UserSetting.Current.PaymentComments.Count > 0)
            {
                foreach (string comment in UserSetting.Current.PaymentComments)
                {
                    this.txtMemo.Items.Add(comment);
                }
            }

            //从配置文件中获取收费栏的宽度
            string temp = AppSettings.CurrentSetting.GetConfigContent("PaymentPanelWidth");
            int    intVal;

            if (int.TryParse(temp, out intVal) && intVal > 0)
            {
                this.paymentPanel.Width = intVal;
            }

            this.parkCombobox1.Init();
            this.label1.Visible        = false;
            this.parkCombobox1.Visible = false;
        }
Esempio n. 12
0
 private void FrmOperatorCardReader_Load(object sender, EventArgs e)
 {
     //this.Text = "请刷" + OpeCardName;
     //this.label1.Text = "请在发卡机上刷" + OpeCardName;
     this.Text        = "请刷授权卡";
     this.label1.Text = "请在发卡机上刷授权卡";
     CardReaderManager.GetInstance(UserSetting.Current.WegenType).PushCardReadRequest(CardReadEventHandler);
 }
Esempio n. 13
0
 private void FrmCards_Deactivate(object sender, EventArgs e)
 {
     CardReaderManager.GetInstance(UserSetting.Current.WegenType).PopCardReadRequest(CardReadHandler);
     if (AppSettings.CurrentSetting.EnableZST)
     {
         FrmZSTSetting frm = FrmZSTSetting.GetInstance();
         frm.ZSTReader.MessageRecieved -= new EventHandler <ZSTReaderEventArgs>(ZSTReader_MessageRecieved);
     }
 }
Esempio n. 14
0
 private void btnSave_Click(object sender, EventArgs e)
 {
     if (CheckSetting())
     {
         SaveSetting();
         CardReaderManager.GetInstance(UserSetting.Current.WegenType).AddReadSectionAndKey(GlobalVariables.ParkingSection, GlobalVariables.ParkingKey);
         MessageBox.Show("保存成功!");
     }
 }
Esempio n. 15
0
 private void ClearCardInfo()
 {
     this.lblCardWarning.Text  = string.Empty;
     this.txtCardID.Text       = string.Empty;
     this.txtCarPlate.Text     = string.Empty;
     this.txtOwnerName.Text    = string.Empty;
     this.txtEntranceTime.Text = string.Empty;
     this.txtEntranceTime.Tag  = null;
     CardReaderManager.GetInstance(UserSetting.Current.WegenType).BeginReadCard();
 }
Esempio n. 16
0
 private void FrmCards_Activated(object sender, EventArgs e)
 {
     CardReaderManager.GetInstance(UserSetting.Current.WegenType).PushCardReadRequest(CardReadHandler);
     ShowOperatorRights(OperatorInfo.CurrentOperator);
     if (AppSettings.CurrentSetting.EnableZST)
     {
         FrmZSTSetting frm = FrmZSTSetting.GetInstance();
         frm.ZSTReader.MessageRecieved += new EventHandler <ZSTReaderEventArgs>(ZSTReader_MessageRecieved);
     }
 }
Esempio n. 17
0
        private CardInfo _cardInfo;//当前读到的卡片,用于写卡模式

        //private string _VideoPath = Application.StartupPath + @"\FrmCardPaying_OpenedVideoes.xml";
        #endregion

        #region 私有方法
        private void ShowCardEventInfo(CardEventReport info)
        {
            this._EnterVideoes.Visible = false;
            this.picIn.Clear();
            this.picIn.Visible = true;
            if (info.IsExitEvent)
            {
                List <SnapShot> imgs = (new SnapShotBll(AppSettings.CurrentSetting.ParkConnect)).GetSnapShots(info.LastDateTime.Value, info.CardID);
                if (imgs != null && imgs.Count > 0)
                {
                    this.picIn.ShowSnapShots(imgs);
                }
            }

            try
            {
                //视频控件容易出问题,这里做一个异常处理
                ucVideoes.ShowVideoes(ParkBuffer.Current.GetEntrance(info.EntranceID).VideoSources);
            }
            catch (Exception ex)
            {
                Ralid.GeneralLibrary.ExceptionHandling.ExceptionPolicy.HandleException(ex);
            }

            if (info.ChargeAsTempCard)
            {
                this.btnCash.Enabled         = true;
                this.btnCardOk.Enabled       = UserSetting.Current.OneKeyOpenDoor ? true : false;
                this.btnYCT.Enabled          = (_YCTReader != null) ? true : false;
                this.btnInvalidEvent.Enabled = true;
                if (UserSetting.Current.OneKeyOpenDoor)
                {
                    this.btnCardOk.Focus();
                }
                else
                {
                    this.btnCash.Focus();
                }
            }
            else
            {
                this.btnCardOk.Enabled       = true;
                this.btnInvalidEvent.Enabled = true;
                this.AcceptButton            = this.btnCardOk;
                this.btnCardOk.Focus();
                this.btnCash.Enabled = false;
                this.btnYCT.Enabled  = false;
            }

            if (info.CardPaymentInfo != null)
            {
                ShowCardChargeInfo(info.CardPaymentInfo);
            }
            CardReaderManager.GetInstance(UserSetting.Current.WegenType).StopReadCard();
        }
Esempio n. 18
0
        /// <summary>
        /// 读取卡片
        /// </summary>
        /// <param name="cardID">卡号(为空时不检查卡号是否一致)</param>
        /// <returns></returns>
        public CardInfo ReadCardWithMessage(string cardID)
        {
            CardInfo       card   = null;
            ReadCardResult result = CardReaderManager.GetInstance(UserSetting.Current.WegenType).ReadSection(cardID, (int)ICCardSection.Parking, 0, 3, GlobalVariables.ParkingKey, true, true, false);

            if (ShowResultMessage(result.ResultCode))
            {
                card = CardDateResolver.Instance.GetCardInfoFromData(result.CardID, result.ParkingDate);
            }
            return(card);
        }
Esempio n. 19
0
 /// <summary>
 /// 数据写入卡片
 /// </summary>
 /// <param name="cardID">卡号</param>
 /// <param name="data">数据</param>
 /// <param name="success">成功后是否有提示音</param>
 /// <param name="fail">失败后是否有提示音</param>
 /// <param name="loop">是否循环写入</param>
 /// <param name="init">是否初始化密钥</param>
 /// <returns></returns>
 private CardOperationResultCode _WriteCard(string cardID, byte[] data, bool success, bool fail, bool loop, bool init)
 {
     if (GlobalVariables.UseMifareIC)
     {
         return(CardReaderManager.GetInstance(UserSetting.Current.WegenType).WriteSection(cardID, GlobalVariables.ParkingSection, 0, 3, data, GlobalVariables.ParkingKey, success, fail, loop, init));
     }
     else
     {
         return(CardReaderManager.GetInstance(UserSetting.Current.WegenType).CPUWriteFile(cardID, GlobalVariables.SamNO, GlobalVariables.ParkingCPUKey, GlobalVariables.ParkingFile, data, GlobalVariables.AlgorithmType, success, fail, loop));
     }
 }
Esempio n. 20
0
        private void FrmParkingDebugTool_Load(object sender, EventArgs e)
        {
            InitCardType();
            InitCarType();
            UserSetting.Current           = new UserSetting();
            UserSetting.Current.WegenType = WegenType.Wengen34;
            KeySetting.Current            = new KeySetting();

            _CurrentSection = GlobalVariables.ParkingSection;

            CardReaderManager.GetInstance(UserSetting.Current.WegenType).AddReadSectionAndKey(_CurrentSection, GlobalVariables.ParkingKey);
        }
Esempio n. 21
0
 /// <summary>
 /// 读卡
 /// </summary>
 private void ReadCard()
 {
     progressBar1.Maximum        = BulkChangeCards.Count;
     progressBar1.Minimum        = 0;
     progressBar1.Value          = 0;
     this.comAccessLevel.Enabled = false;
     this.groupBox3.Enabled      = false;
     this.lblAlarm.Text          = string.Format(Resources.Resource1.FrmCardBulkChange_PleaseReadCard);
     this.lblAlarm.ForeColor     = Color.Blue;
     this.lblAlarm.Refresh();
     CardReaderManager.GetInstance(UserSetting.Current.WegenType).PushCardReadRequest(CardReadHandler);
 }
Esempio n. 22
0
        protected override void ItemShowing()
        {
            CardInfo info = (CardInfo)UpdatingItem;

            this.ucCardInfo.Card = info;
            this.Text            = info.CardID;

            //修改时该处启动读卡器
            if (AppSettings.CurrentSetting.EnableWriteCard && !IsAdding)
            {
                CardReaderManager.GetInstance(UserSetting.Current.WegenType).PushCardReadRequest(CardReadHandler);
            }
        }
Esempio n. 23
0
 /// <summary>
 /// 初始化卡片
 /// </summary>
 /// <param name="cardID">卡片卡号(为空时不检查卡号是否一致)</param>
 /// <returns></returns>
 public CardOperationResultCode InitCard(string cardID)
 {
     try
     {
         //修改扇区2密钥
         //return CardReaderManager.GetInstance(UserSetting.Current.WegenType).SetSectionKey(cardID, (int)ICCardSection.Parking, false, true);
         return(CardReaderManager.GetInstance(UserSetting.Current.WegenType).SetSectionKey(cardID, (int)ICCardSection.Parking, GlobalVariables.DefaultKey, GlobalVariables.ParkingKey, false, true));
     }
     catch (Exception ex)
     {
         Ralid.GeneralLibrary.ExceptionHandling.ExceptionPolicy.HandleException(ex);
     }
     return(CardOperationResultCode.Fail);
 }
Esempio n. 24
0
        /// <summary>
        /// 进场
        /// </summary>
        /// <param name="indoor">是否进内车场</param>
        public void Enter(bool indoor)
        {
            CardReaderManager manager = CardReaderManager.GetInstance(UserSetting.Current.WegenType);
            ReadCardResult    result  = manager.ReadSection(string.Empty, 2, 0, 3, GlobalVariables.ParkingKey, true, true, false);

            if (result.ResultCode == CardOperationResultCode.Success)
            {
                CardInfo card = CardDateResolver.Instance.GetCardInfoFromData(result.CardID, result.ParkingDate);
                if (card != null)
                {
                    Enter(card, indoor);
                }
            }
        }
Esempio n. 25
0
        private void FrmCardCharge_Load(object sender, EventArgs e)
        {
            this.chkWriteCard.Checked = AppSettings.CurrentSetting.EnableWriteCard; //写卡模式时默认选中
            this.chkWriteCard.Visible = AppSettings.CurrentSetting.EnableWriteCard; //写卡模式时显示

            this.ucCardInfo.Init();
            this.ucCardInfo.UseToShow();
            this.comPaymentMode.Init();
            this.comPaymentMode.SelectedPaymentMode = PaymentMode.Cash;
            if (ChargingCard != null)
            {
                //获取最新的卡片信息,这是为了防止用户一直打开卡片管理,而使用的卡片信息是缓存信息,导致充值的卡片信息不是最新的
                CardBll  bll  = new CardBll(AppSettings.CurrentSetting.ParkConnect);
                CardInfo card = bll.GetCardByID(ChargingCard.CardID).QueryObject;
                if (card != null)
                {
                    ChargingCard = card;

                    this.ucCardInfo.Card = ChargingCard;
                    if (ChargingCard.ValidDate > this.dtValidDate.MaxDate)
                    {
                        this.dtValidDate.Value = this.dtValidDate.MaxDate;
                    }
                    else if (ChargingCard.ValidDate < this.dtValidDate.MinDate)
                    {
                        this.dtValidDate.Value = this.dtValidDate.MinDate;
                    }
                    else
                    {
                        this.dtValidDate.Value = ChargingCard.ValidDate;
                    }
                    if (!ChargingCard.IsCardList)
                    {
                        //不是卡片名单时,不需要进行写卡
                        this.chkWriteCard.Checked = false;
                        this.chkWriteCard.Enabled = false;
                    }
                }
                else
                {
                    this.btnOk.Enabled = false;
                    MessageBox.Show(Resource1.FrmMain_NoCard);
                }
            }

            if (AppSettings.CurrentSetting.EnableWriteCard)
            {
                CardReaderManager.GetInstance(UserSetting.Current.WegenType).PushCardReadRequest(CardReadHandler);
            }
        }
Esempio n. 26
0
 /// <summary>
 /// 恢复卡片数据
 /// </summary>
 /// <param name="cardID">卡片号(为空时不检查卡号是否一致)</param>
 /// <param name="data">恢复到卡片的数据</param>
 /// <returns></returns>
 public CardOperationResultCode RecoverCard(string cardID, byte[] data)
 {
     try
     {
         if (data != null && data.Length == 48)
         {
             return(CardReaderManager.GetInstance(UserSetting.Current.WegenType).WriteSection(cardID, (int)ICCardSection.Parking, 0, 3, data, GlobalVariables.ParkingKey, true, true));
         }
     }
     catch (Exception ex)
     {
         Ralid.GeneralLibrary.ExceptionHandling.ExceptionPolicy.HandleException(ex);
     }
     return(CardOperationResultCode.Fail);
 }
Esempio n. 27
0
 private void btnConvert_Click(object sender, EventArgs e)
 {
     if (_StartConvert)
     {
         this.btnConvert.Text = Resources.Resource1.FrmCardDataConvert_StartConvert;
         _StartConvert        = false;
         CardReaderManager.GetInstance(UserSetting.Current.WegenType).PopCardReadRequest(ReadCardHandler);
     }
     else
     {
         this.btnConvert.Text = Resources.Resource1.FrmCardDataConvert_StopConvert;
         _StartConvert        = true;
         CardReaderManager.GetInstance(WegenType.Wengen34).PushCardReadRequest(ReadCardHandler);
     }
 }
Esempio n. 28
0
        private void FrmAddCards_Load(object sender, EventArgs e)
        {
            this.chkWriteCard.Checked = AppSettings.CurrentSetting.EnableWriteCard; //写卡模式时默认选中
            this.chkWriteCard.Visible = AppSettings.CurrentSetting.EnableWriteCard; //写卡模式时显示

            this.comCardType.Init();
            this.comChargeType.Init();
            this.comAccessLevel.Init();
            this.comCardType.SelectedCardType  = CardType.TempCard;
            this.comChargeType.SelectedCarType = CarTypeSetting.DefaultCarType;
            this.comAccessLevel.AccesslevelID  = 0;
            this._curStep = step_welcome;
            InitCardGrid();
            ShowNextStep(_curStep);
            CardReaderManager.GetInstance(UserSetting.Current.WegenType).PushCardReadRequest(CardReadHandler);
        }
Esempio n. 29
0
 private void FrmCardBulkChange_FormClosing(object sender, FormClosingEventArgs e)
 {
     if (this.chkWriteCard.Checked && _changedCards.Count > 0)
     {
         if (MessageBox.Show(Resources.Resource1.FrmCardBulkChange_CloseQuery, Resources.Resource1.Form_Query, MessageBoxButtons.YesNo, MessageBoxIcon.Question)
             == DialogResult.No)
         {
             e.Cancel = true;
             return;
         }
     }
     if (this.chkWriteCard.Checked)
     {
         CardReaderManager.GetInstance(UserSetting.Current.WegenType).PopCardReadRequest(CardReadHandler);
     }
 }
Esempio n. 30
0
 private void ClearCardEvent()
 {
     ClearCardChargeInfo();
     this.picIn.Clear();
     this.picIn.Visible           = false;
     this._EnterVideoes.Visible   = true;
     this.btnCardOk.Enabled       = false;
     this.btnInvalidEvent.Enabled = false;
     this.btnCash.Enabled         = false;
     this.btnYCT.Enabled          = false;
     this.btnInvalidEvent.Enabled = false;
     this.AcceptButton            = null;
     _processingEvent             = null;
     _cardInfo = null;
     CardReaderManager.GetInstance(UserSetting.Current.WegenType).BeginReadCard();
 }