Search in sources :

Example 6 with Trimestre

use of ca.etsmtl.applets.etsmobile.model.Trimestre in project ETSMobile-Android2 by ApplETS.

the class NoteManager method getTrimestres.

public List<Trimestre> getTrimestres() {
    DatabaseHelper dbHelper = new DatabaseHelper(context);
    List<Trimestre> trimestresList = null;
    try {
        trimestresList = dbHelper.getDao(Trimestre.class).queryForAll();
    } catch (SQLException e) {
        Log.e("SQL Exception", e.getMessage());
    }
    return trimestresList;
}
Also used : DatabaseHelper(ca.etsmtl.applets.etsmobile.db.DatabaseHelper) SQLException(java.sql.SQLException) Trimestre(ca.etsmtl.applets.etsmobile.model.Trimestre)

Example 7 with Trimestre

use of ca.etsmtl.applets.etsmobile.model.Trimestre in project ETSMobile-Android2 by ApplETS.

the class TodayFragment method onRequestSuccess.

@Override
public void onRequestSuccess(Object o) {
    if (o instanceof ListeDeSessions && ((ListeDeSessions) o).liste.size() > 0) {
        ListeDeSessions listeDeSessions = (ListeDeSessions) o;
        Date currentDate = new Date();
        Date dateStart = new Date();
        Date dateEnd = new Date();
        Collections.sort(listeDeSessions.liste, new Comparator<Trimestre>() {

            @Override
            public int compare(Trimestre t1, Trimestre t2) {
                Date dateT1 = Utility.getDateFromString(t1.dateDebut);
                Date dateT2 = Utility.getDateFromString(t2.dateDebut);
                return dateT2.compareTo(dateT1);
            }
        });
        Trimestre trimestre = null;
        // Obtention de la session précédente
        if (listeDeSessions.liste.size() > 1) {
            trimestre = listeDeSessions.liste.get(1);
            dateStart = Utility.getDateFromString(trimestre.dateDebut);
            dateEnd = Utility.getDateFromString(trimestre.dateFin);
        }
        // Si la session précédente est cours...
        if (isAdded() && trimestre != null && currentDate.after(dateStart) && currentDate.before(dateEnd)) {
            saveSemesterProgressBarDatesToPrefs(trimestre.dateDebut, trimestre.dateFin);
            setSemesterProgressBarText(dateStart, dateEnd);
        } else {
            trimestre = listeDeSessions.liste.get(0);
            dateStart = Utility.getDateFromString(trimestre.dateDebut);
            dateEnd = Utility.getDateFromString(trimestre.dateFin);
            saveSemesterProgressBarDatesToPrefs(trimestre.dateDebut, trimestre.dateFin);
            setSemesterProgressBarText(dateStart, dateEnd);
        }
    } else {
        horaireManager.onRequestSuccess(o);
    }
}
Also used : ListeDeSessions(ca.etsmtl.applets.etsmobile.model.ListeDeSessions) Trimestre(ca.etsmtl.applets.etsmobile.model.Trimestre) Date(java.util.Date)

Aggregations

Trimestre (ca.etsmtl.applets.etsmobile.model.Trimestre)7 ListeDeSessions (ca.etsmtl.applets.etsmobile.model.ListeDeSessions)4 DateTime (org.joda.time.DateTime)4 SQLException (java.sql.SQLException)3 HashMap (java.util.HashMap)3 DatabaseHelper (ca.etsmtl.applets.etsmobile.db.DatabaseHelper)2 AppletsApiCalendarRequest (ca.etsmtl.applets.etsmobile.http.AppletsApiCalendarRequest)2 SignetsMobileSoap (ca.etsmtl.applets.etsmobile.http.soap.SignetsMobileSoap)2 WebServiceSoap (ca.etsmtl.applets.etsmobile.http.soap.WebServiceSoap)2 ArrayOfFicheEmploye (ca.etsmtl.applets.etsmobile.model.ArrayOfFicheEmploye)2 ArrayOfService (ca.etsmtl.applets.etsmobile.model.ArrayOfService)2 Etudiant (ca.etsmtl.applets.etsmobile.model.Etudiant)2 FicheEmploye (ca.etsmtl.applets.etsmobile.model.FicheEmploye)2 Service (ca.etsmtl.applets.etsmobile.model.Service)2 ca.etsmtl.applets.etsmobile.model.listeHoraireExamensFinaux (ca.etsmtl.applets.etsmobile.model.listeHoraireExamensFinaux)2 ca.etsmtl.applets.etsmobile.model.listeJoursRemplaces (ca.etsmtl.applets.etsmobile.model.listeJoursRemplaces)2 ca.etsmtl.applets.etsmobile.model.listeSeances (ca.etsmtl.applets.etsmobile.model.listeSeances)2 TrimestreComparator (ca.etsmtl.applets.etsmobile.util.TrimestreComparator)2 SpiceException (com.octo.android.robospice.persistence.exception.SpiceException)2 SimpleDateFormat (java.text.SimpleDateFormat)2