/// <summary> /// 显示刷卡信息 /// </summary> /// <param name="card">会员卡实体</param> /// <param name="status">其它信息</param> /// <param name="color">字体颜色</param> public void ChangeText(Models.MemberCard card, String status, System.Drawing.Color color) { if (card == null) { return; } String balance = "未找到"; String expire = "未找到"; if (card.Record != null) { expire = TimeStamp.ConvertIntDateTime(card.Record.ExpiredAt).ToString("yyyy-MM-dd"); balance = card.Record == null ? "0" : card.Record.Balance.ToString(); if (card.Record.Status == Status.Disabled) { expire = "已收回"; } else if (card.Record.ExpiredAt < TimeStamp.GetNowTimeStamp()) { balance = "此卡已过期"; } } this.labCategory.Text = String.Format("会员类别:{0}", card.Category == null ? "未找到" : card.Category.Name); this.labCardNo.Text = String.Format("会员卡号:{0}", card == null ? "未找到" : card.CardNo); this.labCardNum.Text = String.Format("剩余次数:{0}", balance); this.labExpire.Text = String.Format("到期时间:{0}", expire); this.labStatus.Text = String.Format("{0}", status); this.labStatus.ForeColor = color; changeLoction(); }
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); this.card.Record = this.card != null?recordBll.GetMemberCardRecordByMemberCardId(this.card.Id) : null; 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.card.Record.Status = Status.Disabled; if (this.recordBll.EditMemberCardRecord(this.card.Record)) { MessageBox.Show("卡片已收回!", "提示", MessageBoxButtons.OK, MessageBoxIcon.Information); } else { MessageBox.Show("卡片已收回失败!", "提示", MessageBoxButtons.OK, MessageBoxIcon.Error); } }
private void btnSave_Click(object sender, System.EventArgs e) { String msg = null; if (String.IsNullOrEmpty(this.txtNo.Text.Trim())) { msg = "卡号为必填项"; } else if (this.txtNo.Text.Trim().Length != 10) { msg = "卡号长度必须为11位"; } if (msg != null) { this.setLabelMsg(msg, Color.DarkRed); return; } Models.MemberCard card = new Models.MemberCard(); card.CategoryId = (int)this.cbxCategory.SelectedValue; card.CardNo = this.txtNo.Text.Trim(); bool flag = false; try { flag = cardBll.AddMemberCard(card); } catch (ArgumentNullException err) { msg = err.Message; } catch (ArgumentException err) { msg = err.Message; } catch (Exception err) { msg = err.Message; } if (!flag) { this.setLabelMsg(msg, Color.DarkRed); return; } this.setLabelMsg("卡号保存成功", Color.Green); this.txtNo.Clear(); this.txtNo.Focus(); }
public FrmRecovery(Models.MemberCard card) : this() { this.card = card; }
/// <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(); }