Esempio n. 1
0
        public ArquivoResponse GravarArquivo(Arquivo arquivo, bool NovoContent)
        {
            ArquivoResponse resposta = new ArquivoResponse();
            AcessoDados acesso = new AcessoDados();

            DataTable tabela = new DataTable();

            if (arquivo.ListaCategoria == "null") arquivo.ListaCategoria = "";
            tabela = acesso.CarregarDadosParametros("dbCCBC", "USP_INS_Arquivo", arquivo.ArquivoId, arquivo.Content, arquivo.Legenda, arquivo.ListaCategoria, NovoContent, arquivo.Tipo, arquivo.PastaId, arquivo.FileName);

            if (tabela.Rows.Count > 0)
            {
                DataRow dr = tabela.Rows[0];
                if (Util.GetNonNull(dr["ArquivoId"]))
                {
                    resposta.Resposta.Erro = false;
                    resposta.Resposta.Mensagem = "";
                    resposta.Arquivo = arquivo;
                    resposta.Arquivo.ArquivoId = Convert.ToInt64(dr["ArquivoId"].ToString());

                }
            }

            return resposta;
        }
Esempio n. 2
0
        public ActionResult GravarArquivo(int _OwnerId, long _ArquivoId, string _Legenda, string _ListaCategoria, int _ArquivoCategoriaTipoId)
        {
            Arquivo a = new Arquivo();
            ArquivoDAL dal = new ArquivoDAL();

            a.ArquivoId = _ArquivoId;
            a.Legenda = _Legenda;
            a.ListaCategoria = _ListaCategoria;

            var arquivo = dal.GravarArquivo(a, false);
            _ArquivoId = arquivo.Arquivo.ArquivoId;
            dal.GravarArquivoGaleria(_OwnerId, _ArquivoId, _ArquivoCategoriaTipoId);

            return Json(true, JsonRequestBehavior.DenyGet);
        }
Esempio n. 3
0
        public Arquivo CarregarArquivo(long ArquivoId)
        {
            Arquivo cont = new Arquivo();

            AcessoDados acesso = new AcessoDados();

            DataTable tabela = new DataTable();

            tabela = acesso.CarregarDadosParametros("dbCCBC", "USP_SEL_Arquivo", ArquivoId);

            if (tabela.Rows.Count > 0)
            {
                CarregarDTO(cont, tabela.Rows[0], true);
            }

            return cont;
        }
Esempio n. 4
0
        private void CarregarDTO(Arquivo dto, DataRow dr, bool ComFoto)
        {
            if (Util.GetNonNull(dr["ArquivoId"]))
                dto.ArquivoId = (Int64)dr["ArquivoId"];
            if (ComFoto && Util.GetNonNull(dr["Content"]))
            {
                dto.Content = (byte[])dr["Content"];
            }
            //if (Util.GetNonNull(dr["Content64"]))
            //    dto.Base64 = dr["Content64"].ToString();
            if (Util.GetNonNull(dr["Tipo"]))
                dto.Tipo = dr["Tipo"].ToString();
            if (Util.GetNonNull(dr["Legenda"]))
                dto.Legenda = dr["Legenda"].ToString();
            if (Util.GetNonNull(dr["ListaCategoria"]))
                dto.ListaCategoria = dr["ListaCategoria"].ToString();

            if (Util.GetNonNull(dr["NomeArquivo"]))
                dto.FileName = dr["NomeArquivo"].ToString();
        }
Esempio n. 5
0
        public List<Arquivo> ListarArquivosGaleria(int? OwnerId, int? ArquivoCategoriaId = null, int _ArquivoCategoriaTipoId = 0, int PastaId = 0)
        {
            List<Arquivo> lista = new List<Arquivo>();

            AcessoDados acesso = new AcessoDados();

            DataTable tabela = new DataTable();

            if (_ArquivoCategoriaTipoId == (int)Util.ARQUIVO_CATEGORIA_TIPO.PUBLICACAO)
            {
                tabela = acesso.CarregarDadosParametros("dbCCBC", "USP_SEL_PublicacaoArquivo", OwnerId, ArquivoCategoriaId);
            }
            else if (_ArquivoCategoriaTipoId == (int)Util.ARQUIVO_CATEGORIA_TIPO.MENU)
            {
                tabela = acesso.CarregarDadosParametros("dbCCBC", "USP_SEL_MenuArquivo", OwnerId, ArquivoCategoriaId);
            }
            else if (_ArquivoCategoriaTipoId == (int)Util.ARQUIVO_CATEGORIA_TIPO.BANNER)
            {
                tabela = acesso.CarregarDadosParametros("dbCCBC", "USP_SEL_BannerArquivo", OwnerId, ArquivoCategoriaId);
            }
            else if (_ArquivoCategoriaTipoId == (int)Util.ARQUIVO_CATEGORIA_TIPO.MEDIA_GLOBAL)
            {
                tabela = acesso.CarregarDadosParametros("dbCCBC", "USP_SEL_GeralArquivo", PastaId);
            }
            if (tabela.Rows.Count > 0)
            {
                Arquivo dto;
                foreach (DataRow dr in tabela.Rows)
                {
                    dto = new Arquivo();
                    CarregarDTO(dto, dr, false);
                    lista.Add(dto);
                }
            }

            return lista;
        }
Esempio n. 6
0
        public List<Arquivo> ListarArquivos(int? ArquivoId)
        {
            List<Arquivo> lista = new List<Arquivo>();

            AcessoDados acesso = new AcessoDados();

            DataTable tabela = new DataTable();

            tabela = acesso.CarregarDadosParametros("dbCCBC", "USP_SEL_Arquivo", ArquivoId);

            if (tabela.Rows.Count > 0)
            {
                Arquivo dto;
                foreach (DataRow dr in tabela.Rows)
                {
                    dto = new Arquivo();
                    CarregarDTO(dto, dr, false);
                    lista.Add(dto);
                }
            }

            return lista;
        }
Esempio n. 7
0
 public ArquivoResponse()
 {
     Resposta = new Resposta();
     Arquivo = new Arquivo();
 }