private void OnOpenInvoice(object sender, EventArgs e) { var invCtrl = (UI.InvoiceListItem)sender; SelectedInvoice = invCtrl.ProformaInvoice; OpenInvoice?.Invoke(this, e); }
private void dataGridView1_CellClick(object sender, DataGridViewCellEventArgs e) { if (e.RowIndex < 0) { return; } var id = dataGridView1[9, e.RowIndex].Value; if (e.RowIndex + 1 >= dataGridView1.RowCount) { return; } SelectedInvoice = _proformaInvoices.FirstOrDefault(x => x.Id == new Guid(id.ToString())); if (e.ColumnIndex == 7) //fatture { if (SelectedInvoice.Invoice == null) { MessageBox.Show("La fattura non è ancora disponibile"); } else { var basePath = _therapist.InvoicesFolder; var date = $"{SelectedInvoice.Invoice.Date.Year}{SelectedInvoice.Invoice.Date.Month}"; basePath = Path.Combine(basePath, date); if (Directory.Exists(basePath)) { System.Diagnostics.Process.Start(basePath); } else { MessageBox.Show("La cartella non esiste ancora stampare prima la fattura"); } } } else if (e.ColumnIndex == 8) //dettagli { OpenInvoice?.Invoke(this, e); } }