using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Data;
using MySql.Data.MySqlClient;
using fatd_faturamento.ENTIDADE;
using fatd_faturamento.DAL.Conexao;

namespace fatd_faturamento.DAL.Persistencia
{
    public class dalTempHistFaturaNF3EA
    {
        string vFILTER = null;
        string vINNERJOIN = null;
        string vAND = null;
        string vORDERBY = null;

        #region Métodos

        public void Delete(entidadeTempHistFaturaNF3EA objTempHistFaturaNF3EA)
        {

            MySqlCommand cmd = null;
            IGerenciadorTransacao objGerenciadorTransacao = null;
            ConexaoBD objconexaoBD = null;

            try
            {
                objconexaoBD = new ConexaoBD();

                objconexaoBD.SetarConexaoBanco(TipoBDConexao.fat_BD);

                using (objGerenciadorTransacao = FabricaGerenciadorTransacao.GetGerenciador(TipoBDGerenciador.MySql))
                {
                    vORDERBY = " ";

                    if (!String.IsNullOrEmpty(objTempHistFaturaNF3EA.LISTENVIADONF3E))
                    {
                        vAND = vAND + "AND NUMNF NOT IN (" + objTempHistFaturaNF3EA.LISTENVIADONF3E.ToString().ToUpper() + ") ";
                    }
                    else { vAND = " "; }

                    cmd = new MySqlCommand(this.QueryDelete);

                    objGerenciadorTransacao.Execute(cmd);
                }


            }
            catch (Exception)
            {
                throw;
            }
            finally
            {
                if (cmd != null)
                    cmd.Dispose();
            }
        }

        public void Execute(entidadeTempHistFaturaNF3EA objTempHistFaturaNF3EA)
        {

            MySqlCommand cmd = null;
            IGerenciadorTransacao objGerenciadorTransacao = null;
            ConexaoBD objconexaoBD = null;


            try
            {
                objconexaoBD = new ConexaoBD();

                objconexaoBD.SetarConexaoBanco(TipoBDConexao.fat_BD);

                using (objGerenciadorTransacao = FabricaGerenciadorTransacao.GetGerenciador(TipoBDGerenciador.MySql))
                {

                    vORDERBY = " ";

                    vAND = vAND + "CALL CriaHistFaturaNF3e( ";
                    vAND = vAND + Convert.ToInt32(objTempHistFaturaNF3EA.NUMNF.ToString().ToUpper()) + ", ";
                    vAND = vAND + "'" + objTempHistFaturaNF3EA.MESANO1.ToString().ToUpper() + "' , ";
                    vAND = vAND + "'" + objTempHistFaturaNF3EA.MESANO2.ToString().ToUpper() + "' , ";
                    vAND = vAND + "'" + objTempHistFaturaNF3EA.MESANO3.ToString().ToUpper() + "' , ";
                    vAND = vAND + "'" + objTempHistFaturaNF3EA.MESANO4.ToString().ToUpper() + "' , ";
                    vAND = vAND + "'" + objTempHistFaturaNF3EA.MESANO5.ToString().ToUpper() + "' , ";
                    vAND = vAND + "'" + objTempHistFaturaNF3EA.MESANO6.ToString().ToUpper() + "' )";

                    cmd = new MySqlCommand(this.QueryExecute);

                    objGerenciadorTransacao.Execute(cmd);
                }


            }
            catch (Exception)
            {
                throw;
            }
            finally
            {
                if (cmd != null)
                    cmd.Dispose();
            }
        }

