コード例 #1
0
 public Task <int> SaveItemAsync(Debt item)
 {
     if (item.ID != 0)
     {
         return(database.UpdateAsync(item));
     }
     else
     {
         return(database.InsertAsync(item));
     }
 }
コード例 #2
0
ファイル: Past.xaml.cs プロジェクト: xdman69/succ
        private void Button_Click_7(object sender, RoutedEventArgs e)
        {
            var dbConnection = DatabaseDebt;

            DebtDatabase produktDatabase = DatabaseDebt;

            Debt   item  = new Debt();
            string name  = nameDebt.Text;
            string price = newDebt.Text;
            string date  = dateDebt.Text;

            int x = Int32.Parse(price);

            item.Price = x;
            item.Date  = date;
            item.Name  = name;


            DatabaseDebt.SaveItemAsync(item);
            debtCol.Add(item);
            var itemsFromDb = DatabaseDebt.GetItemsAsync().Result;

            debtList.ItemsSource = debtCol;
            int overduePrice = 0;

            foreach (var data in itemsFromDb)
            {
                int result = DateTime.Compare(today.Date, Convert.ToDateTime(data.Date));
                //debtCount.Text = "Dluh celkem: " + data.Price;
                if (result >= 1)
                {
                    overduePrice += data.Price;
                    debtDue.Text  = "Dluh přesčas: " + overduePrice;
                }
            }
        }
コード例 #3
0
 public Task <int> DeleteItemAsync(Debt item)
 {
     return(database.DeleteAsync(item));
 }