Пример #1
0
        public void zamenaMesta(int indexA, int indexB)
        {
            ProfesorC tmp = prof[indexA];

            prof[indexA] = prof[indexB];
            prof[indexB] = tmp;
            ind          = indexA;
            switch (indexA)
            {
            case 0: pozI = 0; pozJ = 0; break;

            case 1: pozI = 0; pozJ = 2; break;

            case 2: pozI = 0; pozJ = 4; break;

            case 3: pozI = 0; pozJ = 6; break;

            case 4: pozI = 2; pozJ = 0; break;

            case 5: pozI = 2; pozJ = 2; break;

            case 6: pozI = 2; pozJ = 4; break;

            case 7: pozI = 2; pozJ = 6; break;
            }
        }
Пример #2
0
        public void napuni()
        {
            Baza baza = new Baza();
            string kabinet, mejl, konsultacije = "";
            string biografija = "Нема описа.";
            string aktivnost = "Нема описа.";

            upit = "SELECT * FROM profesori WHERE idprofesor = " + id;
            using (reader = baza.izvrsiUpit(upit))
            {
                while (reader.Read())
                {
                    if (reader.GetString("biografija") != "") biografija = reader.GetString("biografija");
                    if (reader.GetString("aktivnost") != "") aktivnost = reader.GetString("aktivnost");

                    profesor = new ProfesorC(reader.GetString("idProfesor"), reader.GetString("imePrezime"), reader.GetString("titula"), reader.GetString("zvanje"), reader.GetString("slika"), reader.GetString("konsultacije"), reader.GetString("kabinet"), reader.GetString("mail"), biografija, aktivnost);
                    gridProfesor.DataContext = profesor;
                }
            }

            upit1 = "SELECT * FROM predmeti WHERE id_predm IN (SELECT id_predm FROM pplink WHERE id_prof = " + id + ")";
            using (reader = baza.izvrsiUpit(upit1))
            {
                while (reader.Read())
                {
                    Predmet p = new Predmet(reader.GetString("id_predm"), reader.GetString("naziv"));
                    lvPredmeti.Items.Add(p);
                }
            }
        }
Пример #3
0
        public void dodajStavkuListe(ProfesorC p)
        {
            StackPanel sp = new StackPanel();

            sp.Tag = p.idProfesor;
            Grid      g  = new Grid();
            Rectangle r  = new Rectangle();
            TextBlock tb = new TextBlock();



            ColumnDefinition c = new ColumnDefinition();

            c.Width = new GridLength(1, GridUnitType.Auto);

            ColumnDefinition c1 = new ColumnDefinition();

            c1.Width = new GridLength(1, GridUnitType.Star);

            g.ColumnDefinitions.Add(c);
            g.ColumnDefinitions.Add(c1);

            r.Height = 70;
            r.Width  = 70;
            ImageBrush imageBrush = new ImageBrush();
            string     putanja    = "ms-appx://" + p.slika;

            imageBrush.ImageSource = new BitmapImage(new Uri(putanja, UriKind.RelativeOrAbsolute));
            r.Fill   = imageBrush;
            r.Margin = new Thickness(5, 5, 5, 5);

            tb.Text = p.titula + " " + p.imePrezime;
            tb.VerticalAlignment = VerticalAlignment.Center;
            tb.FontSize          = 20;
            tb.Margin            = new Thickness(15, 0, 0, 0);

            g.Children.Add(r);
            g.Children.Add(tb);
            Grid.SetColumn(r, 0);
            Grid.SetColumn(tb, 1);

            sp.Children.Add(g);
            if (lvProfesori.Items.Count == maxCnt)
            {
                lvProfesori       = new ListView();
                lvProfesori.Width = 500;
                lvProfesori.HorizontalAlignment = HorizontalAlignment.Left;
                lvProfesori.Tapped += lvProfesori_Tapped;
                spProfesori.Children.Add(lvProfesori);
            }
            lvProfesori.Items.Add(sp);
        }
Пример #4
0
        private void lvRukovodioci_Tapped(object sender, TappedRoutedEventArgs e)
        {
            string s;

            try
            {
                int       ind = (sender as ListView).SelectedIndex;
                ListView  lv  = sender as ListView;
                ProfesorC p   = (ProfesorC)lv.Items[ind];
                s = p.idProfesor;
            }
            catch (Exception exc)
            {
                string ex = exc.ToString();
                return;
            }
            this.Frame.Navigate(typeof(Profesor), s);
        }
