Ejemplo n.º 1
0
 private bool salvaDadosBDCadastro()
 {
     try
     {
         System.Data.DataRow[] dtRowNotas       = m_typDatSetTbNotasFiscaisTODAS.tbNotasFiscais.Select("strNumero = '" + m_strNumeroNota + "'");
         System.Data.DataRow[] dtRowNotasAtuais = m_typDatSetTbNotasFiscais.tbNotasFiscais.Select("strNumero = '" + m_strNumeroNota + "'");
         if (((dtRowNotas != null) && (dtRowNotas.Length > 0)) || ((dtRowNotasAtuais != null) && (dtRowNotasAtuais.Length > 0)))
         {
             mdlMensagens.clsMensagens.ShowError(mdlMensagens.clsRepositorioMensagens.GetMensagem(mdlMensagens.Mensagem.mdlNotaFiscal_clsNotaFiscal_NotaExistente));
             return(false);
         }
         else
         {
             mdlDataBaseAccess.Tabelas.XsdTbNotasFiscais.tbNotasFiscaisRow dtrwTbNotasFiscais = null;
             dtrwTbNotasFiscais = m_typDatSetTbNotasFiscais.tbNotasFiscais.NewtbNotasFiscaisRow();
             dtrwTbNotasFiscais.nIdExportador = (short)m_nIdExportador;
             dtrwTbNotasFiscais.strIdPe       = m_strIdPE;
             dtrwTbNotasFiscais.nNotaFiscal   = m_nIdNotaFiscal;
             dtrwTbNotasFiscais.strNumero     = m_strNumeroNota;
             dtrwTbNotasFiscais.dValor        = m_dValorNota;
             dtrwTbNotasFiscais.dtEmissao     = m_dtEmissaoNota;
             m_typDatSetTbNotasFiscais.tbNotasFiscais.AddtbNotasFiscaisRow(dtrwTbNotasFiscais);
         }
         return(true);
     }
     catch (Exception err)
     {
         Object erro = err;
         m_cls_ter_tratadorErro.trataErro(ref erro);
     }
     return(false);
 }
Ejemplo n.º 2
0
 private void carregaDadosBDNotaSelecionada()
 {
     try
     {
         mdlDataBaseAccess.Tabelas.XsdTbNotasFiscais.tbNotasFiscaisRow dtrwTbNotasFiscais = null;
         dtrwTbNotasFiscais = m_typDatSetTbNotasFiscais.tbNotasFiscais.FindBynIdExportadorstrIdPenNotaFiscal((short)m_nIdExportador, m_strIdPE, m_nIdNotaFiscal);
         if ((dtrwTbNotasFiscais != null) && (!m_bCadastroNova))
         {
             m_strNumeroNota = (dtrwTbNotasFiscais.IsstrNumeroNull() ? "" : dtrwTbNotasFiscais.strNumero);
             m_dtEmissaoNota = (dtrwTbNotasFiscais.IsdtEmissaoNull() ? System.DateTime.Now : dtrwTbNotasFiscais.dtEmissao);
             m_dValorNota    = (dtrwTbNotasFiscais.IsdValorNull() ? 0 : dtrwTbNotasFiscais.dValor);
         }
         else
         {
             m_strNumeroNota = "";
             m_dtEmissaoNota = System.DateTime.Now;
             m_dValorNota    = 0;
         }
     }
     catch (Exception err)
     {
         Object erro = err;
         m_cls_ter_tratadorErro.trataErro(ref erro);
     }
 }
Ejemplo n.º 3
0
 protected void carregaDadosBD()
 {
     try
     {
         m_dValorNotasFiscais   = 0;
         m_strNotasFiscais      = "";
         m_strDatasNotasFiscais = "";
         mdlDataBaseAccess.Tabelas.XsdTbNotasFiscais.tbNotasFiscaisRow dtrwTbNotasFiscais = null;
         for (int nCount = 0; nCount < m_typDatSetTbNotasFiscais.tbNotasFiscais.Rows.Count; nCount++)
         {
             dtrwTbNotasFiscais      = (mdlDataBaseAccess.Tabelas.XsdTbNotasFiscais.tbNotasFiscaisRow)m_typDatSetTbNotasFiscais.tbNotasFiscais.Rows[nCount];
             m_dValorNotasFiscais   += (dtrwTbNotasFiscais.IsdValorNull() ? 0 : dtrwTbNotasFiscais.dValor);
             m_strDatasNotasFiscais += (dtrwTbNotasFiscais.IsdtEmissaoNull() ? "?, " : dtrwTbNotasFiscais.dtEmissao.ToString("dd/MM/yyyy") + ", ");
             m_strNotasFiscais      += (dtrwTbNotasFiscais.IsstrNumeroNull() ? "?, " : dtrwTbNotasFiscais.strNumero + ", ");
         }
         if (m_strDatasNotasFiscais.Length > 2)
         {
             m_strDatasNotasFiscais = m_strDatasNotasFiscais.Remove(m_strDatasNotasFiscais.Length - 2, 2);
         }
         if (m_strNotasFiscais.Length > 2)
         {
             m_strNotasFiscais = m_strNotasFiscais.Remove(m_strNotasFiscais.Length - 2, 2);
         }
     }
     catch (Exception err)
     {
         Object erro = err;
         m_cls_ter_tratadorErro.trataErro(ref erro);
     }
 }
