Ejemplo n.º 1
0
        /// <summary>
        /// De Load die hij uitvoerd als je de form opent.
        /// </summary>
        /// <param name="sender"></param>
        /// <param name="e"></param>
        private void FormBekijkenprofiel_Load(object sender, EventArgs e)
        {
            var gebruiker = GebruikerManager.GebruikerOpvragen(UserId);

            Naam.Text  = gebruiker.voornaam + " " + gebruiker.achternaam;
            this.Text  = "Profiel van " + gebruiker.voornaam + " " + gebruiker.achternaam;
            Adres.Text = gebruiker.woonplaats;
            if (gebruiker.oppassen && gebruiker.uitlaten == false)
            {
                OppassenUitlatenLabel.Text = "Kan passen op:";
            }
            else if (gebruiker.oppassen == false && gebruiker.uitlaten)
            {
                OppassenUitlatenLabel.Text = "Kan de volgende dieren uitlaten:";
            }
            else if (gebruiker.oppassen && gebruiker.uitlaten)
            {
                OppassenUitlatenLabel.Text = "Kan op de volgende dieren passen en is bereid om ze uit te laten:";
            }
            Kanpassenop.Text = gebruiker.diertypes;
            Overmijinfo.Text = gebruiker.overmij;
            Prijs.Text       = "Prijs per dag: €" + gebruiker.vraagprijs;
            //Rating
            Bitmap[] Ster = new Bitmap[6]
            {
                Properties.Resources.ster0, Properties.Resources.ster1, Properties.Resources.ster2, Properties.Resources.ster3, Properties.Resources.ster4, Properties.Resources.ster5
            };
            RatingPictureBox.Image = Ster[ReviewManager.BerekenRating(UserId)];
            //Profielfoto
            Profielfoto.Image = ProfielfotoManager.getProfielfoto(gebruiker.userid);
            // LogedIn features weg halen
            if (!LoginCheck())
            {
                List <Control> ReviewPItems = new List <Control>()
                {
                    TitelLabel, BodyLabel, SchrijfhierLabel, OLijnLabel, ASterLabel, RtitelTextBox, RbodyTextBox,
                    Ster1CheckBox, Ster2CheckBox, Ster3CheckBox, Ster4CheckBox, Ster5CheckBox, PReviewButton, DiscardButton
                };

                foreach (var Item in ReviewPItems)
                {
                    Item.Visible = false;
                }
            }
            //reviews laden
            ReviewLoad();
        }
Ejemplo n.º 2
0
        private Gebruiker[] Buildquery()
        {
            string          dier = "", woonplaats;
            bool            Verified, uitlaat, oppas;
            List <CheckBox> CBList = new List <CheckBox>()
            {
                HondCheckBox, KatCheckBox, KnaagdierCheckBox, VogelCheckBox, ReptielCheckBox, AmfibieCheckBox, InsectCheckBox, VisCheckBox
            };

            foreach (CheckBox CB in CBList)
            {
                if (CB.Checked == true)
                {
                    dier = CB.Text;
                }
            }

            Verified   = VerifiedCheckBox.Checked;
            uitlaat    = UitlaatCheckBox.Checked;
            oppas      = OppasCheckBox.Checked;
            woonplaats = ZoektextBox.Text;
            Gebruiker[]      allegebruikers     = GebruikerManager.AlleGebruikers();
            List <Gebruiker> filteredgebruikers = new List <Gebruiker>();

            foreach (var gebruiker in allegebruikers)
            {
                if (!gebruiker.diertypes.Contains(dier))
                {
                    continue;
                }
                if (woonplaats != "" && gebruiker.woonplaats != woonplaats)
                {
                    continue;
                }
                if (PrijsTextBox.Text != "" && (gebruiker.vraagprijs > Convert.ToDouble(PrijsTextBox.Text)))
                {
                    continue;
                }
                if (VerifiedCheckBox.Checked && !gebruiker.verified)
                {
                    continue;
                }
                if (UitlaatCheckBox.Checked && !gebruiker.uitlaten)
                {
                    continue;
                }
                if (OppasCheckBox.Checked && !gebruiker.oppassen)
                {
                    continue;
                }
                filteredgebruikers.Add(gebruiker);
            }

            filteredgebruikers.Sort((Gebruiker a, Gebruiker b) =>
            {
                if (a.verified && !b.verified)
                {
                    return(-1);
                }
                if (b.verified && !a.verified)
                {
                    return(1);
                }
                int Arating = ReviewManager.BerekenRating(a.userid);
                int Brating = ReviewManager.BerekenRating(b.userid);
                return(Brating.CompareTo(Arating));
            });

            return(filteredgebruikers.ToArray());
        }
