public void AddInvoiceCommand_Executed(object sender) { if (AppProperties.FormHaveModifications) { if (!SelectedClient.HasValue) { MessageBox.Show("Selezionare un cliente"); return; } if (!SelectedMeasure.HasValue) { MessageBox.Show("Selezionare una misura"); return; } if (InvoiceRows == null || InvoiceRows.Count == 0) { MessageBox.Show("Aggiungere materiali"); return; } _contoData.InvoiceAdd(new Invoice { ClientId = SelectedClient.Value, MeasureId = SelectedMeasure.Value, InvoiceDate = InvoiceDate, InvoiceYear = InvoiceDate.Year, InvoiceContentRows = InvoiceRows.ToInvoiceContentCollection() }); AppProperties.FormHaveModifications = false; } }