Ejemplo n.º 1
0
        private void sbtnFill_Click(object sender, System.EventArgs e)
        {
            promrate = double.Parse(SysInitial.dsSys.Tables["FP6"].Rows[0]["vcCommCode"].ToString());
            if (promrate == 0)
            {
                promrate = 100;
            }
            string strCardID   = txtCardID.Text.Trim();
            string strCharge   = txtCharge.Text.Trim();
            string strAssID    = txtAssID.Text.Trim();
            int    iIG         = int.Parse(txtIG.Text.Trim());
            string strOperDate = System.DateTime.Now.ToShortDateString() + " " + System.DateTime.Now.ToLongTimeString();

            if (strCardID == "")
            {
                MessageBox.Show("会员卡号不可为空且小于10位,请重新填写会员卡号!", "系统提示", System.Windows.Forms.MessageBoxButtons.OK, System.Windows.Forms.MessageBoxIcon.Error);
                txtCardID.Focus();
                return;
            }
            if (strCardID != "")
            {
                System.Windows.Forms.DialogResult diaRes = MessageBox.Show("是否确定回收,卡号为:" + strCardID + ",回收金额为: " + strCharge + " 元", "请确认", System.Windows.Forms.MessageBoxButtons.YesNo, System.Windows.Forms.MessageBoxIcon.Question);
                if (diaRes.Equals(System.Windows.Forms.DialogResult.Yes))
                {
                    string strresult = cs.CardRollback(strCardID, strCharge, strAssID, strOperDate, promrate, iIG, out err);
                    if (strresult != "")
                    {
                        if (strresult.Equals(CardCommon.CardDef.ConstMsg.RFOK) || strresult.Substring(0, 3) == "000")
                        {
                            MessageBox.Show("回收会员卡成功!", "系统提示", System.Windows.Forms.MessageBoxButtons.OK, System.Windows.Forms.MessageBoxIcon.Information);
                            this.txtCardID.Text    = "";
                            this.txtCharge.Text    = "";
                            this.txtAssName.Text   = "";
                            this.txtLinkPhone.Text = "";
                            this.sbtnFill.Enabled  = false;
                            this.sbtnRead.Enabled  = true;
                            clog.WriteLine(strresult);
                        }
                        else
                        {
                            MessageBox.Show("回收会员卡失败,请重试!", "系统提示", System.Windows.Forms.MessageBoxButtons.OK, System.Windows.Forms.MessageBoxIcon.Error);
                            lblerr.Text            = "回收会员卡失败,本次回收无效,请检查余额是否正确!";
                            this.txtCardID.Text    = "";
                            this.txtCharge.Text    = "";
                            this.txtAssName.Text   = "";
                            this.txtLinkPhone.Text = "";
                            lblerr.Visible         = true;
                            clog.WriteLine(err);
                            clog.WriteLine(strresult);
                        }
                    }
                    else
                    {
                        MessageBox.Show("回收会员卡失败,请重试!", "系统提示", System.Windows.Forms.MessageBoxButtons.OK, System.Windows.Forms.MessageBoxIcon.Error);
                        lblerr.Text            = "回收会员卡失败,本次回收无效,请检查余额是否正确!";
                        this.txtCardID.Text    = "";
                        this.txtCharge.Text    = "";
                        this.txtAssName.Text   = "";
                        this.txtLinkPhone.Text = "";
                        lblerr.Visible         = true;
                        sbtnFill.Enabled       = false;
                        sbtnRead.Enabled       = true;
                        clog.WriteLine(err);
                        clog.WriteLine(strresult);
                    }
                }
            }
            else
            {
                MessageBox.Show("回收会员卡失败,请重试!", "系统提示", System.Windows.Forms.MessageBoxButtons.OK, System.Windows.Forms.MessageBoxIcon.Error);
                lblerr.Text    = "回收会员卡失败,本次回收无效,请检查余额是否正确!";
                lblerr.Visible = true;
                clog.WriteLine(err);
            }
        }