コード例 #1
0
        private void click(object sender, SelectionChangedEventArgs e)
        {
            Osoby osoba = (Osoby)ToDoItemsListView.SelectedItems[0];
            //textBox.Text = osoba.Text;
            Detail customization = new Detail(osoba);

            customization.Show();
            this.Close();
        }
コード例 #2
0
ファイル: Detail.xaml.cs プロジェクト: Mirak52/Datab-ze-osob
        private void change_Click(object sender, RoutedEventArgs e)
        {
            Osoby item = new Osoby();

            item.ID        = _osoba.ID;
            item.FirstName = namech.Text;
            item.LastName  = textch.Text;
            Database.SaveItemAsync(item);
        }
コード例 #3
0
 public Task <int> SaveItemAsync(Osoby item)
 {
     if (item.ID != 0)
     {
         return(database.UpdateAsync(item));
     }
     else
     {
         return(database.InsertAsync(item));
     }
 }
コード例 #4
0
        private void Add_Click(object sender, RoutedEventArgs e)
        {
            /*  Osoby item = new Osoby();
             * item.Name = "Vojtosaurus";
             * item.Text = textBox.Text;
             * item.Done = 0;
             * Database.SaveItemAsync(item);
             */

            if (string.IsNullOrEmpty(FirstName.Text) & string.IsNullOrEmpty(LastName.Text) &
                string.IsNullOrEmpty(LifeNumber.Text))
            {
                Text.Content = "Zadej data správně";
            }
            else
            {
                double num;
                if (double.TryParse(LifeNumber.Text, out num))
                {
                    Osoby item = new Osoby();
                    item.FirstName  = FirstName.Text;
                    item.LastName   = LastName.Text;
                    item.LifeNumber = LifeNumber.Text;
                    DateTime datumCas = DateTime.Now;
                    item.Date = datumCas;

                    item.Sex  = Man.Content.ToString();
                    item.Done = 0;
                    Database.SaveItemAsync(item);
                    var itemsFromDb = Database.GetItemsNotDoneAsync().Result;

                    ItemsCount.Content            = "Items in Database " + itemsFromDb.Count;
                    ToDoItemsListView.ItemsSource = itemsFromDb;
                    Text.Content = "Uloženo";
                }
                else
                {
                    Text.Content = "LifeNumber inst number";
                }
            }
        }
コード例 #5
0
ファイル: Detail.xaml.cs プロジェクト: Mirak52/Datab-ze-osob
 public Detail(Osoby osoba)
 {
     InitializeComponent();
     detail.Content = "ID: " + osoba.ID + " Jméno: " + osoba.FirstName + " Přijmení: " + osoba.LastName + " Datum vytvoření " + osoba.Date;
     this._osoba    = osoba;
 }
コード例 #6
0
 public Task <int> DeleteItemAsync(Osoby item)
 {
     return(database.DeleteAsync(item));
 }