Example #1
0
        private void buttonPretraziClick(object sender, RoutedEventArgs e)
        {
            if (!string.IsNullOrWhiteSpace(textBoxIdTipa.Text))
            {
                var pronadjene = new ObservableCollection <Tip>();

                foreach (var data in Podaci.getInstance().Tipovi)
                {
                    if (data.Id.Contains(textBoxIdTipa.Text))
                    {
                        pronadjene.Add(new Tip(data));
                    }
                }
                Tipovi = pronadjene;
            }
            else
            {
                if (!string.IsNullOrWhiteSpace(textBoxNazivTipa.Text))
                {
                    var pronadjene = new ObservableCollection <Tip>();

                    foreach (var data in Podaci.getInstance().Tipovi)
                    {
                        if (data.Naziv.Contains(textBoxNazivTipa.Text))
                        {
                            pronadjene.Add(new Tip(data));
                        }
                    }
                    Tipovi = pronadjene;
                }
            }
        }
Example #2
0
        //===================== TIPOVI======================
        private void combo_tipovi_Loaded(object sender, RoutedEventArgs e)
        {
            var combo = sender as ComboBox;

            combo.ItemsSource       = Podaci.getInstance().Tipovi;
            combo.DisplayMemberPath = "Naziv";
        }
Example #3
0
        public PrikaziLokale()
        {
            InitializeComponent();
            WindowStartupLocation = System.Windows.WindowStartupLocation.CenterScreen;

            selektovanTip      = null;
            selektovanaEtiketa = null;
            SelektovaniLokal   = null;
            DataContext        = this;
            ObservableCollection <Lokal> l1 = new ObservableCollection <Lokal>();
            ObservableCollection <Lokal> l2 = new ObservableCollection <Lokal>();

            l1     = Podaci.JustGiveMeInstance().Lokali;
            l2     = Podaci.JustGiveMeInstance().LokaliNaMapi;
            lokali = new ObservableCollection <Lokal>();
            for (int i = 0; i < l1.Count; i++)
            {
                Lokali.Add(l1[i]);
            }
            for (int i = 0; i < l2.Count; i++)
            {
                Lokali.Add(l2[i]);
            }
            Etikete = Podaci.getInstance().Etikete;
            Tipovi  = Podaci.getInstance().Tipovi;
        }
Example #4
0
 private void Brisanje_Click(object sender, RoutedEventArgs e)
 {
     Podaci.getInstance().Lokali.Remove(LokalOrig);
     Podaci.getInstance().LokaliNaMapi.Remove(LokalOrig);
     MainWindow.instance.LokaliPins_Draw();
     Close();
 }
Example #5
0
        public PrikaziEtikete()
        {
            InitializeComponent();
            WindowStartupLocation = System.Windows.WindowStartupLocation.CenterScreen;

            SelektovanaEtiketa = null;
            DataContext        = this;
            Etikete            = Podaci.getInstance().Etikete;
        }
Example #6
0
        public PrikaziTipove()
        {
            InitializeComponent();
            WindowStartupLocation = System.Windows.WindowStartupLocation.CenterScreen;

            SelektovanTip = null;
            DataContext   = this;
            Tipovi        = Podaci.getInstance().Tipovi;
        }
