Beispiel #1
0
        private void GetDropProdutos()
        {
            try
            {
                LIS_PRODUTOSColl = LIS_PRODUTOSP.ReadCollectionByParameter(null, "NOMEPRODUTO");

                cbProduto.DisplayMember = "NOMEPRODUTO";
                cbProduto.ValueMember   = "IDPRODUTO";

                LIS_PRODUTOSEntity LIS_PRODUTOSTy = new LIS_PRODUTOSEntity();
                LIS_PRODUTOSTy.NOMEPRODUTO = ConfigMessage.Default.MsgDrop;
                LIS_PRODUTOSTy.IDPRODUTO   = -1;
                LIS_PRODUTOSColl.Add(LIS_PRODUTOSTy);

                Phydeaux.Utilities.DynamicComparer <LIS_PRODUTOSEntity> comparer = new Phydeaux.Utilities.DynamicComparer <LIS_PRODUTOSEntity>(cbProduto.DisplayMember);

                LIS_PRODUTOSColl.Sort(comparer.Comparer);
                cbProduto.DataSource = LIS_PRODUTOSColl;

                cbProduto.SelectedIndex = 0;
            }
            catch (Exception ex)
            {
                MessageBox.Show("Erro técnico: " + ex.Message);
            }
        }
Beispiel #2
0
        private void btnConsultar_Click(object sender, EventArgs e)
        {
            RowRelatorio.Clear();
            int IDMARCA = Convert.ToInt32(cbMarca.SelectedValue);

            if (IDMARCA > 0)
            {
                RowRelatorio.Add(new RowsFiltro("IDMARCA", "System.Int32", "=", IDMARCA.ToString(), "NOMEPRODUTO"));
            }

            LIS_PRODUTOSColl = LIS_PRODUTOSP.ReadCollectionByParameter(RowRelatorio);

            //Remove ID  repetido
            LIS_PRODUTOSCollection LIS_PRODUTOS2Coll = new LIS_PRODUTOSCollection();

            foreach (LIS_PRODUTOSEntity item in LIS_PRODUTOSColl)
            {
                if (LIS_PRODUTOS2Coll.Find(delegate(LIS_PRODUTOSEntity item2)
                {
                    return
                    (item2.IDMARCA == item.IDMARCA);
                }) == null)
                {
                    LIS_PRODUTOS2Coll.Add(item);
                }
            }

            LIS_PRODUTOSColl.Clear();
            LIS_PRODUTOSColl = LIS_PRODUTOS2Coll;

            PreencheGrid();
        }
Beispiel #3
0
        private void btnAdd_Click(object sender, EventArgs e)
        {
            try
            {
                RowsFiltroCollection RowpProdPedido = new RowsFiltroCollection();
                RowpProdPedido.Add(new RowsFiltro("IDPRODUTO", "System.Int32", "=", cbProduto.SelectedValue.ToString()));
                LIS_PRODUTOSCollection LIS_PRODUTOS3Coll = new LIS_PRODUTOSCollection();
                LIS_PRODUTOS3Coll = LIS_PRODUTOSP.ReadCollectionByParameter(RowpProdPedido);

                if (LIS_PRODUTOS3Coll.Count > 0)
                {
                    LIS_PRODUTOSEntity LIS_PRODUTOSTy2 = new LIS_PRODUTOSEntity();
                    LIS_PRODUTOSTy2.IDPRODUTO   = LIS_PRODUTOS3Coll[0].IDPRODUTO;
                    LIS_PRODUTOSTy2.NOMEPRODUTO = LIS_PRODUTOS3Coll[0].NOMEPRODUTO;
                    LIS_PRODUTOSTy2.VALORVENDA1 = LIS_PRODUTOS3Coll[0].VALORVENDA1;
                    LIS_PRODUTOSTy2.NOMEMARCA   = LIS_PRODUTOS3Coll[0].NOMEMARCA;
                    LIS_PRODUTOSTy2.CODBARRA    = LIS_PRODUTOS3Coll[0].CODBARRA;
                    LIS_PRODUTOS2Coll.Add(LIS_PRODUTOSTy2);

                    DataGriewDados.AutoGenerateColumns = false;
                    DataGriewDados.DataSource          = null;
                    DataGriewDados.AutoGenerateColumns = false;
                    DataGriewDados.DataSource          = LIS_PRODUTOS2Coll;

                    lbltTotalRegistros.Text = "Total de Registros: " + LIS_PRODUTOS2Coll.Count.ToString();
                }
            }
            catch (Exception ex)
            {
                MessageBox.Show("Erro técnico: " + ex.Message);
            }
        }
