Exemplo n.º 1
0
        private void sbtnUnionOut_Click(object sender, System.EventArgs e)
        {
            DataTable dt = new DataTable();

            dt = (DataTable)this.dataGrid1.DataSource;
            if (dt == null || dt.Rows.Count <= 0)
            {
                if (this.txtiSerial.Text.Trim() == "" && this.txtUnionOutFee.Text.Trim() == "" && this.txtUnionOutIG.Text.Trim() == "")
                {
                    MessageBox.Show("选择要撤消的行!", "系统提示", System.Windows.Forms.MessageBoxButtons.OK, System.Windows.Forms.MessageBoxIcon.Error);
                    return;
                }
            }

            try
            {
                CMSMStruct.FillFeeStruct ffsDes = new CMSMData.CMSMStruct.FillFeeStruct();
                DateTime dtNow = DateTime.Now;
                ffsDes.iSerial     = Int64.Parse(this.txtiSerial.Text);
                ffsDes.strAssID    = this.txtAssID.Text.Trim();
                ffsDes.strCardID   = this.txtOrgCardID.Text.Trim();
                ffsDes.dFillFee    = Math.Round(double.Parse(this.txtUnionOutFee.Text), 2);
                ffsDes.dFillProm   = 0;
                ffsDes.dFeeLast    = Math.Round(double.Parse(this.txtCurOrgCharge.Text), 2);
                ffsDes.dIGLast     = Math.Round(double.Parse(this.txtCurOrgIG.Text), 2);
                ffsDes.dFillFee    = Math.Round(double.Parse(this.txtUnionOutFee.Text), 2);
                ffsDes.dFeeCur     = ffsDes.dFeeLast + ffsDes.dFillFee;
                ffsDes.dFillProm   = 0;
                ffsDes.dIG         = Math.Round(double.Parse(this.txtUnionOutIG.Text), 2);
                ffsDes.dIGCur      = ffsDes.dIGLast + ffsDes.dIG;
                ffsDes.strComments = "转出撤消,原流水为:" + ffsDes.iSerial + " ";
                ffsDes.strOperName = SysInitial.CurOps.strOperName;
                ffsDes.strDeptID   = SysInitial.LocalDept;
                ffsDes.strType     = "OP019";
                ffsDes.strFillDate = dtNow.ToString();

                string strresult = "";
                CMSMStruct.CardHardStruct chsDes = new CMSMData.CMSMStruct.CardHardStruct();
                chsDes = cs.ReadCardInfo("", out strresult);
                while (chsDes.strCardID != ffsDes.strCardID)
                {
                    MessageBox.Show("目标卡不正确,请将要撤消的目标卡放在读卡器上。", "请放卡", MessageBoxButtons.OK);
                    return;
                }
                err       = null;
                strresult = cs.CardChargeUnionOutRoll(ffsDes, out err);
                if (strresult.Equals(CardCommon.CardDef.ConstMsg.RFOK) || strresult.IndexOf("CMT", 0) >= 0)
                {
                    finalflag = false;
                    MessageBox.Show("会员卡转出撤消成功!", "系统提示", System.Windows.Forms.MessageBoxButtons.OK, System.Windows.Forms.MessageBoxIcon.Information);
                    this.ClearText();
                    this.dataGrid1.DataSource  = null;
                    this.sbtnOrgRead.Enabled   = true;
                    this.sbtnUnionOut.Enabled  = false;
                    this.txtUnionOutIG.Enabled = false;
                }
                else
                {
                    MessageBox.Show("会员卡转出撤消失败,请重试!", "系统提示", System.Windows.Forms.MessageBoxButtons.OK, System.Windows.Forms.MessageBoxIcon.Error);
                    this.ClearText();
                    this.dataGrid1.DataSource  = null;
                    this.sbtnOrgRead.Enabled   = true;
                    this.sbtnUnionOut.Enabled  = false;
                    this.txtUnionOutIG.Enabled = false;
                    if (err != null)
                    {
                        clog.WriteLine(err.ToString() + strresult);
                    }
                    else
                    {
                        clog.WriteLine(strresult);
                    }
                }
            }
            catch (Exception ex)
            {
                MessageBox.Show("会员卡转出撤消失败!", "系统提示", System.Windows.Forms.MessageBoxButtons.OK, System.Windows.Forms.MessageBoxIcon.Error);
                clog.WriteLine(ex);
            }
        }