예제 #1
0
        /// <summary>
        /// Inserts the async.
        /// </summary>
        /// <returns>The async.</returns>
        /// <param name="item">Item.</param>
        public async Task <int> InsertAsync(T item)
        {
            SQLClient             client     = SQLClient.getInstance();
            SQLiteAsyncConnection connection = client.GetOrCreateConnection();

            try
            {
                int n = await connection.InsertAsync(item);

                if (n == 0)
                {
                    System.Diagnostics.Debug.WriteLine("A");
                    return(n);
                }
                else
                {
                    System.Diagnostics.Debug.WriteLine("B");
                    return(n);
                }
            }
            catch (Exception e) {
                System.Diagnostics.Debug.WriteLine("Error");
            }
            return(1);
        }
예제 #2
0
        public static async Task <bool> CreateDatabaseForSDK()
        {
            SQLClient             client     = SQLClient.getInstance();
            SQLiteAsyncConnection connection = client.GetOrCreateConnection();

            try
            {
                await connection.CreateTableAsync <Account>();

                await connection.CreateTableAsync <User>();

                await connection.CreateTableAsync <Events>();

                await connection.CreateTableAsync <Idea>();

                return(true);
            }
            catch (Exception e)
            {
                System.Diagnostics.Debug.WriteLine("Salesforce SDK Database creation Failed" + e.Message);
                return(false);
            }
        }