public override void OnCreate(SQLiteDatabase db)
        {
            SKLogging.WriteLog(TAG, "On create resources database !!!", SKLogging.LogDebug);
            string createMapResourcesTable =
                new StringBuilder("CREATE TABLE IF NOT EXISTS ").Append(MapsDAO.MAPS_TABLE).Append(" (")
                .Append(MapsDAO.KEY).Append(" INTEGER NOT NULL PRIMARY KEY AUTOINCREMENT, " +
                                            "").Append(MapsDAO.CODE).Append(" TEXT UNIQUE, ").Append(MapsDAO.PARENT_CODE)
                .Append(" TEXT, ").Append(MapsDAO.REGION).Append(" TEXT, ").Append(MapsDAO.NAMES).Append(" TEXT, " +
                                                                                                         "").Append(MapsDAO.SKM_FILE_PATH).Append(" TEXT, ").Append(MapsDAO.ZIP_FILE_PATH)
                .Append(" TEXT, ").Append(MapsDAO.TXG_FILE_PATH).Append(" TEXT, ")
                .Append(MapsDAO.TXG_FILE_SIZE).Append(" INTEGER, " +
                                                      "").Append(MapsDAO.SKM_AND_ZIP_FILES_SIZE)
                .Append(" INTEGER, ").Append(MapsDAO.SKM_FILE_SIZE).Append(" INTEGER, " +
                                                                           "").Append(MapsDAO.UNZIPPED_FILE_SIZE)
                .Append(" INTEGER, ").Append(MapsDAO.BOUNDING_BOX_LATITUDE_MAX).Append(" DOUBLE, ")
                .Append(MapsDAO.BOUNDING_BOX_LATITUDE_MIN).Append(" DOUBLE, ")
                .Append(MapsDAO.BOUNDING_BOX_LONGITUDE_MAX).Append(" DOUBLE, ")
                .Append(MapsDAO.BOUNDING_BOX_LONGITUDE_MIN).Append(" DOUBLE, " +
                                                                   "").Append(MapsDAO.SUBTYPE)
                .Append(" TEXT, ").Append(MapsDAO.STATE).Append(" INTEGER, ")
                .Append(MapsDAO.NO_DOWNLOADED_BYTES).Append(" INTEGER, ").Append(MapsDAO.FLAG_ID)
                .Append(" INTEGER, ").Append(MapsDAO.DOWNLOAD_PATH).Append(" TEXT)").ToString();

            db.BeginTransaction();
            db.ExecSQL(createMapResourcesTable);
            db.SetTransactionSuccessful();
            db.EndTransaction();
        }
예제 #2
0
        public void HandlePositiveButtonClick(object sender, DialogClickEventArgs e)
        {
            try
            {
                //signature = Activity.FindViewById<SignaturePadView>(Resource.Id.signatureFrame);
                Bitmap       imagen = signature.GetImage();
                MemoryStream ms     = new MemoryStream();
                //ByteArrayOutputStream bos = new ByteArrayOutputStream();
                imagen.Compress(Bitmap.CompressFormat.Png, 100, ms);
                byte[] bArray = ms.ToArray();

                //string id = Guid.NewGuid().ToString();
                System.Console.WriteLine("GUID: " + guid);
                loadConnection();
                db.BeginTransaction();
                //Se almacena en base de datos el BLOB con su respectivo GUID
                try
                {
                    string          sql        = "INSERT INTO IMAGENES (Nombre,Imagen) VALUES(?,?)";
                    SQLiteStatement insertStmt = db.CompileStatement(sql);
                    insertStmt.ClearBindings();
                    insertStmt.BindString(1, guid);
                    insertStmt.BindBlob(2, bArray);
                    insertStmt.ExecuteInsert();
                    db.SetTransactionSuccessful();
                    db.EndTransaction();
                    db.Close();
                    try
                    {
                        if (actor.Equals("notificando", StringComparison.Ordinal))
                        {
                            ManejoBaseDatos.Abrir();
                            ManejoBaseDatos.Actualizar("Notificaciones", "ValidacionNotificando", "S", "CodigoNotificacion=" + codigo + "");
                            ManejoBaseDatos.Cerrar();
                        }
                        if (actor.Equals("testigo", StringComparison.Ordinal))
                        {
                            ManejoBaseDatos.Abrir();
                            ManejoBaseDatos.Actualizar("Notificaciones", "ValidacionTestigo", "S", "CodigoNotificacion=" + codigo + "");
                            ManejoBaseDatos.Cerrar();
                        }
                    }
                    catch (Exception ex)
                    {
                        System.Console.WriteLine("Error almacenando confirmacion de firma: " + ex.ToString());
                        Toast.MakeText(this.Activity, "Error guardando confirmacion", ToastLength.Short).Show();
                    }
                }
                catch (Exception ex) { System.Console.WriteLine("Error guardando imagen en db: " + ex.ToString()); }

                Toast.MakeText(this.Activity, "Firma capturada de forma exitosa", ToastLength.Short).Show();
            }
            catch (Exception ex) { System.Console.WriteLine("ERROR guardando la imagen: " + ex.ToString()); }
        }
예제 #3
0
 private void endTransaction(SQLiteDatabase mDatabase)
 {
     if (allowTransaction)
     {
         mDatabase.EndTransaction();
     }
     if (writeLocked)
     {
         writeLock.Unlock();
         writeLocked = false;
     }
 }
예제 #4
0
 public void Insert(double Latitude, double Longitude)
 {
     if (db != null)
     {
         db.BeginTransaction();
         ContentValues values = new ContentValues();
         values.Put("ID", Guid.NewGuid().ToString());
         values.Put("latitude", Latitude);
         values.Put("longitude", Longitude);
         db.Insert("Points", null, values);
         db.EndTransaction();
     }
 }
        public override ContentProviderResult[] ApplyBatch(IList <ContentProviderOperation> operations)
        {
            SQLiteDatabase db = mOpenHelper.WritableDatabase;

            db.BeginTransaction();
            try {
                int numOperations = operations.Count;
                ContentProviderResult[] results = new ContentProviderResult[numOperations];
                for (int i = 0; i < numOperations; i++)
                {
                    results[i] = operations[i].Apply(this, results, i);
                }
                db.SetTransactionSuccessful();
                return(results);
            } finally {
                db.EndTransaction();
            }
        }
예제 #6
0
 public static void endTransaction(this SQLiteDatabase db)
 {
     db.EndTransaction();
 }