Ejemplo n.º 1
0
        public void TestWithDrawbank(int total, int payment, int[] bank)
        {
            svc = new WithDraw();
            var result = svc.WithdrawCalculateback(total, payment);

            Assert.Equal(bank, result);
        }
Ejemplo n.º 2
0
        public bool RevertATransaction(Bank bank, Transaction transaction)
        {
            string   transactionId = transaction.Id;
            Customer customer      = this.CustomerExistsOrNotByAccId(bank, transaction.SourceId);

            if (transaction is WithDraw)
            {
                WithDraw wD  = transaction as WithDraw;
                float    amt = wD.Amountflow;
                bank.transactions.Add(new Deposit(wD.SourceId, wD.SourceBankId, -1 * amt));
                return(true);
            }
            else if (transaction is Deposit)
            {
                Deposit dp  = transaction as Deposit;
                float   amt = dp.Amountflow;
                if (customer.GetAccount().IsBalanceSufficient(amt))
                {
                    customer.GetAccount().deductBalance(amt);
                    bank.transactions.Add(new WithDraw(dp.SourceId, dp.SourceBankId, -1 * amt));
                    return(true);
                }
                return(false);
            }

            return(false);
        }
Ejemplo n.º 3
0
        public bool UpdateState(int Id, int State, string meesgage)
        {
            WithDraw draw = Single(Id);

            draw.UTime   = DateTime.Now;
            draw.State   = State;
            draw.Message = meesgage;
            return(Update(draw));
        }
Ejemplo n.º 4
0
        public SelectableTextBlock()
        {
            this.Cursor = Cursors.IBeam;
            Focusable   = true;
            var contextMenu = new ContextMenu();

            ContextMenu = contextMenu;

            copyMenu                  = new MenuItem();
            copyMenu.Header           = "复制";
            copyMenu.InputGestureText = "Ctrl + C";
            copyMenu.Click           += (ss, ee) =>
            {
                Copy();
            };
            contextMenu.Items.Add(copyMenu);

            selectAllMenu                  = new MenuItem();
            selectAllMenu.Header           = "全选";
            selectAllMenu.InputGestureText = "Ctrl + A";
            selectAllMenu.Click           += (ss, ee) =>
            {
                SelectAll();
            };
            contextMenu.Items.Add(selectAllMenu);

            fowardMenu        = new MenuItem();
            fowardMenu.Header = "转发";
            fowardMenu.Click += (ss, ee) =>
            {
                FowardEvent?.Invoke(this);
            };
#if !CUSTOMSERVER
            contextMenu.Items.Add(fowardMenu);
#endif
            var deleteItem = new MenuItem();
            deleteItem.Header = "删除";
            deleteItem.Click += (ss, ee) =>
            {
                Deleted?.Invoke(this);
            };
            contextMenu.Items.Add(deleteItem);

            withDrawMenu        = new MenuItem();
            withDrawMenu.Header = "撤回";
            withDrawMenu.Click += (ss, ee) =>
            {
                WithDraw?.Invoke(this);
            };



            ContextMenuOpening += contextMenu_ContextMenuOpening;

            this.LineHeight = 30;
        }
Ejemplo n.º 5
0
        public string a()
        {
            WithDrawBLL wi    = new WithDrawBLL();
            WithDraw    model = wi.Single(100004);

            model.UTime = DateTime.Now;
            bool flag = wi.Update(model);

            return(flag.ToString());
        }
Ejemplo n.º 6
0
        private void button3_Click(object sender, EventArgs e)
        {
            WithDrawBLL wi    = new WithDrawBLL();
            WithDraw    model = wi.Single(100004);

            model.UTime = DateTime.Now;
            bool flag = wi.Update(model);

            MessageBox.Show(flag.ToString());
        }
Ejemplo n.º 7
0
        public ICashDispenser WithDraw(string name, decimal amount)
        {
            ICashDispenser cashDispenser = Factory.CreateCashDispenser();

            IAccount     account  = GetAccountByName(name);
            ITransaction withDraw = new WithDraw()
            {
                Account = account,
                Amount  = amount
            };

            if (account.Balance < amount)
            {
                cashDispenser.IsSufficientBalance = false;
                return(cashDispenser);
            }
            else
            {
                cashDispenser.IsSufficientBalance = true;
            }

            int[] bills = _dab.GetBills();

            for (int i = 0; i < bills.Length; i++)
            {
                if (!(amount < bills[i]))
                {
                    cashDispenser.NumberOfBills[i] = (int)amount / bills[i];
                    if (cashDispenser.NumberOfBills[i] > _dab.NumberOfBills[i])
                    {
                        cashDispenser.NumberOfBills[i] = _dab.NumberOfBills[i];
                    }
                    amount -= bills[i] * cashDispenser.NumberOfBills[i];
                }
            }

            if (amount > 10)
            {
                cashDispenser.IsSufficientCash = false;
                return(cashDispenser);
            }
            else if (amount > 0 && amount < 10)
            {
                cashDispenser.IsValidAmount = false;
                return(cashDispenser);
            }
            else
            {
                cashDispenser.IsSufficientCash = true;
                cashDispenser.IsValidAmount    = true;
                cashDispenser.Dispense(_dab);
                withDraw.Execute();
                return(cashDispenser);
            }
        }
