コード例 #1
0
        /*
         * Recebe informacao basica das cadeiras que o utilizador esta inscrito EM JSON
         */
        public void receiveCourses(List <jsonValues.Courses> c, Boolean multi, int courseId)
        {
            Course template;


            foreach (jsonValues.Courses co in c)
            {
                if (!multi) // Caso seja uma cadeira
                {
                    if (co.id == courseId)
                    {
                        template           = new Course();
                        template.id        = co.id;
                        template.idNumber  = co.idnumber;
                        template.shortName = co.shortname;
                        template.fullName  = co.fullname;
                        template.summary   = Course.HtmlDecode(co.summary);
                        template.lang      = lang;
                        template.visible   = co.visible;
                        courses.Add(template);
                    }
                }

                else
                {
                    template           = new Course();
                    template.id        = co.id;
                    template.idNumber  = co.idnumber;
                    template.shortName = co.shortname;
                    template.fullName  = co.fullname;
                    template.summary   = Course.HtmlDecode(co.summary);
                    template.lang      = lang;
                    template.visible   = co.visible;
                    courses.Add(template);
                }
            }
        }
コード例 #2
0
        public void receiveNotes(List <jsonValues.notes> notes, int userid)
        {
            clearNotes();
            Note template;

            foreach (jsonValues.LNotes n in notes[0].sitenotes)
            {
                template              = new Note();
                template.id           = n.id;
                template.content      = n.content;
                template.created      = n.created;
                template.lastmodified = n.lastmodified;

                if (n.publishstate.Equals("draft"))
                {
                    template.publishstate = publishstate.PERSONAL;
                }
                else
                {
                    template.publishstate = publishstate.COURSE;
                }
                notasGerais.Add(template);
            }

            foreach (jsonValues.LNotes n in notes[0].personalnotes)
            {
                template              = new Note();
                template.id           = n.id;
                template.content      = n.content;
                template.created      = n.created;
                template.lastmodified = n.lastmodified;

                if (n.publishstate.Equals("draft"))
                {
                    template.publishstate = publishstate.PERSONAL;
                    //Debug.Log(Course.HtmlDecode(template.content));
                    Values v = UnityEngine.JsonUtility.FromJson <Values>(Course.HtmlDecode(template.content));
                    foreach (jsonValues.notes not in v.notes)
                    {
                        if (not.id == userid)
                        {
                            sParam = new studentParameters(not.id, not.aproveitamento, not.assiduidade, not.tutorname);
                        }
                    }
                }
                else
                {
                    template.publishstate = publishstate.COURSE;
                }
                notasPessoais.Add(template);
            }

            foreach (jsonValues.LNotes n in notes[0].coursenotes)
            {
                template              = new Note();
                template.id           = n.id;
                template.content      = n.content;
                template.created      = n.created;
                template.lastmodified = n.lastmodified;

                if (n.publishstate.Equals("draft"))
                {
                    template.publishstate = publishstate.PERSONAL;
                }
                else
                {
                    template.publishstate = publishstate.COURSE;
                }
                notasCurso.Add(template);
            }
        }