private void sbtnRead_Click(object sender, System.EventArgs e) { 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; } MessageBox.Show("刷卡失败,请重试!", "系统提示", System.Windows.Forms.MessageBoxButtons.OK, System.Windows.Forms.MessageBoxIcon.Error); if (strresult != null || strresult != "") { clog.WriteLine(strresult); } return; } if (chs.strCardID == "") { MessageBox.Show("会员卡号不正确,请重试!", "系统提示", System.Windows.Forms.MessageBoxButtons.OK, System.Windows.Forms.MessageBoxIcon.Error); return; } err = null; CMSMStruct.MemberStruct mebres = new CMSMStruct.MemberStruct(); string strDeptNameTmp = CMSMData.CMSMDataAccess.SysInitial.LocalDeptNameTmp; mebres = cs.GetMemberDetail(chs.strCardID, strDeptNameTmp, out err); if (mebres != null) { txtCardID.Text = mebres.strCardID; txtCompName.Text = mebres.strCompanyName; txtLicenseTag.Text = mebres.strLicenseTag; txtCharge.Text = chs.dCurCharge.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); } } }
private void timer1_Tick(object sender, System.EventArgs e) { if (!IsTimeActive) { IsTimeActive = true; string strresult = ""; try { CMSMStruct.CardHardStruct cardhs = ca.ReadCardInfo("Emp", out strresult); if (!strresult.Equals(CardCommon.CardDef.ConstMsg.RFOK)) { IsTimeActive = false; if (strresult == CardCommon.CardDef.ConstMsg.RFAUTHENTICATION_A_ERR) { this.lblpromt.Text = "该卡不属于本系统使用的卡,请检查!"; return; } else { return; } } if (cardhs.strCardID == "") { this.lblpromt.Text = "员工卡号不正确,请重试!"; IsTimeActive = false; return; } else if (cardhs.strCardID.Substring(0, 1) != "F") { this.lblpromt.Text = "此卡不是员工卡,请检查!"; IsTimeActive = false; return; } else { err = null; cardhs.strCardID = cardhs.strCardID.Substring(1, 4); txtCardID.Text = cardhs.strCardID; CMSMStruct.EmpSignStruct esign = new CMSMStruct.EmpSignStruct(); esign.strCardID = cardhs.strCardID; esign.strSignDate = DateTime.Now.ToShortDateString() + " " + DateTime.Now.ToLongTimeString(); esign.strClass = ""; esign.strSignFlag = "1"; esign.strComments = ""; esign.strDeptID = SysInitial.LocalDept; err = null; if (ca.InsertEmpSign(esign, out err)) { IsTimeActive = false; this.txtCardID.Text = ""; this.txtEmpName.Text = ""; this.DgBind(); } else { IsTimeActive = false; if (err != null) { clog.WriteLine(err); } } } } catch (Exception er) { IsTimeActive = false; clog.WriteLine(er); } } }
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; } 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 (chs.iCurIg == -1) { chs.iCurIg = assres.iIgValue; } txtAssID.Text = assres.strAssID; txtCardID.Text = assres.strCardID; txtAssName.Text = assres.strAssName; txtLinkPhone.Text = assres.strLinkPhone; txtCharge.Text = chs.dCurCharge.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); } } } }
private void btnRead_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 = ""; CMSMStruct.CardHardStruct 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; } 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("该会员已经失效,卡号:" + chs.strCardID + ",请核查!", "系统提示", System.Windows.Forms.MessageBoxButtons.OK, System.Windows.Forms.MessageBoxIcon.Error); return; } err = null; DataSet dsout = cs.GetAssConsLast(assres.strCardID, out err); if (dsout == null || err != null) { MessageBox.Show(err.Message, "系统提示", System.Windows.Forms.MessageBoxButtons.OK, System.Windows.Forms.MessageBoxIcon.Error); return; } else { #if !DEBUG if (chs.dCurCharge != Math.Round(double.Parse(dsout.Tables["CurCharge"].Rows[0]["nFeeCur"].ToString()), 2)) { MessageBox.Show("会员卡上当前余额与上次消费后余额不相符,不能撤消!", "系统提示", System.Windows.Forms.MessageBoxButtons.OK, System.Windows.Forms.MessageBoxIcon.Error); return; } else { #endif txtAssID.Text = assres.strAssID; txtCurCharge.Text = chs.dCurCharge.ToString(); txtCardID.Text = assres.strCardID; txtAssName.Text = assres.strAssName; this.txtBillNo.Text = dsout.Tables["Bill"].Rows[0]["iSerial"].ToString(); this.txtConsFee.Text = dsout.Tables["Bill"].Rows[0]["nPay"].ToString(); this.txtConsDate.Text = dsout.Tables["Bill"].Rows[0]["dtTime"].ToString(); this.dataGrid1.SetDataBinding(dsout.Tables["ConsItem"], ""); this.EnToCh("商品编号,商品名称,单价,数量,折扣金额,实收金额", "80,130,70,50,60,70", dsout.Tables["ConsItem"], this.dataGrid1); btnRead.Enabled = false; this.btnRemove.Enabled = true; #if !DEBUG } #endif } } else { MessageBox.Show("无会员资料,请与管理员联系!", "系统提示", System.Windows.Forms.MessageBoxButtons.OK, System.Windows.Forms.MessageBoxIcon.Error); if (err != null) { clog.WriteLine(err); } return; } } }
private void btnRemove_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 = ""; CMSMStruct.CardHardStruct 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; } 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; } if (chs.strCardID != txtCardID.Text.Trim()) { MessageBox.Show("消费撤消卡与首次刷卡不是同一张卡,消费撤消失败,请重试!", "系统提示", System.Windows.Forms.MessageBoxButtons.OK, System.Windows.Forms.MessageBoxIcon.Error); this.ClearText(); btnRead.Enabled = true; return; } else { #region 开始消费撤消 if (this.txtBillNo.Text.Trim() == "") { MessageBox.Show("没有任何可以进行撤消的消费记录!", "系统提示", System.Windows.Forms.MessageBoxButtons.OK, System.Windows.Forms.MessageBoxIcon.Information); return; } CMSMData.CMSMStruct.FillFeeStruct refill = new CMSMData.CMSMStruct.FillFeeStruct(); refill.strAssID = this.txtAssID.Text.Trim(); refill.strCardID = this.txtCardID.Text.Trim(); refill.dFillFee = Math.Round(double.Parse(this.txtConsFee.Text.Trim()), 2); refill.dFillProm = 0; refill.dFeeLast = Math.Round(double.Parse(this.txtCurCharge.Text.Trim()), 2); refill.dFeeCur = refill.dFillFee + refill.dFeeLast; DateTime dtNow = DateTime.Now; refill.iSerial = Int64.Parse(dtNow.ToString("yyyyMMddHHmmss")); refill.strFillDate = dtNow.ToShortDateString() + " " + dtNow.ToLongTimeString(); refill.strComments = "消费撤消,原小票号:" + this.txtBillNo.Text.Trim(); refill.strOperName = SysInitial.CurOps.strOperName; refill.strDeptID = SysInitial.LocalDept; chs.dCurCharge = refill.dFeeCur; double dCurChargeBak = System.Math.Round((double.Parse(txtConsFee.Text.Trim()) + double.Parse(txtCurCharge.Text.Trim())), 2); if (chs.dCurCharge != dCurChargeBak) { MessageBox.Show("消费撤消失败,请重试!", "系统提示", System.Windows.Forms.MessageBoxButtons.OK, System.Windows.Forms.MessageBoxIcon.Error); clog.WriteLine("消费撤消备份值与计算值不等:备份值-" + dCurChargeBak.ToString() + " 计算值" + chs.dCurCharge.ToString()); return; } err = null; strresult = ""; strresult = cs.AssConsRemove(this.txtBillNo.Text.Trim(), refill, chs.iCurIg, dCurChargeBak, out err); if (strresult.Equals(CardCommon.CardDef.ConstMsg.RFOK) || strresult.Substring(0, 3) == "CMT") { MessageBox.Show("消费撤消成功!", "系统提示", System.Windows.Forms.MessageBoxButtons.OK, System.Windows.Forms.MessageBoxIcon.Information); clog.WriteLine(strresult); } else { MessageBox.Show("消费撤消失败,本次消费撤消无效,请检查余额是否正确!", "系统提示", System.Windows.Forms.MessageBoxButtons.OK, System.Windows.Forms.MessageBoxIcon.Error); clog.WriteLine(err + "\n" + strresult); } this.ClearText(); btnRead.Enabled = true; this.btnRemove.Enabled = false; DataTable dtConsItem = new DataTable(); dtConsItem.Columns.Add("GoodsID"); dtConsItem.Columns.Add("GoodsName"); dtConsItem.Columns.Add("Price"); dtConsItem.Columns.Add("Count"); dtConsItem.Columns.Add("Rate"); dtConsItem.Columns.Add("Fee"); dtConsItem.Columns.Add("Comments"); dtConsItem.Columns["Comments"].DefaultValue = ""; this.dataGrid1.SetDataBinding(dtConsItem, ""); this.EnToCh("商品编号,商品名称,单价,数量,折扣金额,应收金额", "80,130,70,50,60,70", dtConsItem, this.dataGrid1); #endregion } }
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); } } } }
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 = ""; 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; } 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("该会员已经失效,卡号:" + chs.strCardID + ",请核查!", "系统提示", System.Windows.Forms.MessageBoxButtons.OK, System.Windows.Forms.MessageBoxIcon.Error); return; } if (assres.dtCreateDate.CompareTo(SysInitial.dtQLTime) < 0 && !assres.setZeroFlag) { chs.iCurIg = 0; chs.needZeroFlag = true; } if (chs.iCurIg <= 0) { MessageBox.Show("当前积分不足,不能兑换!", "系统提示", System.Windows.Forms.MessageBoxButtons.OK, System.Windows.Forms.MessageBoxIcon.Error); return; } txtCardID.Text = assres.strCardID; txtAssName.Text = assres.strAssName; txtLinkPhone.Text = assres.strLinkPhone; txtCharge.Text = chs.dCurCharge.ToString(); txtAssType.Text = GetColCh(assres.strAssType, "AT"); txtAssID.Text = assres.strAssID; txtIgCur.Text = chs.iCurIg.ToString(); txtGoodsID.ReadOnly = false; cmbGoodsName.Enabled = true; txtCount.ReadOnly = false; sbtnRead.Enabled = false; cmbGoodsName.Focus(); } else { MessageBox.Show("无会员资料,请与管理员联系!", "系统提示", System.Windows.Forms.MessageBoxButtons.OK, System.Windows.Forms.MessageBoxIcon.Error); if (err != null) { clog.WriteLine(err); } return; } } }
private void sbtnRead_Click(object sender, System.EventArgs e) { this.sbtnToSilver.Enabled = false; this.sbtnToGold.Enabled = false; this.lblContent.Text = ""; string strresult = ""; 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; 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 (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; txtLinkPhone.Text = assres.strLinkPhone; this.txtIg.Text = chs.iCurIg.ToString(); this.txtAssTypeCode.Text = assres.strAssType; this.txtAssType.Text = this.GetColCh(assres.strAssType, "AT"); if (assres.strAssType == "AT001") { if (chs.iCurIg < 1000) { this.lblContent.Text = "该会员升级积分不足"; } else { if (chs.iCurIg >= 1000) { this.lblContent.Text = "该会员可由普通会员升级至银卡会员"; this.sbtnToSilver.Enabled = true; } if (chs.iCurIg >= 2000) { this.lblContent.Text = "该会员可由普通会员升级至银卡会员或金卡会员"; this.sbtnToGold.Enabled = true; } } } if (assres.strAssType == "AT003") { if (chs.iCurIg < 1500) { this.lblContent.Text = "该会员升级积分不足"; } else { this.lblContent.Text = "该会员可由银卡会员升级至金卡会员"; this.sbtnToGold.Enabled = true; } } } else { MessageBox.Show("无此会员,请核查!", "系统提示", System.Windows.Forms.MessageBoxButtons.OK, System.Windows.Forms.MessageBoxIcon.Error); if (err != null) { clog.WriteLine(err); } } } }
private void btnRead_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 = ""; CMSMStruct.CardHardStruct 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.Substring(0, 2) == "RF") { MessageBox.Show("刷卡失败,请重试!", "系统提示", System.Windows.Forms.MessageBoxButtons.OK, System.Windows.Forms.MessageBoxIcon.Error); } else { MessageBox.Show("刷卡失败,请重试!\n" + strresult, "系统提示", System.Windows.Forms.MessageBoxButtons.OK, System.Windows.Forms.MessageBoxIcon.Error); } if (strresult != null) { clog.WriteLine(strresult); } return; } 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) { DataRow[] drn = SysInitial.dsSys.Tables["AS"].Select("vcCommCode='" + assres.strAssState + "'"); if (drn == null || drn.Length == 0) { MessageBox.Show("会员状态参数错误,请检查参数或重新启动系统!", "系统提示", System.Windows.Forms.MessageBoxButtons.OK, System.Windows.Forms.MessageBoxIcon.Error); return; } else { string strAssState = drn[0]["vcCommName"].ToString(); if (assres.strAssState != "0") { MessageBox.Show("该会员已经失效,卡号:" + chs.strCardID + ",现处于“" + strAssState + "”状态,请核查!", "系统提示", System.Windows.Forms.MessageBoxButtons.OK, System.Windows.Forms.MessageBoxIcon.Error); return; } } err = null; DataTable dtFillFee = cs.GetAssFillLast(assres.strCardID, out err); if (dtFillFee == null || err != null) { MessageBox.Show(err.Message, "系统提示", System.Windows.Forms.MessageBoxButtons.OK, System.Windows.Forms.MessageBoxIcon.Error); return; } else { txtAssID.Text = assres.strAssID; txtCurCharge.Text = dtFillFee.Rows[0]["nFeeCur"].ToString(); txtCardID.Text = assres.strCardID; txtAssName.Text = assres.strAssName; this.txtFillSerial.Text = dtFillFee.Rows[0]["iSerial"].ToString(); this.txtFillFee.Text = dtFillFee.Rows[0]["nFillFee"].ToString(); this.txtFillDate.Text = dtFillFee.Rows[0]["dtFillDate"].ToString(); this.txtPromFee.Text = dtFillFee.Rows[0]["nFillProm"].ToString(); strOldDate = dtFillFee.Rows[0]["dtFillDate"].ToString(); btnRead.Enabled = false; this.btnRemove.Enabled = true; } } else { MessageBox.Show("无会员资料,请与管理员联系!", "系统提示", System.Windows.Forms.MessageBoxButtons.OK, System.Windows.Forms.MessageBoxIcon.Error); if (err != null) { clog.WriteLine(err); } return; } } }
private void btnRemove_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 = ""; CMSMStruct.CardHardStruct 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; } 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; } if (chs.strCardID != txtCardID.Text.Trim()) { MessageBox.Show("充值撤消卡与首次刷卡不是同一张卡,充值撤消失败,请重试!", "系统提示", System.Windows.Forms.MessageBoxButtons.OK, System.Windows.Forms.MessageBoxIcon.Error); this.ClearText(); btnRead.Enabled = true; return; } else { #region 开始充值撤消 if (this.txtFillSerial.Text.Trim() == "") { MessageBox.Show("没有任何可以进行撤消的充值记录!", "系统提示", System.Windows.Forms.MessageBoxButtons.OK, System.Windows.Forms.MessageBoxIcon.Information); return; } CMSMData.CMSMStruct.FillFeeStruct refill = new CMSMData.CMSMStruct.FillFeeStruct(); refill.strAssID = this.txtAssID.Text.Trim(); refill.strCardID = this.txtCardID.Text.Trim(); refill.dFillFee = Math.Round(-double.Parse(this.txtFillFee.Text.Trim()), 2); refill.dFillProm = Math.Round(-double.Parse(this.txtPromFee.Text.Trim()), 2); refill.dFeeLast = Math.Round(double.Parse(this.txtCurCharge.Text.Trim()), 2); refill.dFeeCur = refill.dFillFee + refill.dFeeLast + refill.dFillProm; refill.strFillDate = DateTime.Now.ToShortDateString() + " " + DateTime.Now.ToLongTimeString(); refill.strComments = "充值撤消,原流水号:" + this.txtFillSerial.Text.Trim(); refill.strOperName = SysInitial.CurOps.strOperName; refill.strDeptID = SysInitial.LocalDept; refill.strSerial = this.txtFillSerial.Text.Trim(); if (refill.dFeeCur < 0) { MessageBox.Show("撤消后余额已经小于0,充值撤消失败,请检查是否已经有消费,再重试!", "系统提示", System.Windows.Forms.MessageBoxButtons.OK, System.Windows.Forms.MessageBoxIcon.Error); return; } chs.dCurCharge = refill.dFeeCur; double dCurChargeBak = System.Math.Round(double.Parse(txtCurCharge.Text.Trim()) - double.Parse(this.txtFillFee.Text.Trim()) - double.Parse(this.txtPromFee.Text.Trim()), 2); if (chs.dCurCharge != dCurChargeBak) { MessageBox.Show("充值撤消失败,请重试!", "系统提示", System.Windows.Forms.MessageBoxButtons.OK, System.Windows.Forms.MessageBoxIcon.Error); clog.WriteLine("充值撤消备份值与计算值不等:备份值-- " + dCurChargeBak.ToString() + " 计算值-- " + chs.dCurCharge.ToString()); return; } err = null; strresult = ""; strresult = cs.AssFillRemove(refill, chs.iCurIg, dCurChargeBak, strOldDate, out err); if (strresult.Equals(CardCommon.CardDef.ConstMsg.RFOK) || strresult.Substring(0, 3) == "CMT") { MessageBox.Show("充值撤消成功!", "系统提示", System.Windows.Forms.MessageBoxButtons.OK, System.Windows.Forms.MessageBoxIcon.Information); clog.WriteLine(strresult); } else { MessageBox.Show("充值撤消失败,本次充值撤消无效,请检查余额是否正确!", "系统提示", System.Windows.Forms.MessageBoxButtons.OK, System.Windows.Forms.MessageBoxIcon.Error); clog.WriteLine(err + "\n" + strresult); } this.ClearText(); btnRead.Enabled = true; this.btnRemove.Enabled = false; #endregion } }