Пример #5
0
        public void napuni()
        {
            Baza   baza = new Baza();
            string kabinet, mejl, konsultacije = "";
            string biografija = "Нема описа.";
            string aktivnost  = "Нема описа.";

            upit = "SELECT * FROM profesori WHERE idprofesor = " + id;
            using (reader = baza.izvrsiUpit(upit))
            {
                while (reader.Read())
                {
                    if (reader.GetString("biografija") != "")
                    {
                        biografija = reader.GetString("biografija");
                    }
                    if (reader.GetString("aktivnost") != "")
                    {
                        aktivnost = reader.GetString("aktivnost");
                    }

                    profesor = new ProfesorC(reader.GetString("idProfesor"), reader.GetString("imePrezime"), reader.GetString("titula"), reader.GetString("zvanje"), reader.GetString("slika"), reader.GetString("konsultacije"), reader.GetString("kabinet"), reader.GetString("mail"), biografija, aktivnost);
                    gridProfesor.DataContext = profesor;
                }
            }

            upit1 = "SELECT * FROM predmeti WHERE id_predm IN (SELECT id_predm FROM pplink WHERE id_prof = " + id + ")";
            using (reader = baza.izvrsiUpit(upit1))
            {
                while (reader.Read())
                {
                    Predmet p = new Predmet(reader.GetString("id_predm"), reader.GetString("naziv"));
                    lvPredmeti.Items.Add(p);
                }
            }
        }
Пример #6
0
        public void dodajStavkuListe(ProfesorC p)
        {
            StackPanel sp = new StackPanel();
            sp.Tag = p.idProfesor;
            Grid g = new Grid();
            Rectangle r = new Rectangle();
            TextBlock tb = new TextBlock();

            

            ColumnDefinition c = new ColumnDefinition();
            c.Width = new GridLength(1, GridUnitType.Auto);

            ColumnDefinition c1 = new ColumnDefinition();
            c1.Width = new GridLength(1, GridUnitType.Star);

            g.ColumnDefinitions.Add(c);
            g.ColumnDefinitions.Add(c1);

            r.Height = 70;
            r.Width = 70;
            ImageBrush imageBrush = new ImageBrush();
            string putanja = "ms-appx://" + p.slika;

            imageBrush.ImageSource = new BitmapImage(new Uri(putanja, UriKind.RelativeOrAbsolute));
            r.Fill = imageBrush;
            r.Margin = new Thickness(5, 5, 5, 5);

            tb.Text = p.titula + " " + p.imePrezime;
            tb.VerticalAlignment = VerticalAlignment.Center;
            tb.FontSize = 20;
            tb.Margin = new Thickness(15, 0, 0, 0);

            g.Children.Add(r);
            g.Children.Add(tb);
            Grid.SetColumn(r, 0);
            Grid.SetColumn(tb, 1);

            sp.Children.Add(g);
            if (lvProfesori.Items.Count == maxCnt)
            {
                lvProfesori = new ListView();
                lvProfesori.Width = 500;
                lvProfesori.HorizontalAlignment = HorizontalAlignment.Left;
                lvProfesori.Tapped += lvProfesori_Tapped;
                spProfesori.Children.Add(lvProfesori);
            }
            lvProfesori.Items.Add(sp);

        }
Пример #7
0
        void napraviGrid(int i, int j, ProfesorC p, double op)
        {
            Rectangle r1 = new Rectangle();
            ImageBrush imageBrush = new ImageBrush();
            string putanja = "ms-appx://" + p.slika;
            imageBrush.ImageSource = new BitmapImage(new Uri(putanja, UriKind.RelativeOrAbsolute));
            r1.Fill = imageBrush;
            Grid.SetColumn(r1, i);
            Grid.SetRow(r1, j);
            r1.Tag = p.idProfesor;
            r1.Opacity = op / 2;
             Rectangle r2 = new Rectangle();
            r2.Fill = new SolidColorBrush(Colors.Black);
            r2.Height = 30;
            r2.Opacity = (op / 2); // to je 0.5
            r2.VerticalAlignment = VerticalAlignment.Bottom;
            Grid.SetColumn(r2, i);
            Grid.SetRow(r2, j);

            TextBlock tb = new TextBlock();
            tb.Margin = new Thickness(10, 135, 0, 0);
            tb.FontSize = 15;
            Grid.SetColumn(tb, i);
            Grid.SetRow(tb, j);
            tb.Text = p.imePrezime;
            tb.Opacity = op;

            Rectangle r = new Rectangle();
            r.Fill = new SolidColorBrush(Colors.Black);
            r.Opacity = 0;
            r.Width = 160;
            r.Height = 160;
            Grid.SetColumn(r, i);
            Grid.SetRow(r, j);
            r.Tag = p.idProfesor;
            r.Tapped += Rectangle_Tapped_2;

            gridProfesori.Children.Add(r1);
            gridProfesori.Children.Add(r2);
            gridProfesori.Children.Add(tb);
            gridProfesori.Children.Add(r);
            DoubleAnimation anim1 = new DoubleAnimation();

            Duration duration = new Duration(TimeSpan.FromSeconds(0.5));
            anim1.Duration = duration;
            Storyboard sb = new Storyboard();
            sb.Duration = duration;

            sb.Children.Add(anim1);

            Storyboard.SetTarget(anim1, r1);

            Storyboard.SetTargetProperty(anim1, "Opacity");

            anim1.EnableDependentAnimation = true;

            anim1.To = 1;


            DoubleAnimation anim2 = new DoubleAnimation();

            anim2.Duration = duration;
            sb.Duration = duration;

            sb.Children.Add(anim2);

            Storyboard.SetTarget(anim2, r2);

            Storyboard.SetTargetProperty(anim2, "Opacity");

            anim2.EnableDependentAnimation = true;

            anim2.To = 0.5;


            DoubleAnimation anim3 = new DoubleAnimation();

            anim3.Duration = duration;
            sb.Duration = duration;

            sb.Children.Add(anim3);

            Storyboard.SetTarget(anim3, tb);

            Storyboard.SetTargetProperty(anim3, "Opacity");

            anim3.EnableDependentAnimation = true;

            anim3.To = 1;

            sb.Begin();
        }
