Exemple #1
0
    //At YOMO free network without transaction each record needs 0.9 seconds
    //At YOMO free network with transaction each record needs 0.3 seconds
    public static void UploadExhibitionTestsPending()
    {
        Json json = new Json();

        Sqlite.Open();         // ---------------->

        int countSucceded = 0;
        List <ExhibitionTest> listEtTemp = SqliteJson.SelectTempExhibitionTest(true);

        if (listEtTemp.Count > 0)
        {
            LogB.Information("Starting to upload {0} exhibitionTests...");
            using (SqliteTransaction tr = dbcon.BeginTransaction())
            {
                using (SqliteCommand dbcmdTr = dbcon.CreateCommand())
                {
                    dbcmdTr.Transaction = tr;

                    foreach (ExhibitionTest et in listEtTemp)
                    {
                        bool success = json.UploadExhibitionTest(et);
                        //LogB.Information(json.ResultMessage);
                        if (success)
                        {
                            countSucceded++;
                            SqliteJson.DeleteTempExhibitionTest(true, et, dbcmdTr);                             //delete the record
                        }
                    }
                }
                tr.Commit();
            }
            LogB.Information(string.Format("Done! succeded {0}/{1}", countSucceded, listEtTemp.Count));
        }
        Sqlite.Close();         // <----------------
    }
Exemple #2
0
    /*
     * EXHIBITION //right now does not upload to server when connection returns
     */

    public static void UploadExhibitionTest(ExhibitionTest et)
    {
        Json js = new Json();

        if (!js.UploadExhibitionTest(et))
        {
            LogB.Error(js.ResultMessage);
            SqliteJson.InsertTempExhibitionTest(false, et);             //insert only if could'nt be uploaded
        }
    }