コード例 #1
0
        private void btnOk_Click(object sender, EventArgs e)
        {
            if (CheckInput())
            {
                CardBll       bll = new CardBll(AppSettings.CurrentSetting.ParkConnect);
                CommandResult result;
                if (this.DisableEnableCard.Status == CardStatus.Disabled)
                {
                    result = bll.CardEnable(this.DisableEnableCard, this.txtMemo.Text, !AppSettings.CurrentSetting.EnableWriteCard);
                }
                else
                {
                    result = bll.CardDisable(this.DisableEnableCard, this.txtMemo.Text, !AppSettings.CurrentSetting.EnableWriteCard);
                }
                if (result.Result == ResultCode.Successful)
                {
                    //写卡模式时,将卡片信息写入卡片,这里会使用循环写卡,直到成功或用户取消
                    if (this.chkWriteCard.Checked)
                    {
                        CardOperationManager.Instance.WriteCardLoop(DisableEnableCard);
                    }

                    if (ItemUpdated != null)
                    {
                        ItemUpdated(this, new ItemUpdatedEventArgs(DisableEnableCard));
                    }
                    this.Close();
                }
                else
                {
                    MessageBox.Show(result.Message);
                }
            }
        }
コード例 #2
0
        private void btnOk_Click(object sender, EventArgs e)
        {
            try
            {
                if (CheckInput())
                {
                    CardBll       bll = new CardBll(AppSettings.CurrentSetting.ParkConnect);
                    CommandResult result;
                    if (this.DisableEnableCard.Status == CardStatus.Disabled)
                    {
                        result = bll.CardEnable(this.DisableEnableCard, this.txtMemo.Text, !AppSettings.CurrentSetting.EnableWriteCard);
                    }
                    else
                    {
                        result = bll.CardDisable(this.DisableEnableCard, this.txtMemo.Text, !AppSettings.CurrentSetting.EnableWriteCard);
                    }
                    if (result.Result == ResultCode.Successful)
                    {
                        //写卡模式时,将卡片信息写入卡片,这里会使用循环写卡,直到成功或用户取消
                        if (this.chkWriteCard.Checked)
                        {
                            CardOperationManager.Instance.WriteCardLoop(DisableEnableCard);
                        }

                        if (ItemUpdated != null)
                        {
                            ItemUpdated(this, new ItemUpdatedEventArgs(DisableEnableCard));
                        }

                        if (DataBaseConnectionsManager.Current.StandbyConnected)
                        {
                            //备用数据连上时,同步到备用数据库
                            bll.SyncCardToDatabaseWithoutPaymentInfo(DisableEnableCard, AppSettings.CurrentSetting.CurrentStandbyConnect);
                        }

                        this.Close();
                    }
                    else
                    {
                        MessageBox.Show(result.Message);
                    }
                }
            }
            catch (Exception ex)
            {
                MessageBox.Show(ex.Message);
            }
        }