Exemplo n.º 1
0
        public void Refresh()
        {
            conn.Open();
            MySqlCommand cmd = new MySqlCommand("Select id, ime, prezime, email, telefon, adresa, extra from pacijenti", conn);

            adap = new MySqlDataAdapter(cmd);
            ds   = new DataSet();
            adap.Fill(ds, "LoadDataBindingPacijenti");
            DataGridPacijent.DataContext = ds;
            Ida.Clear();
            ime.Clear();
            prezime.Clear();
            email.Clear();
            telefon.Clear();
            adresa.Clear();
            extra.Clear();
            Search.Clear();
            Save.Content    = "Sačuvaj"; // Save iz buton sacuvaj
            Save.Background = Brushes.LightSkyBlue;
            conn.Close();
        }
Exemplo n.º 2
0
 public void DataGridOnClick()
 {
     try
     {
         Ida.Clear();    // Try and Ida.Clear(); Stop null error
         object item    = DataGridPacijent.SelectedItem;
         string ID      = (DataGridPacijent.SelectedCells[0].Column.GetCellContent(item) as TextBlock).Text;
         string IME     = (DataGridPacijent.SelectedCells[1].Column.GetCellContent(item) as TextBlock).Text;
         string PREZIME = (DataGridPacijent.SelectedCells[2].Column.GetCellContent(item) as TextBlock).Text;
         string EMAIL   = (DataGridPacijent.SelectedCells[3].Column.GetCellContent(item) as TextBlock).Text;
         string TELEFON = (DataGridPacijent.SelectedCells[4].Column.GetCellContent(item) as TextBlock).Text;
         string ADRESA  = (DataGridPacijent.SelectedCells[5].Column.GetCellContent(item) as TextBlock).Text;
         string EXTRA   = (DataGridPacijent.SelectedCells[6].Column.GetCellContent(item) as TextBlock).Text;
         Ida.Text     = ID;
         ime.Text     = IME;
         prezime.Text = PREZIME;
         email.Text   = EMAIL;
         adresa.Text  = ADRESA;
         telefon.Text = TELEFON;
         extra.Text   = EXTRA;
     }
     catch (Exception)
     {
         //code for any other type of exception
     }
     if (Ida.Text != "")
     {
         Save.Content    = "Izmeni";
         Save.Background = Brushes.LightCoral;
     }
     else
     {
         Save.Content    = "Sačuvaj";
         Save.Background = Brushes.LightSkyBlue;
     }
 }