Exemple #1
0
        private void btnTest_Click(object sender, RoutedEventArgs e)
        {
            //persons.Add(new Person(++index));
            //Person p = (Person)this.listView1.SelectedItems[0];
            //MessageBox.Show(p.Sex.ToString());
            StringBuilder sb = new StringBuilder(33);

            sb.Append("123456");
            int   st    = 0;
            Int32 value = 100;

            st = CardRef.CoolerPutCard(sb);
            st = CardRef.CoolerReadCard(sb, ref value);
            st = CardRef.CoolerRechargeCard(sb, 100);
            st = CardRef.CoolerConsumeCard(sb, 100);
            MessageBox.Show(CardRef.GetStr(st));
        }
Exemple #2
0
        private void Button_Click(object sender, RoutedEventArgs e)
        {
            if (IsPrint)
            {
                PrintDialog pDialog1 = new PrintDialog();
                pDialog1.PrintVisual(GridPrint, "会员充值打印");
                DialogResult = true;
                this.Close();
                return;
            }
            dynamic d = GridPrint.DataContext;

            StringBuilder sb = new StringBuilder(33);

            sb.Append(d.CardNo);
            int value = Convert.ToInt32((d.Amount + d.Donate) * 100);

#if !DEBUG
            int st = CardRef.CoolerRechargeCard(sb, value);
#else
            //string strCardNo = "12347";
            int st = 0;
#endif
            if (st != 0)
            {
                MessageBox.Show(CardRef.GetStr(st));
                DialogResult = false;
                this.Close();
                return;
            }

            DXInfo.Models.Recharges recharge = new DXInfo.Models.Recharges();
            recharge.Amount      = d.Amount;
            recharge.Donate      = d.Donate;
            recharge.LastBalance = d.LastBalance;
            recharge.Balance     = d.Balance;
            recharge.Card        = d.Id;
            recharge.CreateDate  = d.CreateDate;
            recharge.UserId      = d.UserId;
            recharge.DeptId      = d.DeptId;
            recharge.PayType     = d.PayType;
            if (this.IsPutCard)
            {
                recharge.RechargeType = 2;
            }
            Guid cardid = d.Id;
            DXInfo.Models.Cards card = uow.Cards.GetById(cardid);//.Where(w => w.Id == cardid).FirstOrDefault();
            if (card == null)
            {
                throw new ArgumentException("此卡信息未找到");
            }
            card.Balance = recharge.Balance;

            uow.Recharges.Add(recharge);

            //小票
            DXInfo.Models.Bills bill = new DXInfo.Models.Bills();
            bill.Amount      = d.Amount;
            bill.Balance     = d.Balance;
            bill.BillType    = "CardInMoneyWindow";
            bill.CardNo      = d.CardNo;
            bill.CreateDate  = d.CreateDate;
            bill.DeptName    = d.DeptName;
            bill.Donate      = d.Donate;
            bill.FullName    = d.FullName;
            bill.LastBalance = d.LastBalance;
            bill.MemberName  = d.MemberName;
            bill.PayTypeName = d.PayTypeName;

            uow.Bills.Add(bill);

            uow.Commit();

            //PrintDialog pDialog = new PrintDialog();
            //pDialog.PrintVisual(GridPrint, "会员充值打印");
            //MyPrint mp = new MyPrint();
            //mp.CardInMoneyPrint(uow, d);

            DialogResult = true;
            this.Close();
        }