private void btSalvar_Click(object sender, RoutedEventArgs e) { try { NfeCupomFiscalReferenciadoDTO CupomVinculado = new NfeCupomFiscalReferenciadoDTO(); CupomVinculado.ModeloDocumentoFiscal = tbModeloDocumentoFiscal.Text; CupomVinculado.DataEmissaoCupom = dpDataEmissao.SelectedDate; int aux; if (int.TryParse(tbNrOrdemECF.Text, out aux)) { CupomVinculado.NumeroOrdemEcf = aux; } else { CupomVinculado.NumeroOrdemEcf = null; } if (int.TryParse(tbNrCaixa.Text, out aux)) { CupomVinculado.NumeroCaixa = aux; } else { CupomVinculado.NumeroCaixa = null; } if (int.TryParse(tbCOO.Text, out aux)) { CupomVinculado.Coo = aux; } else { CupomVinculado.Coo = null; } CupomVinculado.NumeroSerieEcf = tbNrSerieECF.Text; ((NFeViewModel)DataContext).IncluirCupomVinculado(CupomVinculado); tbModeloDocumentoFiscal.Clear(); dpDataEmissao.SelectedDate = null; tbNrOrdemECF.Clear(); tbNrCaixa.Clear(); tbCOO.Clear(); tbNrSerieECF.Clear(); dataGrid.Items.Refresh(); } catch (Exception ex) { MessageBox.Show(ex.Message, "Alerta do sistema"); } }
public void IncluirCupomVinculado(NfeCupomFiscalReferenciadoDTO cupomVinculado) { try { if (NFeSelected.ListaNfeCupomFiscalReferenciado == null) { NFeSelected.ListaNfeCupomFiscalReferenciado = new List <NfeCupomFiscalReferenciadoDTO>(); } NFeSelected.ListaNfeCupomFiscalReferenciado.Add(cupomVinculado); } catch (Exception ex) { throw ex; } }