private void initializeInfoFromDB()
        {
            stPanelIspiti.Children.Clear();
            connection  = new MySqlConnection(Properties.Settings.Default.connectionString);
            connection2 = new MySqlConnection(Properties.Settings.Default.connectionString);

            try
            {
                connection.Open();
                connection2.Open();

                string       query   = "SELECT * FROM ispiti WHERE godina=" + Convert.ToInt32(godinaStudiranja) + " AND smjer LIKE '%" + smjerSt + "%' ;";
                MySqlCommand command = new MySqlCommand(query, connection);

                MySqlDataReader reader = command.ExecuteReader();
                while (reader.Read())
                {
                    string       queryBrPrijava = "SELECT COUNT(*) FROM prijave WHERE ispiti_id=" + reader["id"] + ";";
                    MySqlCommand command2       = new MySqlCommand(queryBrPrijava, connection2);
                    Ispit        ispit          = new Ispit(reader["skraceni_naziv"].ToString(), reader["naziv"].ToString(), reader.GetDateTime(reader.GetOrdinal("datum")), int.Parse(command2.ExecuteScalar().ToString()), Convert.ToInt32(reader["id"].ToString()));
                    ispit.PromjeneUBazi += () => { initializeInfoFromDB(); };
                    stPanelIspiti.Children.Add(ispit);
                }
            }
            catch (Exception ex)
            {
                MessageBox.Show(ex.Message);
            }
            finally
            {
                connection.Close();
                connection2.Close();
            }
        }
Beispiel #2
0
 private void clickMouseLeftButtonDown(object sender, RoutedEventArgs e)
 {
     if (listaPrijavaEventRaised == false)
     {
         Ispit         ispt     = (Ispit)sender;
         WindowPrijava wPrijava = new WindowPrijava(ispt.IDIspita);
         wPrijava.Prijavljeno += () => { PromjeneUBazi(); };
         wPrijava.ShowDialog();
     }
     listaPrijavaEventRaised = false;
 }