Exemplo n.º 1
0
        public StudentskeVesti action(int idPageSent, string xxml = "")
        {
            string xml = "";

            if (xxml != "")
            {
                xml = @xxml + "";
            }
            else
            {
                xml = @teksti + "";
            }

            string naslov = "", opis = "", velikaSlika = "", malaSlika = "", tekst = "";
            int    id;

            using (XmlReader reader = XmlReader.Create(new StringReader(xml)))
            {
                reader.ReadToFollowing("vest");
                reader.MoveToFirstAttribute();
                id = Convert.ToInt32(reader.Value);
                int brojac = id;
                for (int i = 0; i < brojac; i++)
                {
                    if (id == idPageSent)
                    {
                        reader.ReadToFollowing("naslov");
                        naslov = reader.ReadElementContentAsString();

                        reader.ReadToFollowing("opis");
                        opis = reader.ReadElementContentAsString();

                        reader.ReadToFollowing("tekst");
                        tekst = reader.ReadElementContentAsString();

                        reader.ReadToFollowing("mSlika");
                        malaSlika = reader.ReadElementContentAsString();

                        reader.ReadToFollowing("vSlika");
                        velikaSlika = reader.ReadElementContentAsString();
                        break;
                    }

                    reader.ReadToFollowing("vest");
                    reader.MoveToFirstAttribute();
                    id = Convert.ToInt32(reader.Value);
                }
            }
            StudentskeVesti vest1 = new StudentskeVesti(naslov, tekst, velikaSlika, malaSlika, opis, id);

            return(vest1);
        }
Exemplo n.º 2
0
        public void upisVesti(int idPageSent)
        {
            int[] nizId = new int[4];
            int   id;

            ride.getText();

            id = ride.getMaxId();

            int brojac = 0;

            while (brojac < 4)
            {
                if (id != idPageSent)
                {
                    nizId[brojac] = id;
                    brojac++;
                }
                id--;
            }

            xml = ride.getTeksti();
            StudentskeVesti vest1 = ride.action(idPageSent);

            GlavniGrid.DataContext = vest1;


            StudentskeVesti vest2 = ride.action(nizId[0], xml);

            artikal1.DataContext = vest2;
            artikal1.Tag         = nizId[0];

            StudentskeVesti vest3 = ride.action(nizId[1], xml);

            artikal2.DataContext = vest3;
            artikal2.Tag         = nizId[1];

            StudentskeVesti vest4 = ride.action(nizId[2], xml);

            artikal3.DataContext = vest4;
            artikal3.Tag         = nizId[2];

            StudentskeVesti vest5 = ride.action(nizId[3], xml);

            artikal4.DataContext = vest5;
            artikal4.Tag         = nizId[3];
        }