Exemple #1
0
        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;
            }
        }
Exemple #2
0
 public InvoiceRow AddInvoiceDetail(InvoiceRow e)
 {
     try
     {
         InvoiceRows.Add(e);
         int id = this.SaveChanges();
     }
     catch (Exception ex)
     {
     }
     return(e);
 }