Exemplo n.º 1
0
        public void Search(string text)
        {
            string          sql_like = '%' + text + '%';
            List <ListItem> list     = conn.Query <ListItem>("select * from ListItem " +
                                                             "where title like ? " +
                                                             "or detail like ? " +
                                                             "or date like ?", sql_like, sql_like, sql_like);

            Allitems.Clear();
            foreach (var item in list)
            {
                Allitems.Add(item);
            }
        }
Exemplo n.º 2
0
        public List <ListItem> Search(string text)
        {
            Regex           reg   = new Regex(text);
            SQLiteCommand   cmd   = conn.CreateCommand("select * from ListItem");
            List <ListItem> list  = cmd.ExecuteQuery <ListItem>();
            List <ListItem> list2 = new List <ListItem>();

            Allitems.Clear();
            foreach (var item in list)
            {
                if (reg.IsMatch(item.title) || reg.IsMatch(item.detail) || reg.IsMatch(item.date))
                {
                    Allitems.Add(item);
                }
            }
            return(list2);
        }
Exemplo n.º 3
0
 public async void DeleteListItem(ListItem item = null)
 {
     try {
         if (item != null)
         {
             conn.Delete(item);
             Allitems.Remove(item);
         }
         else
         {
             conn.Delete(select_item);
             Allitems.Remove(select_item);
             select_item = null;
         }
         UpdateTile();
     } catch {
         MessageDialog dialog = new MessageDialog("数据库异常,删除数据失败");
         await dialog.ShowAsync();
     }
 }
Exemplo n.º 4
0
 public async void AddListItem(ListItem item = null)
 {
     try {
         if (item != null)
         {
             conn.Insert(item);
             Allitems.Add(item);
         }
         else
         {
             conn.Insert(select_item);
             Allitems.Add(select_item);
             select_item = null;
         }
         UpdateTile();
     } catch {
         MessageDialog dialog = new MessageDialog("数据库异常,插入数据失败");
         await dialog.ShowAsync();
     }
 }