Пример #1
0
        public ActionResult Index()
        {
            ParametrosViewModel model = new ParametrosViewModel();

            model.Parametros = parametrosAppService.Obter() ?? new ParametrosOrdemCompraDTO();
            model.PodeSalvar = parametrosAppService.EhPermitidoSalvar();
            CarregarCombos(model);
            return(View(model));
        }
Пример #2
0
        public ActionResult Cadastro(int?id)
        {
            PreRequisicaoMaterialCadastroViewModel model = new PreRequisicaoMaterialCadastroViewModel();
            var preRequisicaoMaterial = preRequisicaoMaterialAppService.ObterPeloId(id) ?? new PreRequisicaoMaterialDTO();

            if (id.HasValue && !preRequisicaoMaterial.Id.HasValue)
            {
                messageQueue.Add(Application.Resource.Sigim.ErrorMessages.NenhumRegistroEncontrado, TypeMessage.Error);
            }

            model.PreRequisicaoMaterial = preRequisicaoMaterial;
            model.JsonItens             = JsonConvert.SerializeObject(preRequisicaoMaterial.ListaItens, Formatting.Indented, new JsonSerializerSettings {
                ReferenceLoopHandling = ReferenceLoopHandling.Ignore
            });

            var parametros = parametrosOrdemCompraAppService.Obter();

            if (parametros != null)
            {
                model.DataMinima = parametros.DiasDataMinima.HasValue ? DateTime.Now.AddDays(parametros.DiasDataMinima.Value) : DateTime.Now;
                model.DataMaxima = parametros.DiasPrazo.HasValue ? model.DataMinima.Value.AddDays(parametros.DiasPrazo.Value) : DateTime.Now;
                model.Prazo      = parametros.DiasPrazo.HasValue ? parametros.DiasPrazo.Value : 0;
            }

            model.PodeSalvar        = preRequisicaoMaterialAppService.EhPermitidoSalvar(preRequisicaoMaterial);
            model.PodeCancelar      = preRequisicaoMaterialAppService.EhPermitidoCancelar(preRequisicaoMaterial);
            model.PodeImprimir      = preRequisicaoMaterialAppService.EhPermitidoImprimir(preRequisicaoMaterial);
            model.PodeAdicionarItem = preRequisicaoMaterialAppService.EhPermitidoAdicionarItem(preRequisicaoMaterial);
            model.PodeCancelarItem  = preRequisicaoMaterialAppService.EhPermitidoCancelarItem(preRequisicaoMaterial);
            model.PodeEditarItem    = preRequisicaoMaterialAppService.EhPermitidoEditarItem(preRequisicaoMaterial);
            model.PodeAprovarItem   = preRequisicaoMaterialAppService.EhPermitidoAprovarItem(preRequisicaoMaterial);

            return(View(model));
        }