Esempio n. 1
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   password = CurrentUser.Current.PassWordKey;
                bool     flag     = false;
                string[] mary1    = StringUtil.readBlock(RFIDClass.ReadCardAndReturnStatus(password, Convert.ToInt32(1)));
                if (mary1[4] == "11" || mary1[4] == "12")
                {
                    flag     = true;
                    password = SystemConstant.StringEmpty;
                    mary1    = StringUtil.readBlock(RFIDClass.ReadCardAndReturnStatus(password, Convert.ToInt32(1)));
                }
                if (mary1[4] != "0")
                {
                    throw new Exception(RFIDClass.ConvertMeassByStatus(Convert.ToInt32(mary1[4])));
                }

                if (string.IsNullOrEmpty(_cardInfo.card_id))
                {
                    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
                {
                    MessageBoxForm.Show("停车卡未在后台注册,请联系管理员!", MessageBoxButtons.OK);
                }
            }
            catch (Exception ex)
            {
                Bouwa.Helper.Class.Log.WriterLine(Bouwa.Helper.Class.ELevel.error, "读卡出现异常", ex.Message);
                MessageBoxForm.Show(_cardBll.ConvertMeassByStatus(status), MessageBoxButtons.OK);
            }
        }
Esempio n. 2
0
        /// <summary>
        /// 为控件赋值
        /// </summary>
        /// <param name="theId"></param>
        private void SetFormFromInfo(Guid theId)
        {
            if (theId != Bouwa.Helper.SystemConstant.GuidEmpty)
            {
                _objCardInfo = _objCardInfoBLL.GetById(theId, null, ref _objSystemMessageInfo);
                if (_objCardInfo != null)
                {
                    this.txtBatch.Text                   = _objCardInfo.batch;
                    this.tbxCardNum.Text                 = _objCardInfo.no;
                    this.tbxCardType.Text                = _objCardInfo.CardType;
                    this.ddlCostType.SelectedValue       = _objCardInfo.cost_type;
                    this.ddlPurpoe.SelectedValue         = _objCardInfo.purpose;
                    this.ddlSubmitType.SelectedValue     = _objCardInfo.submit_type;
                    this.ddlDefault_Status.SelectedValue = _objCardInfo.status;
                    this.dtpEffectDate.Value             = _objCardInfo.efffect_date;
                    this.dtpEndDate.Value                = _objCardInfo.end_date;

                    if (_objCardInfo.cost_type == Bouwa.ITSP2V31.Model.CardInfo.CardTypeInfoCostType.限时卡)
                    {
                        this.lblDefault.Text      = "剩余时间:";
                        this.tbxDefault.Text      = _objCardInfo.charges_date.ToString();
                        this.lblDefault_Unit.Text = this.lblMax_Unit.Text = "分钟";
                        this.lblMax.Text          = "上限时间:";
                        this.tbxMax.Text          = _objCardInfo.MaxChargesDate.ToString();
                    }
                    else if (_objCardInfo.cost_type == Bouwa.ITSP2V31.Model.CardInfo.CardTypeInfoCostType.限次卡)
                    {
                        this.lblDefault.Text      = "剩余次数:";
                        this.tbxDefault.Text      = _objCardInfo.times.ToString();
                        this.lblDefault_Unit.Text = this.lblMax_Unit.Text = "次";
                        this.lblMax.Text          = "上限次数:";
                        this.tbxMax.Text          = _objCardInfo.MaxTimes.ToString();
                    }
                    else if (_objCardInfo.cost_type == Bouwa.ITSP2V31.Model.CardInfo.CardTypeInfoCostType.限期卡)
                    {
                        this.lblDefault.Text = "到期日期:";
                        this.tbxDefault.Text = _objCardInfo.end_date.ToString("yyyy-MM-dd");
                        this.lblMax.Visible  = this.lblMax_Unit.Visible = this.tbxMax.Visible = this.lblDefault_Unit.Visible = false;
                    }
                    else
                    {
                        this.tbxDefault.Text = _objCardInfo.money.ToString();
                        this.tbxMax.Text     = _objCardInfo.MaxMoney.ToString();
                    }
                }
            }
        }
