Ejemplo n.º 1
0
        public override int buscarRegistros()
        {
            TList_CadLote lista = TCN_CadLote.Busca(Nr_loteproducao.Text,
                                                    Ds_loteproducao.Text,
                                                    0,
                                                    Cd_loteID.Text,
                                                    string.Empty,
                                                    null);

            if (lista != null)
            {
                if (lista.Count > 0)
                {
                    this.Lista         = lista;
                    BS_Lote.DataSource = lista;
                }
                else
                if ((vTP_Modo == TTpModo.tm_Standby) || (vTP_Modo == TTpModo.tm_busca))
                {
                    BS_Lote.Clear();
                }
                return(lista.Count);
            }
            else
            {
                return(0);
            }
        }
Ejemplo n.º 2
0
        public TList_CadLote Select(TpBusca[] vBusca, Int32 vTop, string vNM_Campo)
        {
            TList_CadLote lista = new TList_CadLote();
            SqlDataReader reader;
            bool          podeFecharBco = false;

            if (Banco_Dados == null)
            {
                this.CriarBanco_Dados(false);
                podeFecharBco = true;
            }

            try
            {
                if (vNM_Campo == "")
                {
                    reader = this.ExecutarBusca(this.SqlCodeBusca(vBusca, Convert.ToInt16(vTop), ""));
                }
                else
                {
                    reader = this.ExecutarBusca(this.SqlCodeBusca(vBusca, Convert.ToInt16(vTop), vNM_Campo));
                }

                while (reader.Read())
                {
                    TRegistro_CadLote CadLote = new TRegistro_CadLote();
                    if (!reader.IsDBNull(reader.GetOrdinal("NR_LoteProducao")))
                    {
                        CadLote.Nr_loteproducao = reader.GetDecimal(reader.GetOrdinal("NR_LoteProducao"));
                    }
                    if (!reader.IsDBNull(reader.GetOrdinal("DS_LoteProducao")))
                    {
                        CadLote.Ds_loteproducao = reader.GetString(reader.GetOrdinal("DS_LoteProducao"));
                    }
                    if (!reader.IsDBNull(reader.GetOrdinal("CD_LoteID")))
                    {
                        CadLote.Cd_loteID = reader.GetString(reader.GetOrdinal("CD_LoteID"));
                    }
                    if (!reader.IsDBNull(reader.GetOrdinal("QT_Dias_Validade")))
                    {
                        CadLote.Qt_dias_Validade = reader.GetDecimal(reader.GetOrdinal("QT_Dias_Validade"));
                    }
                    lista.Add(CadLote);
                }
            }
            finally
            {
                if (podeFecharBco)
                {
                    this.deletarBanco_Dados();
                }
            }
            return(lista);
        }
Ejemplo n.º 3
0
        public TList_CadLote Select(TpBusca[] vBusca, int vTop, string vNM_Campo)
        {
            TList_CadLote lista         = new TList_CadLote();
            SqlDataReader reader        = null;
            bool          podeFecharBco = false;

            if (Banco_Dados == null)
            {
                podeFecharBco = CriarBanco_Dados(false);
            }

            try
            {
                reader = ExecutarBusca(SqlCodeBusca(vBusca, Convert.ToInt16(vTop), vNM_Campo));
                while (reader.Read())
                {
                    TRegistro_CadLote CadLote = new TRegistro_CadLote();
                    if (!reader.IsDBNull(reader.GetOrdinal("NR_LoteProducao")))
                    {
                        CadLote.Nr_loteproducao = reader.GetDecimal(reader.GetOrdinal("NR_LoteProducao"));
                    }
                    if (!reader.IsDBNull(reader.GetOrdinal("DS_LoteProducao")))
                    {
                        CadLote.Ds_loteproducao = reader.GetString(reader.GetOrdinal("DS_LoteProducao"));
                    }
                    if (!reader.IsDBNull(reader.GetOrdinal("CD_LoteID")))
                    {
                        CadLote.Cd_loteID = reader.GetString(reader.GetOrdinal("CD_LoteID"));
                    }
                    if (!reader.IsDBNull(reader.GetOrdinal("DT_IniVigencia")))
                    {
                        CadLote.Dt_inivigencia = reader.GetDateTime(reader.GetOrdinal("DT_IniVigencia"));
                    }
                    if (!reader.IsDBNull(reader.GetOrdinal("DT_FinVigencia")))
                    {
                        CadLote.Dt_finvigencia = reader.GetDateTime(reader.GetOrdinal("DT_FinVigencia"));
                    }
                    lista.Add(CadLote);
                }
            }
            finally
            {
                reader.Close();
                reader.Dispose();
                if (podeFecharBco)
                {
                    deletarBanco_Dados();
                }
            }
            return(lista);
        }