public List <Posicionamento> GetAll() { List <Posicionamento> lista = new List <Posicionamento>(); using (SqlConnection con = new SqlConnection(ConnectionFactory.GetStringConexao())) { con.Open(); string sql = "SELECT ID_POSICAO, DS_POSICAO FROM TB_POSICIONAMENTO"; using (SqlCommand cmd = new SqlCommand(sql, con)) { using (SqlDataReader dr = cmd.ExecuteReader()) { if (dr != null) { while (dr.Read()) { Posicionamento p = new Posicionamento(); p.IdPosicao = Convert.ToInt32(dr["ID_POSICAO"]); p.DescricaoPosicao = Convert.ToString(dr["DS_POSICAO"]); lista.Add(p); } } return(lista); } } } }
//set do enum de posicionamento public void SetPosicionamento(int p) { somAmbiente.Play(); if (p == 0) { myPosition = Posicionamento.intro; } else if (p == 1) { myPosition = Posicionamento.livre; } else if (p == 2) { myPosition = Posicionamento.tema1; } else if (p == 3) { myPosition = Posicionamento.tema2; } else if (p == 4) { myPosition = Posicionamento.tema3; } else if (p == 5) { myPosition = Posicionamento.tema4; } }