Search in sources :

Example 1 with ListeDesElementsEvaluation

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

the class SignetsMobileSoap method listeElementsEvaluation.

/**
 * Liste des ��l��ments d'��valuation (devoirs, labos, examens, etc.) avec
 * la note obtenue et les statisques, comme dans SIGNETS
 */
public ListeDesElementsEvaluation listeElementsEvaluation(final String codeAccesUniversel, final String motPasse, final String pSigle, final String pGroupe, final String pSession) throws Exception {
    return (ListeDesElementsEvaluation) execute(new IWcfMethod() {

        @Override
        public ExtendedSoapSerializationEnvelope CreateSoapEnvelope() {
            ExtendedSoapSerializationEnvelope __envelope = createEnvelope();
            SoapObject __soapReq = new SoapObject("http://etsmtl.ca/", "listeElementsEvaluation");
            __envelope.setOutputSoapObject(__soapReq);
            PropertyInfo __info = null;
            __info = new PropertyInfo();
            __info.namespace = "http://etsmtl.ca/";
            __info.name = "codeAccesUniversel";
            __info.type = PropertyInfo.STRING_CLASS;
            __info.setValue(codeAccesUniversel);
            __soapReq.addProperty(__info);
            __info = new PropertyInfo();
            __info.namespace = "http://etsmtl.ca/";
            __info.name = "motPasse";
            __info.type = PropertyInfo.STRING_CLASS;
            __info.setValue(motPasse);
            __soapReq.addProperty(__info);
            __info = new PropertyInfo();
            __info.namespace = "http://etsmtl.ca/";
            __info.name = "pSigle";
            __info.type = PropertyInfo.STRING_CLASS;
            __info.setValue(pSigle);
            __soapReq.addProperty(__info);
            __info = new PropertyInfo();
            __info.namespace = "http://etsmtl.ca/";
            __info.name = "pGroupe";
            __info.type = PropertyInfo.STRING_CLASS;
            __info.setValue(pGroupe);
            __soapReq.addProperty(__info);
            __info = new PropertyInfo();
            __info.namespace = "http://etsmtl.ca/";
            __info.name = "pSession";
            __info.type = PropertyInfo.STRING_CLASS;
            __info.setValue(pSession);
            __soapReq.addProperty(__info);
            return __envelope;
        }

        @Override
        public Object ProcessResult(ExtendedSoapSerializationEnvelope __envelope, SoapObject __result) throws Exception {
            return (ListeDesElementsEvaluation) getResult(ListeDesElementsEvaluation.class, __result, "listeElementsEvaluationResult", __envelope);
        }
    }, "http://etsmtl.ca/listeElementsEvaluation");
}
Also used : SoapObject(org.ksoap2.serialization.SoapObject) PropertyInfo(org.ksoap2.serialization.PropertyInfo) ListeDesElementsEvaluation(ca.etsmtl.applets.etsmobile.model.ListeDesElementsEvaluation)

Example 2 with ListeDesElementsEvaluation

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

the class NoteManager method deleteExpiredListeDesElementsEvaluation.

/**
 * Deletes marks in DB that doesn't exist on API
 *
 * @param
 */
private void deleteExpiredListeDesElementsEvaluation(String id) {
    DatabaseHelper dbHelper = new DatabaseHelper(context);
    try {
        Dao<ListeDesElementsEvaluation, String> listeDesElementsEvaluationDao = dbHelper.getDao(ListeDesElementsEvaluation.class);
        ListeDesElementsEvaluation listeDesElementsEvaluation = listeDesElementsEvaluationDao.queryForId(id);
        if (listeDesElementsEvaluation != null) {
            Dao<ElementEvaluation, String> elementsEvaluationDao = dbHelper.getDao(ElementEvaluation.class);
            DeleteBuilder<ElementEvaluation, String> deleteBuilder = elementsEvaluationDao.deleteBuilder();
            Where where = deleteBuilder.where();
            where.eq("listeDesElementsEvaluation_id", listeDesElementsEvaluation);
            deleteBuilder.delete();
        }
        listeDesElementsEvaluationDao.deleteById(id);
    } catch (SQLException e) {
        e.printStackTrace();
    }
}
Also used : DatabaseHelper(ca.etsmtl.applets.etsmobile.db.DatabaseHelper) SQLException(java.sql.SQLException) ListeDesElementsEvaluation(ca.etsmtl.applets.etsmobile.model.ListeDesElementsEvaluation) Where(com.j256.ormlite.stmt.Where) ElementEvaluation(ca.etsmtl.applets.etsmobile.model.ElementEvaluation)

Example 3 with ListeDesElementsEvaluation

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

the class NoteManager method deleteExpiredCours.

/**
 * Deletes courses in DB that doesn't exist on API
 *
 * @param
 */