Ejemplo n.º 3
0
        public void MaakResultaat(Gebruiker gebruiker, int pos)
        {
            //Globale variabelen
            int H       = 100;
            int W       = 400;
            int posX    = Convert.ToInt32(500 - 0.5 * W);
            int posY    = 0;
            int bufferY = 15;
            int bufferX = 10;

            //Per blok variabelen
            int blokX = posX;
            int blokY = posY + H * pos;

            //
            // ResultaatLabel
            //
            var ResultaatLabel = new Label();

            ResultaatLabel.Click += delegate
            {
                profiel_ClickEvent(gebruiker);
            };
            ResultaatLabel.AutoSize = true;
            ResultaatLabel.Font     = new Font("Microsoft Sans Serif", 12F, FontStyle.Regular, GraphicsUnit.Point, ((byte)(0)));
            ResultaatLabel.Location = new Point(blokX + 70 + bufferX, blokY + bufferY);
            ResultaatLabel.Name     = "ResultaatLabel";
            ResultaatLabel.Size     = new Size(180, 20);
            ResultaatLabel.TabIndex = 57;
            ResultaatLabel.Text     = gebruiker.voornaam + " " + gebruiker.achternaam;
            panel.Controls.Add(ResultaatLabel);
            ResultaatList.Add(ResultaatLabel);
            //
            // ProfielFotoPictureBox
            //
            var ProfielFotoPictureBox = new PictureBox();

            ProfielFotoPictureBox.Click += delegate
            {
                profiel_ClickEvent(gebruiker);
            };
            ProfielFotoPictureBox.Location = new Point(blokX, blokY + bufferY);
            ProfielFotoPictureBox.Name     = "ProfielFotoPictureBox";
            ProfielFotoPictureBox.Size     = new Size(70, 70);
            ProfielFotoPictureBox.TabIndex = 58;
            ProfielFotoPictureBox.TabStop  = false;
            ProfielFotoPictureBox.Image    = ProfielfotoManager.getProfielfoto(gebruiker.userid);
            ProfielFotoPictureBox.SizeMode = PictureBoxSizeMode.StretchImage;
            panel.Controls.Add(ProfielFotoPictureBox);
            ResultaatList.Add(ProfielFotoPictureBox);
            //
            // OppassenUitlaten
            //
            string verzorgen        = "";
            var    OppassenUitlaten = new Label();

            OppassenUitlaten.Click += delegate
            {
                profiel_ClickEvent(gebruiker);
            };
            OppassenUitlaten.AutoSize = true;
            OppassenUitlaten.Location = new Point(blokX + 70 + bufferX, blokY + bufferY + 20);
            OppassenUitlaten.Name     = "OppassenUitlaten";
            OppassenUitlaten.Size     = new Size(136, 13);
            OppassenUitlaten.TabIndex = 59;
            if (gebruiker.oppassen && gebruiker.uitlaten == false)
            {
                verzorgen = " verzorgen.";
            }
            else if (gebruiker.oppassen == false && gebruiker.uitlaten)
            {
                verzorgen = " uitlaten.";
            }
            else if (gebruiker.oppassen && gebruiker.uitlaten)
            {
                verzorgen = " verzorgen en uitlaten.";
            }
            OppassenUitlaten.Text = "Kan een " + gebruiker.diertypes + verzorgen;
            panel.Controls.Add(OppassenUitlaten);
            ResultaatList.Add(OppassenUitlaten);
            //
            // RatingPictureBox
            //
            var RatingPictureBox = new PictureBox();

            RatingPictureBox.Click += delegate
            {
                profiel_ClickEvent(gebruiker);
            };
            RatingPictureBox.Location = new Point(blokX + 70 + bufferX, blokY + bufferY + 20 + 15 + 15);
            RatingPictureBox.Name     = "RatingPictureBox";
            RatingPictureBox.Size     = new Size(100, 20);
            RatingPictureBox.TabIndex = 60;
            RatingPictureBox.TabStop  = false;
            Bitmap[] images = new Bitmap[] { Properties.Resources.ster0, Properties.Resources.ster1,
                                             Properties.Resources.ster2, Properties.Resources.ster3, Properties.Resources.ster4, Properties.Resources.ster5 };
            RatingPictureBox.Image    = images[ReviewManager.BerekenRating(gebruiker.userid)];
            RatingPictureBox.SizeMode = PictureBoxSizeMode.StretchImage;
            panel.Controls.Add(RatingPictureBox);
            ResultaatList.Add(RatingPictureBox);
            //
            // VerifiedPicktureBox
            //
            if (gebruiker.verified)
            {
                var VerifiedPicktureBox = new PictureBox();
                VerifiedPicktureBox.Click += delegate
                {
                    profiel_ClickEvent(gebruiker);
                };
                VerifiedPicktureBox.Location = new Point(blokX + 70 + bufferX + ResultaatLabel.Width, blokY + bufferY);
                VerifiedPicktureBox.Name     = "VerifiedPicktureBox";
                VerifiedPicktureBox.Size     = new Size(20, 20);
                VerifiedPicktureBox.TabIndex = 61;
                VerifiedPicktureBox.TabStop  = false;
                VerifiedPicktureBox.Image    = Properties.Resources.checkbox;
                VerifiedPicktureBox.SizeMode = PictureBoxSizeMode.StretchImage;
                panel.Controls.Add(VerifiedPicktureBox);
                ResultaatList.Add(VerifiedPicktureBox);
            }
            //
            // Locatielabel
            //
            var Locatielabel = new Label();

            Locatielabel.Click += delegate
            {
                profiel_ClickEvent(gebruiker);
            };
            Locatielabel.AutoSize = true;
            Locatielabel.Location = new Point(blokX + 70 + bufferX, blokY + bufferY + 20 + 15);
            Locatielabel.Name     = "Locatielabel";
            Locatielabel.Size     = new Size(51, 13);
            Locatielabel.TabIndex = 62;
            Locatielabel.Text     = gebruiker.woonplaats + " - €" + gebruiker.vraagprijs + " per dag";
            panel.Controls.Add(Locatielabel);
            ResultaatList.Add(Locatielabel);
        }