Пример #1
0
        private Models.TodoItem GetTodo(string to_select_title)
        {
            var db = App.conn;

            Models.TodoItem todo = null;
            using (var statement = db.Prepare("SELECT title, details, date FROM Todo WHERE Title = ?"))
            {
                statement.Bind(1, to_select_title);
                SQLiteResult result = statement.Step();
                if (SQLiteResult.ROW == result)
                {
                    todo = new TodoItem((string)statement[0], (string)statement[1], Convert.ToDateTime((string)statement[2]));
                }
            }
            return(todo);
        }
Пример #2
0
 private void Search_Click(object sender, RoutedEventArgs e)
 {
     if (SearchBox.Text != "")
     {
         Models.TodoItem todo = GetTodo(SearchBox.Text);
         if (todo == null)
         {
             var i = new MessageDialog("No result!").ShowAsync();
         }
         else
         {
             StringBuilder MyStringBuilder = new StringBuilder();
             MyStringBuilder.Append("Title: ");
             MyStringBuilder.Append(todo.title);
             MyStringBuilder.Append(" Description: ");
             MyStringBuilder.Append(todo.details);
             MyStringBuilder.Append(" Time: ");
             MyStringBuilder.Append(todo.date.ToString());
             var i = new MessageDialog(MyStringBuilder.ToString()).ShowAsync();
         }
     }
 }