Ejemplo n.º 8
0
        public int Init(int UserId, int PayId, decimal Amount, int Platform, string BankCard)
        {
            WithDraw model = new WithDraw();

            model.UserId             = UserId;
            model.Amount             = Amount;
            model.Platform           = Platform;
            model.PayId              = PayId;
            model.IP                 = ITOrm.Utility.Client.Ip.GetClientIp();
            model.ReceiverBankCardNo = BankCard;
            return(Insert(model));
        }
Ejemplo n.º 9
0
        private void EditExchangPermission_Load(object sender, EventArgs e)
        {
            WithDraw item = new WithDraw();

            item           = db.WithDraws.SingleOrDefault(s => s.Id == Id);
            comboBox1.Text = item.Item.Name.ToString();
            comboBox2.Text = item.Supplier.Name.ToString();
            comboBox3.Text = item.WareHouse.Name.ToString();

            TBQuantity.Text  = item.Quantity.ToString();
            TBPermitNUM.Text = item.LicenseNum.ToString();
        }
Ejemplo n.º 10
0
        private void button1_Click(object sender, EventArgs e)
        {
            var itemInfo       = ENT.Items.Where(r => r.Name == (string)CBItems.SelectedItem).SingleOrDefault();
            var supplierInfo   = ENT.Suppliers.Where(r => r.Name == (string)CBSupplier.SelectedItem).SingleOrDefault();
            var storeInfo      = ENT.WareHouses.Where(r => r.Name == (string)CBStore.SelectedItem).SingleOrDefault();
            var Customers      = ENT.Customers.Where(r => r.Name == (string)CBCust.SelectedItem).SingleOrDefault();
            var wareHouseItems = ENT.WareHouseItems.Where(r => r.IdItem == itemInfo.ID).SingleOrDefault();

            WithDraw Sperm = new WithDraw();

            try
            {
                if (string.IsNullOrWhiteSpace(TBQuntity.Text) || string.IsNullOrWhiteSpace(TBNUM.Text))
                {
                    MessageBox.Show("Please Complete empty Field");
                }

                else if (Convert.ToInt32(TBQuntity.Text) > wareHouseItems.Quantity)
                {
                    MessageBox.Show("this Quantity Greater than item Quantity");
                }
                else
                {
                    Sperm.IdItem      = itemInfo.ID;
                    Sperm.IdSupplier  = supplierInfo.Id;
                    Sperm.IdWareHouse = storeInfo.Id;
                    Sperm.IdCustomer  = Customers.IdCustomers;

                    Sperm.LicenseData = date.Value;
                    Sperm.Quantity    = Convert.ToInt32(TBQuntity.Text);
                    Sperm.LicenseNum  = Convert.ToInt32(TBNUM.Text);

                    ENT.WithDraws.Add(Sperm);
                    ENT.SaveChanges();

                    MessageBox.Show("Done");
                    CBItems.SelectedItem    = string.Empty;
                    CBSupplier.SelectedItem = string.Empty;
                    CBStore.SelectedItem    = string.Empty;
                    TBQuntity.Text          = string.Empty;
                    TBNUM.Text = string.Empty;

                    ListOfExchangePermission.DataSource = ENT.WithDraws.Select(P => new { P.Id, P.IdItem, P.IdSupplier, P.IdWareHouse, P.LicenseNum, P.Quantity }).ToList();
                }
            }
            catch (Exception)
            {
                MessageBox.Show("Invalid Field");
            }
        }
Ejemplo n.º 11
0
        static void Main(string[] args)
        {
            MyEvent  evt      = new MyEvent();
            Deposit  deposit  = new Deposit();
            WithDraw withDraw = new WithDraw();

            evt.MyBalance += deposit.DepositHandler;
            int bal = 100;

            evt.RaiseEvent(ref bal);
            Console.WriteLine("Balance is" + bal);
            evt.MyBalance -= deposit.DepositHandler;
            evt.MyBalance += withDraw.WithDrawHandler;

            evt.RaiseEvent(ref bal);
            Console.WriteLine("Balance is" + bal);
            Console.ReadKey();
        }
