private void buttonDeleteFundingLineEvent_Click(object sender, EventArgs e) { if (listViewFundingLineEvent.SelectedItems.Count != 0) { FundingLineEvent fundingLineEventBody = (FundingLineEvent)listViewFundingLineEvent.SelectedItems[0].Tag; if (fundingLineEventBody.Type != OFundingLineEventTypes.Entry) { Fail("wrongType"); return; } if (fundingLineEventBody.Amount > _fundingLine.AnticipatedRemainingAmount) { Fail("amountCommitted"); return; } ServicesProvider.GetInstance().GetFundingLinesServices().DeleteFundingLineEvent(fundingLineEventBody); _fundingLine.RemoveEvent(fundingLineEventBody); RefreshView(); } }