Пример #1
0
        private void sbtnAgain_Click(object sender, System.EventArgs e)
        {
            if (dataGrid1.CurrentRowIndex < 0)
            {
                MessageBox.Show("没有选中已挂失的会员!", "系统提示", System.Windows.Forms.MessageBoxButtons.OK, System.Windows.Forms.MessageBoxIcon.Information);
                return;
            }
            err = null;
            string strCardID = dataGrid1[dataGrid1.CurrentRowIndex, 0].ToString();

            CMSMData.CMSMStruct.MemberStruct mebres = new CMSMData.CMSMStruct.MemberStruct();
            mebres = cs.GetMemberLoseDetail(strCardID, out err);
            if (mebres == null || err != null)
            {
                MessageBox.Show("获取会员资料错误,请重试!", "系统提示", System.Windows.Forms.MessageBoxButtons.OK, System.Windows.Forms.MessageBoxIcon.Error);
                if (err != null)
                {
                    clog.WriteLine(err);
                }
                return;
            }

            frmInputBox frmInput = new frmInputBox();

            frmInput.Text        = "补卡输入新卡号";
            frmInput.label1.Text = "请输入新会员卡的卡号:";
            frmInput.label2.Text = "Again";
            frmInput.ShowDialog();
            if (SysInitial.strTmp == "CanCel")
            {
                return;
            }
            while (SysInitial.strTmp == "")
            {
                MessageBox.Show("输入的会员卡号不正确,请重新输入!", "系统提示", System.Windows.Forms.MessageBoxButtons.OK, System.Windows.Forms.MessageBoxIcon.Error);
                frmInput = new frmInputBox();
                frmInput.ShowDialog();
                if (SysInitial.strTmp == "CanCel")
                {
                    return;
                }
            }

            string strNewCardID = SysInitial.strTmp;

            SysInitial.strTmp = "";

            err = null;
            string strresult = cs.CardAgain(strNewCardID, mebres, out err);

            if (err != null || (!strresult.Equals(CardCommon.CardDef.ConstMsg.RFOK)))
            {
                if (strresult == "")
                {
                    strresult = this.GetColCh(strresult, "ERR");
                }
                MessageBox.Show("补发卡失败,请重试!", "系统提示", System.Windows.Forms.MessageBoxButtons.OK, System.Windows.Forms.MessageBoxIcon.Error);
                if (err != null && strresult != "")
                {
                    clog.WriteLine(err.Message + "\n" + strresult);
                }
                else if (err != null)
                {
                    clog.WriteLine(err);
                }
                else
                {
                    clog.WriteLine(strresult);
                }
                this.DgBind();
            }
            else
            {
                MessageBox.Show("补发卡成功!", "系统提示", System.Windows.Forms.MessageBoxButtons.OK, System.Windows.Forms.MessageBoxIcon.Information);
                this.DgBind();
            }
        }
Пример #2
0
        private void sbtnAgain_Click(object sender, System.EventArgs e)
        {
            if (dataGrid1.CurrentRowIndex < 0)
            {
                MessageBox.Show("没有选中已挂失的会员!", "系统提示", System.Windows.Forms.MessageBoxButtons.OK, System.Windows.Forms.MessageBoxIcon.Information);
                return;
            }
            err = null;
            string strCardID = dataGrid1[dataGrid1.CurrentRowIndex, 1].ToString();

            CMSMData.CMSMStruct.AssociatorStruct assres = new CMSMData.CMSMStruct.AssociatorStruct();
            Ping      ping = new Ping();
            PingReply pr   = ping.Send("10.10.10.203");

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

            assres = cs.GetAssociatorLost(strCardID, out err);
            if (assres == null || err != null)
            {
                MessageBox.Show("获取会员资料错误,请重试!", "系统提示", System.Windows.Forms.MessageBoxButtons.OK, System.Windows.Forms.MessageBoxIcon.Error);
                if (err != null)
                {
                    clog.WriteLine(err);
                }
                return;
            }

            frmInputBox frmInput = new frmInputBox();

            frmInput.Text        = "补卡输入新卡号";
            frmInput.label1.Text = "请输入新会员卡的卡号:";
            frmInput.label2.Text = "Again";
            frmInput.ShowDialog();
            if (SysInitial.strTmp == "CanCel")
            {
                return;
            }
            while (SysInitial.strTmp == "")
            {
                MessageBox.Show("输入的会员卡号不正确,请重新输入!", "系统提示", System.Windows.Forms.MessageBoxButtons.OK, System.Windows.Forms.MessageBoxIcon.Error);
                frmInput = new frmInputBox();
                frmInput.ShowDialog();
                if (SysInitial.strTmp == "CanCel")
                {
                    return;
                }
            }

            string strNewCardID = SysInitial.strTmp;

            SysInitial.strTmp = "";

            if (assres.dtCreateDate.CompareTo(SysInitial.dtQLTime) < 0 && !assres.setZeroFlag)
            {
                assres.iIgValue     = 0;
                assres.needZeroFlag = true;
            }

            err = null;
            string strresult = cs.CardAgain(strNewCardID, assres, out err);

            if (err != null || (!strresult.Equals(CardCommon.CardDef.ConstMsg.RFOK)))
            {
                if (strresult == "")
                {
                    strresult = this.GetColCh(strresult, "ERR");
                }
                MessageBox.Show("补发卡失败,请重试!", "系统提示", System.Windows.Forms.MessageBoxButtons.OK, System.Windows.Forms.MessageBoxIcon.Error);
                if (err != null || strresult != null)
                {
                    clog.WriteLine(err + "\n" + strresult);
                }
            }
            else
            {
                MessageBox.Show("补发卡成功!", "系统提示", System.Windows.Forms.MessageBoxButtons.OK, System.Windows.Forms.MessageBoxIcon.Information);
                this.DgBind();
            }
        }