public void deleteExpiredCours(ListeDeCours listeDeCours) {
    DatabaseHelper dbHelper = new DatabaseHelper(context);
    HashMap<String, Cours> coursHashMap = new HashMap<String, Cours>();
    for (Cours cours : listeDeCours.liste) {
        cours.id = cours.sigle + cours.session;
        coursHashMap.put(cours.id, cours);
    }
    ArrayList<Cours> dbCours = new ArrayList<Cours>();
    try {
        dbCours = (ArrayList<Cours>) dbHelper.getDao(Cours.class).queryForAll();
        ArrayList<ListeDesElementsEvaluation> dbliste = (ArrayList<ListeDesElementsEvaluation>) dbHelper.getDao(ListeDesElementsEvaluation.class).queryForAll();
        for (Cours coursNew : dbCours) {
            if (!coursHashMap.containsKey(coursNew.id)) {
                Dao<Cours, String> coursDao = dbHelper.getDao(Cours.class);
                coursDao.deleteById(coursNew.id);
                deleteExpiredListeDesElementsEvaluation(coursNew.id);
            }
        }
    } catch (SQLException e) {
        e.printStackTrace();
    }
}
Also used : DatabaseHelper(ca.etsmtl.applets.etsmobile.db.DatabaseHelper) HashMap(java.util.HashMap) SQLException(java.sql.SQLException) ArrayList(java.util.ArrayList) ListeDesElementsEvaluation(ca.etsmtl.applets.etsmobile.model.ListeDesElementsEvaluation) ListeDeCours(ca.etsmtl.applets.etsmobile.model.ListeDeCours) Cours(ca.etsmtl.applets.etsmobile.model.Cours)

Example 4 with ListeDesElementsEvaluation

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

the class NoteManager method getListElementsEvaluation.

public ListeDesElementsEvaluation getListElementsEvaluation(String id) {
    DatabaseHelper dbHelper = new DatabaseHelper(context);
    ListeDesElementsEvaluation listElementsEvaluation = null;
    try {
        Dao<ListeDesElementsEvaluation, String> listElementsEvaluationsDao = dbHelper.getDao(ListeDesElementsEvaluation.class);
        listElementsEvaluation = listElementsEvaluationsDao.queryForId(id);
    } catch (SQLException e) {
        Log.e("SQL Exception", e.getMessage());
    }
    return listElementsEvaluation;
}
Also used : DatabaseHelper(ca.etsmtl.applets.etsmobile.db.DatabaseHelper) SQLException(java.sql.SQLException) ListeDesElementsEvaluation(ca.etsmtl.applets.etsmobile.model.ListeDesElementsEvaluation)

Example 5 with ListeDesElementsEvaluation

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

the class NoteManager method updateElementsEvaluation.

/**
 * Rajout de l'id pour identifier les éléments d'évaluation par rapport au cours effectué dans une session
 */
public void updateElementsEvaluation(ListeDesElementsEvaluation listElementsEvaluation) {
    DatabaseHelper dbHelper = new DatabaseHelper(context);
    try {
        dbHelper.getDao(ListeDesElementsEvaluation.class).createOrUpdate(listElementsEvaluation);
        for (ElementEvaluation elementEvaluation : listElementsEvaluation.liste) {
            elementEvaluation.id = listElementsEvaluation.id + elementEvaluation.nom;
            elementEvaluation.listeDesElementsEvaluation = listElementsEvaluation;
            dbHelper.getDao(ElementEvaluation.class).createOrUpdate(elementEvaluation);
        }
    } catch (SQLException e) {
        Log.e("SQL Exception", e.getMessage());
    }
}
Also used : DatabaseHelper(ca.etsmtl.applets.etsmobile.db.DatabaseHelper) SQLException(java.sql.SQLException) ListeDesElementsEvaluation(ca.etsmtl.applets.etsmobile.model.ListeDesElementsEvaluation) ElementEvaluation(ca.etsmtl.applets.etsmobile.model.ElementEvaluation)

Aggregations

ListeDesElementsEvaluation (ca.etsmtl.applets.etsmobile.model.ListeDesElementsEvaluation)5 DatabaseHelper (ca.etsmtl.applets.etsmobile.db.DatabaseHelper)4 SQLException (java.sql.SQLException)4 ElementEvaluation (ca.etsmtl.applets.etsmobile.model.ElementEvaluation)2 Cours (ca.etsmtl.applets.etsmobile.model.Cours)1 ListeDeCours (ca.etsmtl.applets.etsmobile.model.ListeDeCours)1 Where (com.j256.ormlite.stmt.Where)1 ArrayList (java.util.ArrayList)1 HashMap (java.util.HashMap)1 PropertyInfo (org.ksoap2.serialization.PropertyInfo)1 SoapObject (org.ksoap2.serialization.SoapObject)1