public async Task <IActionResult> OnGetAsync() { //var userId = await _userManager.GetUserAsync(User); var lista = Task.Run(() => _appServiceAtendimento.AtendimentoAtivo(User.Identity.Name)); await lista; Input.ListaAtendimento = lista.Result.ToList(); return(Page()); }
public async Task <IActionResult> OnGetAsync() { await OnLoad(); //var user = await _userManager.GetUserAsync(User); var atendimemnto_ativio = _appServiceAtendimento.AtendimentoAtivo(User.Identity.Name).FirstOrDefault(); if (atendimemnto_ativio == null) { StatusMessage = "Não existe atendimento ativo no momento!"; return(RedirectToPage("./Index")); } Input = new() { Id = atendimemnto_ativio.Id, Protocolo = atendimemnto_ativio.Protocolo, Data = atendimemnto_ativio.Data, DataF = atendimemnto_ativio.DataF, Setor = atendimemnto_ativio.Setor, Canal = atendimemnto_ativio.Canal, Servicos = atendimemnto_ativio.Servicos, Descricao = atendimemnto_ativio.Descricao, Status = atendimemnto_ativio.Status, Ultima_Alteracao = atendimemnto_ativio.Ultima_Alteracao, Ativo = atendimemnto_ativio.Ativo, Owner_AppUser_Id = atendimemnto_ativio.Owner_AppUser_Id, Pessoa = atendimemnto_ativio.Pessoa, Empresa = atendimemnto_ativio.Empresa }; return(Page()); }
public async Task <IActionResult> OnGetAsync(Guid?id) { Input = new(); //var user = await _userManager.GetUserAsync(User); var at_ativo = Task.Run(() => _appServiceAtendimento.AtendimentoAtivo(User.Identity.Name)); at_ativo.Wait(); foreach (var at in at_ativo.Result) { StatusMessage = "Um atendimento encontra-se ativo, finalize antes de iniciar outro atendimento."; return(RedirectToPage("./Novo")); } if (id != null) { var t = Task.Run(() => _appServicePessoa.GetById((Guid)id)); await t; var e = Task.Run(() => _appServiceEmpresa.ConsultaByRazaoSocial(new Functions.Mask().Remove(t.Result.CPF))); await e; Input.Pessoa = t.Result; foreach (var emp in e.Result) { Input.Empresa = emp; } } return(Page()); }
private async Task LoadPATAsync() { var list = new List <InputModelIndex>(); var pat = await _userManager.GetUsersInRoleAsync("M_Pat"); foreach (ApplicationUser s in pat) { var t = await _appServiceStatusAtendimento.ListByUser(s.UserName); if (t.Any()) { if (t.FirstOrDefault().Online) { var ativo = _appAtendimento.AtendimentoAtivo(s.UserName); if (ativo.Any()) { list.Add(new InputModelIndex() { Atendente = s.Name + " " + s.LastName, Status = "Em Atendimento" }); } else { list.Add(new InputModelIndex() { Atendente = s.Name + " " + s.LastName, Status = "Disponível" }); } } else { list.Add(new InputModelIndex() { Atendente = s.Name + " " + s.LastName, Status = "Indisponível" }); } } else { var ativo = _appAtendimento.AtendimentoAtivo(s.UserName); if (ativo.Any()) { list.Add(new InputModelIndex() { Atendente = s.Name + " " + s.LastName, Status = "Em Atendimento" }); } else { list.Add(new InputModelIndex() { Atendente = s.Name + " " + s.LastName, Status = "Disponível" }); } } } ListaPAT = list; }