Пример #1
0
    public void Add()
    {
        dt = DateTime.Now;

        int value = int.Parse(Qtde.text);

        if (popup.value == "School")
        {
            for (int i = 0; i < value; i++)
            {
                school = new SchoolSerialized("1234", "Escola Marota", "1234", "1234");
                schooldao.SaveOrUpdate(school);
            }
            print(school + GetTimeWated());
        }
        else if (popup.value == "Teacher")
        {
            for (int i = 0; i < value; i++)
            {
                ts = new TeacherSerialized("a", "*****@*****.**", true,
                                           "Sordi", "Rodrigo", "1234", "", "a", school);
                tsdao.SaveOrUpdate(ts);
            }
            print(ts + GetTimeWated());
        }
        else if (popup.value == "StudentGroup_Teacher")
        {
            for (int i = 0; i < value; i++)
            {
                sg_ts = new StudentGroup_TeacherSerialized(school, ts, sgs);
                sg_tsdao.SaveOrUpdate(sg_ts);
            }
            print(sg_ts + GetTimeWated());
        }
        else if (popup.value == "StudentGroup")
        {
            for (int i = 0; i < value; i++)
            {
                sgs = new StudentGroupSerialized("Group", "Manha", school, "Serie 1");
                sgsdao.SaveOrUpdate(sgs);
            }
            print(sgs + GetTimeWated());
        }
        else if (popup.value == "Student")
        {
            for (int i = 0; i < value; i++)
            {
                ss = new StudentSerialized(999999, 1l, 1000l, "", "", "", "Rodrigo", school, sgs, "Sordi");
                ssdao.SaveOrUpdate(ss);
            }
            print(ss + GetTimeWated());
        }
    }
Пример #2
0
    public List <string> LoadClassFriendsNames(StudentGroupSerialized sgs)
    {
        List <string> result = new List <string> ();

        /*List<StudentSerialized> ssList = LoadAll (); //LoadFile ();
         * foreach (StudentSerialized ss in ssList) {
         *      if (ss.getStudentGroupSerialized ().Id == sgs.Id) {
         *              result.Add (ss.getName ());
         *      }
         * }*/

        return(result);
    }
Пример #3
0
    public List <StudentSerialized> GetStudentsFromGroup(StudentGroupSerialized sgs)
    {
        List <StudentSerialized> studentsToReturn = new List <StudentSerialized> ();

        /*List<StudentSerialized> students = LoadAll ();
         *
         * if (students.Count > 0) {
         *      foreach (StudentSerialized ss in students) {
         *              if (ss != null && ss.getStudentGroupSerialized () != null && sgs != null && ss.getStudentGroupSerialized ().Id == sgs.Id) {
         *                      studentsToReturn.Add (ss);
         *              }
         *      }
         * }*/
        return(studentsToReturn);
    }
Пример #4
0
    public StudentGroup_TeacherSerialized(studentgroup_teacher sgt)
    {
        base.ObjectId  = sgt.ObjectId;
        base.CreatedAt = sgt.CreatedAt;
        base.UpdatedAt = sgt.UpdatedAt;
        //base.Id = 0;

        if (sgt.School != null)
        {
            SchoolSerialized ss = new SchoolSerializedDAO().LoadByObjectId(sgt.School.ObjectId);
            if (ss != null)
            {
                this.SchoolSerialized = ss;
            }
            else
            {
                //Debug.Log ("Serialized: There is no relationship saved");
            }
        }

        if (sgt.StudentGroup != null)
        {
            StudentGroupSerialized sgs = new StudentGroupSerializedDAO().LoadByObjectId(sgt.StudentGroup.ObjectId);
            if (sgs != null)
            {
                this.StudentGroupSerialized = sgs;
            }
            else
            {
                //Debug.Log ("Serialized: There is no relationship saved");
            }
        }

        if (sgt.Teacher != null)
        {
            TeacherSerialized ts = new TeacherSerializedDAO().LoadByObjectId(sgt.Teacher.ObjectId);
            if (ts != null)
            {
                this.TeacherSerialized = ts;
            }
            else
            {
                //Debug.Log ("Serialized: There is no relationship saved");
            }
        }
    }
Пример #5
0
    public StudentGroup(StudentGroupSerialized sgs)
    {
        if (sgs != null)
        {
            this.ObjectId = sgs.ObjectId;

            this.Name   = sgs.Name;
            this.Period = sgs.Period;
            this.Series = sgs.Series;

            School s = new School();
            if (sgs.SchoolSerialized != null)
            {
                s.ObjectId = sgs.SchoolSerialized.ObjectId;
            }
            this.School = s;
        }
    }
    public List <DiagnosisLevelSnapshotSerialized> LoadByGroupSerie(StudentGroupSerialized sgs)
    {
        List <DiagnosisLevelSnapshotSerialized> result = new List <DiagnosisLevelSnapshotSerialized> ();

        /*List<DiagnosisLevelSnapshotSerialized> dlssList = LoadAll ();// LoadFile ();
         * foreach (DiagnosisLevelSnapshotSerialized dlss in dlssList) {
         *      if (sgs != null &&
         *                      dlss != null &&
         *                  dlss.getStudentSerialized () != null &&
         *                  dlss.getStudentSerialized ().getStudentGroupSerialized () != null &&
         *                      dlss.getStudentSerialized ().getStudentGroupSerialized ().Id == sgs.Id &&
         *              dlss.getStudentSerialized ().getStudentGroupSerialized ().getSeries ().Equals(sgs.getSeries ())) {
         *              result.Add (dlss);
         *      }
         * }*/

        return(result);
    }
    //Verify if Group is in a Relation List
    public bool Contains(StudentGroupSerialized sgs, List <StudentGroup_TeacherSerialized> sg_tsList)
    {
        bool contains = false;

        /*if (sgs.Id == 0) {
         *      //Debug.Log ("Group is not saved!");
         *      return false;
         * }
         *
         * foreach (StudentGroup_TeacherSerialized sg_ts in sg_tsList) {
         *      if (sg_ts != null && sgs.Id == sg_ts.getStudentGroupSerialized ().Id) {
         *              contains = true;
         *              break;
         *      }
         * }*/

        return(contains);
    }
