Exemple #1
0
        public ha_add_new_entry()
        {
            InitializeComponent();

            DataContext          = new ComboBoxViewModel();
            tb_data.SelectedDate = DateTime.Today;
        }
        private void Select()
        {
            model = new ComboBoxViewModel();

            try
            {
                connection.Open();
                //sql = "select to_char(Дата,'dd-mm-yyyy') as \"Дата\", \"Основная категория\", Категория, Стоимость, Комментарий, id from mainSelect()";

                sql = "select strftime('%d-%m-%Y',e.date) as \"Дата\", m.name as \"Основная категория\",n.name as Категория, ABS(e.cost) as Стоимость, e.comment as Комментарий, e.id as id from Entry as e " +
                      " left join NameCategory as n " +
                      " on e.name_category = n.id " +
                      " left join MainCategory as m " +
                      " on e.main_category = m.id " +
                      " order by e.date; ";

                cmd = new SQLiteCommand(sql, connection);
                cmd.ExecuteNonQuery();

                SQLiteDataAdapter dataAdapter = new SQLiteDataAdapter(cmd);

                dt = new DataTable("mainSelect()");
                dataAdapter.Fill(dt);
                dg.ItemsSource = dt.DefaultView;
                connection.Close();
            }
            catch (Exception ex)
            {
                connection.Close();
            }
        }
        public MainWindow()
        {
            connection_string = @"Data Source=db\homeaccountingdb.db; Version=3";
            InitializeComponent();

            tb_data.SelectedDate = DateTime.Today;

            model       = new ComboBoxViewModel();
            DataContext = new ComboBoxViewModel();
        }
Exemple #4
0
        public MainWindow()
        {
            string server   = "localhost";
            string port     = "5432";
            string user_id  = "homeaccountingUser";
            string password = "******";
            string database = "homeaccountingtest";

            connection_string = $"Server={server};Port={port};" +
                                $"User Id={user_id};Password={password};" +
                                $"Database={database};";
            InitializeComponent();

            tb_data.SelectedDate = DateTime.Today;

            model       = new ComboBoxViewModel();
            DataContext = new ComboBoxViewModel();
        }
Exemple #5
0
        private void Select()
        {
            model = new ComboBoxViewModel();

            try
            {
                connection.Open();
                sql = "select to_char(Дата,'dd-mm-yyyy') as \"Дата\", \"Основная категория\", Категория, Стоимость, Комментарий, id from mainSelect()";
                cmd = new NpgsqlCommand(sql, connection);
                cmd.ExecuteNonQuery();

                NpgsqlDataAdapter dataAdapter = new NpgsqlDataAdapter(cmd);

                dt = new DataTable("mainSelect()");
                dataAdapter.Fill(dt);
                dg.ItemsSource = dt.DefaultView;
                connection.Close();
            }
            catch (Exception ex)
            {
                connection.Close();
            }
        }