Beispiel #4
0
        private PRODUTOSEntity BuscaProduto(string CODPRODUTOFORNECEDOR)
        {
            PRODUTOSEntity result = new PRODUTOSEntity();

            try
            {
                RowRelatorio.Clear();
                RowRelatorio.Add(new RowsFiltro("CODPRODUTOFORNECEDOR", "System.String", "=", CODPRODUTOFORNECEDOR.ToString()));

                LIS_PRODUTOSCollection LIS_PRODUTOSColl = new LIS_PRODUTOSCollection();
                LIS_PRODUTOSProvider   LIS_PRODUTOSP    = new LIS_PRODUTOSProvider();

                LIS_PRODUTOSColl = LIS_PRODUTOSP.ReadCollectionByParameter(RowRelatorio);

                if (LIS_PRODUTOSColl.Count > 0)
                {
                    result = PRODUTOSP.Read(Convert.ToInt32(LIS_PRODUTOSColl[0].IDPRODUTO));
                }


                return(result);
            }
            catch (Exception ex)
            {
                MessageBox.Show("Erro técnico: " + ex.Message);
                return(result);
            }
        }
Beispiel #5
0
        private void btnConsultar_Click(object sender, EventArgs e)
        {
            try
            {
                RowRelatorio.Clear();
                int IDGRUPOCATEGORIA = Convert.ToInt32(cbGrupoCategoria.SelectedValue);
                int IDMARCA          = Convert.ToInt32(cbMarca.SelectedValue);
                if (IDGRUPOCATEGORIA > 0)
                {
                    RowRelatorio.Add(new RowsFiltro("IDGRUPOCATEGORIA", "System.Int32", "=", IDGRUPOCATEGORIA.ToString()));
                }

                if (IDMARCA > 0)
                {
                    RowRelatorio.Add(new RowsFiltro("IDMARCA", "System.Int32", "=", IDMARCA.ToString()));
                }

                LIS_PRODUTOSColl = LIS_PRODUTOSP.ReadCollectionByParameter(RowRelatorio, "NOMEPRODUTO");



                PreencheGrid();
            }
            catch (Exception ex)
            {
                MessageBox.Show("Erro na pesquisa!");
                MessageBox.Show("Erro técnico: " + ex.Message);
            }
        }
