public Observacao BuscaObservacao(int pIDResponsavel)
        {
            //string Observacaov = "";
            using (SqlConnection objConexao = new SqlConnection(strConexao))
            {
                using (SqlCommand objComando = new SqlCommand(strSelect, objConexao))
                {
                    try
                    {
                        objComando.Parameters.AddWithValue("@IdResponsavel", Convert.ToString(IDTeste));
                        objConexao.Open();
                        SqlDataReader objDataReader = objComando.ExecuteReader();
                        Observacao    objOservacao  = new Observacao();
                        if (objDataReader.HasRows)
                        {
                            objDataReader.Read();
                            //nome = leitor["Nome"].ToString();
                            objOservacao.observacaov = objDataReader["Observacao"].ToString();
                        }
                        objConexao.Close();
                        //retorno o nome
                        return(objOservacao);
                    }
                    catch (Exception ex)
                    {
                        MessageBox.Show("Erro!" + ex.Message);
                        //throw;
                    }
                }
            }
            Observacao objOservacaoFalha = new Observacao();

            return(objOservacaoFalha);
        }
        public List <Observacao> Selecionar()
        {
            List <Observacao> lstObservacaos = new List <Observacao>();

            using (SqlConnection objConexao = new SqlConnection(strConexao))
            {
                using (SqlCommand objComando = new SqlCommand(strSelect, objConexao))
                {
                    try
                    {
                        objComando.Parameters.AddWithValue("@IdResponsavel", Convert.ToString(IDTeste));
                        objConexao.Open();
                        SqlDataReader objDataReader = objComando.ExecuteReader();

                        if (objDataReader.HasRows)
                        {
                            while (objDataReader.Read())
                            {
                                Observacao objObservacao = new Observacao();
                                //objObservacao.IdResponsavel = Convert.ToInt32(objDataReader["IDResponsavel"].ToString());
                                objObservacao.Observacaov = objDataReader["Observacaov"].ToString();

                                lstObservacaos.Add(objObservacao);
                            }
                            objDataReader.Close();
                        }
                        objConexao.Close();
                    }
                    catch (Exception ex)
                    {
                        MessageBox.Show("Erro!" + ex.Message);
                        // throw;
                    }
                }
            }

            return(lstObservacaos);
        }
Exemplo n.º 3
0
        public Observacao BuscaObservacao(int pIDResponsavel)
        {
            //string Observacaov = "";
            using (SqlConnection objConexao = new SqlConnection(strConexao))
            {
                using (SqlCommand objComando = new SqlCommand(strSelect, objConexao))
                {
                    try
                    {
                        objComando.Parameters.AddWithValue("@IdResponsavel", Convert.ToString(IDTeste));
                        objConexao.Open();
                        SqlDataReader objDataReader = objComando.ExecuteReader();
                        Observacao objOservacao = new Observacao();
                        if (objDataReader.HasRows)
                        {
                            objDataReader.Read();
                            //nome = leitor["Nome"].ToString();
                            objOservacao.observacaov = objDataReader["Observacao"].ToString();
                        }
                        objConexao.Close();
                        //retorno o nome
                        return objOservacao;
                    }
                    catch (Exception ex)
                    {
                        MessageBox.Show("Erro!" + ex.Message);
                        //throw;
                    }

                }
            }
            Observacao objOservacaoFalha = new Observacao();
            return objOservacaoFalha;
        }
Exemplo n.º 4
0
        public List<Observacao> Selecionar()
        {
            List<Observacao> lstObservacaos = new List<Observacao>();

            using (SqlConnection objConexao = new SqlConnection(strConexao))
            {
                using (SqlCommand objComando = new SqlCommand(strSelect, objConexao))
                {
                    try
                    {
                        objComando.Parameters.AddWithValue("@IdResponsavel", Convert.ToString(IDTeste));
                        objConexao.Open();
                        SqlDataReader objDataReader = objComando.ExecuteReader();

                        if (objDataReader.HasRows)
                        {
                            while (objDataReader.Read())
                            {
                                Observacao objObservacao = new Observacao();
                                //objObservacao.IdResponsavel = Convert.ToInt32(objDataReader["IDResponsavel"].ToString());
                                objObservacao.Observacaov = objDataReader["Observacaov"].ToString();

                                lstObservacaos.Add(objObservacao);
                            }
                            objDataReader.Close();
                        }
                        objConexao.Close();
                    }
                    catch (Exception ex)
                    {
                        MessageBox.Show("Erro!" + ex.Message);
                       // throw;
                    }
                }
            }

            return lstObservacaos;
        }