예제 #1
0
        private void sbtnRelease_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连接!");
                this.ClearText();
                txtCardID.ReadOnly  = false;
                sbtnRelease.Enabled = false;
                return;
            }

            string strCardID = txtCardID.Text.Trim();

            if (strCardID == "")
            {
                MessageBox.Show("会员卡号不可为空,请重新填写会员卡号!", "系统提示", System.Windows.Forms.MessageBoxButtons.OK, System.Windows.Forms.MessageBoxIcon.Error);
                txtCardID.Focus();
                return;
            }
            System.Windows.Forms.DialogResult diaRes = MessageBox.Show("是否确定解挂该会员卡?", "请确认", System.Windows.Forms.MessageBoxButtons.YesNo, System.Windows.Forms.MessageBoxIcon.Question);
            if (diaRes.Equals(System.Windows.Forms.DialogResult.Yes))
            {
                err = null;
                cs.CardRelease(txtAssID.Text.Trim(), strCardID, out err);
                if (err != null)
                {
                    MessageBox.Show("解挂失败,请重试!", "系统提示", System.Windows.Forms.MessageBoxButtons.OK, System.Windows.Forms.MessageBoxIcon.Error);
                    clog.WriteLine(err);
                }
                else
                {
                    MessageBox.Show("解挂成功!", "系统提示", System.Windows.Forms.MessageBoxButtons.OK, System.Windows.Forms.MessageBoxIcon.Information);
                    this.ClearText();
                    txtCardID.ReadOnly  = false;
                    sbtnRelease.Enabled = false;
                }
            }
        }