Example #1
0
        /// <summary>
        /// 查看
        /// </summary>
        /// <param name="sender"></param>
        /// <param name="e"></param>
        private void tbnView_Click(object sender, EventArgs e)
        {
            if (dgvMain.SelectedRows.Count == 0)
            {
                MessageBoxForm.Show(new SystemMessage().GetInfoByCode("PleaseSelectData"), MessageBoxButtons.OK);
                return;
            }

            Bouwa.ITSP2V31.Win.CardInfo.View frmCardInfoEdit = new Bouwa.ITSP2V31.Win.CardInfo.View();

            string strId = dgvMain.SelectedRows[0].Cells["Id"].Value.ToString();

            frmCardInfoEdit.Parameter.Add("ActionType", ActionType.View.ToString("D"));
            frmCardInfoEdit.Parameter.Add("Id", strId);
            frmCardInfoEdit.StartPosition = FormStartPosition.CenterScreen;
            frmCardInfoEdit.ShowDialog(this);
        }
Example #2
0
        /// <summary>
        /// 进行读卡操作
        /// </summary>
        private void ReadCard()
        {
            //先读取卡内信息
            CardInfoBLL _cardBll = new CardInfoBLL();
            int         status   = -1; //保存读取后返回的一个状态

            Bouwa.ITSP2V31.Model.CardInfo _cardInfo = _cardBll.GetCardInfoByCard(Bouwa.Helper.CurrentUser.Current.PassWordKey, out status);
            try
            {
                //string[] mary1 = StringUtil.readBlock(RFIDClass.ReadCardAndReturnStatus(CurrentUser.Current.PassWordKey, Convert.ToInt32(1)));
                //if (mary1[4] != "0")
                //{
                //    //MessageBoxForm.Show(RFIDClass.ConvertMeassByStatus(Convert.ToInt32(mary1[4])));
                //    throw new Exception(RFIDClass.ConvertMeassByStatus(Convert.ToInt32(mary1[4])));
                //}
                ////string[] mary6 = StringUtil.readBlock(RFIDClass.ReadCardAndReturnStatus(CurrentUser.Current.PassWordKey, Convert.ToInt32(6)));
                ////判断当前读的卡是否能初始化的条件; 1: 卡状态为空卡255 ;2:卡状态为已充值,但最后操作时间为空
                //string cardStatus = mary1[2].ToString();
                //if (cardStatus.Length >= 16)
                //{
                //    cardStatus = HelperClass.getCardStatus(cardStatus.Substring(13, 1));
                //}
                //else
                //{
                //    cardStatus = Bouwa.ITSP2V31.Model.CardTypeInfo.CardTypeInfoDefaultCardStatus.空白卡.ToString("D");
                //}

                //if (cardStatus.Equals(CardTypeInfo.CardTypeInfoDefaultCardStatus.空白卡.ToString("D"))
                //    || (cardStatus.Equals(CardTypeInfo.CardTypeInfoDefaultCardStatus.已充值.ToString("D")) && string.IsNullOrEmpty(HelperClass.DecryptByString(mary1[3])))
                //    ||  _cardInfo ==null
                //    )
                //{
                //    Bouwa.ITSP2V31.WIN.CardType.CardTypeList frmCardType = new Bouwa.ITSP2V31.WIN.CardType.CardTypeList();
                //    MessageBoxForm.Show("停车卡还未初始化,需先初始化停车卡!", MessageBoxButtons.OK);

                //    frmCardType.StartPosition = FormStartPosition.CenterScreen;

                //    frmCardType.ShowDialog(this);
                //    return;
                //}
                //再去读取一次
                if (status == 11 || status == 12)
                {
                    _cardInfo = _cardBll.GetCardInfoByCard(string.Empty, out status);
                }
                if (status != 0)
                {
                    MessageBoxForm.Show(RFIDClass.ConvertMeassByStatus(status), MessageBoxButtons.OK);
                    return;
                }
                else if (_cardInfo == null)
                {
                    MessageBoxForm.Show("此卡为空卡,请先进行初始化!", MessageBoxButtons.OK);
                    return;
                }
                //执行查询
                BindingSource bs           = new BindingSource();
                Hashtable     objHashtable = new Hashtable();
                objHashtable.Add("no", _cardInfo.no);
                objHashtable.Add("cost_type", (int)_cardInfo.cost_type); //扣费类型
                objHashtable.Add("card_id", _cardInfo.card_id);          //卡内编号
                //objHashtable.Add("saas_id", CurrentUser.Current.SAASID);

                IList <Bouwa.ITSP2V31.Model.CardInfo> CardInfo = _objCardInfoBLL.SearchByCondition(objHashtable, null, 1, 1, "[status] DESC", ref _objSystemMessageInfo);

                //说明注册过了
                if (CardInfo != null && CardInfo.Count > 0)
                {
                    Bouwa.ITSP2V31.Win.CardInfo.View frmCardInfoEdit = new Bouwa.ITSP2V31.Win.CardInfo.View();

                    frmCardInfoEdit.Parameter.Add("ActionType", ActionType.View.ToString("D"));
                    frmCardInfoEdit.Parameter.Add("Id", CardInfo[0].id.ToString());
                    frmCardInfoEdit.StartPosition = FormStartPosition.CenterScreen;
                    frmCardInfoEdit.ShowDialog(this);
                }//说明未注册
                else
                {
                    //Bouwa.ITSP2V31.WIN.CardType.CardTypeList frmCardType = new Bouwa.ITSP2V31.WIN.CardType.CardTypeList();
                    //MessageBoxForm.Show("停车卡还未初始化,需先初始化停车卡!", MessageBoxButtons.OK);
                    MessageBoxForm.Show("后台未找到停车卡信息,请联系管理员!", MessageBoxButtons.OK);
                    //frmCardType.StartPosition = FormStartPosition.CenterScreen;
                    //frmCardType.ShowDialog(this);
                    return;
                }
            }
            catch (Exception ex)
            {
                Bouwa.Helper.Class.Log.WriterLine(Bouwa.Helper.Class.ELevel.error, "读卡出现异常", ex.Message);
                MessageBoxForm.Show(_cardBll.ConvertMeassByStatus(status), MessageBoxButtons.OK);
            }
        }