public HttpResponseMessage PutEncerrarChamada([FromBody] ChamadaVO chamada) { Retorno obj = new Retorno(); if (chamada != null) { obj.ListRetorno = ChamadaDAO.EncerrarChamada(chamada.Id, Metodos.GetCurrentTime()).Cast <object>().ToList(); obj.ObjTypeName = typeof(AlunoChamadaVO).Name; obj.TpRetorno = (int)TpRetornoEnum.Sucesso; obj.RetornoMensagem = "Sucesso."; obj.RetornoDescricao = "A chamada foi encerrada."; } else { obj.TpRetorno = (int)TpRetornoEnum.SemRetorno; obj.RetornoMensagem = "Tente Novamente."; obj.RetornoDescricao = "A chamada não foi encerrada."; } return(new HttpResponseMessage() { Content = new StringContent(Metodos.ObjectToJson(obj)), StatusCode = HttpStatusCode.OK }); }
public HttpResponseMessage PutConcluirChamada([FromBody] Retorno chamada)//[FromBody] ChamadaVO chamada, [FromBody] AlunoChamadaAlteracaoVO alunos) { Retorno obj = new Retorno(); if (chamada != null) { ChamadaVO chamadaObj = Metodos.JsonToCustomObject <ChamadaVO>(chamada.ObjRetorno); List <AlunoChamadaAlteracaoVO> alunos = Metodos.JsonToCustomObject <AlunoChamadaAlteracaoVO>(chamada.ListRetorno); bool resposta = ChamadaDAO.ConcluirChamada(chamadaObj.Id, alunos); if (resposta) { obj.TpRetorno = (int)TpRetornoEnum.Sucesso; obj.RetornoMensagem = "Chamada Concluída."; } else { obj.TpRetorno = (int)TpRetornoEnum.Erro; obj.RetornoMensagem = "Falha na operação"; obj.RetornoDescricao = "Tente novamente."; } } return(new HttpResponseMessage() { Content = new StringContent(Metodos.ObjectToJson(obj)), StatusCode = HttpStatusCode.OK }); }
private void GetChamadaAberta() { ConsumeRest getChamada = new ConsumeRest(); string parametros = string.Format("professorId={0}&sitChamadaId={1}", usuario.Id, (int)SitChamadaEnum.Aberta); getChamada.GetResponse <Retorno>("chamada/ChamadaAberta", parametros).ContinueWith(t => { Device.BeginInvokeOnMainThread(() => { if ((TpRetornoEnum)t.Result.TpRetorno == TpRetornoEnum.Sucesso && t.Result.ObjRetorno != null) { if (t.Result.ObjTypeName == typeof(ChamadaVO).Name) { chamada = Metodos.JsonToCustomObject <ChamadaVO>(t.Result.ObjRetorno); ExibeDadosChamada(); } dadosChamada.BackgroundColor = Color.FromHex("328325"); } else if ((TpRetornoEnum)t.Result.TpRetorno == TpRetornoEnum.Erro) { dadosChamada.BackgroundColor = Color.FromHex("A63030"); } Label lb = GetLabelDefaul(); lb.Text = t.Result.RetornoMensagem + ((!string.IsNullOrWhiteSpace(t.Result.RetornoDescricao)) ? (Environment.NewLine + t.Result.RetornoDescricao) : ""); dadosChamada.IsVisible = true; dadosChamada.Content = lb; }); }); }
public PageListViewAluno(ChamadaVO chamadaAberta, List <AlunoChamadaVO> alunos) { this.chamada = chamadaAberta; Label header = new Label { Text = "Alunos aguardando presença", FontSize = 25, HorizontalOptions = LayoutOptions.Center, TextColor = Color.FromHex("1B4B67"), FontAttributes = FontAttributes.Bold }; StackLayout decricao = new StackLayout { Orientation = StackOrientation.Horizontal, HorizontalOptions = LayoutOptions.FillAndExpand, Padding = new Thickness(10, Device.OnPlatform(20, 5, 5), 10, 5), Children = { new Label { HorizontalOptions = LayoutOptions.Start, Text = "Aluno", TextColor = Color.FromHex("1B4B67"), FontSize = 15, FontAttributes = FontAttributes.Bold }, new Label { HorizontalOptions = LayoutOptions.EndAndExpand, Text = "Marcar Presença", TextColor = Color.FromHex("1B4B67"), FontSize = 15, FontAttributes = FontAttributes.Bold } } }; conteudo = new StackLayout { Padding = new Thickness(10, Device.OnPlatform(20, 0, 0), 10, 5), Children = { header, decricao } }; info = GetMessageDefault(); if (alunos == null || alunos.Count == 0) { info.BackgroundColor = Color.FromHex("328325"); info.Content = new Label { Text = "Todos os alunos estão presentes. Conclua a chamada!", FontSize = 20, HorizontalOptions = LayoutOptions.CenterAndExpand, VerticalOptions = LayoutOptions.Center, FontAttributes = FontAttributes.Bold, TextColor = Color.White }; } ObservableCollection <AlunoChamadaVO> alunosNaoPresentes = Metodos.ListToObservableCollection(alunos); listAlunos = ConfiguraLit(alunosNaoPresentes); if (alunos == null || alunos.Count == 0) { conteudo.Children.Add(info); } else { conteudo.Children.Add(listAlunos); } btnConcluirChamada = GetButtonDefault("CONCLUIR CHAMADA"); btnConcluirChamada.Margin = new Thickness(0, 10); btnConcluirChamada.Clicked += async(sender, args) => { bool resposta = await DisplayAlert("ATENÇÂO", "Ao concluir a chamada a mesma não estará mais disponível para alterações. Deseja Concluir?", "Concluir", "Cancelar"); if (resposta) { ConcluirChamada((listAlunos.ItemsSource as ObservableCollection <AlunoChamadaVO>)); } }; this.BackgroundColor = Color.White; this.Content = new StackLayout { Children = { GetHeader("Concluir Chamada"), conteudo, btnConcluirChamada, GetFooter() } }; }