public RetornoModel <List <Setor> > GetSetores(int eventoID, int apresentacaoID, [FromUri] bool comCotaNominal = true, [FromUri] bool comCotaPromocional = true, int mostrarEstatistica = 0) { var retorno = new RetornoModel <List <Setor> >(); var stopwatch = new Stopwatch(); stopwatch.Start(); List <Setor> resultado; try { using (var setorBO = new SetorBO()) { var ado = new MasterADOBase(); var canalTipoPOS = ConfiguracaoAppUtil.GetAsInt("CanalTipoPOS"); var isPOS = new CanalBO(ado).isPOS(SessionModel.CanalID, canalTipoPOS); resultado = setorBO.Listar(apresentacaoID, eventoID, SessionModel.CanalID, comCotaNominal, comCotaPromocional, isPOS, SessionModel.SessionID, Convert.ToBoolean(mostrarEstatistica)); } } catch (Exception ex) { stopwatch.Stop(); retorno.Mensagem = ex.Message; LogUtil.Error(string.Format("##GET.Eventos/id/apresentacao/id/setores.EXCEPTION## SESSION {0}, MSG {1}, TEMPO DECORRIDO {2}", SessionModel.SessionID, ex.Message, stopwatch.Elapsed), ex); retorno.Sucesso = false; LogUtil.Error(ex); throw new HttpResponseException(Request.CreateResponse(HttpStatusCode.NotFound, ParseRetorno(retorno))); } retorno.Retorno = resultado; retorno.Sucesso = true; stopwatch.Stop(); if (resultado == null || resultado.Count == 0) { retorno.Sucesso = false; retorno.Mensagem = "Nenhum setor encontrado par a apresentação ou apresentação não encontrada"; LogUtil.Info(string.Format("##GET.Eventos/id/apresentacao/id/setores## SESSION {0}, TEMPO DECORRIDO {1}, MSG {2}", SessionModel.SessionID, stopwatch.Elapsed, retorno.Mensagem)); NewRelicIgnoreTransaction(); throw new HttpResponseException(Request.CreateResponse(HttpStatusCode.NotFound, ParseRetorno(retorno))); } retorno.Mensagem = "OK"; LogUtil.Info(string.Format("##GET.Eventos/id/apresentacao/id/setores## SESSION {0}, TEMPO DECORRIDO {1}, MSG {2}", SessionModel.SessionID, stopwatch.Elapsed, retorno.Mensagem)); 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)); }