Ejemplo n.º 4
0
 private bool salvaDadosBDEdicao()
 {
     try
     {
         bool bAtual = false;
         System.Data.DataRow[] dtRowNotas       = m_typDatSetTbNotasFiscaisTODAS.tbNotasFiscais.Select("strNumero = '" + m_strNumeroNota + "'");
         System.Data.DataRow[] dtRowNotasAtuais = m_typDatSetTbNotasFiscais.tbNotasFiscais.Select("strNumero = '" + m_strNumeroNota + "'");
         if ((dtRowNotasAtuais != null) && (dtRowNotasAtuais.Length > 0))
         {
             if (((mdlDataBaseAccess.Tabelas.XsdTbNotasFiscais.tbNotasFiscaisRow)dtRowNotasAtuais[0]).nNotaFiscal == m_nIdNotaFiscal)
             {
                 bAtual = true;
             }
         }
         if ((((dtRowNotas != null) && (dtRowNotas.Length > 0)) || ((dtRowNotasAtuais != null) && (dtRowNotasAtuais.Length > 0))) && (bAtual == false))
         {
             mdlMensagens.clsMensagens.ShowError(mdlMensagens.clsRepositorioMensagens.GetMensagem(mdlMensagens.Mensagem.mdlNotaFiscal_clsNotaFiscal_NotaExistente));
             return(false);
         }
         else
         {
             mdlDataBaseAccess.Tabelas.XsdTbNotasFiscais.tbNotasFiscaisRow dtrwTbNotasFiscais = null;
             dtrwTbNotasFiscais = m_typDatSetTbNotasFiscais.tbNotasFiscais.FindBynIdExportadorstrIdPenNotaFiscal((short)m_nIdExportador, m_strIdPE, m_nIdNotaFiscal);
             if (dtrwTbNotasFiscais != null)
             {
                 dtrwTbNotasFiscais.strNumero = m_strNumeroNota;
                 dtrwTbNotasFiscais.dValor    = m_dValorNota;
                 dtrwTbNotasFiscais.dtEmissao = m_dtEmissaoNota;
             }
             return(true);
         }
     }
     catch (Exception err)
     {
         Object erro = err;
         m_cls_ter_tratadorErro.trataErro(ref erro);
     }
     return(false);
 }
Ejemplo n.º 5
0
 private void removeNotaSelecionada(ref mdlComponentesGraficos.ListView lvNotas)
 {
     try
     {
         if (lvNotas.SelectedItems.Count > 0)
         {
             if (mdlMensagens.clsMensagens.ShowQuestion("Siscobras", mdlMensagens.clsRepositorioMensagens.GetMensagem(mdlMensagens.Mensagem.mdlNotaFiscal_clsNotaFiscal_ApagarNotas).Replace("TAG", lvNotas.SelectedItems.Count.ToString()), System.Windows.Forms.MessageBoxButtons.YesNo) == System.Windows.Forms.DialogResult.Yes)
             {
                 mdlDataBaseAccess.Tabelas.XsdTbNotasFiscais.tbNotasFiscaisRow dtrwTbNotasFiscais = null;
                 foreach (System.Windows.Forms.ListViewItem lvItemNota in lvNotas.SelectedItems)
                 {
                     dtrwTbNotasFiscais = m_typDatSetTbNotasFiscais.tbNotasFiscais.FindBynIdExportadorstrIdPenNotaFiscal((short)m_nIdExportador, m_strIdPE, (int)lvItemNota.Tag);
                     dtrwTbNotasFiscais.Delete();
                 }
             }
         }
     }
     catch (Exception err)
     {
         Object erro = err;
         m_cls_ter_tratadorErro.trataErro(ref erro);
     }
 }