Beispiel #6
0
        private void FilterList()
        {
            // Nome campo que sera filtrado
            string campo = cbCamposPesquisa.SelectedValue.ToString();

            //Necessario passar a coleção vazia para o grid, para pegar o tipo da coluna
            if (LIS_PRODUTOSColl.Count == 0)
            {
                DataGriewDados.AutoGenerateColumns = false;
                DataGriewDados.DataSource          = LIS_PRODUTOSColl;
            }

            // Retorna o tipo da coluna para pesquisa Ex.: String, Integer, Date...
            string Tipo = DataGriewDados.Columns[cbCamposPesquisa.SelectedValue.ToString()].ValueType.FullName;

            if (Tipo.Length > 20)
            {
                Tipo = Util.GetTypeCell(Tipo);//Retorna o texto resumido do tipo
            }
            string Valor = txtCriterioPesquisa.Text;

            //Verifica se o valor digitado e compativel com
            // o tipo de pesquisa
            if (ValidacoesLibrary.ValidaTipoPesquisa(Tipo, Valor))
            {
                if (Tipo == "System.DateTime")//formata data para pesquisa.
                {
                    Valor = Util.ConverStringDateSearch(txtCriterioPesquisa.Text);
                }
                else if (Tipo == "System.Decimal")//formata Numeric para pesquisa.
                {
                    Valor = Util.ConverStringDecimalSearch(txtCriterioPesquisa.Text);
                }

                filtroProfile = new RowsFiltro(campo, Tipo, cbTipoPesquisa.SelectedValue.ToString(), Valor);

                if (!chkBoxAcumulaPesquisa.Checked)//Acumular pesquisa
                {
                    Filtro.Clear();
                }

                Filtro.Insert(Filtro.Count, filtroProfile);

                LIS_PRODUTOSColl = LIS_PRODUTOSP.ReadCollectionByParameter(Filtro, "NOMEPRODUTO");
                DataGriewDados.AutoGenerateColumns = false;
                DataGriewDados.DataSource          = LIS_PRODUTOSColl;

                lblTotalPesquisa.Text = LIS_PRODUTOSColl.Count.ToString();
            }
            else
            {
                MessageBox.Show(ConfigMessage.Default.searchFieldType);
                errorProvider1.SetError(txtCriterioPesquisa, ConfigMessage.Default.searchFieldType);
                txtCriterioPesquisa.Focus();
            }
        }
Beispiel #7
0
        private void PreencheGrid()
        {
            CreaterCursor Cr = new CreaterCursor();

            this.Cursor = Cr.CreateCursor(Cr.btmap, 0, 0);

            DataGriewDados.Rows.Clear();
            FORNECEDORProvider FORNECEDORP = new FORNECEDORProvider();

            foreach (var LIS_PRODUTOSTy in LIS_PRODUTOSColl)
            {
                RowRelatorio.Clear();
                RowRelatorio.Add(new RowsFiltro("IDMARCA", "System.Int32", "=", LIS_PRODUTOSTy.IDMARCA.ToString(), "NOMEPRODUTO"));

                LIS_PRODUTOSCollection LIS_PRODUTOSColl3 = new LIS_PRODUTOSCollection();
                LIS_PRODUTOSColl3 = LIS_PRODUTOSP.ReadCollectionByParameter(RowRelatorio);

                //Titulo
                DataGridViewRow row1 = new DataGridViewRow();
                row1.CreateCells(DataGriewDados, "Marca: " + LIS_PRODUTOSTy.NOMEMARCA, string.Empty, string.Empty,
                                 string.Empty, string.Empty, string.Empty, string.Empty, string.Empty, string.Empty, string.Empty, string.Empty);

                row1.DefaultCellStyle.Font = new Font("Arial", 8, FontStyle.Bold);
                DataGriewDados.Rows.Add(row1);

                foreach (var LIS_PRODUTOS3Ty in LIS_PRODUTOSColl3)
                {
                    DataGridViewRow row2                 = new DataGridViewRow();
                    string          NOMEPRODUTO          = LIS_PRODUTOS3Ty.NOMEPRODUTO;
                    string          IDPRODUTO            = LIS_PRODUTOS3Ty.IDPRODUTO.ToString();
                    string          CODPRODUTOFORNECEDOR = LIS_PRODUTOS3Ty.CODPRODUTOFORNECEDOR;
                    string          CODBARRA             = LIS_PRODUTOS3Ty.CODBARRA;
                    string          LOCALIZACAO          = LIS_PRODUTOS3Ty.LOCALIZACAO;
                    string          DATACADASTRO         = Convert.ToDateTime(LIS_PRODUTOS3Ty.DATACADASTRO).ToString("dd/MM/yyyy");
                    string          VALORVENDA1          = Convert.ToDecimal(LIS_PRODUTOS3Ty.VALORVENDA1).ToString("n2");
                    string          VALORVENDA2          = Convert.ToDecimal(LIS_PRODUTOS3Ty.VALORVENDA2).ToString("n2");
                    string          VALORVENDA3          = Convert.ToDecimal(LIS_PRODUTOS3Ty.VALORVENDA3).ToString("n2");
                    string          ESTOQUEATUAL         = Util.EstoqueAtual(Convert.ToInt32(LIS_PRODUTOS3Ty.IDPRODUTO), chkFiscal.Checked).ToString();
                    string          NOMEMARCA            = LIS_PRODUTOS3Ty.NOMEMARCA;

                    row2.CreateCells(DataGriewDados, NOMEPRODUTO, IDPRODUTO, CODPRODUTOFORNECEDOR,
                                     CODBARRA, LOCALIZACAO, DATACADASTRO, VALORVENDA1, ESTOQUEATUAL, VALORVENDA2, VALORVENDA3, NOMEMARCA);

                    row2.DefaultCellStyle.Font = new Font("Arial", 8);
                    DataGriewDados.Rows.Add(row2);
                }


                lblTotalPesquisa.Text = (DataGriewDados.Rows.Count - 1).ToString();
            }

            this.Cursor = Cursors.Default;
        }
