public ActionResult ArmazenarDocumento(int _registroDocumento, int _registroCaixa) { bool sucesso = false; using (TransactionScope scope = new TransactionScope()) { try { _DAO.ArmazenarDocumento(_registroDocumento, _registroCaixa); _DAO.RegistrarArmazenamentoDocumento(_registroDocumento, Seguranca.UsuarioLogado().Registro); sucesso = true; } catch (Exception ex) { MetodosUtilidadeGeral.MensagemDeErro(ex.Message, Response); } if (sucesso) { scope.Complete(); return(RedirectToAction("DocumentosNaoArmazenados").ComMensagemDeSucesso("Documento armazenado com sucesso!")); } return(RedirectToAction("ArmazenarDocumento")); } }
public ActionResult RevisarDocumento(int _registroDocumento) { try { if (!_DAO.DocumentoRevisado(_registroDocumento)) { _DAO.RegistrarRevisaoDocumento(_registroDocumento, Seguranca.UsuarioLogado().Registro); } return(RedirectToAction("ListarDocumentosNaoRevisados", "Documento", new { _registroCaixa = _DAO.GetByRegistro(_registroDocumento).Caixa }).ComMensagemDeSucesso("Revisão concluída!")); } catch (Exception ex) { return(View("Revisar", new { _registroDocumento = _registroDocumento }).ComMensagemDeErro(ex.Message)); } }
public ActionResult CadastrarDocumento(Documento _novoDocumento) { try { _DAO.SalvarDocumento(_novoDocumento); Logador.LogAcao(Logador.LogAcoes.Salvar, "CADASTRO DE DOCUMENTO (REGISTRO " + _novoDocumento.Registro.ToString() + ")"); _DAO.RegistrarCadastroDocumento(_novoDocumento.Registro, Seguranca.UsuarioLogado().Registro); } catch (Exception ex) { return(RedirectToAction("Cadastrar").ComMensagemDeErro(ex.Message)); } return(RedirectToAction("VinculacaoImagem", "DocumentoDigitalizacao", new { _registroDocumento = _novoDocumento.Registro })); }
public ActionResult Indexar(int Registro, List <int> regIndex, List <string> valor) { bool sucesso = false; if (!ModelState.IsValid) { return(View("Indexacao", new DocumentoBO().GetByRegistro(Registro))); } //using (TransactionScope scope = new TransactionScope()) //{ try { SubserieIndiceValor _valorIndice; for (int i = 0; i < regIndex.Count; i++) { _valorIndice = new SubserieIndiceValor(Registro, regIndex[i], valor[i]); SalvarIndice(_valorIndice); } new DocumentoBO().RegistrarIndexacaoDocumento(Registro, Seguranca.UsuarioLogado().Registro); sucesso = true; } catch (Exception ex) { sucesso = false; // MetodosUtilidadeGeral.MensagemDeErro(ex.Message, Response); valor = new List <string>(); return(RedirectToAction("Indexacao", new { _registroDocumento = Registro }).ComMensagemDeErro(ex.Message)); } if (sucesso) { //scope.Complete(); return(RedirectToAction("ConcluirCaptura", "Documento", new { _registroDocumento = Registro })); } //else //{ // scope.Dispose(); return(View("Indexacao", new DocumentoBO().GetByRegistro(Registro))); //} // } }
public void ImportarArquivo(HttpPostedFileBase imagemSelecionada, string _registroDocumento, string ordem) { if (imagemSelecionada != null) { if (Path.GetExtension(imagemSelecionada.FileName).Contains("pdf")) { SalvarArquivo(int.Parse(_registroDocumento), imagemSelecionada, ordem); new DocumentoBO().RegistrarCapturaDocumento(int.Parse(_registroDocumento), Seguranca.UsuarioLogado().Registro); } else { throw new Exception("O arquivo selecionado deve possuir a exentensão .pdf"); } } else { throw new Exception("Nenhum arquivo selecionado."); } }