Example #7
0
 public override ValidationResult Validate(object value, System.Globalization.CultureInfo cultureInfo)
 {
     try
     {
         String id = value as string;
         if (string.IsNullOrWhiteSpace(id))
         {
             return(new ValidationResult(false, "Id: ne može se sastojati samo iz razmaka"));
         }
         if (id.Any(ch => char.IsPunctuation(ch)))
         {
             return(new ValidationResult(false, "Id: znakovi interpunkcije nisu dozvoljeni."));
         }
         else
         {
             if (klasa.Equals("etiketa"))
             {
                 foreach (Etiketa etiketa in Podaci.getInstance().Etikete)
                 {
                     if (etiketa.Id.Equals(id))
                     {
                         return(new ValidationResult(false, "Id mora biti jedinstven."));
                     }
                 }
                 return(new ValidationResult(true, ""));
             }
             else if (klasa.Equals("tip"))
             {
                 foreach (Tip tip in Podaci.getInstance().Tipovi)
                 {
                     if (tip.Id.Equals(id))
                     {
                         return(new ValidationResult(false, "Id mora biti jedinstven."));
                     }
                 }
                 return(new ValidationResult(true, ""));
             }
             else
             {
                 foreach (Lokal lokal in Podaci.getInstance().Lokali)
                 {
                     if (lokal.Id.Equals(id))
                     {
                         return(new ValidationResult(false, "Id mora biti jedinstven."));
                     }
                 }
                 return(new ValidationResult(true, ""));
             }
         }
     }
     catch
     {
         return(new ValidationResult(false, "Neočekivana greška."));
     }
 }
        public PretragaNaMapi()
        {
            InitializeComponent();
            WindowStartupLocation = System.Windows.WindowStartupLocation.CenterScreen;

            selektovanTip      = null;
            selektovanaEtiketa = null;
            SelektovaniLokal   = null;
            DataContext        = this;
            Lokali             = Podaci.getInstance().LokaliNaMapi;
            Etikete            = Podaci.getInstance().Etikete;
            Tipovi             = Podaci.getInstance().Tipovi;
        }
Example #9
0
        private void Combo_tipovi_Loaded(object sender, RoutedEventArgs e)
        {
            var combo = sender as ComboBox;

            combo.ItemsSource       = Podaci.getInstance().Tipovi;
            combo.DisplayMemberPath = "Naziv";
            for (int i = 0; i < Podaci.getInstance().Tipovi.Count; i++)
            {
                if (Podaci.getInstance().Tipovi[i].Id == lokal.Tip.Id)
                {
                    combo.SelectedIndex = i;
                    break;
                }
            }
        }
Example #10
0
        private void buttonPonistiClick(object sender, RoutedEventArgs e)
        {
            textBoxIdLokala.Text     = "";
            textBoxKapacitetOd.Text  = "";
            textBoxKapacitetDo.Text  = "";
            textBoxNazivLokala.Text  = "";
            comboBoxRezervacija.Text = "";
            comboBoxHendikep.Text    = "";
            comboBoxPusenje.Text     = "";
            comboBoxAlkohol.Text     = "";
            comboBoxCene.Text        = "";
            comboBoxEtikete.Text     = "";
            comboBoxTip.Text         = "";

            Lokali = Podaci.getInstance().LokaliNaMapi;
        }
Example #11
0
        private void buttonPretraziClick(object sender, RoutedEventArgs e)
        {
            if (!string.IsNullOrWhiteSpace(textBoxIdEtikete.Text))
            {
                var pronadjene = new ObservableCollection <Etiketa>();

                foreach (var data in Podaci.getInstance().Etikete)
                {
                    if (data.Id.Contains(textBoxIdEtikete.Text))
                    {
                        pronadjene.Add(new Etiketa(data));
                    }
                }
                Etikete = pronadjene;
            }
        }
Example #12
0
 public MainWindow(string grad)
 {
     InitializeComponent();
     instance         = this;
     this.DataContext = this;
     this.grad        = grad;
     nazad            = false;
     MapaPath         = Directory.GetCurrentDirectory() + "\\Images\\" + grad + ".png";
     Lokali           = Podaci.getInstance(this.grad).Lokali;
     LokaliNaMapi     = Podaci.JustGiveMeInstance().LokaliNaMapi;
     for (int i = 0; i < lokaliNaMapi.Count; i++)
     {
         LokaliNaMapi[i].Visible = true;
     }
     LokaliPins_Draw();
     Nazad.IsEnabled = true;
 }