Esempio n. 3
0
        /// <summary>
        /// 申请换卡 跟换卡操作
        /// </summary>
        /// <param name="sender"></param>
        /// <param name="e"></param>
        private void btnChangeCard_Click(object sender, EventArgs e)
        {
            try
            {
                //询问用户
                if (MessageBoxForm.Show("您确定要进行" + btnChangeCard.Text + "?", MessageBoxButtons.OKCancel) == DialogResult.OK)
                {
                    Bouwa.ITSP2V31.Model.CardInfo _cardInfo = new Bouwa.ITSP2V31.Model.CardInfo();
                    //执行对象复制
                    ObjectMapper.CopyProperties(_objCardInfo, _cardInfo);

                    //说明是申请换卡
                    if (btnChangeCard.Tag.ToString() == "0")
                    {
                        //只有在已充值的状态下才能申请换卡
                        if (_objCardInfo.status == Bouwa.ITSP2V31.Model.CardInfo.CardTypeInfoDefaultCardStatus.已充值)
                        {
                            //测试数据存放
                            _cardInfo.saas_id    = CurrentUser.Current.SAASID;
                            _cardInfo.Network_id = CurrentUser.Current.NetWorkID;
                            //更新人临时存放当前操作人
                            _cardInfo.modify_user = CurrentUser.Current.UserId;
                            //更改状态为退卡
                            _cardInfo.status = Bouwa.ITSP2V31.Model.CardInfo.CardTypeInfoDefaultCardStatus.已挂失;

                            //执行退卡操作
                            int resout = _cardBll.UpdateCarInfoAndApplyChangeCardHistoryRecord(_cardInfo, CurrentUser.Current.PassWordKey, true);
                            if (resout == 0)
                            {
                                MessageBoxForm.Show("恭喜您" + btnChangeCard.Text + "成功!", MessageBoxButtons.OK);
                                //关闭窗口
                                this.Close();
                                return;
                            }
                            else if (resout == 1)
                            {
                                MessageBoxForm.Show("网络连接不正常,请重新进行" + btnChangeCard.Text + "操作!", MessageBoxButtons.OK);
                            }
                            else
                            {
                                MessageBoxForm.Show(_cardBll.ConvertMeassByStatus(resout), MessageBoxButtons.OK);
                            }
                        }
                        else
                        {
                            MessageBoxForm.Show("已充值状态下才能进行" + btnChangeCard.Text + "操作!", MessageBoxButtons.OK);
                        }
                    }    //说明是执行换卡操作
                    else
                    {
                        //执行换卡操作
                        Bouwa.ITSP2V31.Win.CardType.ChangeCardInit _cardInit = new Bouwa.ITSP2V31.Win.CardType.ChangeCardInit(_cardInfo);
                        this.Parameter["ActionType"] = "Init";
                        _cardInit.ShowDialog();
                        this.Close();
                        //换卡结束
                    }
                }
            }
            catch (Exception ex)
            {
                Log.WriterLine(ELevel.error, "执行" + btnChangeCard.Text + "操作出现异常", ex.Message);
                MessageBoxForm.Show("执行" + btnChangeCard.Text + "操作出现异常,请稍后再试!", MessageBoxButtons.OK);
            }
        }
