示例#1
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);
            }
        }