Example #1
0
        private void AddTransaction_Click(object sender, RoutedEventArgs e)
        {
            int    month     = MTH.SelectedIndex;
            int    year      = Int32.Parse(YR.Text);
            int    count     = Pocet.SelectedIndex + 1;
            int    item      = Itemy.SelectedIndex + 1;
            bool   paid      = Convert.ToBoolean(Paid.IsChecked);
            Seznam ids       = (Seznam)Seznamy.SelectedItem;
            int    idseznamu = ids.ID;

            try
            {
                Transakce t = new Transakce();
                t.IDPredmet = item;
                t.Mnozstvi  = count;
                t.Rok       = year;
                t.Mesic     = month;
                t.Zaplaceno = paid;
                t.IDSeznamu = idseznamu;

                App.Database.SaveItems <Transakce>(t);
                MessageBox.Show("Výdaj byl přidán");
            }
            catch
            {
                MessageBox.Show("Něco se pokazilo");
            }
        }
Example #2
0
        private void Delete_Click(object sender, RoutedEventArgs e)
        {
            string    y = (string)TransakceLV.SelectedItem;
            string    v = y.Split('.')[0];
            int       r = Int32.Parse(v);
            Transakce l = new Transakce();

            l.ID = r;
            App.Database.DeleteItem <Transakce>(l);
            FillTR();
        }