Пример #1
0
        public Task <long> ClassificarRelato(ClassificarRelatoCommand command)
        {
            var requestUrl = CreateRequestUri(string.Format(System.Globalization.CultureInfo.InvariantCulture,
                                                            $"{ResourceRelato}/ClassificarRelato"));

            return(Post(requestUrl, command));
        }
        public async Task <ActionResult <bool> > ClassificarRelato(ClassificarRelatoCommand command)
        {
            try
            {
                var result = await Mediator.Send(command);

                return(result);
            }
            catch (Exception e)
            {
                Console.WriteLine(e);
                throw;
            }
        }
        public async Task <ActionResult <bool> > UpdateRelato(ClassificarRelatoCommand command)
        {
            try
            {
                var sgsoRole = await _roleManager.FindByNameAsync(UserRoles.GestorSgsoSite);

                command.CodPerfilSgso = sgsoRole.Id;

                command.CodSituacaoAtribuicao = (int)EnumSituacaoAtribuicao.OcorrenciaAtribuida;

                var result = await Mediator.Send(command);

                return(result);
            }
            catch (Exception e)
            {
                Console.WriteLine(e);
                throw;
            }
        }
        public async Task <IActionResult> Edit(IFormCollection collection)
        {
            try
            {
                var subAssunto = 0;
                if (collection["ddlSubAssunto"].ToString().Length > 0)
                {
                    subAssunto = int.Parse(collection["ddlSubAssunto"].ToString());
                }

                var subLocal = 0;
                if (collection["ddlSubLocal"].ToString().Length > 0)
                {
                    subLocal = int.Parse(collection["ddlSubLocal"].ToString());
                }

                var command = new ClassificarRelatoCommand
                {
                    CodRelato     = int.Parse(collection["CodRelato"].ToString()),
                    AlteradoPor   = User.Identity.Name,
                    CodLocal      = int.Parse(collection["ddlLocal"].ToString()),
                    CodSubLocal   = subLocal,
                    CodAssunto    = int.Parse(collection["ddlAssunto"].ToString()),
                    CodSubAssunto = subAssunto,
                    //Rn0034
                    FlgStatusRelato = (int)EnumStatusRelato.Ocorrenciaclassificada,
                    DscClassificada = "Ocorrência classificada, " + DateTime.Now.ToString("dd/MM/yyyy") + ", " + DateTime.Now.ToString("hh:mm"),
                    //Rn0073
                    DscOcorrenciaRelator = collection["DscOcorrenciaRelator"].ToString(),
                    FlgDscOcorrencia     = Convert.ToBoolean(collection["FlgDscOcorrencia"].ToString())
                };

                var idRelato = await ApiClientFactory.Instance.ClassificarRelato(command);

                return(RedirectToAction(nameof(Index), new { crud = (int)EnumCrud.Updated }));
            }
            catch (Exception e)
            {
                return(RedirectToAction(nameof(Index), new { notify = (int)EnumNotify.Error, message = e.Message.ToString() }));
            }
        }