Esempio n. 4
0
        /// <summary>
        /// 执行退卡操作
        /// </summary>
        /// <param name="sender"></param>
        /// <param name="e"></param>
        private void btnBack_Click(object sender, EventArgs e)
        {
            if (MessageBoxForm.Show("您确定要进行退卡?", MessageBoxButtons.OKCancel) == DialogResult.OK)
            {
                int status = -1; //保存读取后返回的一个状态
                Bouwa.ITSP2V31.Model.CardInfo _cardInfo = _cardBll.GetCardInfoByCard(Bouwa.Helper.CurrentUser.Current.PassWordKey, out status);

                if (_cardInfo == null)
                {
                    MessageBoxForm.Show(_cardBll.ConvertMeassByStatus(status), MessageBoxButtons.OK);
                    return;
                }
                else if (status != 0)
                {
                    MessageBoxForm.Show(_cardBll.ConvertMeassByStatus(status), MessageBoxButtons.OK);
                    return;
                }
                else if (string.IsNullOrEmpty(_cardInfo.card_id))
                {
                    MessageBoxForm.Show("未读取到卡信息,请将卡放到入读卡器上!", MessageBoxButtons.OK);
                    return;
                }
                else if (_objCardInfo.card_id != null & _cardInfo.card_id.ToString() != _objCardInfo.card_id.ToString())
                {
                    MessageBoxForm.Show("卡信息与当前所读卡信息不一致,请更换卡!", MessageBoxButtons.OK);
                    return;
                }
                else if (_objCardInfo.status == Bouwa.ITSP2V31.Model.CardInfo.CardTypeInfoDefaultCardStatus.已充值)
                {
                    //测试数据存放
                    _cardInfo.id         = _objCardInfo.id;
                    _cardInfo.saas_id    = CurrentUser.Current.SAASID;
                    _cardInfo.Network_id = CurrentUser.Current.NetWorkID;
                    //更新人临时存放当前操作人
                    _cardInfo.modify_user = CurrentUser.Current.UserId;
                    //备份当前状态
                    Bouwa.ITSP2V31.Model.CardInfo.CardTypeInfoDefaultCardStatus backStatus = _cardInfo.status;
                    //更改状态为退卡
                    _cardInfo.status = Bouwa.ITSP2V31.Model.CardInfo.CardTypeInfoDefaultCardStatus.已退卡;

                    //根据扣费类型获取对应的量
                    if (_cardInfo.cost_type == Bouwa.ITSP2V31.Model.CardInfo.CardTypeInfoCostType.金额卡 ||
                        _cardInfo.cost_type == Bouwa.ITSP2V31.Model.CardInfo.CardTypeInfoCostType.限次卡 ||
                        _cardInfo.cost_type == Bouwa.ITSP2V31.Model.CardInfo.CardTypeInfoCostType.限期卡 ||
                        _cardInfo.cost_type == Bouwa.ITSP2V31.Model.CardInfo.CardTypeInfoCostType.限时卡)
                    {
                        //执行退卡操作
                        int resout = _cardBll.UpdateCarInfoAndBackCardHistoryRecord(_cardInfo, CurrentUser.Current.PassWordKey, true);
                        if (resout == 0)
                        {
                            MessageBoxForm.Show("恭喜您退卡成功!", MessageBoxButtons.OK);
                            //关闭窗口
                            this.Close();
                            return;
                        }
                        else if (resout == 1)
                        {
                            MessageBoxForm.Show("网络连接不正常,请重新进行退卡操作!", MessageBoxButtons.OK);
                        }
                        else
                        {
                            MessageBoxForm.Show(_cardBll.ConvertMeassByStatus(resout), MessageBoxButtons.OK);
                        }
                        //更改到之前的状态
                        _cardInfo.status = backStatus;
                        //退卡失败后进行回写
                        _cardBll.UpdateCarInfoAndBackCardHistoryRecord(_cardInfo, CurrentUser.Current.PassWordKey, false);
                    }
                    else
                    {
                        MessageBoxForm.Show("消费类型有误,请联系管理员!", MessageBoxButtons.OK);
                        return;
                    }
                }
                else if (_objCardInfo.status == Bouwa.ITSP2V31.Model.CardInfo.CardTypeInfoDefaultCardStatus.已退卡)
                {
                    MessageBoxForm.Show("已是退卡状态,不能进行退卡操作!", MessageBoxButtons.OK);
                }
                else if (_objCardInfo.status == Bouwa.ITSP2V31.Model.CardInfo.CardTypeInfoDefaultCardStatus.已初始化 ||
                         _objCardInfo.status == Bouwa.ITSP2V31.Model.CardInfo.CardTypeInfoDefaultCardStatus.空白卡 ||
                         _objCardInfo.status == Bouwa.ITSP2V31.Model.CardInfo.CardTypeInfoDefaultCardStatus.已挂失 ||
                         _objCardInfo.status == Bouwa.ITSP2V31.Model.CardInfo.CardTypeInfoDefaultCardStatus.已禁用 ||
                         _objCardInfo.status == Bouwa.ITSP2V31.Model.CardInfo.CardTypeInfoDefaultCardStatus.已重置 ||
                         _objCardInfo.status == Bouwa.ITSP2V31.Model.CardInfo.CardTypeInfoDefaultCardStatus.制卡审批
                         )
                {
                    MessageBoxForm.Show("已充值状态下才能进行退卡操作!", MessageBoxButtons.OK);
                }
                else
                {
                    MessageBoxForm.Show("卡不能识别!", MessageBoxButtons.OK);
                    return;
                }
            }
        }