Пример #8
0
    public void LoadLast()
    {
        dt = DateTime.Now;

        if (popup.value == "School")
        {
            school = schooldao.LoadLast();
            print(school + GetTimeWated());
        }
        else if (popup.value == "Teacher")
        {
            ts = tsdao.LoadLast();
            print(ts + GetTimeWated());
        }
        else if (popup.value == "StudentGroup_Teacher")
        {
            sg_ts = sg_tsdao.LoadLast();
            print(sg_ts + GetTimeWated());
        }
        else if (popup.value == "StudentGroup")
        {
            sgs = sgsdao.LoadLast();
            print(sgs + GetTimeWated());
        }
        else if (popup.value == "Student")
        {
            ss = ssdao.LoadLast();
            print(ss + GetTimeWated());
        }



        /*dt = DateTime.Now;
         * int value = int.Parse (Index.text);
         * ss = dao.LoadById (value);
         * print (ss + GetTimeWated ());
         *
         *
         * /*TeacherSerialized ts = new TeacherSerialized ("a", "*****@*****.**", true, "Sordi", "Rodrigo", "1234", "", "a", ss);
         * tdao.SaveOrUpdate (ts);
         *
         * foreach (TeacherSerialized aux in tdao.LoadAll ())
         *      Debug.Log (aux);*/
    }
    public Dictionary <int, List <DiagnosisLevelSnapshotSerialized> > LoadByGroupSerieButThis(StudentGroupSerialized sgs)
    {
        //Debug.Log ("sgs.Id = " + sgs.Id);
        //Debug.Log ("sgs.getSeries () = " + sgs.getSeries ());
        Dictionary <int, List <DiagnosisLevelSnapshotSerialized> > result = new Dictionary <int, List <DiagnosisLevelSnapshotSerialized> > ();

        /*List<DiagnosisLevelSnapshotSerialized> dlssList = LoadAll ();// LoadFile ();
         * foreach (DiagnosisLevelSnapshotSerialized dlss in dlssList) {
         *      if (sgs != null &&
         *              dlss != null &&
         *                  dlss.getStudentSerialized () != null &&
         *                  dlss.getStudentSerialized ().getStudentGroupSerialized () != null &&
         *                      dlss.getStudentSerialized ().getStudentGroupSerialized ().Id != sgs.Id &&
         *              !dlss.getStudentSerialized ().getStudentGroupSerialized ().getSeries ().Equals(sgs.getSeries ())) {
         *              int id = dlss.getStudentSerialized ().getStudentGroupSerialized ().Id;
         *              if (!result.ContainsKey (id)) {
         *                      //Debug.Log ("Dont Contains and new = " + id);
         *                      result.Add (id, new List<DiagnosisLevelSnapshotSerialized> () {dlss});
         *              } else {
         *                      //Debug.Log ("Contains and add = " + id);
         *                      List<DiagnosisLevelSnapshotSerialized> value = null;
         *                      if (result.TryGetValue (id, out value)) {
         *                              value.Add (dlss);
         *                      }
         *              }
         *      }//else
         *              //Debug.Log ("Doesn enter in list = " + dlss.getStudentSerialized ().getStudentGroupSerialized ().Id);
         * }*/

        return(result);
    }
Пример #10
0
 public StudentSerialized(long birthDate, long buildingsCount, long coins, string diagnosisLevel, string gender, string guardian, string name, SchoolSerialized schoolSerialized, StudentGroupSerialized studentGroupSerialized, string lastName)
 {
     this.BirthDate              = birthDate;
     this.BuildingsCount         = buildingsCount;
     this.Coins                  = coins;
     this.DiagnosisLevel         = diagnosisLevel;
     this.Gender                 = gender;
     this.Guardian               = guardian;
     this.Name                   = name;
     this.SchoolSerialized       = schoolSerialized;
     this.StudentGroupSerialized = studentGroupSerialized;
     this.LastName               = lastName;
 }
Пример #11
0
 public StudentGroup_TeacherSerialized(SchoolSerialized schoolSerialized, TeacherSerialized teacherSerialized, StudentGroupSerialized studentGroupSerialized)
 {
     this.SchoolSerialized       = schoolSerialized;
     this.TeacherSerialized      = teacherSerialized;
     this.StudentGroupSerialized = studentGroupSerialized;
 }