Esempio n. 1
0
        private void Delete_OnClick(object sender, RoutedEventArgs e)
        {
            var removeItem = _observableDataBanks.Where(x => x.Selected).ToList();

            if (removeItem.Count == 0)
            {
                MessageBox.Show("Check a box to delete a record.", "Error", MessageBoxButton.OK, MessageBoxImage.Stop);
                return;
            }

            foreach (var item in removeItem)
            {
//                var timestamp = item.Timestamp.ToString("yyyy-MM-dd HH:mm:ss");

                _observableDataBanks.Remove(item);
                _current += item.Money;
                _expense.Remove(item);
                var currentTotal = new SqlConnect.Bank(_current, DateTime.Now);
                SqlConnect.InsertMoney("total", _userId, _current);
                _total.Add(currentTotal);
                SqlConnect.DeleteMoney("expense", item.Id, _userId);
            }

            CurrentMoney.Text = _current.ToString("C");
        }