Example #1
0
        public string Excluir(TRegistro_PrecoANP val)
        {
            System.Collections.Hashtable hs = new System.Collections.Hashtable(2);
            hs.Add("@P_ID_PRECO", val.Id_preco);
            hs.Add("@P_CD_COMBUSTIVEL", val.Cd_combustivel);

            return(this.executarProc("EXCLUI_PDC_PRECOANP", hs));
        }
Example #2
0
        public string Gravar(TRegistro_PrecoANP val)
        {
            System.Collections.Hashtable hs = new System.Collections.Hashtable(4);
            hs.Add("@P_ID_PRECO", val.Id_preco);
            hs.Add("@P_CD_COMBUSTIVEL", val.Cd_combustivel);
            hs.Add("@P_VL_PRECO", val.Vl_preco);
            hs.Add("@P_DT_PRECO", val.Dt_preco);

            return(this.executarProc("IA_PDC_PRECOANP", hs));
        }
Example #3
0
        public TList_PrecoANP Select(Utils.TpBusca[] vBusca, int vTop, string vNM_Campo, string vOrder)
        {
            TList_PrecoANP lista         = new TList_PrecoANP();
            bool           podeFecharBco = false;

            if (Banco_Dados == null)
            {
                podeFecharBco = this.CriarBanco_Dados(false);
            }
            System.Data.SqlClient.SqlDataReader reader = this.ExecutarBusca(this.SqlCodeBusca(vBusca, Convert.ToInt16(vTop), vNM_Campo, vOrder));
            try
            {
                while (reader.Read())
                {
                    TRegistro_PrecoANP reg = new TRegistro_PrecoANP();
                    if (!reader.IsDBNull(reader.GetOrdinal("id_preco")))
                    {
                        reg.Id_preco = reader.GetDecimal(reader.GetOrdinal("id_preco"));
                    }
                    if (!reader.IsDBNull(reader.GetOrdinal("cd_combustivel")))
                    {
                        reg.Cd_combustivel = reader.GetString(reader.GetOrdinal("cd_combustivel"));
                    }
                    if (!reader.IsDBNull(reader.GetOrdinal("ds_combustivel")))
                    {
                        reg.Ds_combustivel = reader.GetString(reader.GetOrdinal("ds_combustivel"));
                    }
                    if (!reader.IsDBNull(reader.GetOrdinal("vl_preco")))
                    {
                        reg.Vl_preco = reader.GetDecimal(reader.GetOrdinal("vl_preco"));
                    }
                    if (!reader.IsDBNull(reader.GetOrdinal("dt_preco")))
                    {
                        reg.Dt_preco = reader.GetDateTime(reader.GetOrdinal("dt_preco"));
                    }

                    lista.Add(reg);
                }
            }
            finally
            {
                reader.Close();
                reader.Dispose();
                if (podeFecharBco)
                {
                    this.deletarBanco_Dados();
                }
            }
            return(lista);
        }