Beispiel #8
0
        private void PesquisaRapida()
        {
            CreaterCursor Cr = new CreaterCursor();

            this.Cursor = Cr.CreateCursor(Cr.btmap, 0, 0);

            try
            {
                RowRelatorio.Clear();
                RowRelatorio.Add(new RowsFiltro("NOMEPRODUTO", "System.String", "collate pt_br like", "%" + txtCriterioPesquisa.Text.Replace("'", "") + "%", "or"));
                RowRelatorio.Add(new RowsFiltro("CODPRODUTOFORNECEDOR", "System.String", "collate pt_br like", "%" + txtCriterioPesquisa.Text.Replace("'", "") + "%", "or"));
                RowRelatorio.Add(new RowsFiltro("CODBARRA", "System.String", "collate pt_br like", "%" + txtCriterioPesquisa.Text.Replace("'", "") + "%"));


                if (ValidacoesLibrary.ValidaTipoInt32(txtCriterioPesquisa.Text))
                {
                    RowRelatorio.Add(new RowsFiltro("IDPRODUTO", "System.Int32", "like", txtCriterioPesquisa.Text.Replace("'", "")));
                }

                RowRelatorio.Add(new RowsFiltro("FLAGINATIVO", "System.String", "=", "N"));

                LIS_PRODUTOSColl = LIS_PRODUTOSP.ReadCollectionByParameter(RowRelatorio, "NOMEPRODUTO");

                LIS_PRODUTOSCollection LIS_PRODUTOSColl_2 = new LIS_PRODUTOSCollection();

                //retira produto inativo
                foreach (var item in LIS_PRODUTOSColl)
                {
                    if (item.FLAGINATIVO == "N")
                    {
                        LIS_PRODUTOSColl_2.Add(item);
                    }
                }


                LIS_PRODUTOSColl.Clear();
                LIS_PRODUTOSColl = LIS_PRODUTOSColl_2;
                DataGriewDados.AutoGenerateColumns = false;
                DataGriewDados.DataSource          = LIS_PRODUTOSColl;

                lblTotalPesquisa.Text = LIS_PRODUTOSColl.Count.ToString();

                this.Cursor = Cursors.Default;
            }
            catch (Exception ex)
            {
                this.Cursor = Cursors.Default;
                MessageBox.Show("Erro técnico: " + ex.Message);
            }
        }
Beispiel #9
0
        private void btnPesquisa_Click(object sender, EventArgs e)
        {
            if (cbTipoPesquisa.Text == "Todos")
            {
                Filtro.Clear();

                LIS_PRODUTOSColl = LIS_PRODUTOSP.ReadCollectionByParameter(Filtro, "NOMEPRODUTO");
                DataGriewDados.AutoGenerateColumns = false;
                DataGriewDados.DataSource          = LIS_PRODUTOSColl;

                lblTotalPesquisa.Text = LIS_PRODUTOSColl.Count.ToString();
            }
            else
            {
                PesquisaFiltro();
            }
        }
