コード例 #1
0
        private static void LogarModificacao(ArquivoContratoInfo pParametro, int IdUsuarioLogado, string DescricaoUsuarioLogado)
        {
            ReceberEntidadeRequest <ArquivoContratoInfo> lEntrada = new ReceberEntidadeRequest <ArquivoContratoInfo>();

            lEntrada.Objeto = pParametro;
            ReceberObjetoResponse <ArquivoContratoInfo> lRetorno = ReceberArquivosContratos(lEntrada);

            LogCadastro.Logar(lRetorno.Objeto, IdUsuarioLogado, DescricaoUsuarioLogado, LogCadastro.eAcao.Receber);
        }
コード例 #2
0
        private static ArquivoContratoInfo CriarRegistroArquivoContrato(DataRow linha, Boolean TrazerArquivo)
        {
            ArquivoContratoInfo lArquivoContratoInfo = new ArquivoContratoInfo();

            lArquivoContratoInfo.IdContrato        = linha["id_contrato"].DBToInt32();
            lArquivoContratoInfo.IdArquivoContrato = linha["id_ArquivoContrato"].DBToInt32();
            lArquivoContratoInfo.MIMEType          = linha["mime_type"].DBToString();
            lArquivoContratoInfo.Extensao          = linha["extensao"].DBToString();
            lArquivoContratoInfo.Tamanho           = linha["tamanho"].DBToInt32();
            lArquivoContratoInfo.Nome = linha["nome"].DBToString();
            if (TrazerArquivo)
            {
                lArquivoContratoInfo.Arquivo = (byte[])linha["arquivo"];
            }


            return(lArquivoContratoInfo);
        }
コード例 #3
0
        private string ResponderReceberArquivo()
        {
            bool   Ok       = true;
            string lRetorno = string.Empty;
            SalvarEntidadeCadastroResponse lResposta = InserirItemDeSistema(
                new SalvarEntidadeCadastroRequest <ContratoInfo>()
            {
                EntidadeCadastro = new ContratoInfo()
                {
                    DsContrato    = this.RequestTermo,
                    DsPath        = this.RequestTipoDeObjeto,
                    StObrigatorio = true
                },
                DescricaoUsuarioLogado = base.UsuarioLogado.Nome,
                IdUsuarioLogado        = base.UsuarioLogado.Id
            });

            if (lResposta.StatusResposta != MensagemResponseStatusEnum.OK)
            {
                Ok = false;
            }
            if (Ok)
            {
                ArquivoContratoInfo lArquivoContrato = new ArquivoContratoInfo();
                HttpPostedFile      lFile            = Request.Files[0];
                byte[] lFileBytes = new byte[lFile.InputStream.Length];
                lFile.InputStream.Read(lFileBytes, 0, lFileBytes.Length);

                lArquivoContrato.IdContrato = int.Parse(lResposta.DescricaoResposta);
                lArquivoContrato.Arquivo    = lFileBytes;
                lArquivoContrato.Extensao   = Path.GetExtension(lFile.FileName).ToLower();
                lArquivoContrato.MIMEType   = lFile.ContentType;
                lArquivoContrato.Nome       = Path.GetFileNameWithoutExtension(lFile.FileName);
                lArquivoContrato.Tamanho    = lFile.ContentLength;

                SalvarEntidadeCadastroResponse lResposta2 = InserirItemDeSistema(
                    new SalvarEntidadeCadastroRequest <ArquivoContratoInfo>()
                {
                    EntidadeCadastro = lArquivoContrato
                });

                if (lResposta2.StatusResposta != MensagemResponseStatusEnum.OK)
                {
                    Ok = false;
                }
            }

            if (Ok)
            {
                TransporteObjetoDoSistema lObjetoDeRetorno = new TransporteObjetoDoSistema();

                lObjetoDeRetorno.Id = lResposta.DescricaoResposta;

                lObjetoDeRetorno.Descricao = this.RequestTermo;

                lRetorno = RetornarSucessoAjax(lObjetoDeRetorno, "Registro e Arquivo salvos com sucesso!");
            }
            else
            {
                lRetorno = RetornarErroAjax("Erro ao gravar o arquivo.");
            }
            return(lRetorno);
        }