Пример #1
0
 //Insert new definition into the Definition table
 public static void Insert(HindiTranslation newTranslation)
 {
     using (SQLiteConnection conn = new SQLiteConnection(new SQLite.Net.Platform.WinRT.SQLitePlatformWinRT(), DB_PATH))
     {
         conn.RunInTransaction(() =>
         {
             conn.Insert(newTranslation);
         });
     }
 }
Пример #2
0
        //Update existing definition in the database
        public static void UpdateTranslation(HindiTranslation translation)
        {
            using (SQLiteConnection conn = new SQLiteConnection(new SQLite.Net.Platform.WinRT.SQLitePlatformWinRT(), DB_PATH))
            {
                var existingEntry = conn.Query<HindiTranslation>("SELECT * FROM HindiTranslation WHERE ID =" + translation.ID).FirstOrDefault();

                if (existingEntry != null)
                {
                    conn.RunInTransaction(() =>
                    {
                        conn.Update(translation);
                    });
                }
            }
        }
        public void AddNewTranslation(string newTerm, string newUserTranslation)
        {
            if (!String.IsNullOrWhiteSpace(newTerm))
            {
                if (String.IsNullOrWhiteSpace(newUserTranslation))
                {
                    newUserTranslation = "";
                }

                HindiTranslation newTranslation = new HindiTranslation(newTerm, newUserTranslation);

                Dictionary.Add(newTranslation);
                DBHelper.Insert(newTranslation);

                CurrentTranslation           = newTranslation;
                IsCurrentTranslationSelected = true;
            }
        }