Example #1
0
        private void button1_Click1(object sender, RoutedEventArgs e)
        {
            Tip man = new Tip();

            for (int i = 0; i < listaTipova.Count; i++)
            {
                if (listaTipova.ElementAt(i).id.Equals(idOdSelektovanog.Text))
                {
                    man = listaTipova.ElementAt(i);
                }
            }

            var s = new IzmenaTip(mainWindow, man);

            s.ShowDialog();
            dgrMain.Items.Refresh();
            dgrMain.SelectedItem = null;
        }
 internal static void Dodaj_tip(Tip t)
 {
     tipovi.Add(t.ID, t);
 }
        public bool FilterTask(object value)
        {
            var entry = value as Manifestacija;

            if (entry != null)
            {
                if (_filterString2 != "Filtriraj po:" && !(string.IsNullOrEmpty(_filterString)))
                {
                    if (comboBox1.SelectedIndex == 0)
                    {
                        return(true);
                    }
                    if (comboBox1.SelectedIndex == 1)
                    {
                        return(entry.pusenje && entry.ID.Contains(_filterString));
                    }
                    if (comboBox1.SelectedIndex == 2)
                    {
                        return(!(entry.pusenje) && entry.ID.Contains(_filterString));
                    }
                    if (comboBox1.SelectedIndex == 3)
                    {
                        return(entry.hendikep && entry.ID.Contains(_filterString));
                    }
                    if (comboBox1.SelectedIndex == 4)
                    {
                        return(!(entry.hendikep) && entry.ID.Contains(_filterString));
                    }
                    if (comboBox1.SelectedIndex == 5)
                    {
                        return(entry.alkohol.Contains("Dozvoljeno") && entry.ID.Contains(_filterString));
                    }
                    if (comboBox1.SelectedIndex == 6)
                    {
                        return(entry.alkohol.Contains("Nedozvoljeno") && entry.ID.Contains(_filterString));
                    }
                    if (comboBox1.SelectedIndex == 7)
                    {
                        return(entry.Cene.Contains("Besplatno") && entry.ID.Contains(_filterString));
                    }
                    if (comboBox1.SelectedIndex == 8)
                    {
                        return(entry.Cene.Contains("Niske cene") && entry.ID.Contains(_filterString));
                    }
                    if (comboBox1.SelectedIndex == 9)
                    {
                        return(entry.Cene.Contains("Srednje cene") && entry.ID.Contains(_filterString));
                    }
                    if (comboBox1.SelectedIndex == 10)
                    {
                        return(entry.Cene.Contains("Visoke cene") && entry.ID.Contains(_filterString));
                    }
                }
                else if (!string.IsNullOrEmpty(_filterString) && _filterString2 == "Filtriraj po:")
                {
                    return(entry.ID.Contains(_filterString));
                }
                else if (_filterString2 != "Filtriraj po:" && string.IsNullOrEmpty(_filterString))
                {
                    if (comboBox1.SelectedIndex == 0)
                    {
                        return(true);
                    }
                    if (comboBox1.SelectedIndex == 1)
                    {
                        return(entry.pusenje);
                    }
                    if (comboBox1.SelectedIndex == 2)
                    {
                        return(!(entry.pusenje));
                    }
                    if (comboBox1.SelectedIndex == 3)
                    {
                        return(entry.hendikep);
                    }
                    if (comboBox1.SelectedIndex == 4)
                    {
                        return(!(entry.hendikep));
                    }
                    if (comboBox1.SelectedIndex == 5)
                    {
                        return(entry.alkohol.Contains("Dozvoljeno"));
                    }
                    if (comboBox1.SelectedIndex == 6)
                    {
                        return(entry.alkohol.Contains("Nedozvoljeno"));
                    }
                    if (comboBox1.SelectedIndex == 7)
                    {
                        return(entry.Cene.Contains("Besplatno"));
                    }
                    if (comboBox1.SelectedIndex == 8)
                    {
                        return(entry.Cene.Contains("Niske cene"));
                    }
                    if (comboBox1.SelectedIndex == 9)
                    {
                        return(entry.Cene.Contains("Srednje cene"));
                    }
                    if (comboBox1.SelectedIndex == 10)
                    {
                        return(entry.Cene.Contains("Visoke cene"));
                    }
                }
                else if (comboBox2.SelectedItem != null && comboBox2.Visibility == System.Windows.Visibility.Visible)
                {
                    Tip tip = new Tip();
                    tip = (Tip)comboBox2.SelectedItem;
                    return(entry.tipovId.Contains(tip.ime));
                }


                return(true);
            }
            return(false);
        }