Example #13
0
        private void Sacuvaj_Click(object sender, RoutedEventArgs e)
        {
            id_Eror = false; naziv_Error = false; opis_Error = false; ikonica_Error = false;
            textB_id.GetBindingExpression(TextBox.TextProperty).UpdateSource();
            textB_naziv.GetBindingExpression(TextBox.TextProperty).UpdateSource();
            textB_opis.GetBindingExpression(TextBox.TextProperty).UpdateSource();
            textB_ikonica.GetBindingExpression(TextBox.TextProperty).UpdateSource();

            if (textB_id.Text == OrigTip.Id)
            {
                id_Eror = false;
            }
            else
            {
                for (int i = 0; i < Podaci.getInstance().Tipovi.Count; i++)
                {
                    if (Podaci.getInstance().Tipovi[i].Id == textB_id.Text)
                    {
                        id_Eror = true;
                        MessageBox.Show("Vec postoji tip sa tim ID-om");
                    }
                }
            }
            if (id_Eror == false && opis_Error == false && naziv_Error == false && ikonica_Error == false)
            {
                textB_id.GetBindingExpression(TextBox.TextProperty).UpdateSource();
                textB_naziv.GetBindingExpression(TextBox.TextProperty).UpdateSource();
                textB_ikonica.GetBindingExpression(TextBox.TextProperty).UpdateSource();
                textB_opis.GetBindingExpression(TextBox.TextProperty).UpdateSource();
                for (int i = 0; i < Podaci.getInstance().Tipovi.Count; i++)
                {
                    if (Podaci.getInstance().Tipovi[i].Id == OrigTip.Id)
                    {
                        Podaci.getInstance().Tipovi[i] = tip;
                    }
                }
                Close();
            }
        }
Example #14
0
 private void buttonPonistiClick(object sender, RoutedEventArgs e)
 {
     Etikete = Podaci.getInstance().Etikete;
     textBoxIdEtikete.Text = "";
 }