        public DataTable Select(entidadeTempHistFaturaNF3EA objTempHistFaturaNF3EA)
        {
            DataTable dt = null;
            MySqlCommand cmd = null;
            IGerenciadorTransacao objGerenciadorTransacao = null;
            ConexaoBD objconexaoBD = null;

            try
            {
                objconexaoBD = new ConexaoBD();

                objconexaoBD.SetarConexaoBanco(TipoBDConexao.fat_BD);

                using (objGerenciadorTransacao = FabricaGerenciadorTransacao.GetGerenciador(TipoBDGerenciador.MySql))
                {

                    vFILTER = vFILTER + "NUMNF, ";
                    vFILTER = vFILTER + "NOMEMAQUINA, ";
                    vFILTER = vFILTER + "MESANO1, ";
                    vFILTER = vFILTER + "MESANO2, ";
                    vFILTER = vFILTER + "MESANO3, ";
                    vFILTER = vFILTER + "MESANO4, ";
                    vFILTER = vFILTER + "MESANO5, ";
                    vFILTER = vFILTER + "MESANO6, ";
                    vFILTER = vFILTER + "MESANO7, ";
                    vFILTER = vFILTER + "MESANO8, ";
                    vFILTER = vFILTER + "MESANO9, ";
                    vFILTER = vFILTER + "MESANO10, ";
                    vFILTER = vFILTER + "MESANO11, ";
                    vFILTER = vFILTER + "MESANO12, ";
                    vFILTER = vFILTER + "MESANO13, ";
                    vFILTER = vFILTER + "PCONSP1, ";
                    vFILTER = vFILTER + "PCONSP2, ";
                    vFILTER = vFILTER + "PCONSP3, ";
                    vFILTER = vFILTER + "PCONSP4, ";
                    vFILTER = vFILTER + "PCONSP5, ";
                    vFILTER = vFILTER + "PCONSP6, ";
                    vFILTER = vFILTER + "PCONSP7, ";
                    vFILTER = vFILTER + "PCONSP8, ";
                    vFILTER = vFILTER + "PCONSP9, ";
                    vFILTER = vFILTER + "PCONSP10, ";
                    vFILTER = vFILTER + "PCONSP11, ";
                    vFILTER = vFILTER + "PCONSP12, ";
                    vFILTER = vFILTER + "PCONSP13, ";
                    vFILTER = vFILTER + "PCONSFP1, ";
                    vFILTER = vFILTER + "PCONSFP2, ";
                    vFILTER = vFILTER + "PCONSFP3, ";
                    vFILTER = vFILTER + "PCONSFP4, ";
                    vFILTER = vFILTER + "PCONSFP5, ";
                    vFILTER = vFILTER + "PCONSFP6, ";
                    vFILTER = vFILTER + "PCONSFP7, ";
                    vFILTER = vFILTER + "PCONSFP8, ";
                    vFILTER = vFILTER + "PCONSFP9, ";
                    vFILTER = vFILTER + "PCONSFP10, ";
                    vFILTER = vFILTER + "PCONSFP11, ";
                    vFILTER = vFILTER + "PCONSFP12, ";
                    vFILTER = vFILTER + "PCONSFP13, ";
                    vFILTER = vFILTER + "PDEMP1, ";
                    vFILTER = vFILTER + "PDEMP2, ";
                    vFILTER = vFILTER + "PDEMP3, ";
                    vFILTER = vFILTER + "PDEMP4, ";
                    vFILTER = vFILTER + "PDEMP5, ";
                    vFILTER = vFILTER + "PDEMP6, ";
                    vFILTER = vFILTER + "PDEMP7, ";
                    vFILTER = vFILTER + "PDEMP8, ";
                    vFILTER = vFILTER + "PDEMP9, ";
                    vFILTER = vFILTER + "PDEMP10, ";
                    vFILTER = vFILTER + "PDEMP11, ";
                    vFILTER = vFILTER + "PDEMP12, ";
                    vFILTER = vFILTER + "PDEMP13, ";
                    vFILTER = vFILTER + "PDEMFP1, ";
                    vFILTER = vFILTER + "PDEMFP2, ";
                    vFILTER = vFILTER + "PDEMFP3, ";
                    vFILTER = vFILTER + "PDEMFP4, ";
                    vFILTER = vFILTER + "PDEMFP5, ";
                    vFILTER = vFILTER + "PDEMFP6, ";
                    vFILTER = vFILTER + "PDEMFP7, ";
                    vFILTER = vFILTER + "PDEMFP8, ";
                    vFILTER = vFILTER + "PDEMFP9, ";
                    vFILTER = vFILTER + "PDEMFP10, ";
                    vFILTER = vFILTER + "PDEMFP11, ";
                    vFILTER = vFILTER + "PDEMFP12, ";
                    vFILTER = vFILTER + "PDEMFP13, ";
                    vFILTER = vFILTER + "PDULP1, ";
                    vFILTER = vFILTER + "PDULP2, ";
                    vFILTER = vFILTER + "PDULP3, ";
                    vFILTER = vFILTER + "PDULP4, ";
                    vFILTER = vFILTER + "PDULP5, ";
                    vFILTER = vFILTER + "PDULP6, ";
                    vFILTER = vFILTER + "PDULP7, ";
                    vFILTER = vFILTER + "PDULP8, ";
                    vFILTER = vFILTER + "PDULP9, ";
                    vFILTER = vFILTER + "PDULP10, ";
                    vFILTER = vFILTER + "PDULP11, ";
                    vFILTER = vFILTER + "PDULP12, ";
                    vFILTER = vFILTER + "PDULP13, ";
                    vFILTER = vFILTER + "PDULFP1, ";
                    vFILTER = vFILTER + "PDULFP2, ";
                    vFILTER = vFILTER + "PDULFP3, ";
                    vFILTER = vFILTER + "PDULFP4, ";
                    vFILTER = vFILTER + "PDULFP5, ";
                    vFILTER = vFILTER + "PDULFP6, ";
                    vFILTER = vFILTER + "PDULFP7, ";
                    vFILTER = vFILTER + "PDULFP8, ";
                    vFILTER = vFILTER + "PDULFP9, ";
                    vFILTER = vFILTER + "PDULFP10, ";
                    vFILTER = vFILTER + "PDULFP11, ";
                    vFILTER = vFILTER + "PDULFP12, ";
                    vFILTER = vFILTER + "PDULFP13, ";
                    vFILTER = vFILTER + "VALOR1, ";
                    vFILTER = vFILTER + "VALOR2, ";
                    vFILTER = vFILTER + "VALOR3, ";
                    vFILTER = vFILTER + "VALOR4, ";
                    vFILTER = vFILTER + "VALOR5, ";
                    vFILTER = vFILTER + "VALOR6, ";
                    vFILTER = vFILTER + "VALOR7, ";
                    vFILTER = vFILTER + "VALOR8, ";
                    vFILTER = vFILTER + "VALOR9, ";
                    vFILTER = vFILTER + "VALOR10, ";
                    vFILTER = vFILTER + "VALOR11, ";
                    vFILTER = vFILTER + "VALOR12, ";
                    vFILTER = vFILTER + "VALOR13, ";
                    vFILTER = vFILTER + "DATAPAG1, ";
                    vFILTER = vFILTER + "DATAPAG2, ";
                    vFILTER = vFILTER + "DATAPAG3, ";
                    vFILTER = vFILTER + "DATAPAG4, ";
                    vFILTER = vFILTER + "DATAPAG5, ";
                    vFILTER = vFILTER + "DATAPAG6, ";
                    vFILTER = vFILTER + "DATAPAG7, ";
                    vFILTER = vFILTER + "DATAPAG8, ";
                    vFILTER = vFILTER + "DATAPAG9, ";
                    vFILTER = vFILTER + "DATAPAG10, ";
                    vFILTER = vFILTER + "DATAPAG11, ";
                    vFILTER = vFILTER + "DATAPAG12, ";
                    vFILTER = vFILTER + "DATAPAG13, ";
                    vFILTER = vFILTER + "FP1, ";
                    vFILTER = vFILTER + "FP2, ";
                    vFILTER = vFILTER + "FP3, ";
                    vFILTER = vFILTER + "FP4, ";
                    vFILTER = vFILTER + "FP5, ";
                    vFILTER = vFILTER + "FP6, ";
                    vFILTER = vFILTER + "FP7, ";
                    vFILTER = vFILTER + "FP8, ";
                    vFILTER = vFILTER + "FP9, ";
                    vFILTER = vFILTER + "FP10, ";
                    vFILTER = vFILTER + "FP11, ";
                    vFILTER = vFILTER + "FP12, ";
                    vFILTER = vFILTER + "FP13, ";
                    vFILTER = vFILTER + "DIAS1, ";
                    vFILTER = vFILTER + "DIAS2, ";
                    vFILTER = vFILTER + "DIAS3, ";
                    vFILTER = vFILTER + "DIAS4, ";
                    vFILTER = vFILTER + "DIAS5, ";
                    vFILTER = vFILTER + "DIAS6, ";
                    vFILTER = vFILTER + "DIAS7, ";
                    vFILTER = vFILTER + "DIAS8, ";
                    vFILTER = vFILTER + "DIAS9, ";
                    vFILTER = vFILTER + "DIAS10, ";
                    vFILTER = vFILTER + "DIAS11, ";
                    vFILTER = vFILTER + "DIAS12, ";
                    vFILTER = vFILTER + "DIAS13, ";
                    vFILTER = vFILTER + "OCOR1, ";
                    vFILTER = vFILTER + "OCOR2, ";
                    vFILTER = vFILTER + "OCOR3, ";
                    vFILTER = vFILTER + "OCOR4, ";
                    vFILTER = vFILTER + "OCOR5, ";
                    vFILTER = vFILTER + "OCOR6, ";
                    vFILTER = vFILTER + "OCOR7, ";
                    vFILTER = vFILTER + "OCOR8, ";
                    vFILTER = vFILTER + "OCOR9, ";
                    vFILTER = vFILTER + "OCOR10, ";
                    vFILTER = vFILTER + "OCOR11, ";
                    vFILTER = vFILTER + "OCOR12, ";
                    vFILTER = vFILTER + "OCOR13  ";

                    vINNERJOIN = " ";

                    vORDERBY = " ";

                    vAND = vAND + "AND NOMEMAQUINA = ?NOMEMAQUINA ";


                    cmd = new MySqlCommand(this.QuerySelect);

                    cmd.Parameters.AddWithValue("?NOMEMAQUINA", objTempHistFaturaNF3EA.NOMEMAQUINA.ToString().ToUpper());

                    dt = objGerenciadorTransacao.GetDataTable(cmd);

                }

                return dt;
            }
            catch (Exception ex)
            {
                throw ex;
            }
            finally
            {
                if (cmd != null)
                    cmd.Dispose();
            }
        }

