예제 #1
0
        private void btnSubmit_Click(object sender, System.EventArgs e)
        {
            if (String.IsNullOrEmpty(this.txtMoney.Text.Trim()))
            {
                MessageBox.Show("请先选择充值次数及金额!", "提示", MessageBoxButtons.OK, MessageBoxIcon.Error);
                return;
            }
            else if (this.card.Record == null || this.card.Record.Status == Status.Disabled)
            {
                this.card.Record = new MemberCardRecord();
                this.card.Record.MemberCardId = this.card.Id;
                this.card.Record.CreatedAt    = TimeStamp.GetNowTimeStamp();
            }

            MemberCardCategoryValue cat = this.cmbMoney.SelectedItem as MemberCardCategoryValue;

            this.card.Record.Balance  += cat.ValueNum;
            this.card.Record.BeginAt   = TimeStamp.ConvertDateTimeInt(DateTime.Now.Date);
            this.card.Record.ExpiredAt = TimeStamp.ConvertDateTimeInt(this.validTime.Value.Date.AddHours(23));

            if (this.card.Record.Id > 0 ? recordBll.EditMemberCardRecord(this.card.Record) : recordBll.AddMemberCardRecord(this.card.Record))
            {
                SaleLog log = new SaleLog();
                log.CreatedAt = TimeStamp.ConvertDateTimeInt(DateTime.Now);
                log.MemberId  = this.card.Id;
                log.MemberNo  = this.card.CardNo;
                log.GoodsId   = cat.GoodsId;
                log.Money     = Convert.ToDecimal(this.txtMoney.Text.Trim());
                log.Summary   = String.Format("卡号:{0}在{1}充值{2}元", this.card.CardNo, DateTime.Now.ToString("yyyy-MM-dd hh:mm:ss"), cat.Money);
                saleBll.AddLog(log);
                Callback(log.Summary);
                this.labMoney.Text = String.Format("帐户剩余次数:{0}次", this.card.Record.Balance.ToString());
            }

            this.btnSubmit.Enabled = false;
            this.validTime.Visible = false;
            this.labTip.Visible    = false;
            this.card = null;
            this.cmbMoney.DataSource = null;
            this.txtMoney.Clear();
            MessageBox.Show("充值成功!", "提示", MessageBoxButtons.OK, MessageBoxIcon.Information);
        }
예제 #2
0
        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;
        }
예제 #3
0
 public FrmRecharge(Models.MemberCard card) : this()
 {
     this.card = card;
 }