Пример #8
0
        void napraviGrid(int i, int j, ProfesorC p, double op)
        {
            Rectangle  r1         = new Rectangle();
            ImageBrush imageBrush = new ImageBrush();
            string     putanja    = "ms-appx://" + p.slika;

            imageBrush.ImageSource = new BitmapImage(new Uri(putanja, UriKind.RelativeOrAbsolute));
            r1.Fill = imageBrush;
            Grid.SetColumn(r1, i);
            Grid.SetRow(r1, j);
            r1.Tag     = p.idProfesor;
            r1.Opacity = op / 2;
            Rectangle r2 = new Rectangle();

            r2.Fill              = new SolidColorBrush(Colors.Black);
            r2.Height            = 30;
            r2.Opacity           = (op / 2); // to je 0.5
            r2.VerticalAlignment = VerticalAlignment.Bottom;
            Grid.SetColumn(r2, i);
            Grid.SetRow(r2, j);

            TextBlock tb = new TextBlock();

            tb.Margin   = new Thickness(10, 135, 0, 0);
            tb.FontSize = 15;
            Grid.SetColumn(tb, i);
            Grid.SetRow(tb, j);
            tb.Text    = p.imePrezime;
            tb.Opacity = op;

            Rectangle r = new Rectangle();

            r.Fill    = new SolidColorBrush(Colors.Black);
            r.Opacity = 0;
            r.Width   = 160;
            r.Height  = 160;
            Grid.SetColumn(r, i);
            Grid.SetRow(r, j);
            r.Tag     = p.idProfesor;
            r.Tapped += Rectangle_Tapped_2;

            gridProfesori.Children.Add(r1);
            gridProfesori.Children.Add(r2);
            gridProfesori.Children.Add(tb);
            gridProfesori.Children.Add(r);
            DoubleAnimation anim1 = new DoubleAnimation();

            Duration duration = new Duration(TimeSpan.FromSeconds(0.5));

            anim1.Duration = duration;
            Storyboard sb = new Storyboard();

            sb.Duration = duration;

            sb.Children.Add(anim1);

            Storyboard.SetTarget(anim1, r1);

            Storyboard.SetTargetProperty(anim1, "Opacity");

            anim1.EnableDependentAnimation = true;

            anim1.To = 1;


            DoubleAnimation anim2 = new DoubleAnimation();

            anim2.Duration = duration;
            sb.Duration    = duration;

            sb.Children.Add(anim2);

            Storyboard.SetTarget(anim2, r2);

            Storyboard.SetTargetProperty(anim2, "Opacity");

            anim2.EnableDependentAnimation = true;

            anim2.To = 0.5;


            DoubleAnimation anim3 = new DoubleAnimation();

            anim3.Duration = duration;
            sb.Duration    = duration;

            sb.Children.Add(anim3);

            Storyboard.SetTarget(anim3, tb);

            Storyboard.SetTargetProperty(anim3, "Opacity");

            anim3.EnableDependentAnimation = true;

            anim3.To = 1;

            sb.Begin();
        }
