예제 #1
0
        private async void Uloz_Prijem_Click(object sender, RoutedEventArgs e)
        {
            _cena       = Prijata_Castka.Text;
            _utracenoZa = PrijatoZa.Text;

            if (Kalendar.SelectedDate.HasValue)
            {
                _datum = Kalendar.SelectedDate.Value;
            }
            else
            {
                _datum = DateTime.Now.Date;
            }

            int.TryParse(_zustatek, out int _zustatekF);
            int.TryParse(_cena, out int _cenaF);

            _zustatekF += _cenaF;

            _zustatek = _zustatekF.ToString();

            Finance_Items entry1 = new Finance_Items()
            {
                Zustatek = _zustatek, Prijem = _cena, Vydej = "0", Nazev = _utracenoZa, Kategorie = _selectedCategory, Datum = _datum
            };

            await database.SaveItemAsync_FinanceItems(entry1);

            FromPrijem.Content = new MainPage();
        }
예제 #2
0
 public Task <int> SaveItemAsync_FinanceItems(Finance_Items item)
 {
     if (item.ID != 0)
     {
         return(database.UpdateAsync(item));
     }
     else
     {
         return(database.InsertAsync(item));
     }
 }
        private async void Uloz_Prijem_Click(object sender, RoutedEventArgs e)
        {
            _dluhOd  = Pujceno_Nazev.Text;
            _pujceno = Pujceno_Castka.Text;
            _sazba   = Sazba.Text;

            if (PocatekKalendar.SelectedDate.HasValue)
            {
                _datumPoc = PocatekKalendar.SelectedDate.Value;
            }
            else
            {
                _datumPoc = DateTime.Now;
            }

            if (KonecKalendar.SelectedDate.HasValue)
            {
                _datumKon = KonecKalendar.SelectedDate.Value;
            }
            else
            {
                _datumKon = DateTime.Now;
            }

            int.TryParse(_puvodni_zustatek, out int _puvodni_zustatekF);
            int.TryParse(_pujceno, out int _pujcenoF);

            _puvodni_zustatekF = _puvodni_zustatekF - _pujcenoF;
            _puvodni_zustatek  = _puvodni_zustatekF.ToString();



            Dluhy_Items entry1 = new Dluhy_Items()
            {
                Nazev = _dluhOd, PocatekPujcky = _datumPoc, KonecPujcky = _datumKon, Sazba = _sazba, VysePujcky = _pujceno
            };
            await database.SaveItemAsync_DluhyItems(entry1);

            Finance_Items entry2 = new Finance_Items()
            {
                Zustatek = _puvodni_zustatek, Prijem = "0", Vydej = _pujceno, Nazev = _dluhOd + "- Půjčka", Kategorie = "Půjčka", Datum = _datumPoc
            };
            await database.SaveItemAsync_FinanceItems(entry2);

            FromDluh.Content = new MainPage();
        }