private void CarregarListas(RelOrcamentoListaViewModel model) { List <ObraDTO> lista = new List <ObraDTO>(); EmpresaDTO empresa = empresaAppService.ObterEmpresaSemObraPai(model.Filtro.EmpresaId); if (empresa != null && empresa.ListaObraSemPai != null) { lista = empresa.ListaObraSemPai; } model.ListaEmpresa = new SelectList(empresaAppService.ListarTodos(), "Id", "NumeroNomeEmpresa", model.Filtro.EmpresaId); model.ListaObra = new SelectList(lista, "Id", "NumeroDescricao", model.Filtro.ObraId); model.ListaIndice = new SelectList(indiceFinanceiroAppService.ListarTodos().OrderBy(l => l.Indice), "Id", "Indice", model.Filtro.IndiceId); }
public ActionResult Index() { var model = new RelOrcamentoListaViewModel(); model.Filtro.PaginationParameters.PageSize = this.DefaultPageSize; model.Filtro.PaginationParameters.UniqueIdentifier = GenerateUniqueIdentifier(); model.PodeImprimir = orcamentoAppService.EhPermitidoImprimirRelOrcamento(); CarregarListas(model); model.JsonItensClasse = JsonConvert.SerializeObject(new List <ClasseDTO>(), Formatting.Indented, new JsonSerializerSettings { ReferenceLoopHandling = ReferenceLoopHandling.Ignore }); return(View(model)); }
public ActionResult Imprimir(RelOrcamentoListaViewModel model) { if (ModelState.IsValid) { Session["Filtro"] = model; model.Filtro.ListaClasse = Newtonsoft.Json.JsonConvert.DeserializeObject <List <ClasseDTO> >(model.JsonItensClasse); OrcamentoDTO orcamentoDTO = orcamentoAppService.GerarRelatorioOrcamento(model.Filtro); if (orcamentoDTO == null) { messageQueue.Add(Application.Resource.Sigim.ErrorMessages.InformacaoNaoEncontrada, TypeMessage.Error); return(PartialView("_NotificationMessagesPartial")); } TempData["orcamentoDTO"] = orcamentoDTO; return(Content("<script>executarImpressao();</script>")); } return(Content("<script>smartAlert(\"Atenção\", \"Ocorreu erro ao tentar imprimir !\", \"warning\")</script>")); }