private void reject_Click(object sender, EventArgs e) { if (listBox.SelectedItem != null) { RejectPaymentRequestCommand command = new RejectPaymentRequestCommand(); bool result = command.rejectPaymentRequest((PolicyPayment)listBox.SelectedItem); if (result) { listBox.Items.Clear(); label2.Text = "Запрос на выплату отклонен."; GetAllIndividualWithPaymentRequests command1 = new GetAllIndividualWithPaymentRequests(); List <Individual> individualList = command1.getAllIndividualClientsWithPaymentRequests(); listBox.Items.AddRange(individualList.ToArray()); GetAllLegalPersonsWithPaymentRequests command2 = new GetAllLegalPersonsWithPaymentRequests(); List <LegalPerson> legalList = command2.getAllLegalPersonsClientsWithPaymentRequests(); listBox.Items.AddRange(legalList.ToArray()); label1.Text = "Все клиенты, оформившие обращение за выплатой"; reject.Visible = false; submit.Visible = false; button1.Visible = true; } else { label2.Text = "Не удалось отклонить запрос на выплату."; } } }
public FormPaymentAdmin() { InitializeComponent(); reject.Visible = false; submit.Visible = false; GetAllIndividualWithPaymentRequests command = new GetAllIndividualWithPaymentRequests(); List <Individual> individualList = command.getAllIndividualClientsWithPaymentRequests(); listBox.Items.AddRange(individualList.ToArray()); GetAllLegalPersonsWithPaymentRequests command2 = new GetAllLegalPersonsWithPaymentRequests(); List <LegalPerson> legalList = command2.getAllLegalPersonsClientsWithPaymentRequests(); listBox.Items.AddRange(legalList.ToArray()); }