Ejemplo n.º 12
0
        private void BtnAdd_Click(object sender, EventArgs e)
        {
            try
            {
                WithDraw Sperm          = new WithDraw();
                var      itemInfo       = db.Items.Where(r => r.Name == (string)comboBox1.SelectedItem).SingleOrDefault();
                var      supplierInfo   = db.Suppliers.Where(r => r.Name == (string)comboBox2.SelectedItem).SingleOrDefault();
                var      storeInfo      = db.WareHouses.Where(r => r.Name == (string)comboBox3.SelectedItem).SingleOrDefault();
                var      Customers      = db.Customers.Where(r => r.Name == (string)CBCust.SelectedItem).SingleOrDefault();
                var      wareHouseItems = db.WareHouseItems.Where(r => r.IdItem == itemInfo.ID).SingleOrDefault();
                if (string.IsNullOrWhiteSpace(TBQuantity.Text) || string.IsNullOrWhiteSpace(TBPermitNUM.Text))
                {
                    MessageBox.Show("Please Complete empty Field");
                }

                else if (Convert.ToInt32(TBQuantity.Text) > wareHouseItems.Quantity)
                {
                    MessageBox.Show("this Quantity Greater than item Quantity");
                }
                else
                {
                    Sperm.IdItem      = itemInfo.ID;
                    Sperm.IdSupplier  = supplierInfo.Id;
                    Sperm.IdWareHouse = storeInfo.Id;
                    Sperm.IdCustomer  = Customers.IdCustomers;

                    Sperm.LicenseData = LicenseDate.Value;
                    Sperm.Quantity    = Convert.ToInt32(TBQuantity.Text);
                    Sperm.LicenseNum  = Convert.ToInt32(TBPermitNUM.Text);

                    db.WithDraws.Add(Sperm);
                    db.SaveChanges();

                    MessageBox.Show("Done");
                    this.Close();
                }
            }
            catch (Exception)
            {
                MessageBox.Show("Invalid Field");
            }
        }
Ejemplo n.º 13
0
        /// <summary>
        /// Bắt sự kiện đăng nhập và khởi tạo các use case có liên quan
        /// </summary>
        /// <param name="isSuccess"></param>
        /// <param name="ds"></param>
        /// <param name="mathe"></param>
        private void Validation_login(bool isSuccess, DanhsachtheATM ds, string mathe)
        {
            if (isSuccess)
            {
                this.ds    = ds;
                tk         = DanhSachTaiKhoan_BUL.Instance.LayThongTinTaiKhoan(ds.Mataikhoan);
                kh         = KhachHang_BUL.Instance.LayThongTinKhachHang(tk.Makhachhang);
                main       = new MainUC(tk, kh);
                this.mathe = mathe;

                main.rutten       += Main_rutten;
                main.checkBalance += Main_checkBalance;
                main.history      += Main_history;
                main.changePIN    += Main_changePIN;
                main.exit         += Main_exit;
                main.cardTranfer  += Main_cardTranfer;

                viewHistory   = new ViewHistory(tk, kh, mathe, thongTinMay.MaATM);
                checkBanlance = new CheckBanlance(tk, kh, mathe, thongTinMay.MaATM);
                changePIN     = new ChangePIN(mathe, thongTinMay.MaATM, this);
                withDraw      = new WithDraw(tk, kh);
                beingFinal    = new BeingFinal_UC(tk, kh);
                cardTranfer   = new CardTranfer(tk, kh, mathe, thongTinMay.MaATM, this);
                final_UC      = new Final_UC(tk, kh);

                withDraw.SetMoney   += WithDraw_SetMoney;
                viewHistory.click   += ViewHistory_click;
                checkBanlance.click += CheckBanlance_click;
                changePIN.ok        += ChangePIN_ok;
                cardTranfer.tranfer += CardTranfer_tranfer;

                final_UC.click_Finish += Final_UC_click_Finish;

                mainPanel.Controls.Clear();
                mainPanel.Controls.Add(main);
            }
        }
Ejemplo n.º 14
0
 private void Button_WithDraw_Click(object sender, EventArgs e)
 {
     WithDraw?.Invoke(this, EventArgs.Empty);
 }
Ejemplo n.º 15
0
 /// <summary>
 /// Delete,根据实体对象删除
 /// </summary>
 /// <returns>返回,成功:true,失败:false</returns>
 public bool Delete(WithDraw entity)
 {
     return(dal.Update(entity));
 }
Ejemplo n.º 16
0
 /// <summary>
 /// 插入数据
 /// </summary>
 /// <returns>返回,成功:true,失败:false</returns>
 public int Insert(WithDraw entity)
 {
     return(dal.Insert(entity));
 }