Exemple #1
0
        public HttpResponseMessage PutResponderChamada([FromBody] ChamadaForPresencaVO alunoChamada)
        {
            Retorno obj = new Retorno();

            if (alunoChamada.Id > 0)
            {
                bool resposta = ChamadaDAO.MarcarPresenca(alunoChamada.Id, Metodos.GetCurrentTime());

                if (resposta)
                {
                    obj.TpRetorno        = (int)TpRetornoEnum.Sucesso;
                    obj.RetornoMensagem  = "Sucesso";
                    obj.RetornoDescricao = "Presença Confirmada!";
                }
                else
                {
                    obj.TpRetorno        = (int)TpRetornoEnum.Erro;
                    obj.RetornoMensagem  = "Aconteceu um erro na requisição.";
                    obj.RetornoDescricao = "Houve um erro na requisição, tente novamente. Caso o erro perista contate o professor!";
                }
            }
            else
            {
                obj.TpRetorno        = (int)TpRetornoEnum.Erro;
                obj.RetornoMensagem  = "Erro.";
                obj.RetornoDescricao = "Houve um erro na requisição, tente novamente!";
            }

            return(new HttpResponseMessage()
            {
                Content = new StringContent(Metodos.ObjectToJson(obj)),
                StatusCode = HttpStatusCode.OK
            });
        }
Exemple #2
0
        private void GetMateriaChamada()
        {
            Label lb = GetLabelDefaul();

            ConsumeRest getChamada = new ConsumeRest();

            string parametros = string.Format("alunoId={0}", usuario.Id);

            getChamada.GetResponse <Retorno>("alunoChamada/GetChamadaAberta", parametros).ContinueWith(t =>
            {
                if (t.IsCompleted)
                {
                    Device.BeginInvokeOnMainThread(() =>
                    {
                        Retorno obj;

                        if (t.Result is Retorno)
                        {
                            obj = (Retorno)t.Result;

                            if ((TpRetornoEnum)obj.TpRetorno == TpRetornoEnum.Sucesso && obj.ObjRetorno != null)
                            {
                                if (obj.ObjTypeName == typeof(ChamadaForPresencaVO).Name)
                                {
                                    chamada = Metodos.JsonToCustomObject <ChamadaForPresencaVO>(obj.ObjRetorno);
                                }

                                dadosChamada.BackgroundColor = Color.FromHex("328325");
                                GetDadosChamada(chamada);
                            }
                            else if ((TpRetornoEnum)obj.TpRetorno == TpRetornoEnum.Erro)
                            {
                                dadosChamada.BackgroundColor = Color.FromHex("A63030");
                            }

                            lb.Text = obj.RetornoMensagem + ((!string.IsNullOrWhiteSpace(obj.RetornoDescricao)) ?
                                                             (Environment.NewLine + obj.RetornoDescricao) : "");
                            dadosChamada.IsVisible = true;
                            dadosChamada.Content   = lb;
                        }
                    });
                }
            });
        }
Exemple #3
0
        private void ResponderChamada(ChamadaForPresencaVO alunoChamada)
        {
            Label lb = GetLabelDefaul();

            ConsumeRest putChamada = new ConsumeRest();

            putChamada.PutResponse <Retorno>("alunoChamada/ResponderChamada", alunoChamada).ContinueWith(t =>
            {
                if (t.IsCompleted)
                {
                    Device.BeginInvokeOnMainThread(() =>
                    {
                        Retorno obj;

                        if (t.Result is Retorno)
                        {
                            obj = (Retorno)t.Result;

                            if ((TpRetornoEnum)obj.TpRetorno == TpRetornoEnum.Sucesso)
                            {
                                dadosChamada.BackgroundColor = Color.FromHex("328325");
                                scroll.Content = null;
                            }
                            else if ((TpRetornoEnum)obj.TpRetorno == TpRetornoEnum.Erro)
                            {
                                dadosChamada.BackgroundColor = Color.FromHex("A63030");
                            }

                            lb.Text = obj.RetornoMensagem + ((!string.IsNullOrWhiteSpace(obj.RetornoDescricao)) ?
                                                             (Environment.NewLine + obj.RetornoDescricao) : "");
                            dadosChamada.IsVisible = true;
                            dadosChamada.Content   = lb;
                        }
                    });
                }
            });
        }
Exemple #4
0
        private void GetDadosChamada(ChamadaForPresencaVO chamada)
        {
            scroll.IsVisible = true;

            scroll.Content = new StackLayout
            {
                HorizontalOptions = LayoutOptions.FillAndExpand,

                Children =
                {
                    new Label
                    {
                        Text              = "Matéria",
                        FontSize          = Device.GetNamedSize(NamedSize.Small, typeof(Label)),
                        VerticalOptions   = LayoutOptions.Start,
                        HorizontalOptions = LayoutOptions.Start,
                        TextColor         = Color.Black
                    },

                    new Label
                    {
                        Text              = chamada.Materia,
                        FontSize          = Device.GetNamedSize(NamedSize.Medium, typeof(Label)),
                        VerticalOptions   = LayoutOptions.Start,
                        HorizontalOptions = LayoutOptions.Start,
                        FontAttributes    = FontAttributes.Bold,
                        TextColor         = Color.FromHex("1B4B67")
                    },

                    new Label
                    {
                        Text              = "Professor",
                        FontSize          = Device.GetNamedSize(NamedSize.Small, typeof(Label)),
                        VerticalOptions   = LayoutOptions.Start,
                        HorizontalOptions = LayoutOptions.Start,
                        TextColor         = Color.Black
                    },

                    new Label
                    {
                        Text              = chamada.Professor,
                        FontSize          = Device.GetNamedSize(NamedSize.Medium, typeof(Label)),
                        VerticalOptions   = LayoutOptions.Start,
                        HorizontalOptions = LayoutOptions.Start,
                        FontAttributes    = FontAttributes.Bold,
                        TextColor         = Color.FromHex("1B4B67")
                    },

                    new Label
                    {
                        Text              = "Situação",
                        FontSize          = Device.GetNamedSize(NamedSize.Small, typeof(Label)),
                        VerticalOptions   = LayoutOptions.Start,
                        HorizontalOptions = LayoutOptions.Start,
                        TextColor         = Color.Black
                    },

                    new Label
                    {
                        Text              = chamada.Situacao,
                        FontSize          = Device.GetNamedSize(NamedSize.Medium, typeof(Label)),
                        VerticalOptions   = LayoutOptions.Start,
                        HorizontalOptions = LayoutOptions.Start,
                        FontAttributes    = FontAttributes.Bold,
                        TextColor         = Color.Red
                    },

                    btnResponderChamada
                }
            };
        }