Esempio n. 5
0
        /// <summary>
        /// 进行卡重置
        /// </summary>
        /// <param name="sender"></param>
        /// <param name="e"></param>
        private void btnReset_Click(object sender, EventArgs e)
        {
            if (MessageBoxForm.Show("您确定要进行卡重置?", MessageBoxButtons.OKCancel) == DialogResult.OK)
            {
                int status = -1; //保存读取后返回的一个状态
                Bouwa.ITSP2V31.Model.CardInfo _cardInfo = _cardBll.GetCardInfoByCard(Bouwa.Helper.CurrentUser.Current.PassWordKey, out status);

                if (_cardInfo == null)
                {
                    MessageBoxForm.Show(_cardBll.ConvertMeassByStatus(status), MessageBoxButtons.OK);
                    return;
                }
                else if (status != 0)
                {
                    MessageBoxForm.Show(_cardBll.ConvertMeassByStatus(status), MessageBoxButtons.OK);
                    return;
                }
                else if (string.IsNullOrEmpty(_cardInfo.card_id))
                {
                    MessageBoxForm.Show("未读取到卡信息,请将卡放到入读卡器上!", MessageBoxButtons.OK);
                    return;
                }
                else if (_objCardInfo.card_id != null & _cardInfo.card_id.ToString() != _objCardInfo.card_id.ToString())
                {
                    MessageBoxForm.Show("卡信息与当前所读卡信息不一致,请更换卡!", MessageBoxButtons.OK);
                    return;
                }
                else if (_objCardInfo.status == Bouwa.ITSP2V31.Model.CardInfo.CardTypeInfoDefaultCardStatus.已充值 ||
                         _objCardInfo.status == Bouwa.ITSP2V31.Model.CardInfo.CardTypeInfoDefaultCardStatus.已初始化 ||
                         _objCardInfo.status == Bouwa.ITSP2V31.Model.CardInfo.CardTypeInfoDefaultCardStatus.空白卡 ||
                         _objCardInfo.status == Bouwa.ITSP2V31.Model.CardInfo.CardTypeInfoDefaultCardStatus.已挂失 ||
                         _objCardInfo.status == Bouwa.ITSP2V31.Model.CardInfo.CardTypeInfoDefaultCardStatus.已禁用 ||
                         _objCardInfo.status == Bouwa.ITSP2V31.Model.CardInfo.CardTypeInfoDefaultCardStatus.已退卡 ||
                         _objCardInfo.status == Bouwa.ITSP2V31.Model.CardInfo.CardTypeInfoDefaultCardStatus.已重置 ||
                         _objCardInfo.status == Bouwa.ITSP2V31.Model.CardInfo.CardTypeInfoDefaultCardStatus.制卡审批
                         )
                {
                    _cardInfo.modify_user = CurrentUser.Current.UserId; //保存更新人
                    int resout = _cardBll.ResetCarInforAndCarHistoryByID(_cardInfo, CurrentUser.Current.PassWordKey);
                    if (resout == 0)
                    {
                        MessageBoxForm.Show("恭喜您卡重置成功!", MessageBoxButtons.OK);
                        //关闭窗口
                        this.Close();
                        return;
                    }
                    else if (resout == 1)
                    {
                        MessageBoxForm.Show("网络连接不正常,请重新进行卡重置!", MessageBoxButtons.OK);
                    }
                    else
                    {
                        MessageBoxForm.Show(_cardBll.ConvertMeassByStatus(resout), MessageBoxButtons.OK);
                    }
                }
                else
                {
                    MessageBoxForm.Show("卡不能识别!", MessageBoxButtons.OK);
                    return;
                }
            }
        }