Пример #9
0
        private void napuni()
        {
            Baza baza = new Baza();


            upit = "SELECT * FROM smerovi WHERE id_smer = " + id;
            string          naziv         = "";
            int             duzinaStringa = 0;
            MySqlDataReader reader;

            using (reader = baza.izvrsiUpit(upit))
            {
                while (reader.Read())
                {
                    naziv         = reader.GetString("naziv");
                    duzinaStringa = reader.GetString("naziv").Length;
                    //if (duzinaStringa > 18) naziv = reader.GetString("skracenica");

                    Smer smer = new Smer(reader.GetInt32("id_smer"), naziv, reader.GetString("skracenica"), reader.GetInt32("id_smer"), reader.GetInt32("id_smer"), reader.GetString("slika"), reader.GetString("boja"), reader.GetString("opis"), reader.GetString("kompetencije"));
                    gridSmer.DataContext = smer;
                    upit  = "SELECT * FROM profesori WHERE idProfesor = " + reader.GetString("id_ruk");
                    upit1 = "SELECT * FROM profesori WHERE idProfesor = " + reader.GetString("id_sek");
                }
            }

            using (reader = baza.izvrsiUpit(upit))
            {
                while (reader.Read())
                {
                    ProfesorC p = new ProfesorC(reader.GetString("idProfesor"), reader.GetString("imePrezime"), reader.GetString("titula"), reader.GetString("zvanje"), reader.GetString("slika"), reader.GetString("konsultacije"), reader.GetString("kabinet"), reader.GetString("mail"), reader.GetString("biografija"), reader.GetString("aktivnost"));
                    lvRukovodioci.Items.Add(p);
                }
            }

            using (reader = baza.izvrsiUpit(upit1))
            {
                while (reader.Read())
                {
                    ProfesorC p = new ProfesorC(reader.GetString("idProfesor"), reader.GetString("imePrezime"), reader.GetString("titula"), reader.GetString("zvanje"), reader.GetString("slika"), reader.GetString("konsultacije"), reader.GetString("kabinet"), reader.GetString("mail"), reader.GetString("biografija"), reader.GetString("aktivnost"));
                    lvRukovodioci.Items.Add(p);
                }
            }

            upit = "SELECT naziv, semestar FROM predmeti as P, splink as S WHERE id_smer =" + id + " AND P.id_predm = S.id_predm";

            ListViewItem lvi = new ListViewItem();

            lvi.Content    = "I година";
            lvi.FontSize   = 18;
            lvi.Background = new SolidColorBrush(Colors.RoyalBlue);
            lvi.VerticalContentAlignment = VerticalAlignment.Center;
            lvi.Padding = new Thickness(5, 0, 0, 0);
            lvSpisakPredmeta.Items.Add(lvi);

            int status = 1;

            using (reader = baza.izvrsiUpit(upit))
            {
                while (reader.Read())
                {
                    if ((reader.GetString("semestar").Equals("3") || reader.GetString("semestar").Equals("4")) && (status == 1))
                    {
                        lvi            = new ListViewItem();
                        lvi.Content    = "II година";
                        lvi.FontSize   = 18;
                        lvi.Background = new SolidColorBrush(Colors.Purple);
                        lvi.VerticalContentAlignment = VerticalAlignment.Center;
                        lvi.Padding = new Thickness(5, 0, 0, 0);
                        lvSpisakPredmeta.Items.Add(lvi);
                        status = 2;
                    }
                    else if ((reader.GetString("semestar").Equals("5") || reader.GetString("semestar").Equals("6")) && (status == 2))
                    {
                        lvi            = new ListViewItem();
                        lvi.Content    = "III година";
                        lvi.FontSize   = 18;
                        lvi.Background = new SolidColorBrush(Colors.Pink);
                        lvi.VerticalContentAlignment = VerticalAlignment.Center;
                        lvi.Padding = new Thickness(5, 0, 0, 0);
                        lvSpisakPredmeta.Items.Add(lvi);
                        status = 0;
                    }

                    lvi = new ListViewItem();
                    lvi.BorderThickness = new Thickness(4, 0, 0, 0);
                    lvi.BorderBrush     = new SolidColorBrush(Colors.RoyalBlue);
                    if (status == 2)
                    {
                        lvi.BorderBrush = new SolidColorBrush(Colors.Purple);
                    }
                    else if (status == 0)
                    {
                        lvi.BorderBrush = new SolidColorBrush(Colors.Pink);
                    }
                    lvi.VerticalContentAlignment = VerticalAlignment.Center;
                    lvi.Padding = new Thickness(5, 0, 0, 0);
                    lvi.Content = reader.GetString("naziv");

                    lvSpisakPredmeta.Items.Add(lvi);
                }
            }
        }
