private void btSalvar_Click(object sender, RoutedEventArgs e)
        {
            try
            {
                NFeCupomFiscalDTO cupomVinculado = new NFeCupomFiscalDTO();

                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");
            }
        }
Пример #2
0
        public void incluirCupomVinculado(NFeCupomFiscalDTO cupomVinculado)
        {
            try
            {
                if (nfeSelected.listaCupomFiscal == null)
                {
                    nfeSelected.listaCupomFiscal = new List <NFeCupomFiscalDTO>();
                }

                nfeSelected.listaCupomFiscal.Add(cupomVinculado);
            }
            catch (Exception ex)
            {
                throw ex;
            }
        }