Example #1
0
        public string getIdiomas()
        {
            string  ret      = "";
            dynamic listJson = new JsonArray();

            cn = new util.ClasseConexao();
            cn.Conectar();
            cmd = new OracleCommand("select * from TBLIDIOMA where ATIVO = 1", cn.getConnection());
            dr  = cmd.ExecuteReader();
            while (dr.Read())
            {
                string  retorno = "";
                dynamic idioma  = new JsonObject();

                idioma.id   = dr.GetOracleDecimal(0).Value;
                idioma.nome = dr.GetOracleString(1).Value;


                ret = idioma.ToString();
                listJson.Add(idioma);
                int a = retorno.Length;
            }

            dynamic idiomas = new JsonObject();

            idiomas.idiomas = listJson;
            cn.Desconectar();
            return(idiomas.ToString());
        }
Example #2
0
        public string insertConta(string Nome, string DataNascimento, int IDUsuario, int IdIdioma, string ImageString)
        {
            byte[] image = Convert.FromBase64String(ImageString);

            cn.Conectar();
            string query = "insert into tblConta(Nome, Foto, DTNASCIMENTO, IDCLiente, IDIDIOMA, ATIVO, LINE) values('" + Nome + "',:PICT,TO_DATE('" + DataNascimento + "','dd/mm/yyyy')," + IDUsuario + "," + IdIdioma + ", 1, 0)";

            cmd = new OracleCommand(query, cn.getConnection());


            OracleParameter blobParameter = new OracleParameter();

            blobParameter.OracleDbType  = OracleDbType.Blob;
            blobParameter.ParameterName = "PICT";
            blobParameter.Value         = image;

            cmd.Parameters.Add(blobParameter);

            string retorno = "1";

            try
            {
                cmd.ExecuteNonQuery();
            }
            catch (Exception ex)
            {
                retorno = ex.Message + "\n" + query;
            }

            cn.Desconectar();
            return(retorno);
        }
Example #3
0
        public bool Login(string Email, string Senha)
        {
            cn.Conectar();
            //Adicionar parametros depois, para não ter chance de SQL Injection
            //cmd = new OracleCommand("select LoginUsuario('"+Email+"', '"+Senha+"') from dual", cn.getConnection());
            cmd = new OracleCommand("select IDCLIENTE from tblUsuarioCliente su where su.EMAIL = '" + Email + "' and su.SENHA = '" + Senha + "'", cn.getConnection());

            dr = cmd.ExecuteReader();
            bool retorno = false;

            while (dr.Read())
            {
                IDUsuario = int.Parse(dr.GetOracleDecimal(0).Value.ToString());
                retorno   = true;
            }

            dr.Close();
            cn.Desconectar();

            return(retorno);
        }
Example #4
0
        public string getFavoritosConta(int IDConta)
        {
            string  ret      = "";
            dynamic listJson = new JsonArray();

            cn.Conectar();
            cmd = new OracleCommand("select f.*, c.Imagem, c.Ano, c.Sinopse from Favoritos f inner join TBLCatalogo c on f.IDCat = c.IDCat and AtivoF = 1 and AtivoC = 1 and AtivoCO = 1 and f.IDSerieCatalogo = 0 and IDConta = " + IDConta, cn.getConnection());
            dr  = cmd.ExecuteReader();
            while (dr.Read())
            {
                string  retorno  = "";
                dynamic favorito = new JsonObject();
                byte[]  k        = null;
                if (dr.GetOracleBlob(8) != null)
                {
                    k = dr.GetOracleBlob(8).Value;
                }

                favorito.nome    = dr.GetOracleString(3).Value;
                favorito.imagem  = Convert.ToBase64String(k);
                favorito.idCat   = dr.GetOracleDecimal(2).Value;
                favorito.ano     = dr.GetOracleDecimal(9).Value;
                favorito.sinopse = dr.GetOracleString(10).Value;

                ret = favorito.ToString();
                listJson.Add(favorito);
                int a = retorno.Length;
            }

            dynamic favoritos = new JsonObject();

            favoritos.favoritos = listJson;
            cn.Desconectar();
            return(favoritos.ToString());
        }
Example #5
0
        public string getTopFilmes()
        {
            string  ret      = "";
            dynamic listJson = new JsonArray();

            cn.Conectar();
            cmd = new OracleCommand("select * from TopMidia t inner join TBLCatalogo c on t.IDCat = c.IDCat and c.IDserieCatalogo = 0 and c.ativo = 1 where rownum <= 10", cn.getConnection());
            dr  = cmd.ExecuteReader();
            while (dr.Read())
            {
                string  retorno  = "";
                dynamic catalogo = new JsonObject();
                byte[]  k        = null;
                if (dr.GetOracleBlob(3).Value != null)
                {
                    k = dr.GetOracleBlob(3).Value;
                }

                catalogo.IDCat = dr.GetOracleDecimal(0).Value;
                //catalogo.ano = dr.GetOracleString(4).Value;
                //catalogo.caminho = dr.GetOracleString(10).Value;
                catalogo.IDCategoria = dr.GetOracleDecimal(5).Value;
                catalogo.imagem      = Convert.ToBase64String(k);
                catalogo.sinopse     = dr.GetOracleString(11).Value;
                catalogo.nome        = dr.GetOracleString(12).Value;
                catalogo.ano         = dr.GetOracleDecimal(4).Value;

                ret = catalogo.ToString();
                listJson.Add(catalogo);
                int a = retorno.Length;
            }
            dynamic catalogos = new JsonObject();

            catalogos.catalogo = listJson;
            cn.Desconectar();
            return(catalogos.ToString());
        }