コード例 #1
0
        //Realizar os tratamentos necessários
        //Salvar um novo registro
        public bool salvar(Convenio OConvenio, HttpPostedFileBase OFoto)
        {
            OConvenio.chaveUrl = UtilString.cleanStringToURL(OConvenio.titulo).ToLower();

            var flagSucesso = false;

            if (OConvenio.id > 0)
            {
                flagSucesso = this.atualizar(OConvenio);
            }

            if (OConvenio.id == 0)
            {
                flagSucesso = this.inserir(OConvenio);
            }

            if (flagSucesso && OFoto != null)
            {
                var listaThumbs = new List <ThumbDTO>();

                listaThumbs.Add(new ThumbDTO {
                    folderName = "sistema", height = 50, width = 0
                });

                var OArquivo = new ArquivoUpload();

                OArquivo.idReferenciaEntidade = OConvenio.id;

                OArquivo.entidade = EntityTypes.CONVENIO;

                this.OArquivoUploadFotoBL.salvar(OArquivo, OFoto, "", listaThumbs);
            }

            return(flagSucesso);
        }
コード例 #2
0
        //
        public bool salvar(Noticia ONoticia, HttpPostedFileBase OFoto, HttpPostedFileBase OArquivoPDF = null)
        {
            bool flagSucesso = false;

            ONoticia.chaveUrl = UtilString.cleanStringToURL(ONoticia.titulo).ToLower();

            if (ONoticia.id > 0)
            {
                flagSucesso = this.atualizar(ONoticia);
            }

            if (ONoticia.id == 0)
            {
                flagSucesso = this.inserir(ONoticia);
            }


            if (flagSucesso && OFoto != null)
            {
                var OArquivo = new ArquivoUpload();

                OArquivo.idReferenciaEntidade = ONoticia.id;

                OArquivo.entidade = EntityTypes.NOTICIA;

                var listaThumb = new List <ThumbDTO> {
                    new ThumbDTO {
                        folderName = "destaque", width = 105, height = 70
                    },

                    new ThumbDTO {
                        folderName = "listagem", width = 250, height = 167
                    },

                    new ThumbDTO {
                        folderName = "interna", width = 74, height = 50
                    },
                };

                this.OArquivoUploadFotoBL.salvar(OArquivo, OFoto, "", listaThumb);
            }

            if (flagSucesso && OArquivoPDF != null)
            {
                this.OArquivoUploadBL.salvarDocumento(ONoticia.id, EntityTypes.NOTICIA, "", OArquivoPDF, 0);
            }

            return(true);
        }