Example #15
0
        private void buttonPretraziClick(object sender, RoutedEventArgs e)
        {
            var pronadjene1 = new ObservableCollection <Lokal>();
            var pronadjene2 = new ObservableCollection <Lokal>();

            Lokali      = Podaci.getInstance().LokaliNaMapi;
            pronadjene2 = Lokali;
            foreach (var lokal in Lokali)
            {
                lokal.Visible = false;
            }

            if (!string.IsNullOrWhiteSpace(textBoxIdLokala.Text))
            {
                foreach (var data in Lokali)
                {
                    if (data.Id.Contains(textBoxIdLokala.Text))
                    {
                        pronadjene1.Add(data);
                    }
                }
                foreach (var lokal in pronadjene1)
                {
                    lokal.Visible = true;
                }
                MainWindow.instance.LokaliPins_Draw();
                this.Close();
            }
            else
            {
                if (!string.IsNullOrWhiteSpace(textBoxKapacitetOd.Text))
                {
                    foreach (var data in pronadjene2)
                    {
                        // Konvertuje string u int.
                        int i = 0;
                        if (!Int32.TryParse(textBoxKapacitetOd.Text, out i))
                        {
                            i = 0;
                        }

                        if (data.Kapacitet >= i)
                        {
                            pronadjene1.Add(data);
                        }
                    }
                    pronadjene2 = new ObservableCollection <Lokal>(pronadjene1);
                    pronadjene1.Clear();
                }

                if (!string.IsNullOrWhiteSpace(textBoxKapacitetDo.Text))
                {
                    foreach (var data in pronadjene2)
                    {
                        // Konvertuje string u int.
                        int i = 0;
                        if (!Int32.TryParse(textBoxKapacitetDo.Text, out i))
                        {
                            i = 0;
                        }

                        if (data.Kapacitet <= i)
                        {
                            pronadjene1.Add(data);
                        }
                    }
                    pronadjene2 = new ObservableCollection <Lokal>(pronadjene1);
                    pronadjene1.Clear();
                }
                if (!string.IsNullOrWhiteSpace(textBoxNazivLokala.Text))
                {
                    foreach (var data in pronadjene2)
                    {
                        if (data.Naziv.Contains(textBoxNazivLokala.Text))
                        {
                            pronadjene1.Add(data);
                        }
                    }
                    pronadjene2 = new ObservableCollection <Lokal>(pronadjene1);
                    pronadjene1.Clear();
                }
                if (!string.IsNullOrWhiteSpace(comboBoxRezervacija.Text))
                {
                    foreach (var data in pronadjene2)
                    {
                        if (data.PrimaRezervacije.Contains(comboBoxRezervacija.Text))
                        {
                            pronadjene1.Add(data);
                        }
                    }
                    pronadjene2 = new ObservableCollection <Lokal>(pronadjene1);
                    pronadjene1.Clear();
                }
                if (!string.IsNullOrWhiteSpace(comboBoxHendikep.Text))
                {
                    foreach (var data in pronadjene2)
                    {
                        if (data.DostupanHendikepiranim.Contains(comboBoxHendikep.Text))
                        {
                            pronadjene1.Add(data);
                        }
                    }
                    pronadjene2 = new ObservableCollection <Lokal>(pronadjene1);
                    pronadjene1.Clear();
                }
                if (!string.IsNullOrWhiteSpace(comboBoxPusenje.Text))
                {
                    foreach (var data in pronadjene2)
                    {
                        if (data.DozvoljenoPusenje.Contains(comboBoxPusenje.Text))
                        {
                            pronadjene1.Add(data);
                        }
                    }
                    pronadjene2 = new ObservableCollection <Lokal>(pronadjene1);
                    pronadjene1.Clear();
                }
                if (!string.IsNullOrWhiteSpace(comboBoxAlkohol.Text))
                {
                    foreach (var data in pronadjene2)
                    {
                        if (data.SluziAlkohol.Contains(comboBoxAlkohol.Text))
                        {
                            pronadjene1.Add(data);
                        }
                    }
                    pronadjene2 = new ObservableCollection <Lokal>(pronadjene1);
                    pronadjene1.Clear();
                }
                if (!string.IsNullOrWhiteSpace(comboBoxCene.Text))
                {
                    foreach (var data in pronadjene2)
                    {
                        if (data.CenovnaKategorija.Contains(comboBoxCene.Text))
                        {
                            pronadjene1.Add(data);
                        }
                    }
                    pronadjene2 = new ObservableCollection <Lokal>(pronadjene1);
                    pronadjene1.Clear();
                }
                if (!string.IsNullOrWhiteSpace(comboBoxEtikete.Text))
                {
                    foreach (var data in pronadjene2)
                    {
                        foreach (var data2 in data.Etikete)
                        {
                            if (data2.Id.Equals(comboBoxEtikete.Text))
                            {
                                pronadjene1.Add(data);
                            }
                        }
                    }
                    pronadjene2 = new ObservableCollection <Lokal>(pronadjene1);
                    pronadjene1.Clear();
                }
                if (!string.IsNullOrWhiteSpace(comboBoxTip.Text))
                {
                    foreach (var data in pronadjene2)
                    {
                        if (data.Tip.Naziv.Contains(comboBoxTip.Text))
                        {
                            pronadjene1.Add(data);
                        }
                    }
                    pronadjene2 = new ObservableCollection <Lokal>(pronadjene1);
                }

                foreach (var lokal in pronadjene2)
                {
                    lokal.Visible = true;
                }
                MainWindow.instance.PNM.Header  = "Poništi";
                MainWindow.instance.PNM.ToolTip = "Poništi pretragu lokala na mapi - CTRL+P";
                MainWindow.instance.LokaliPins_Draw();
                this.Close();
            }
        }
Example #16
0
 private void Brisanje_Click(object sender, RoutedEventArgs e)
 {
     Podaci.getInstance().Etikete.Remove(origEtiketa);
     Close();
 }
Example #17
0
 private void Brisanje_Click(object sender, RoutedEventArgs e)
 {
     Podaci.getInstance().Tipovi.Remove(origTip);
     Close();
 }
Example #18
0
 private void buttonPonistiClick(object sender, RoutedEventArgs e)
 {
     Tipovi                = Podaci.getInstance().Tipovi;
     textBoxIdTipa.Text    = "";
     textBoxNazivTipa.Text = "";
 }