private async Task InsertTodoItem(TodoItem2 todoItem)
 {
     // This code inserts a new TodoItem into the database. When the operation completes
     // and Mobile Services has assigned an Id, the item is added to the CollectionView
     await todoTable.InsertAsync(todoItem);
     Items.Add(todoItem);
 }
Ejemplo n.º 2
0
        private void register(object sender, RoutedEventArgs e)
        {
            var todoItem = new TodoItem2
            {
                Name     = textBox.Text,
                SchoolID = textBox1.Text,
                username = textBox2.Text,
                password = passwordBox.Password,
                email    = textBox3.Text,
                phoneno  = textBox4.Text
            };
            var todoItem2 = new TodoItem4
            {
                username = textBox2.Text,
                password = passwordBox.Password,
                value    = "Parent"
            };
            string pw1 = passwordBox.Password;
            string pw2 = passwordBox2.Password;

            if (pw1.Equals(pw2))
            {
                InsertTodoItem(todoItem);
                InsertTodoItem(todoItem2);
                this.Frame.Navigate(typeof(MainPage), null);
            }
            else
            {
            }
        }
        private async void Save()
        {
            var todoItem = new TodoItem2 { Text = this.Text, Guid = Guid.NewGuid() };
            try
            {
                await InsertTodoItem(todoItem);
            }
            catch (Exception e)
            {

            }
        }
        private async void Remove(TodoItem2 item)
        {
            try
            {
                // This code takes a freshly completed TodoItem and updates the database. When the MobileService 
                // responds, the item is removed from the list 
                await todoTable.DeleteAsync(item);
                items.Remove(item);
            }
            catch
            {

            }
        }
Ejemplo n.º 5
0
        private async Task InsertTodoItem(TodoItem2 todoitem2)
        {
            await registerparent.InsertAsync(todoitem2);

            items2.Add(todoitem2);
        }