コード例 #1
0
        public static void EditDatabase(int num, string id, string json, string id_system)
        {
            var conn = new SQLiteConnection(new SQLitePlatformWinRT(), Path.Combine(ApplicationData.Current.LocalFolder.Path, "RemindList.db"));
            var up   = conn.Table <RemindListDB>();

            //机智的我,删除和插入替换了update
            //bool isfound_id, isfound_id_system;
            //isfound_id = isfound_id_system = true;
            //if (id == null)
            //    isfound_id = false;
            //if (id_system == null)
            //    isfound_id_system = false;
            //if (isfound_id)
            //    up.Delete(x => x.Id.Equals(id));
            //else if (isfound_id_system)
            //    up.Delete(x => x.Id_system.Equals(id_system));
            //else if (isfound_id_system && isfound_id)
            //    up.Delete(x => x.Id .Equals( id) && x.Id_system.Equals( id_system));
            //else
            //{
            //}
            up.Delete(x => x.Num == num);
            RemindListDB temp = new RemindListDB()
            {
                Id = id, Id_system = id_system, json = json
            };

            conn.Insert(temp);
            conn.Dispose();
        }
コード例 #2
0
        public static RemindListDB ToModel(string id)
        {
            RemindListDB item = new RemindListDB();

            using (var conn = new SQLiteConnection(new SQLitePlatformWinRT(), Path.Combine(ApplicationData.Current.LocalFolder.Path, "RemindList.db")))
            {
                item = (from p in conn.Table <RemindListDB>()
                        where p.Id == id
                        select p).FirstOrDefault();
            }
            return(item);
        }
コード例 #3
0
        public static void EditDatabase(int num, string id, string json, string id_system)
        {
            var conn = new SQLiteConnection(new SQLitePlatformWinRT(), Path.Combine(ApplicationData.Current.LocalFolder.Path, "RemindList.db"));
            var up = conn.Table<RemindListDB>();
            //机智的我,删除和插入替换了update
            //bool isfound_id, isfound_id_system;
            //isfound_id = isfound_id_system = true;
            //if (id == null)
            //    isfound_id = false;
            //if (id_system == null)
            //    isfound_id_system = false;
            //if (isfound_id)
            //    up.Delete(x => x.Id.Equals(id));
            //else if (isfound_id_system)
            //    up.Delete(x => x.Id_system.Equals(id_system));
            //else if (isfound_id_system && isfound_id)
            //    up.Delete(x => x.Id .Equals( id) && x.Id_system.Equals( id_system));
            //else
            //{

            //}
            up.Delete(x => x.Num == num);
            RemindListDB temp = new RemindListDB() { Id = id, Id_system = id_system, json = json };
            conn.Insert(temp);



        }