Example #1
0
 public ActionResult Save(DtoReservaSalvar dtoReservaSalvar)
 {
     try
     {
         var result = new { Status = "Sucesso", Id = Salvar(dtoReservaSalvar, (int)_funcId) };
         return(Json(result, JsonRequestBehavior.AllowGet));
     }
     catch (Exception ex)
     {
         var result = new { Status = "Falha", Msg = ex.Message };
         return(Json(result, JsonRequestBehavior.AllowGet));
     }
 }
Example #2
0
        public JsonResult Transmitir(DtoReservaSalvar dtoReservaSalvar)
        {
            try
            {
                Usuario usuario = App.AutenticacaoService.GetUsuarioLogado();

                _reservaId = Salvar(dtoReservaSalvar, 0);

                App.ReservaService.Transmitir(_reservaId, usuario, (int)_funcId);

                var reserva = App.ReservaService.Buscar(new Reserva {
                    Codigo = _reservaId
                }).FirstOrDefault();

                var result = new { Status = "Sucesso", reserva.Codigo, objModel = reserva };

                return(Json(result, JsonRequestBehavior.AllowGet));
            }
            catch (Exception ex)
            {
                string status;

                var reserva = App.ReservaService.Buscar(new Reserva {
                    Codigo = _reservaId
                }).FirstOrDefault();

                if (reserva.StatusProdesp == "E" && reserva.TransmitirProdesp)
                {
                    status = "Falha Prodesp";
                }
                else if (reserva.StatusProdesp == "S" && reserva.StatusSiafemSiafisico == "S" && reserva.StatusDoc == false)
                {
                    status = "Falha Doc";
                }
                else
                {
                    status = "Falha";
                }

                var result = new { Status = status, Msg = ex.Message, reserva.Codigo, objModel = reserva };
                return(Json(result, JsonRequestBehavior.AllowGet));
            }
        }
Example #3
0
        private int Salvar(DtoReservaSalvar dtoReservaSalvar, int funcId)
        {
            EnumAcao enumAcao = dtoReservaSalvar.Reserva.Codigo > 0 ? EnumAcao.Alterar : EnumAcao.Inserir;

            return(App.ReservaService.Salvar(dtoReservaSalvar.Reserva, dtoReservaSalvar.ReservaMes ?? new List <ReservaMes>(), funcId, (short)enumAcao));
        }