Beispiel #1
0
        /********************************************************************  VER ORÇAMENTOS - NÍVEL DIRETOR ********************************************************************/
        public List <Requisicao> VerOrcamentos(String ID)
        {
            //SqlConnection Conexao = new SqlConnection(ConfigurationManager.ConnectionStrings["BancoEstoque"].ConnectionString);
            SqlConnection Conexao = new SqlConnection("Server = DESKTOP-PHTQI5U\\SQLEXPRESS; Database = DRLTCC; Trusted_Connection = True;");

            Conexao.Open();

            SqlCommand Comando = new SqlCommand();

            Comando.Connection  = Conexao;
            Comando.CommandText = "select FK_CodigoEmpresa, E.NomeEmpresa, E.Fone, E.Contato from Item_Empresa join Empresa E on CodigoEmpresa = FK_CodigoEmpresa where FK_CodigoItem = @FK_CodigoItem;";
            Comando.Parameters.AddWithValue("@FK_CodigoItem", ID);

            SqlDataReader Leitor2 = Comando.ExecuteReader();

            Int32[] teste = PegaCodigoItem(ID);
            Int32   N     = 0;
            Int32   numero;

            while (Leitor2.Read())
            {
                Requisicao R = new Requisicao();

                R.FK_CodigoEmpresa = Convert.ToInt32(Leitor2["FK_CodigoEmpresa"].ToString());
                R.NomeEmpresa      = Leitor2["NomeEmpresa"].ToString();
                R.Fone             = Leitor2["Fone"].ToString();
                R.Contato          = Leitor2["Contato"].ToString();
                Orcamentos.Add(R);
                numero = teste[N];
                Pegavalores(numero);
                N++;
            }

            Conexao.Close();
            return(Orcamentos);
        }