Esempio n. 6
0
        /// <summary>
        /// 充值
        /// </summary>
        /// <param name="sender"></param>
        /// <param name="e"></param>
        private void btnChargeValue_Click(object sender, EventArgs e)
        {
            int status = -1; //保存读取后返回的一个状态

            Bouwa.ITSP2V31.Model.CardInfo _cardInfo = _cardBll.GetCardInfoByCard(Bouwa.Helper.CurrentUser.Current.PassWordKey, out status);

            if (_cardInfo == null)
            {
                MessageBoxForm.Show(_cardBll.ConvertMeassByStatus(status), MessageBoxButtons.OK);
                return;
            }
            else if (status != 0)
            {
                MessageBoxForm.Show(_cardBll.ConvertMeassByStatus(status), MessageBoxButtons.OK);
                return;
            }
            else if (string.IsNullOrEmpty(_cardInfo.card_id))
            {
                MessageBoxForm.Show("未读取到卡信息,请将卡放到入读卡器上!", MessageBoxButtons.OK);
                return;
            }
            else if (_objCardInfo.card_id != null & _cardInfo.card_id.ToString() != _objCardInfo.card_id.ToString())
            {
                MessageBoxForm.Show("卡信息与当前所读卡信息不一致,请更换卡!", MessageBoxButtons.OK);
                return;
            }
            else if (_objCardInfo.status == Bouwa.ITSP2V31.Model.CardInfo.CardTypeInfoDefaultCardStatus.已充值 ||
                     _objCardInfo.status == Bouwa.ITSP2V31.Model.CardInfo.CardTypeInfoDefaultCardStatus.已初始化)
            {
                //测试数据存放
                _cardInfo.id      = _objCardInfo.id;
                _cardInfo.saas_id = CurrentUser.Current.SAASID;
                //_cardInfo.no = _objCardInfo.no;
                _cardInfo.Network_id = CurrentUser.Current.NetWorkID;
                //更新人临时存放当前操作人
                _cardInfo.modify_user = CurrentUser.Current.UserId;
                //最大限额
                _cardInfo.MaxCount = string.IsNullOrEmpty(tbxMax.Text)?99999: decimal.Parse(tbxMax.Text);

                BaseForm bf = null; //保存窗口
                //根据扣费类型跳转到对应的充值界面
                if (_cardInfo.cost_type == Bouwa.ITSP2V31.Model.CardInfo.CardTypeInfoCostType.金额卡)
                {
                    bf = new MemoryCard(_cardInfo);
                }
                else if (_cardInfo.cost_type == Bouwa.ITSP2V31.Model.CardInfo.CardTypeInfoCostType.限次卡)
                {
                    bf = new LimitOfTimeCard(_cardInfo);
                }
                else if (_cardInfo.cost_type == Bouwa.ITSP2V31.Model.CardInfo.CardTypeInfoCostType.限期卡)
                {
                    bf = new DeadlineCard(_cardInfo);
                }
                else if (_cardInfo.cost_type == Bouwa.ITSP2V31.Model.CardInfo.CardTypeInfoCostType.限时卡)
                {
                    bf = new TimeCard(_cardInfo);
                }
                else
                {
                    MessageBoxForm.Show("消费类型有误,请联系管理员!", MessageBoxButtons.OK);
                    return;
                }
                //执行跳转
                bf.ShowDialog();

                //刷新窗口数据
                View_Load(sender, e);
            }
            else
            {
                MessageBoxForm.Show("只能对初始化或已充值状态下的卡进行充值!", MessageBoxButtons.OK);
                return;
            }
        }
        Bouwa.ITSP2V31.Model.CardInfo _objCardInfo = null;// 保存卡上信息


        public ChangeCardInit(Bouwa.ITSP2V31.Model.CardInfo _cardInfo)
        {
            _objCardInfo = _cardInfo;// 保存传送过来的值
            InitializeComponent();
        }
Esempio n. 8
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);
            }
        }
