Exemple #1
0
        public ItemA Podrobno(string a, string b)
        {
            ItemA item = new ItemA();

            using (NpgsqlConnection con = new NpgsqlConnection("Server=hattie.db.elephantsql.com; User Id=qrallryw;" + "Password=42JSx-SoQO5TfgzavjTAU5Bz2qJli0rN; Database=qrallryw;"))
            {
                con.Open();
                NpgsqlCommand    com    = new NpgsqlCommand("SELECT * FROM return_podrobno_arhiv(" + Public.id + ",'" + a + "'," + b + ")", con);
                NpgsqlDataReader reader = com.ExecuteReader();
                while (reader.Read())
                {
                    item = new ItemA(Convert.ToString(reader.GetDouble(1)), reader.GetString(2), reader.GetString(3), reader.GetDateTime(0));
                }
                con.Close();
            }
            return(item);
        }
Exemple #2
0
        private void PodrobnoButton_Click(object sender, EventArgs e)
        {
            try
            {
                groupBox1.Visible         = true;
                DatumDateTimePicker.Value = Convert.ToDateTime(listView1.SelectedItems[0].SubItems[1].Text);
                string b = listView1.SelectedItems[0].SubItems[2].Text;
                string a = DatumDateTimePicker.Value.ToString("yyyy-MM-dd");

                if ((a != null) && (b != null))
                {
                    ItemA item = A.Podrobno(a, b);
                    DatumDateTimePicker.Value = item.D;
                    ZnesekTextBox.Text        = item.A;
                    LokacijaTextBox.Text      = item.B;
                    KrajTextBox.Text          = item.C;
                }
                else
                {
                    MessageBox.Show("Prosimo izberite željen račun ter določite datum");
                }
            }
            catch (Exception)
            {
                try
                {
                    DatumDateTimePicker.Value = Convert.ToDateTime(listView1.SelectedItems[0].SubItems[1].Text);
                    ZnesekTextBox.Text        = listView1.SelectedItems[0].SubItems[2].Text;
                    MessageBox.Show("Ta podatek nima lokacije");;
                }
                catch (Exception)
                {
                    MessageBox.Show("napaka");
                }
            }
        }