private int Salvar(ModelSalvar objSave, int funcId) { var acao = objSave.Model.Id > 0 ? EnumAcao.Alterar : EnumAcao.Inserir; return(App.EmpenhoReforcoService.Salvar( objSave.Model, objSave.Meses ?? new List <EmpenhoReforcoMes>(), objSave.Itens ?? new List <EmpenhoReforcoItem>(), Convert.ToInt32(funcId), (short)acao)); }
public ActionResult Save(ModelSalvar objSave) { try { return(Json(new { Status = "Sucesso", Id = Salvar(objSave, Convert.ToInt32(_funcId)) })); } catch (Exception ex) { return(Json(new { Status = "Falha", Msg = ex.Message })); } }
private int SalvarService(ModelSalvar objSave, int funcionalidade) { var acao = objSave.Model.Id > 0 ? EnumAcao.Alterar : EnumAcao.Inserir; return(App.EmpenhoCancelamentoService.Salvar( objSave.Model, objSave.Meses ?? new List <EmpenhoCancelamentoMes>(), objSave.Itens ?? new List <EmpenhoCancelamentoItem>(), funcionalidade, Convert.ToInt16(acao))); }
private int SalvarService(ModelSalvar objSave, int funcionalidade) { var acao = objSave.Model.Id > 0 ? EnumAcao.Alterar : EnumAcao.Inserir; return(App.EmpenhoService.Salvar( objSave.Model, objSave.Meses ?? new List <EmpenhoMes>(), objSave.Itens ?? new List <EmpenhoItem>(), funcionalidade, (short)acao)); }
public ActionResult Save(ModelSalvar movimentacao) { try { movimentacao.Model.Cancelamento = movimentacao.Model.Cancelamento ?? new List <MovimentacaoCancelamento>(); movimentacao.Model.NotasCreditos = movimentacao.Model.NotasCreditos ?? new List <MovimentacaoNotaDeCredito>(); movimentacao.Model.Distribuicao = movimentacao.Model.Distribuicao ?? new List <MovimentacaoDistribuicao>(); movimentacao.Model.Meses = movimentacao.Model.Meses ?? new List <MovimentacaoMes>(); var id = Salvar(movimentacao.Model, Convert.ToInt32(_funcId)); return(Json(new { Status = "Sucesso", Id = id })); } catch (Exception ex) { return(Json(new { Status = "Falha", Msg = ex.Message })); } }
public JsonResult Transmitir(ModelSalvar objSave) { var objModel = new EmpenhoCancelamento(); try { var usuario = App.AutenticacaoService.GetUsuarioLogado(); _modelId = SalvarService(objSave, (int)_funcId); App.EmpenhoCancelamentoService.Transmitir(_modelId, usuario, (int)_funcId); objModel = App.EmpenhoCancelamentoService.Buscar( new EmpenhoCancelamento { Id = _modelId }).FirstOrDefault(); return(Json(new { Status = "Sucesso", Codigo = objModel.Id, objModel })); } catch (Exception ex) { objModel = App.EmpenhoCancelamentoService.Buscar( new EmpenhoCancelamento { Id = _modelId }).FirstOrDefault(); var status = "Falha"; if (objModel.StatusProdesp.Equals("E") && objModel.TransmitirProdesp) { status = "Falha Prodesp"; } if (objModel.StatusProdesp == "S" && !objModel.StatusDocumento && objModel.StatusSiafemSiafisico == "S") { status = "Falha Doc"; } return(Json(new { Status = status, Msg = ex.Message, Codigo = objModel.Id, objModel })); } }
public JsonResult Transmitir(ModelSalvar objSave) { Empenho objModel; try { _modelId = SalvarService(objSave, (int)_funcId); App.EmpenhoService.Transmitir(_modelId, App.AutenticacaoService.GetUsuarioLogado(), (int)_funcId); objModel = App.EmpenhoService.Buscar(new Empenho { Id = _modelId }).FirstOrDefault(); Elmah.ErrorSignal.FromCurrentContext().Raise(new Exception("ERROR EMPENHOCONTROLLER - TRANSMITIR - 1: OBJMODEL-DATAPRODESP = " + objModel.DataTransmitidoProdesp + " - OBJMODEL-DATASIAFEM = " + objModel.DataTransmitidoSiafem)); return(Json(new { Status = "Sucesso", Codigo = objModel.Id, objModel })); } catch (Exception ex) { objModel = App.EmpenhoService.Buscar(new Empenho { Id = _modelId }).FirstOrDefault(); var status = "Falha"; if (objModel.StatusProdesp == "E" && objModel.TransmitirProdesp) { status = "Falha Prodesp"; } if (objModel.StatusProdesp == "S" && !objModel.StatusDocumento && objModel.StatusSiafemSiafisico == "S") { status = "Falha Doc"; } return(Json(new { Status = status, Msg = ex.Message, Codigo = objModel.Id, objModel })); } }
public JsonResult Transmitir(ModelSalvar mov) { MovimentacaoOrcamentaria objModel; try { var usuario = App.AutenticacaoService.GetUsuarioLogado(); _modelId = Salvar(mov.Model, 0); App.MovimentacaoService.Transmitir(_modelId, usuario, (int)_funcId); objModel = App.MovimentacaoService.Selecionar(_modelId); return(Json(new { Status = "Sucesso", Codigo = objModel.Id, objModel })); } catch (Exception ex) { objModel = App.MovimentacaoService.Selecionar(_modelId); var result = new { Status = "Falha", Msg = ex.Message, Codigo = objModel.Id, objModel }; return(Json(result)); } }