Ejemplo n.º 1
0
        private void editIspitanik(object sender, RoutedEventArgs e)
        {
            try
            {
                edit = true;
                DodajIspitanika dodajIspitanika = new DodajIspitanika();
                dodajIspitanika.lblTitle.Content = "IZMENI ISPITANIKA";

                this.conn.Open();
                DataRowView row = (DataRowView)this.dgMain.SelectedItems[0];
                selectedRow = row;
                this.query  = @"select * from tblIspitanik where IspitanikID = " + row["ID"];

                SqlCommand    cmd    = new SqlCommand(this.query, this.conn);
                SqlDataReader reader = cmd.ExecuteReader();

                while (reader.Read())
                {
                    dodajIspitanika.tbIspitanikIme.Text      = reader["IspitanikIme"].ToString();
                    dodajIspitanika.tbIspitanikPrezime.Text  = reader["IspitanikPrezime"].ToString();
                    dodajIspitanika.tbIspitanikUsername.Text = reader["Username"].ToString();
                    dodajIspitanika.tbIspitanikPassword.Text = reader["Password"].ToString();
                }

                dodajIspitanika.ShowDialog();
            }
            catch (ArgumentOutOfRangeException)
            {
                MessageBox.Show("Morate selektovati red!");
            }
            finally
            {
                this.conn.Close();
                this.btnRNRefresh_Click(sender, e);
                this.dgMain.SelectedIndex = this.dgMain.Items.Count - 1;
                this.dgMain.ScrollIntoView(this.dgMain.SelectedItem);
                edit = false;
            }
        }
Ejemplo n.º 2
0
        private void chooseToAdd()
        {
            this.blurEffect.Radius = 5;
            this.Effect            = this.blurEffect;
            switch (this.currentlyActive)
            {
            case 1:     // otvori dodaj ucenika
                Add addNew = new Add();
                addNew.ShowDialog();
                break;

            case 2:     // otvori dodaj profesora
                DodajProfesora dodajProfesora = new DodajProfesora();
                dodajProfesora.ShowDialog();
                break;

            case 3:     // otvori dodaj instrument
                DodajInstrument dodajInstrument = new DodajInstrument();
                dodajInstrument.ShowDialog();
                break;

            case 4:     // otvori dodaj ispitanika
                DodajIspitanika dodajIspitanika = new DodajIspitanika();
                dodajIspitanika.ShowDialog();
                break;

            case 5:     // otvori dodaj ispit
                DodajIspit dodajIspit = new DodajIspit();
                dodajIspit.ShowDialog();
                break;

            case 6:     // otvori dodaj ispit
                DodajPitanje dodajPitanje = new DodajPitanje();
                dodajPitanje.ShowDialog();
                break;
            }
            this.Effect = null;
        }