        public DataTable Select_1(entidadeTempHistFaturaNF3EA objTempHistFaturaNF3EA)
        {
            DataTable dt = null;
            MySqlCommand cmd = null;
            IGerenciadorTransacao objGerenciadorTransacao = null;
            ConexaoBD objconexaoBD = null;

            try
            {
                objconexaoBD = new ConexaoBD();

                objconexaoBD.SetarConexaoBanco(TipoBDConexao.fat_BD);

                using (objGerenciadorTransacao = FabricaGerenciadorTransacao.GetGerenciador(TipoBDGerenciador.MySql))
                {

                    vFILTER = vFILTER + "NUMNF, ";
                    vFILTER = vFILTER + "NOMEMAQUINA, ";
                    vFILTER = vFILTER + "MESANO1, ";
                    vFILTER = vFILTER + "MESANO2, ";
                    vFILTER = vFILTER + "MESANO3, ";
                    vFILTER = vFILTER + "MESANO4, ";
                    vFILTER = vFILTER + "MESANO5, ";
                    vFILTER = vFILTER + "MESANO6, ";
                    vFILTER = vFILTER + "MESANO7, ";
                    vFILTER = vFILTER + "MESANO8, ";
                    vFILTER = vFILTER + "MESANO9, ";
                    vFILTER = vFILTER + "MESANO10, ";
                    vFILTER = vFILTER + "MESANO11, ";
                    vFILTER = vFILTER + "MESANO12, ";
                    vFILTER = vFILTER + "MESANO13, ";
                    vFILTER = vFILTER + "PCONSP1, ";
                    vFILTER = vFILTER + "PCONSP2, ";
                    vFILTER = vFILTER + "PCONSP3, ";
                    vFILTER = vFILTER + "PCONSP4, ";
                    vFILTER = vFILTER + "PCONSP5, ";
                    vFILTER = vFILTER + "PCONSP6, ";
                    vFILTER = vFILTER + "PCONSP7, ";
                    vFILTER = vFILTER + "PCONSP8, ";
                    vFILTER = vFILTER + "PCONSP9, ";
                    vFILTER = vFILTER + "PCONSP10, ";
                    vFILTER = vFILTER + "PCONSP11, ";
                    vFILTER = vFILTER + "PCONSP12, ";
                    vFILTER = vFILTER + "PCONSP13, ";
                    vFILTER = vFILTER + "PCONSFP1, ";
                    vFILTER = vFILTER + "PCONSFP2, ";
                    vFILTER = vFILTER + "PCONSFP3, ";
                    vFILTER = vFILTER + "PCONSFP4, ";
                    vFILTER = vFILTER + "PCONSFP5, ";
                    vFILTER = vFILTER + "PCONSFP6, ";
                    vFILTER = vFILTER + "PCONSFP7, ";
                    vFILTER = vFILTER + "PCONSFP8, ";
                    vFILTER = vFILTER + "PCONSFP9, ";
                    vFILTER = vFILTER + "PCONSFP10, ";
                    vFILTER = vFILTER + "PCONSFP11, ";
                    vFILTER = vFILTER + "PCONSFP12, ";
                    vFILTER = vFILTER + "PCONSFP13, ";
                    vFILTER = vFILTER + "PDEMP1, ";
                    vFILTER = vFILTER + "PDEMP2, ";
                    vFILTER = vFILTER + "PDEMP3, ";
                    vFILTER = vFILTER + "PDEMP4, ";
                    vFILTER = vFILTER + "PDEMP5, ";
                    vFILTER = vFILTER + "PDEMP6, ";
                    vFILTER = vFILTER + "PDEMP7, ";
                    vFILTER = vFILTER + "PDEMP8, ";
                    vFILTER = vFILTER + "PDEMP9, ";
                    vFILTER = vFILTER + "PDEMP10, ";
                    vFILTER = vFILTER + "PDEMP11, ";
                    vFILTER = vFILTER + "PDEMP12, ";
                    vFILTER = vFILTER + "PDEMP13, ";
                    vFILTER = vFILTER + "PDEMFP1, ";
                    vFILTER = vFILTER + "PDEMFP2, ";
                    vFILTER = vFILTER + "PDEMFP3, ";
                    vFILTER = vFILTER + "PDEMFP4, ";
                    vFILTER = vFILTER + "PDEMFP5, ";
                    vFILTER = vFILTER + "PDEMFP6, ";
                    vFILTER = vFILTER + "PDEMFP7, ";
                    vFILTER = vFILTER + "PDEMFP8, ";
                    vFILTER = vFILTER + "PDEMFP9, ";
                    vFILTER = vFILTER + "PDEMFP10, ";
                    vFILTER = vFILTER + "PDEMFP11, ";
                    vFILTER = vFILTER + "PDEMFP12, ";
                    vFILTER = vFILTER + "PDEMFP13, ";
                    vFILTER = vFILTER + "PDULP1, ";
                    vFILTER = vFILTER + "PDULP2, ";
                    vFILTER = vFILTER + "PDULP3, ";
                    vFILTER = vFILTER + "PDULP4, ";
                    vFILTER = vFILTER + "PDULP5, ";
                    vFILTER = vFILTER + "PDULP6, ";
                    vFILTER = vFILTER + "PDULP7, ";
                    vFILTER = vFILTER + "PDULP8, ";
                    vFILTER = vFILTER + "PDULP9, ";
                    vFILTER = vFILTER + "PDULP10, ";
                    vFILTER = vFILTER + "PDULP11, ";
                    vFILTER = vFILTER + "PDULP12, ";
                    vFILTER = vFILTER + "PDULP13, ";
                    vFILTER = vFILTER + "PDULFP1, ";
                    vFILTER = vFILTER + "PDULFP2, ";
                    vFILTER = vFILTER + "PDULFP3, ";
                    vFILTER = vFILTER + "PDULFP4, ";
                    vFILTER = vFILTER + "PDULFP5, ";
                    vFILTER = vFILTER + "PDULFP6, ";
                    vFILTER = vFILTER + "PDULFP7, ";
                    vFILTER = vFILTER + "PDULFP8, ";
                    vFILTER = vFILTER + "PDULFP9, ";
                    vFILTER = vFILTER + "PDULFP10, ";
                    vFILTER = vFILTER + "PDULFP11, ";
                    vFILTER = vFILTER + "PDULFP12, ";
                    vFILTER = vFILTER + "PDULFP13, ";
                    vFILTER = vFILTER + "VALOR1, ";
                    vFILTER = vFILTER + "VALOR2, ";
                    vFILTER = vFILTER + "VALOR3, ";
                    vFILTER = vFILTER + "VALOR4, ";
                    vFILTER = vFILTER + "VALOR5, ";
                    vFILTER = vFILTER + "VALOR6, ";
                    vFILTER = vFILTER + "VALOR7, ";
                    vFILTER = vFILTER + "VALOR8, ";
                    vFILTER = vFILTER + "VALOR9, ";
                    vFILTER = vFILTER + "VALOR10, ";
                    vFILTER = vFILTER + "VALOR11, ";
                    vFILTER = vFILTER + "VALOR12, ";
                    vFILTER = vFILTER + "VALOR13, ";
                    vFILTER = vFILTER + "DATAPAG1, ";
                    vFILTER = vFILTER + "DATAPAG2, ";
                    vFILTER = vFILTER + "DATAPAG3, ";
                    vFILTER = vFILTER + "DATAPAG4, ";
                    vFILTER = vFILTER + "DATAPAG5, ";
                    vFILTER = vFILTER + "DATAPAG6, ";
                    vFILTER = vFILTER + "DATAPAG7, ";
                    vFILTER = vFILTER + "DATAPAG8, ";
                    vFILTER = vFILTER + "DATAPAG9, ";
                    vFILTER = vFILTER + "DATAPAG10, ";
                    vFILTER = vFILTER + "DATAPAG11, ";
                    vFILTER = vFILTER + "DATAPAG12, ";
                    vFILTER = vFILTER + "DATAPAG13, ";
                    vFILTER = vFILTER + "FP1, ";
                    vFILTER = vFILTER + "FP2, ";
                    vFILTER = vFILTER + "FP3, ";
                    vFILTER = vFILTER + "FP4, ";
                    vFILTER = vFILTER + "FP5, ";
                    vFILTER = vFILTER + "FP6, ";
                    vFILTER = vFILTER + "FP7, ";
                    vFILTER = vFILTER + "FP8, ";
                    vFILTER = vFILTER + "FP9, ";
                    vFILTER = vFILTER + "FP10, ";
                    vFILTER = vFILTER + "FP11, ";
                    vFILTER = vFILTER + "FP12, ";
                    vFILTER = vFILTER + "FP13, ";
                    vFILTER = vFILTER + "DIAS1, ";
                    vFILTER = vFILTER + "DIAS2, ";
                    vFILTER = vFILTER + "DIAS3, ";
                    vFILTER = vFILTER + "DIAS4, ";
                    vFILTER = vFILTER + "DIAS5, ";
                    vFILTER = vFILTER + "DIAS6, ";
                    vFILTER = vFILTER + "DIAS7, ";
                    vFILTER = vFILTER + "DIAS8, ";
                    vFILTER = vFILTER + "DIAS9, ";
                    vFILTER = vFILTER + "DIAS10, ";
                    vFILTER = vFILTER + "DIAS11, ";
                    vFILTER = vFILTER + "DIAS12, ";
                    vFILTER = vFILTER + "DIAS13, ";
                    vFILTER = vFILTER + "OCOR1, ";
                    vFILTER = vFILTER + "OCOR2, ";
                    vFILTER = vFILTER + "OCOR3, ";
                    vFILTER = vFILTER + "OCOR4, ";
                    vFILTER = vFILTER + "OCOR5, ";
                    vFILTER = vFILTER + "OCOR6, ";
                    vFILTER = vFILTER + "OCOR7, ";
                    vFILTER = vFILTER + "OCOR8, ";
                    vFILTER = vFILTER + "OCOR9, ";
                    vFILTER = vFILTER + "OCOR10, ";
                    vFILTER = vFILTER + "OCOR11, ";
                    vFILTER = vFILTER + "OCOR12, ";
                    vFILTER = vFILTER + "OCOR13  ";

                    vINNERJOIN = " ";

                    vORDERBY = " ";

                    vAND = vAND + "AND NUMNF = ?NUMNF ";


                    cmd = new MySqlCommand(this.QuerySelect);

                    cmd.Parameters.AddWithValue("?NUMNF", objTempHistFaturaNF3EA.NUMNF);

                    dt = objGerenciadorTransacao.GetDataTable(cmd);

                }

                return dt;
            }
            catch (Exception ex)
            {
                throw ex;
            }
            finally
            {
                if (cmd != null)
                    cmd.Dispose();
            }
        }