Beispiel #10
0
        private void btnConsultar_Click(object sender, EventArgs e)
        {
            try
            {
                CreaterCursor Cr = new CreaterCursor();
                this.Cursor = Cr.CreateCursor(Cr.btmap, 0, 0);

                RowRelatorio.Clear();
                int IDGRUPOCATEGORIA = Convert.ToInt32(cbGrupoCategoria.SelectedValue);
                int IDMARCA          = Convert.ToInt32(cbMarca.SelectedValue);
                if (IDGRUPOCATEGORIA > 0)
                {
                    RowRelatorio.Add(new RowsFiltro("IDGRUPOCATEGORIA", "System.Int32", "=", IDGRUPOCATEGORIA.ToString()));
                }

                if (IDMARCA > 0)
                {
                    RowRelatorio.Add(new RowsFiltro("IDMARCA", "System.Int32", "=", IDMARCA.ToString()));
                }

                if (rbOrdemCodigo.Checked)
                {
                    LIS_PRODUTOSColl = LIS_PRODUTOSP.ReadCollectionByParameter(RowRelatorio, "IDPRODUTO");
                }
                else if (rbOrdemCodigoReferencia.Checked)
                {
                    LIS_PRODUTOSColl = LIS_PRODUTOSP.ReadCollectionByParameter(RowRelatorio, "CODPRODUTOFORNECEDOR");
                }
                else
                {
                    LIS_PRODUTOSColl = LIS_PRODUTOSP.ReadCollectionByParameter(RowRelatorio, "NOMEPRODUTO");
                }


                this.Cursor = Cursors.Default;

                PreencheGrid();
            }
            catch (Exception ex)
            {
                this.Cursor = Cursors.Default;
                MessageBox.Show("Erro na pesquisa!");
                MessageBox.Show("Erro técnico: " + ex.Message);
            }
        }
Beispiel #11
0
        private void btnConsultar_Click(object sender, EventArgs e)
        {
            try
            {
                CreaterCursor Cr = new CreaterCursor();
                this.Cursor = Cr.CreateCursor(Cr.btmap, 0, 0);

                RowRelatorio.Clear();
                int idgrupocategoria = Convert.ToInt32(cbGrupoCategoria.SelectedValue);
                if (idgrupocategoria > 0)
                {
                    RowRelatorio.Add(new RowsFiltro("idgrupocategoria", "System.Int32", "=", idgrupocategoria.ToString()));
                }

                LIS_PRODUTOSColl = LIS_PRODUTOSP.ReadCollectionByParameter(RowRelatorio);

                //Remove ID  repetido
                LIS_PRODUTOSCollection LIS_PRODUTOS2Coll = new LIS_PRODUTOSCollection();
                foreach (LIS_PRODUTOSEntity item in LIS_PRODUTOSColl)
                {
                    if (LIS_PRODUTOS2Coll.Find(delegate(LIS_PRODUTOSEntity item2)
                    {
                        return
                        (item2.IDGRUPOCATEGORIA == item.IDGRUPOCATEGORIA);
                    }) == null)
                    {
                        LIS_PRODUTOS2Coll.Add(item);
                    }
                }

                LIS_PRODUTOSColl.Clear();
                LIS_PRODUTOSColl = LIS_PRODUTOS2Coll;

                PreencheGrid();

                this.Cursor = Cursors.Default;
            }
            catch (Exception ex)
            {
                this.Cursor = Cursors.Default;
                MessageBox.Show("Erro técnico: " + ex.Message);
            }
        }
