public static void ReabrirNFCeProcessar(TRegistro_Lote_X_NFCe val, BancoDados.TObjetoBanco banco) { bool st_transacao = false; TCD_Lote_X_NFCe qtb_nfce = new TCD_Lote_X_NFCe(); try { if (banco == null) { st_transacao = qtb_nfce.CriarBanco_Dados(true); } else { qtb_nfce.Banco_Dados = banco; } qtb_nfce.executarSql("delete tb_pdv_xml_nfce " + "where cd_empresa = '" + val.Cd_empresa.Trim() + "' and id_nfce = " + val.Id_cupomstr + "\r\n" + "delete tb_fat_lote_x_nfce where cd_empresa = '" + val.Cd_empresa.Trim() + "' and id_lote = " + val.Id_lotestr + " and id_cupom = " + val.Id_cupomstr + "\r\n" + "if not exists(select 1 from tb_fat_lote_x_nfce x where x.id_lote = " + val.Id_lotestr + ")\r\n" + "delete tb_fat_lotenfce where id_lote = " + val.Id_lotestr, null); if (st_transacao) { qtb_nfce.Banco_Dados.Commit_Tran(); } } catch (Exception ex) { if (st_transacao) { qtb_nfce.Banco_Dados.RollBack_Tran(); } throw new Exception("Erro reabrir NFC-e processar: " + ex.Message.Trim()); } finally { if (st_transacao) { qtb_nfce.deletarBanco_Dados(); } } }
public static string Excluir(TRegistro_Lote_X_NFCe val, BancoDados.TObjetoBanco banco) { bool st_transacao = false; TCD_Lote_X_NFCe qtb_lote = new TCD_Lote_X_NFCe(); try { if (banco == null) { st_transacao = qtb_lote.CriarBanco_Dados(true); } else { qtb_lote.Banco_Dados = banco; } qtb_lote.Excluir(val); if (st_transacao) { qtb_lote.Banco_Dados.Commit_Tran(); } return("OK"); } catch (Exception ex) { if (st_transacao) { qtb_lote.Banco_Dados.RollBack_Tran(); } throw new Exception("Erro excluir registro: " + ex.Message.Trim()); } finally { if (st_transacao) { qtb_lote.deletarBanco_Dados(); } } }