Пример #1
0
        //打印优惠券
        private void btnCoupon_Click(object sender, EventArgs e)
        {
            InputNumber inputNumber = new InputNumber("输入账单号", false);

            if (inputNumber.ShowDialog() != DialogResult.OK)
            {
                return;
            }

            var act_id = inputNumber.number;
            var act    = db.Account.FirstOrDefault(x => x.id == act_id);

            if (act == null)
            {
                return;
            }

            //if (BathClass.ToBool(act.couponPrinted))
            //{
            //    InformationDlg dlg = new InformationDlg("该账单号已经打印");
            //    dlg.ShowDialog();
            //    return;
            //}

            var act_money = BathClass.get_account_money(act);

            if (db.Coupon.Any(x => x.minAmount != null && act_money >= x.minAmount))
            {
                var coupons = db.Coupon.Where(x => x.minAmount != null && act_money >= x.minAmount);
                var coupon  = coupons.OrderByDescending(x => x.money).FirstOrDefault();

                PrintCoupon.Print_Coupon((byte[])coupon.img.ToArray());

                //act.couponPrinted = true;
                db.SubmitChanges();
            }
            else
            {
                InformationDlg dlg = new InformationDlg("未达到最低赠送消费金额");
                dlg.ShowDialog();
            }
        }
Пример #2
0
        private void show_msg(string msg)
        {
            InformationDlg dlg = new InformationDlg(msg);

            dlg.ShowDialog();
        }