Beispiel #12
0
        private void PesquisaProduto()
        {
            try
            {
                RowsFiltroCollection RowRelatorio = new RowsFiltroCollection();
                RowRelatorio.Clear();
                RowRelatorio.Add(new RowsFiltro("NOMEPRODUTO", "System.String", "collate pt_br like", "%" + txtNomePesquisa.Text.Replace("'", "") + "%", "or"));
                RowRelatorio.Add(new RowsFiltro("CODBARRA", "System.String", "collate pt_br like", "%" + txtNomePesquisa.Text.Replace("'", "") + "%"));

                LIS_PRODUTOSColl = LIS_PRODUTOSP.ReadCollectionByParameter(RowRelatorio, "NOMEPRODUTO");
                DataGriewDados.AutoGenerateColumns = false;
                DataGriewDados.DataSource          = LIS_PRODUTOSColl;
                txtNomePesquisa.Focus();
                lblTotalPesquisa.Text = "Total da pesquisa: " + LIS_PRODUTOSColl.Count.ToString();
            }
            catch (Exception ex)
            {
                MessageBox.Show("Erro técnico: " + ex.Message);
            }
        }
Beispiel #13
0
        private static LIS_PRODUTOSCollection ExecuteReader(ref LIS_PRODUTOSCollection collection, ref FbDataReader dataReader, FbCommand dbCommand)
        {
            using (dataReader = dbCommand.ExecuteReader())
            {
                collection = new LIS_PRODUTOSCollection();

                if (dataReader.HasRows)
                {
                    while (dataReader.Read())
                    {
                        collection.Add(FillEntityObject(ref dataReader));
                    }
                }

                if (!(dataReader.IsClosed))
                {
                    dataReader.Close();
                }
                dataReader.Dispose();
            }

            return(collection);
        }
Beispiel #14
0
        private int BuscarCodigoProduto(string NomeProduto)
        {
            int result = -1;

            try
            {
                RowsFiltroCollection RowRelatorio = new RowsFiltroCollection();
                RowRelatorio.Clear();
                RowRelatorio.Add(new RowsFiltro("NOMEPRODUTO", "System.String", "=", NomeProduto));
                LIS_PRODUTOSColl = Lis_PRODUTOSP.ReadCollectionByParameter(RowRelatorio);

                if (LIS_PRODUTOSColl.Count > 0)
                {
                    result = Convert.ToInt32(LIS_PRODUTOSColl[0].IDPRODUTO);
                }

                return(result);
            }
            catch (Exception ex)
            {
                MessageBox.Show("Erro técnico: " + ex.Message);
                return(result);
            }
        }
Beispiel #15
0
        private void btnPesquisa_Click(object sender, EventArgs e)
        {
            if (Validacoes())
            {
                try
                {
                    RowRelatorio.Clear();

                    if (Convert.ToInt32(cbProduto.SelectedValue) > 0)
                    {
                        RowRelatorio.Add(new RowsFiltro("IDPRODUTO", "System.Int32", "=", Convert.ToInt32(cbProduto.SelectedValue).ToString()));
                    }

                    LIS_PRODUTOSColl = LIS_PRODUTOSP.ReadCollectionByParameter(RowRelatorio, "NOMEPRODUTO");

                    PreencheGrid();
                }
                catch (Exception EX)
                {
                    MessageBox.Show("Erro na pesquisa!");
                    MessageBox.Show("Erro técnico: " + EX.Message);
                }
            }
        }