        #endregion

        #region " Comandos SQL "

        StringBuilder sb = new StringBuilder();


        protected string QueryInsert
        {
            get
            {
                this.sb.Clear();

                this.sb.AppendLine("INSERT INTO  ");
                this.sb.AppendLine("TEMP_HIST_FATURA_NF3E_A SET  ");
                this.sb.AppendLine(vFILTER);

                return sb.ToString();
            }
        }

        protected string QueryUpdate
        {
            get
            {
                this.sb.Clear();

                this.sb.AppendLine("UPDATE  ");
                this.sb.AppendLine("TEMP_HIST_FATURA_NF3E_A SET  ");
                this.sb.AppendLine(vFILTER);
                this.sb.AppendLine("WHERE 1 = 1 ");
                this.sb.AppendLine(vAND);

                return sb.ToString();
            }
        }

        protected string QueryDelete
        {
            get
            {
                this.sb.Clear();

                this.sb.AppendLine("DELETE FROM TEMP_HIST_FATURA_NF3E_A ");
                this.sb.AppendLine("WHERE 1 = 1 ");
                this.sb.AppendLine(vAND);
                this.sb.AppendLine(vORDERBY);

                return sb.ToString();
            }
        }

        protected string QuerySelect
        {
            get
            {
                this.sb.Clear();

                this.sb.AppendLine("SELECT ");
                this.sb.AppendLine(vFILTER);
                this.sb.AppendLine("FROM ");
                this.sb.AppendLine("TEMP_HIST_FATURA_NF3E_A  ");
                this.sb.AppendLine(vINNERJOIN);
                this.sb.AppendLine("WHERE 1 = 1  ");
                this.sb.AppendLine(vAND);
                this.sb.AppendLine(vORDERBY);

                return sb.ToString();
            }
        }

        protected string QueryExecute
        {
            get
            {
                this.sb.Clear();

                this.sb.AppendLine(vAND);
                this.sb.AppendLine(vORDERBY);

                return sb.ToString();
            }
        }

        #endregion



    }
}
