Example #1
0
        private void prijaviSeGumb_Click(object sender, EventArgs e)
        {
            // Povezivanje s bazom radi provjere je li korisnik s unesenim podacima uistinu u bazi podataka
            string query = "SELECT username, password FROM Admini WHERE username = @username AND password = @password";

            using (connection = new SqlConnection(connectionString))
                using (SqlCommand command = new SqlCommand(query, connection))
                    using (SqlDataAdapter adapter = new SqlDataAdapter(command))
                    {
                        command.Parameters.AddWithValue("@username", korisnickoImeText.Text);
                        command.Parameters.AddWithValue("@password", lozinkaText.Text);

                        DataTable Admin = new DataTable();
                        adapter.Fill(Admin);

                        if (Admin.Rows.Count == 0)
                        {
                            // Korisnik nije u bazi
                            MessageBox.Show("Neispravni podaci!", "Greška");
                        }
                        else
                        {
                            // Dobra prijava
                            visi_pristup = 1;
                            this.Hide();
                            var form2 = new formaZaOdabirVremenaIDvorane(visi_pristup);
                            form2.Closed += (s, args) => this.Close();
                            form2.Show();
                        }
                    }
        }
Example #2
0
        private void vratiSeNaFormuZaODabirVremenaIDvoraneGumb_Click(object sender, EventArgs e)
        {
            this.Hide();
            formaZaOdabirVremenaIDvorane form3 = new formaZaOdabirVremenaIDvorane(vrstaKorisnika);

            form3.Closed += (s, args) => this.Close();
            form3.Show();
        }
Example #3
0
        private void pogledajRasporedGumb_Click(object sender, EventArgs e)
        {
            // sakriji trenutnu formu
            this.Hide();
            // otvori novu formu za odabir vremena pisanja kolokvija
            var form2 = new formaZaOdabirVremenaIDvorane(visi_pristup);

            form2.Closed += (s, args) => this.Close();
            form2.Show();
        }