Beispiel #16
0
        public LIS_PRODUTOSCollection ReadCollection()
        {
            FbDataReader dataReader = null;

            try
            {
                LIS_PRODUTOSCollection collection = null;

                //Verificando a existência de um transação aberta
                if (dbTransaction != null)
                {
                    if (dbCnn.State == ConnectionState.Closed)
                    {
                        dbCnn.Open();
                    }

                    dbCommand             = new FbCommand("SELECT * FROM LIS_PRODUTOS", dbCnn);
                    dbCommand.Transaction = ((FbTransaction)(dbTransaction));
                }
                else
                {
                    if (dbCnn == null)
                    {
                        dbCnn = ((FbConnection)GetConnectionDB());
                    }

                    if (dbCnn.State == ConnectionState.Closed)
                    {
                        dbCnn.Open();
                    }

                    dbCommand             = new FbCommand("SELECT * FROM LIS_PRODUTOS", dbCnn);
                    dbCommand.Transaction = dbCnn.BeginTransaction(IsolationLevel.ReadCommitted);
                }

                // Tipo do comando de banco Procedure ou SQL
                dbCommand.CommandType = CommandType.Text;

                collection = ExecuteReader(ref collection, ref dataReader, dbCommand);

                if (dataReader != null)
                {
                    dataReader.Close();
                    dataReader.Dispose();
                }

                if (dbTransaction == null)
                {
                    dbCommand.Transaction.Commit();
                    dbCnn.Close();
                }

                return(collection);
            }
            catch (Exception ex)
            {
                // Deleta reader
                if (dataReader != null)
                {
                    dataReader.Close();
                    dataReader.Dispose();
                }

                if (dbTransaction != null)
                {
                    this.RollbackTransaction();
                }
                else
                {
                    if (dbCommand.Transaction != null)
                    {
                        dbCommand.Transaction.Rollback();
                    }
                    if (dbCnn.State == ConnectionState.Open)
                    {
                        dbCnn.Close();
                    }
                }

                throw ex;
            }
        }
