public RetornoModel <List <PacoteRetorno> > GetPacotesEvento(int id) { var retorno = new RetornoModel <List <PacoteRetorno> >(); List <PacoteRetorno> pacotes; try { using (var ado = new MasterADOBase()) { var pacoteBO = new PacoteBO(ado); pacotes = pacoteBO.ListarPorEvento(id, SessionModel.CanalID); } } catch (Exception ex) { retorno.Mensagem = ex.Message; retorno.Sucesso = false; LogUtil.Error(ex); throw new HttpResponseException(Request.CreateResponse(HttpStatusCode.InternalServerError, ParseRetorno(retorno))); } retorno.Retorno = pacotes; retorno.Sucesso = true; if (pacotes == null || pacotes.Count == 0) { retorno.Mensagem = "Evento ou pacotes não encontrados"; retorno.Sucesso = false; NewRelicIgnoreTransaction(); throw new HttpResponseException(Request.CreateResponse(HttpStatusCode.NotFound, ParseRetorno(retorno))); } retorno.Mensagem = "OK"; return(ParseRetorno(retorno)); }
public RetornoModel <Evento> GetEvento(int id, int mostrarEstatistica = 0) { var retorno = new RetornoModel <Evento>(); var stopwatch = new Stopwatch(); stopwatch.Start(); try { using (var ado = new MasterADOBase()) { var eventoBO = new EventoBO(ado); var canalTipoPOS = ConfiguracaoAppUtil.GetAsInt("CanalTipoPOS"); var isPOS = new CanalBO(ado).isPOS(SessionModel.CanalID, canalTipoPOS); retorno.Retorno = eventoBO.Consultar(id, isPOS, Convert.ToBoolean(mostrarEstatistica)); var pacoteBO = new PacoteBO(ado); if (retorno.Retorno != null) { retorno.Retorno.Pacote = pacoteBO.ListarPorEvento(id, SessionModel.CanalID); if (retorno.Retorno.Pacote.Any()) { foreach (var pacote in retorno.Retorno.Pacote) { pacote.PacoteItem = pacoteBO.ListarItens(pacote.ID); } } } } } catch (Exception ex) { stopwatch.Stop(); retorno.Mensagem = ex.Message; LogUtil.Error(string.Format("##GET.Eventos.eventos/id.EXCEPTION## SESSION {0}, MSG {1}, TEMPO DECORRIDO {2}", this.SessionModel.SessionID, ex.Message, stopwatch.Elapsed), ex); retorno.Sucesso = false; LogUtil.Error(ex); throw new HttpResponseException(Request.CreateResponse(HttpStatusCode.InternalServerError, ParseRetorno(retorno))); } stopwatch.Stop(); retorno.Sucesso = (retorno.Retorno != null); if (!retorno.Sucesso) { retorno.Mensagem = "Evento não encontrado"; LogUtil.Info(string.Format("##GET.Eventos.eventos/id## SESSION {0}, TEMPO DECORRIDO {1}, MSG {2}", this.SessionModel.SessionID, stopwatch.Elapsed, retorno.Mensagem)); retorno.Sucesso = false; NewRelicIgnoreTransaction(); throw new HttpResponseException(Request.CreateResponse(HttpStatusCode.NotFound, ParseRetorno(retorno))); } retorno.Mensagem = "OK"; LogUtil.Info(string.Format("##GET.Eventos.eventos/id## SESSION {0}, TEMPO DECORRIDO {1}, MSG {2}", this.SessionModel.SessionID, stopwatch.Elapsed, retorno.Mensagem)); return(ParseRetorno(retorno)); }