예제 #1
0
        private void FillTransTable()
        {
            string        sql  = "SELECT * FROM public.transact_log_view_admin";
            NpgsqlCommand comm = new NpgsqlCommand(sql, super.conn);

            try
            {
                super.conn.Open();
                NpgsqlDataReader reader = comm.ExecuteReader();
                for (int i = 0; reader.Read(); i++)
                {
                    var          par0 = reader.GetInt32(0);
                    var          par1 = reader.GetString(1);
                    var          par2 = reader.GetString(2);
                    var          par3 = reader.GetInt32(3);
                    var          par4 = reader.GetDate(4).ToString();
                    var          par5 = reader.GetValue(5).ToString();
                    TransactList item = new TransactList(reader.GetInt32(0), reader.GetString(1), reader.GetString(2), reader.GetInt32(3), reader.GetDate(4).ToString(), reader.GetValue(5).ToString());
                    dg_transact.Items.Add(item);
                }
            }
            catch (NpgsqlException ex)
            {
                MessageBox.Show(ex.Message, "Ошибка на сервере", MessageBoxButton.OK, MessageBoxImage.Error, MessageBoxResult.OK);
            }
            catch (Exception ex)
            {
                MessageBox.Show(ex.Message, "Ошибка", MessageBoxButton.OK, MessageBoxImage.Error, MessageBoxResult.OK);
            }
            finally { super.conn.Close(); }
        }
예제 #2
0
        private void Dg_transact_MouseDoubleClick(object sender, MouseButtonEventArgs e)
        {
            TransactList  item = dg_transact.SelectedItem as TransactList;
            string        sql  = "select description from transact_log where id = " + item.id + "";
            NpgsqlCommand comm = new NpgsqlCommand(sql, super.conn);

            super.conn.Open();
            var      a    = comm.ExecuteScalar().ToString();
            Read_win read = new Read_win(comm.ExecuteScalar().ToString());

            read.Show();
            super.conn.Close();
        }
예제 #3
0
        private void Dg_log_MouseDoubleClick(object sender, MouseButtonEventArgs e)
        {
            Dispatcher.BeginInvoke((Action)(() => tab_panel.SelectedItem = tab_transact));
            LogList selected = dg_log.SelectedItem as LogList;

            for (int i = 0; i < dg_transact.Items.Count; i++)
            {
                TransactList item = dg_transact.Items[i] as TransactList;
                if (item.id == selected.transact_id)
                {
                    dg_transact.SelectedIndex = i;
                    dg_transact.ScrollIntoView(dg_transact.Items[i]);
                    break;
                }
            }
        }