Esempio n. 9
0
        /// <summary>
        /// 为控件赋值
        /// </summary>
        /// <param name="theId"></param>
        private void SetFormFromInfo(Guid theId)
        {
            //_objCardTypeInfo = _objCardTypeBLL.GetById(theId, null, ref _objSystemMessageInfo);
            string password = CurrentUser.Current.PassWordKey;
            bool   flag     = false;

            string[] mary1 = StringUtil.readBlock(RFIDClass.ReadCardAndReturnStatus(password, Convert.ToInt32(1)));
            if (mary1[4] == "11" || mary1[4] == "12")
            {
                flag     = true;
                password = SystemConstant.StringEmpty;
                mary1    = StringUtil.readBlock(RFIDClass.ReadCardAndReturnStatus(password, Convert.ToInt32(1)));
            }
            if (mary1[4] != "0")
            {
                throw new Exception(RFIDClass.ConvertMeassByStatus(Convert.ToInt32(mary1[4])));
            }
            Hashtable objHashtable = new Hashtable();

            objHashtable.Add("no", (mary1[1] == null || string.IsNullOrEmpty(mary1[1])) ? "" : mary1[1].Substring(9));
            objHashtable.Add("cost_type", (mary1[2] == null || string.IsNullOrEmpty(mary1[2])) ? "0" : mary1[2].Substring(12, 1)); //扣费类型
            objHashtable.Add("card_id", mary1[0]);                                                                                 //卡内编号
            this.tbxNum.Text = objHashtable["no"].ToString();
            string overPlus = (mary1[1] == null || string.IsNullOrEmpty(mary1[1])) ? "0" : mary1[1].Substring(4, 5);               //剩余金额/剩余次数/剩余分钟
            string overDate = (mary1[2] == null || string.IsNullOrEmpty(mary1[2])) ? "0" : mary1[2].Substring(6, 6);               //最晚日期

            this.ddlStatus.SelectedValue = (mary1[2] == null || string.IsNullOrEmpty(mary1[2])) ? "0" : mary1[2].Substring(13, 1);
            string costType = objHashtable["cost_type"].ToString();

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

            Bouwa.ITSP2V31.Model.CardInfo cardMessage = null;
            if (cardInfo != null && cardInfo.Count > 0)
            {
                cardMessage                      = cardInfo[0];
                this.tbxCardType.Text            = cardMessage.CardType;
                this.tbxLotNo.Text               = cardMessage.batch;
                this.ddlCostType.SelectedValue   = cardMessage.cost_type;
                this.ddlSubmitType.SelectedValue = cardMessage.submit_type;
                this.ddlPurpose.SelectedValue    = cardMessage.purpose;
                this.dtpEffectDate.Text          = cardMessage.efffect_date.ToString("yyyy-MM-dd");
                this.dtpOutDate.Text             = cardMessage.end_date.ToString("yyyy-MM-dd");
            }
            //if (_objCardTypeInfo != null)
            //{
            //    this.tbxNum.Text = _objCardId;
            //    this.tbxLotNo.Text = _objCardTypeInfo.Batch;
            //    this.tbxCardType.Text = _objCardTypeInfo.Name;
            //    this.ddlStatus.SelectedValue = _objCardTypeInfo.Status;
            //    //this.lblSaasId.Text = _objCardTypeInfo.SaasId.ToString();
            //    //this.lblCardTypeId.Text = _objCardTypeInfo.Id.ToString();
            //    this.ddlCostType.SelectedValue = _objCardTypeInfo.CostType.ToString("D");
            //    this.ddlPurpose.SelectedValue = _objCardTypeInfo.Purpose;
            //    this.ddlSubmitType.SelectedValue = _objCardTypeInfo.SubmitType;
            //    this.dtpEffectDate.Text = _objCardTypeInfo.EffectDate.ToString();
            //    this.dtpOutDate.Text = _objCardTypeInfo.OutDate.ToString();
            //    //判断剩余金额字段是否可更改
            //    if (_objCardTypeInfo.DefaultChange == CardTypeInfo.CardTypeInfoDefaultChange.可变)
            //    {
            //        this.tbxPlusOver.ReadOnly = false;
            //    }
            //    else
            //    {
            //        this.tbxPlusOver.ReadOnly = true;
            //    }

            //}
            if (cardMessage != null)
            {
                if (costType.Equals(CardTypeInfo.CardTypeInfoCostType.限时卡.ToString("D")))
                {
                    this.lblPlusOver.Text     = "剩余时间:";
                    this.lblPlusOverUnit.Text = this.lblMaxUnit.Text = "分钟";
                    this.tbxMax.Text          = "上限时间:";
                    this.tbxPlusOver.Text     = Convert.ToString(60 * Convert.ToInt32(overPlus.Substring(0, 4)) + Convert.ToInt32(overPlus.Substring(5)) * 10);
                    this.tbxMax.Text          = cardMessage.MaxChargesDate.ToString();
                }
                else if (costType.Equals(CardTypeInfo.CardTypeInfoCostType.限次卡.ToString("D")))
                {
                    this.lblPlusOver.Text     = "剩余次数:";
                    this.lblPlusOverUnit.Text = this.lblMaxUnit.Text = "次";
                    this.lblMax.Text          = "上限次数:";
                    this.tbxPlusOver.Text     = overPlus.ToString();
                    this.tbxMax.Text          = cardMessage.MaxTimes.ToString();
                }
                else if (costType.Equals(CardTypeInfo.CardTypeInfoCostType.限期卡.ToString("D")))
                {
                    this.lblPlusOver.Text        = "到期日期:";
                    this.tbxPlusOver.Text        = cardMessage.end_date.ToString("yyyy-MM-dd");
                    this.lblPlusOverUnit.Visible = this.lblMax.Visible =
                        this.tbxMax.Visible      = this.lblMaxUnit.Visible = false;
                }
                else
                {
                    this.tbxPlusOver.Text = Convert.ToDecimal(float.Parse(overPlus) / 10).ToString("0.00");
                    this.tbxMax.Text      = cardMessage.MaxMoney.ToString();
                }
            }
        }