/// <summary>
        /// Metodo para buscar religiao de uma pessoa especifica. Recebe como parametro o id da pessoa. Retorna uma religiao.
        /// </summary>
        /// <param name="pIdPessoa">Int idPessoa</param>
        /// <returns>Objeto Religioes.</returns>
        public static Religioes GetOne(int pIdPessoa)
        {
            StringBuilder sql = new StringBuilder();
            MySqlCommand  cmm = new MySqlCommand();

            cmm.Parameters.AddWithValue("@idPessoa", pIdPessoa);

            sql.Append("SELECT nome ");
            sql.Append("FROM religioes WHERE idPessoa = @idPessoa");

            cmm.CommandText = sql.ToString();

            Religioes religiao = new Religioes();

            DataTable dt = MySQL.MySQL.MySQL.getDataTable(cmm);

            foreach (DataRow row in dt.Rows)
            {
                religiao = new Religioes
                {
                    nome = row.IsNull("nome") ? "" : (string)row["nome"]
                };
            }

            dt.Dispose();

            return(religiao);
        }
Exemplo n.º 2
0
        public static Religioes ToFirstUpper(Religioes pReligiao)
        {
            System.Globalization.CultureInfo cultureInfo = System.Threading.Thread.CurrentThread.CurrentCulture;
            Religioes newReligiao = new Religioes();

            if (pReligiao != null)
            {
                newReligiao.nome = (pReligiao.nome == null) ? null : cultureInfo.TextInfo.ToTitleCase(pReligiao.nome);
            }

            return(newReligiao);
        }