private void findCard(String no) { this.card = cardBll.GetMemberCardByNo(no); this.card.Record = this.card != null?recordBll.GetMemberCardRecordByMemberCardId(this.card.Id) : null; this.card.Category = catBll.GetMemberCardCategoryById(this.card.CategoryId); String msg = null; if (this.card == null) { msg = "此卡不存在!"; } else if (this.card.Record == null) { msg = "此卡未开户,请先开卡!"; } if (!String.IsNullOrEmpty(msg)) { MessageBox.Show(msg, "提示", MessageBoxButtons.OK, MessageBoxIcon.Error); return; } this.labNo.Text = this.card.CardNo.Trim(); this.labBalance.Text = this.card.Record.Balance.ToString(); this.labCategory.Text = this.card.Category.Name.Trim(); this.labExpirt.Text = this.card.Record.ExpiredAt.ToString(); this.btnRecovery.Enabled = true; }
private void findCard(String no) { this.card = cardBll.GetMemberCardByNo(no); if (this.card != null) { this.card.Record = recordBll.GetMemberCardRecordByMemberCardId(this.card.Id); this.card.Category = catBll.GetMemberCardCategoryById(this.card.CategoryId); } String msg = null; if (this.card == null) { msg = "此卡不存在!"; } if (!String.IsNullOrEmpty(msg)) { MessageBox.Show(msg, "提示", MessageBoxButtons.OK, MessageBoxIcon.Error); return; } if (this.card.Record == null || this.card.Record.Status == Status.Disabled) { DialogResult result = MessageBox.Show("此卡未开户,是否开卡?", "温馨提示", MessageBoxButtons.YesNo, MessageBoxIcon.Question); if (result == DialogResult.No) { return; } this.card.Record = new MemberCardRecord(); this.card.Record.MemberCardId = this.card.Id; this.card.Record.CreatedAt = TimeStamp.GetNowTimeStamp(); } this.labMemberCardCategory.Text = this.card.Category.Name; this.labMoney.Text = String.Format("帐户剩余次数:{0}次", Convert.ToInt32(this.card.Record.Balance)); this.btnSubmit.Enabled = true; }
/// <summary> /// 查找会员卡信息 /// </summary> /// <param name="no"></param> private void FindMemberCard(String no) { this.initUI(); String audioKey = null; String msg = ""; this.card = cardBll.GetMemberCardByNo(no); if (this.card != null) { this.card.Category = catBll.GetMemberCardCategoryById(this.card.CategoryId); this.card.Record = recordBll.GetMemberCardRecordByMemberCardId(this.card.Id); this.fullCardInfo(); } //判断会员卡是否存在 if (card == null) { msg = "此卡不存在!"; audioKey = "AudioCardNotFound"; } else if (card.Record == null) { msg = "此卡未开启!"; audioKey = "AudioCardNotAvailable"; } else if (card.Record.Status == Status.Disabled) { msg = "此卡已回收,请重新开卡后使用!"; audioKey = "AudioCardStatusInvalid"; } else if (card.Record.Balance <= 0) { msg = "此卡次数不足,请充值后再试!"; audioKey = "AudioCardArrearage"; } else if (card.Record.ExpiredAt < TimeStamp.GetNowTimeStamp()) { msg = "此卡已过期!"; audioKey = "AudioCardExpired"; } else if (!card.Category.isDateAllow() || !card.Category.isTimeAllow()) { msg = "此卡不在可用时间段!"; audioKey = "AudioCardTimeInvalid"; } if (!String.IsNullOrEmpty(msg)) { this.setLabelStatus(msg, Color.Red, audioKey); return; } this.setLabelStatus("此卡可以使用", Color.Green); this.numValue.Enabled = true; this.btnSubmit.Enabled = true; this.numValue.Maximum = card.Record.Balance; if (!this.ckbAuto.Checked) { return; } this.AddRecord(); }