Пример #10
0
        private void napuni()
        {
            Baza baza = new Baza();

            
            upit = "SELECT * FROM smerovi WHERE id_smer = " + id;
            string naziv = "";
            int duzinaStringa = 0;
            MySqlDataReader reader;
            using (reader = baza.izvrsiUpit(upit))
            {
                while (reader.Read())
                {
                    naziv = reader.GetString("naziv");
                    duzinaStringa = reader.GetString("naziv").Length;
                    //if (duzinaStringa > 18) naziv = reader.GetString("skracenica");

                    Smer smer = new Smer(reader.GetInt32("id_smer"), naziv, reader.GetString("skracenica"), reader.GetInt32("id_smer"), reader.GetInt32("id_smer"), reader.GetString("slika"), reader.GetString("boja"), reader.GetString("opis"), reader.GetString("kompetencije"));
                    gridSmer.DataContext = smer;
                    upit = "SELECT * FROM profesori WHERE idProfesor = " + reader.GetString("id_ruk");
                    upit1 = "SELECT * FROM profesori WHERE idProfesor = " + reader.GetString("id_sek");
                }
            }

            using (reader = baza.izvrsiUpit(upit))
            {
                while (reader.Read())
                {
                    ProfesorC p = new ProfesorC(reader.GetString("idProfesor"), reader.GetString("imePrezime"), reader.GetString("titula"), reader.GetString("zvanje"), reader.GetString("slika"), reader.GetString("konsultacije"), reader.GetString("kabinet"), reader.GetString("mail"), reader.GetString("biografija"), reader.GetString("aktivnost"));
                    lvRukovodioci.Items.Add(p);
                }
            }

            using (reader = baza.izvrsiUpit(upit1))
            {
                while (reader.Read())
                {
                    ProfesorC p = new ProfesorC(reader.GetString("idProfesor"), reader.GetString("imePrezime"), reader.GetString("titula"), reader.GetString("zvanje"), reader.GetString("slika"), reader.GetString("konsultacije"), reader.GetString("kabinet"), reader.GetString("mail"), reader.GetString("biografija"), reader.GetString("aktivnost"));
                    lvRukovodioci.Items.Add(p);
                }
            }

            upit = "SELECT naziv, semestar FROM predmeti as P, splink as S WHERE id_smer =" + id +" AND P.id_predm = S.id_predm";

            ListViewItem lvi = new ListViewItem();
            lvi.Content = "I година";
            lvi.FontSize = 18;
            lvi.Background = new SolidColorBrush(Colors.RoyalBlue);
            lvi.VerticalContentAlignment = VerticalAlignment.Center;
            lvi.Padding = new Thickness(5, 0, 0, 0);
            lvSpisakPredmeta.Items.Add(lvi);

            int status = 1;

            using (reader = baza.izvrsiUpit(upit))
            {
                while (reader.Read())
                {
                    if ((reader.GetString("semestar").Equals("3") || reader.GetString("semestar").Equals("4")) && (status == 1))
                    {
                        lvi = new ListViewItem();
                        lvi.Content = "II година";
                        lvi.FontSize = 18;
                        lvi.Background = new SolidColorBrush(Colors.Purple);
                        lvi.VerticalContentAlignment = VerticalAlignment.Center;
                        lvi.Padding = new Thickness(5, 0, 0, 0);
                        lvSpisakPredmeta.Items.Add(lvi);
                        status = 2;
                    }
                    else if ((reader.GetString("semestar").Equals("5") || reader.GetString("semestar").Equals("6")) && (status == 2))
                    {
                        lvi = new ListViewItem();
                        lvi.Content = "III година";
                        lvi.FontSize = 18;
                        lvi.Background = new SolidColorBrush(Colors.Pink);
                        lvi.VerticalContentAlignment = VerticalAlignment.Center;
                        lvi.Padding = new Thickness(5, 0, 0, 0);
                        lvSpisakPredmeta.Items.Add(lvi);
                        status = 0;
                    }
                    
                    lvi = new ListViewItem();
                    lvi.BorderThickness = new Thickness(4, 0, 0, 0);
                    lvi.BorderBrush = new SolidColorBrush(Colors.RoyalBlue);
                    if (status == 2)
                    {
                        lvi.BorderBrush = new SolidColorBrush(Colors.Purple);
                    }
                    else if (status == 0)
                    {
                        lvi.BorderBrush = new SolidColorBrush(Colors.Pink);
                    }
                    lvi.VerticalContentAlignment = VerticalAlignment.Center;
                    lvi.Padding = new Thickness(5, 0, 0, 0);
                    lvi.Content = reader.GetString("naziv");

                    lvSpisakPredmeta.Items.Add(lvi);

                }
            }
        }