Example #1
0
        private void RemoveButton_Click_1(object sender, RoutedEventArgs e)
        {
            AccList acclist = (AccList)FindResource("acclist");


            AccIoList acciolist = (AccIoList)FindResource("acciolist");

            int idx = 0;

            while (idx < acciolist.Count)
            {
                AccIo acio = acciolist[idx];
                if (acio.Id.Equals(acclist[listbox1.SelectedIndex].Id))
                {
                    acciolist.RemoveAt(idx);
                    //acciolist.Remove(aio);
                }
                else
                {
                    ++idx;
                }
            }

            if (listbox1.SelectedIndex >= 0)
            {
                acclist.RemoveAt(listbox1.SelectedIndex);
            }
        }
Example #2
0
        private void Moneyout_Click(object sender, RoutedEventArgs e)
        {
            ICollectionView view = CollectionViewSource.GetDefaultView(FindResource("acclist"));
            Account         acc  = (Account)view.CurrentItem; //리스트에서 찾은거를 객체화해줌.

            if (int.Parse(money.Text) <= 0)
            {
                MessageBox.Show("0원이하 출금불가");
                return;
            }
            else if (int.Parse(money.Text) > acc.Bal)
            {
                MessageBox.Show("잔액보다 높은금액 출금불가");
                return;
            }
            acc.Bal -= int.Parse(money.Text);



            AccIo accio = new AccIo()
            {
                Id      = int.Parse(accioid.Text),
                History = Moneyin.Content.ToString(),
                Money   = int.Parse(money.Text),
                Balance = int.Parse(acciobal.Text),
                Date    = DateTime.Now
            };

            acciolist.Add(accio);
            //listbox2.Items.Add(accio);
        }
Example #3
0
        private void Moneyin_Click(object sender, RoutedEventArgs e)
        {
            ICollectionView view = CollectionViewSource.GetDefaultView(FindResource("acclist"));
            Account         acc  = (Account)view.CurrentItem; //리스트에서 찾은거를 객체화해줌.

            if (int.Parse(money.Text) <= 0)
            {
                MessageBox.Show("0원이하 입금불가");
                return;
            }
            acc.Bal += int.Parse(money.Text);



            AccIo accio = new AccIo()
            {
                Id      = int.Parse(accioid.Text),
                History = Moneyin.Content.ToString(),
                Money   = int.Parse(money.Text),
                Balance = int.Parse(acciobal.Text),
                Date    = DateTime.Now
            };

            acciolist.Add(accio);
            //listbox2.Items.Add(accio);
            //foreach (Account a in acclist)
            //{
            //    if (a.Id.Equals(int.Parse(Accid.Text)) == true)
            //    {
            //        a.moenyinput(int.Parse(money.Text));
            //    }
            //}     //foreach 안먹음
        }