Beispiel #17
0
        public LIS_PRODUTOSCollection ReadCollectionByParameter(List <RowsFiltro> RowsFiltro, string FieldOrder)
        {
            FbDataReader           dataReader    = null;
            string                 strSqlCommand = String.Empty;
            LIS_PRODUTOSCollection collection    = null;

            try
            {
                if (RowsFiltro != null)
                {
                    if (RowsFiltro.Count > 0)
                    {
                        strSqlCommand = "SELECT * FROM LIS_PRODUTOS WHERE (";

                        ArrayList _rowsFiltro = new ArrayList();
                        RowsFiltro.ForEach(delegate(RowsFiltro i)
                        {
                            string[] item = { i.Condicao.ToString(), i.Campo.ToString(), i.Tipo.ToString(), i.Operador.ToString(), i.Valor.ToString() };
                            _rowsFiltro.Add(item);
                        });

                        int _count = 1;
                        foreach (string[] item in _rowsFiltro)
                        {
                            strSqlCommand += "(" + item[1] + " " + item[3];
                            switch (item[2])
                            {
                            case ("System.String"):
                                if (item[3].ToUpper() != "LIKE")
                                {
                                    strSqlCommand += " '" + item[4] + "')";
                                }
                                else
                                {
                                    strSqlCommand += " '%" + item[4] + "%')";
                                }
                                break;

                            case ("System.Int16"):
                                if (item[3].ToUpper() != "LIKE")
                                {
                                    strSqlCommand += " " + item[4] + ")";
                                }
                                else
                                {
                                    strSqlCommand += " '%" + item[4] + "%')";
                                }
                                break;

                            case ("System.Int32"):
                                if (item[3].ToUpper() != "LIKE")
                                {
                                    strSqlCommand += " " + item[4] + ")";
                                }
                                else
                                {
                                    strSqlCommand += " '%" + item[4] + "%')";
                                }
                                break;

                            case ("System.Int64"):
                                if (item[3].ToUpper() != "LIKE")
                                {
                                    strSqlCommand += " " + item[4] + ")";
                                }
                                else
                                {
                                    strSqlCommand += " '%" + item[4] + "%')";
                                }
                                break;

                            case ("System.Double"):
                                if (item[3].ToUpper() != "LIKE")
                                {
                                    strSqlCommand += " " + item[4] + ")";
                                }
                                else
                                {
                                    strSqlCommand += " '%" + item[4] + "%')";
                                }
                                break;

                            case ("System.Decimal"):
                                if (item[3].ToUpper() != "LIKE")
                                {
                                    strSqlCommand += " " + item[4] + ")";
                                }
                                else
                                {
                                    strSqlCommand += " '%" + item[4] + "%')";
                                }
                                break;

                            case ("System.Float"):
                                if (item[3].ToUpper() != "LIKE")
                                {
                                    strSqlCommand += " " + item[4] + ")";
                                }
                                else
                                {
                                    strSqlCommand += " '%" + item[4] + "%')";
                                }
                                break;

                            case ("System.Byte"):
                                strSqlCommand += " " + item[4] + ")";
                                break;

                            case ("System.SByte"):
                                strSqlCommand += " " + item[4] + ")";
                                break;

                            case ("System.Char"):
                                if (item[3].ToUpper() != "LIKE")
                                {
                                    strSqlCommand += " '" + item[4] + "')";
                                }
                                else
                                {
                                    strSqlCommand += " '%" + item[4] + "%')";
                                }
                                break;

                            case ("System.DateTime"):
                                if (item[3].ToUpper() != "LIKE")
                                {
                                    strSqlCommand += " '" + item[4] + "')";
                                }
                                else
                                {
                                    strSqlCommand += " '%" + item[4] + "%')";
                                }
                                break;

                            case ("System.Guid"):
                                if (item[3].ToUpper() != "LIKE")
                                {
                                    strSqlCommand += " '" + item[4] + "')";
                                }
                                else
                                {
                                    strSqlCommand += " '%" + item[4] + "%')";
                                }
                                break;

                            case ("System.Boolean"):
                                strSqlCommand += " " + item[4] + ")";
                                break;
                            }
                            if (_rowsFiltro.Count > 1)
                            {
                                if (_count < _rowsFiltro.Count)
                                {
                                    strSqlCommand += " " + item[0] + " ";
                                }
                                _count++;
                            }
                        }
                        strSqlCommand += ") order by  " + FieldOrder;
                    }
                    else
                    {
                        strSqlCommand = "SELECT * FROM LIS_PRODUTOS  order by  " + FieldOrder;
                    }
                }
                else
                {
                    strSqlCommand = "SELECT * FROM LIS_PRODUTOS order by  " + FieldOrder;
                }

                //Verificando a existência de um transação aberta
                if (dbTransaction != null)
                {
                    if (dbCnn.State == ConnectionState.Closed)
                    {
                        dbCnn.Open();
                    }

                    dbCommand             = new FbCommand(strSqlCommand, dbCnn);
                    dbCommand.CommandType = CommandType.Text;
                    dbCommand.Transaction = ((FbTransaction)(dbTransaction));
                }
                else
                {
                    if (dbCnn == null)
                    {
                        dbCnn = new FbConnection(connectionString);
                    }

                    if (dbCnn.State == ConnectionState.Closed)
                    {
                        dbCnn.Open();
                    }

                    dbCommand             = new FbCommand(strSqlCommand, dbCnn);
                    dbCommand.CommandType = CommandType.Text;
                    dbCommand.Transaction = dbCnn.BeginTransaction(IsolationLevel.ReadCommitted);
                }


                collection = ExecuteReader(ref collection, ref dataReader, dbCommand);

                if (dataReader != null)
                {
                    dataReader.Close();
                    dataReader.Dispose();
                }

                if (dbTransaction == null)
                {
                    dbCommand.Transaction.Commit();
                    dbCnn.Close();
                }

                return(collection);
            }
            catch (Exception ex)
            {
                // Deleta reader
                if (dataReader != null)
                {
                    dataReader.Close();
                    dataReader.Dispose();
                }

                if (dbTransaction != null)
                {
                    this.RollbackTransaction();
                }
                else
                {
                    if (dbCommand.Transaction != null)
                    {
                        dbCommand.Transaction.Rollback();
                    }
                    if (dbCnn.State == ConnectionState.Open)
                    {
                        dbCnn.Close();
                    }
                }

                throw ex;
            }
        }