Exemplo n.º 1
0
        private void DeletePayment(IPayment payment, ItemControl ucPayments)
        {
            string message;

            message = "Are you sure you want to delete the selected item?";

            if (MessageBox.Show(message, "Delete", MessageBoxButtons.YesNo, MessageBoxIcon.Question) == DialogResult.Yes)
            {
                payment.Delete(((IPayment)ucPayments.SelectedRow).Id);

                ucPayments.PopulateList(new SortableBindingList<IPayment>(payment.GetPayments(_year, _week)));

                _modified = true;
            }
        }
Exemplo n.º 2
0
        private void RemoveOldTransactions(IPayment payment)
        {
            var newAffectedMonths = payment.PayPattern.Element.AffectedMonths;
            IEnumerable <ITransaction> projectTransactions = Project.CurrentProject.Transactions.GetTransactionsByPayment(payment);

            if (!newAffectedMonths.Any())
            {
                payment.Delete();
                projectTransactions.ToList().ForEach(t => t.Delete());
            }

            var removedTransactions = projectTransactions.Where(t => !newAffectedMonths.Contains(t.Month.Element.MonthType));

            removedTransactions.ToList().ForEach(t => t.Delete());
        }