Пример #1
0
        static public bool Upsert(int FontSize, string BibleName, int Chapter, int Verse, string UserName, string Passwd, int id = 1)
        {
            UserCacheData data = new UserCacheData();

            data.FontSize  = FontSize;
            data.Id        = id;
            data.BibleName = BibleName;
            data.Chapter   = Chapter;
            data.Verse     = Verse;
            data.UserName  = UserName;
            data.Passwd    = Passwd;

            return(Upsert(data));
        }
Пример #2
0
        static public bool Upsert(UserCacheData Data)
        {
            string DBPath = System.IO.Path.Combine(System.Environment.GetFolderPath(System.Environment.SpecialFolder.MyDocuments), "WBA.db");

            var db = new SQLiteConnection(DBPath);

            db.CreateTable <UserCacheData>();


            var list = db.Query <UserCacheData>("select * from User where _id = ?", Data.Id);

            if (list.Count == 0)
            {
                // only insert the data if it doesn't already exist
                db.Insert(Data);
            }
            else
            {
                db.Update(Data);
            }

            return(true);
        }