Example #1
0
        private void button1_Click(object sender, RoutedEventArgs e)
        {
            if (ls != null)
            {
                Studenti s = ls.Find(jmbg.Text);

                if (s != null)
                {
                    MessageBox.Show(s + " uspesno zaposlen! :) ");
                    Zaposlen z = s;
                    ls.Delete(s);
                    if (lz == null)
                    {
                        lz = new ListaStudenata <Zaposlen>(z);
                    }
                    else
                    {
                        lz.Add(z);
                    }


                    string st = "";
                    foreach (var item in lz)
                    {
                        st += item;
                    }

                    MessageBox.Show(st);
                }
            }
            else
            {
                MessageBox.Show("Takav student ne postoji");
            }
        }
Example #2
0
        public void Add(T student)
        {
            ListaStudenata <T> ls    = new ListaStudenata <T>(student);
            ListaStudenata <T> lista = this;

            while (lista.Next != null)
            {
                lista = lista.Next;
            }
            lista.Next = ls;
        }
Example #3
0
        private void button_Click(object sender, RoutedEventArgs e)
        {
            if (ls == null)
            {
                ls = new ListaStudenata <Studenti>(new Studenti(index.Text, upisan.Text, jmbg.Text, int.Parse(godine.Text)));
            }
            else
            {
                ls.Add(new Studenti(index.Text, upisan.Text, jmbg.Text, int.Parse(godine.Text)));
            }

            string st = "";

            foreach (var item in ls)
            {
                st += item;
            }
            dogadjaj(int.Parse(godine.Text));
            MessageBox.Show(st);
        }
Example #4
0
        public bool Delete(T student)
        {
            ListaStudenata <T> lista = this;

            if (lista.S.Equals(student))
            {
                S          = lista.Next.S;
                lista.Next = lista.Next.Next;
                return(true);
            }
            while (lista.Next != null)
            {
                if (lista.Next.S.Equals(student))
                {
                    lista.Next = lista.Next.Next;
                    return(true);
                }
                lista = lista.Next;
            }
            return(false);
        }
Example #5
0
        public T this[int index]
        {
            get
            {
                ListaStudenata <T> ls = this;
                int br = 0;

                while (br++ != index && ls != null)
                {
                    ls = ls.Next;
                }
                if (ls != null)
                {
                    return(ls.s);
                }
                return(null);
            }
            set
            {
                S = value;
            }
        }