Пример #1
0
        private void sbtnRead_Click(object sender, System.EventArgs e)
        {
            Ping      ping = new Ping();
            PingReply pr   = ping.Send("10.10.10.203");

            if (pr.Status != IPStatus.Success)
            {
                MessageBox.Show("童鞋!VPN掉线了或者网速太慢,请检查vpn连接!");
                return;
            }

            string strresult = "";

            lblerr.Visible = false;
            chs            = cs.ReadCardInfo("", out strresult);
            if (!strresult.Equals(CardCommon.CardDef.ConstMsg.RFOK))
            {
                if (strresult == CardCommon.CardDef.ConstMsg.RFAUTHENTICATION_A_ERR)
                {
                    MessageBox.Show("该卡不属于本系统使用的卡,请检查!", "系统提示", System.Windows.Forms.MessageBoxButtons.OK, System.Windows.Forms.MessageBoxIcon.Error);
                    return;
                }
                if (strresult != "")
                {
                    strresult = this.GetColCh(strresult, "ERR");
                }
                MessageBox.Show("刷卡失败,请重试!", "系统提示", System.Windows.Forms.MessageBoxButtons.OK, System.Windows.Forms.MessageBoxIcon.Error);
                if (strresult != null)
                {
                    clog.WriteLine(strresult);
                }
                return;
            }
            string aaccc = chs.strCardID;

//			chs.strCardID="GY000011";
            if (chs.strCardID == "")
            {
                MessageBox.Show("会员卡号不正确,请重试!", "系统提示", System.Windows.Forms.MessageBoxButtons.OK, System.Windows.Forms.MessageBoxIcon.Error);
                return;
            }
            else if (chs.strCardID.Substring(0, 1) == "F")
            {
                MessageBox.Show("此卡为员工卡,不可进行充值!", "系统提示", System.Windows.Forms.MessageBoxButtons.OK, System.Windows.Forms.MessageBoxIcon.Error);
                return;
            }
            else
            {
                err = null;
                CMSMData.CMSMStruct.AssociatorStruct assres = new CMSMData.CMSMStruct.AssociatorStruct();
                assres = cs.GetAssociatorName(chs.strCardID, out err);
                if (assres != null)
                {
                    string strAssState = assres.strAssState;
                    if (strAssState != "0")
                    {
                        MessageBox.Show("该会员已经失效,请核查!", "系统提示", System.Windows.Forms.MessageBoxButtons.OK, System.Windows.Forms.MessageBoxIcon.Error);
                        return;
                    }
                    if (chs.dCurCharge == -1)
                    {
                        chs.dCurCharge = assres.dCharge;
                    }
                    if (int.Parse(SysInitial.Card) == 8)
                    {
                        if (chs.dCurCharge <= 2 && assres.strAssType == "AT001")
                        {
                            double dRate = 0;
                            if (!cs.AssTypeTrans(assres.strCardID, "AT002", out dRate, out err))
                            {
                                clog.WriteLine("变更卡类型失败:" + assres.strCardID + "。\n" + err.ToString());
                            }
                            else
                            {
                                assres.strAssType = "AT002";
                                assres.dRate      = dRate;
                            }
                        }
                        if (assres.strAssType == "AT001")
                        {
                            MessageBox.Show("老卡会员不允许充值,请先将卡内余额消费完!", "系统提示", System.Windows.Forms.MessageBoxButtons.OK, System.Windows.Forms.MessageBoxIcon.Error);
                            return;
                        }
                    }
                    if (assres.dtCreateDate.CompareTo(SysInitial.dtQLTime) < 0 && !assres.setZeroFlag)
                    {
                        chs.iCurIg            = 0;
                        this.txtZeroFlag.Text = "1";
                    }
                    if (chs.iCurIg == -1)
                    {
                        chs.iCurIg = assres.iIgValue;
                    }
                    txtAssID.Text        = assres.strAssID;
                    txtCardID.Text       = assres.strCardID;
                    txtAssName.Text      = assres.strAssName;
                    this.txtAssType.Text = assres.strAssType;
                    txtLinkPhone.Text    = assres.strLinkPhone;
                    txtCharge.Text       = chs.dCurCharge.ToString();
                    this.txtIg.Text      = chs.iCurIg.ToString();
                    txtCardID.ReadOnly   = true;
                    sbtnFill.Enabled     = true;
                    sbtnRead.Enabled     = false;
                    txtFillFee.ReadOnly  = false;
                    txtFillFee.Focus();
                }
                else
                {
                    MessageBox.Show("无此会员,请核查!", "系统提示", System.Windows.Forms.MessageBoxButtons.OK, System.Windows.Forms.MessageBoxIcon.Error);
                    if (err != null)
                    {
                        clog.WriteLine(err);
                    }
                }
            }
        }