Пример #1
0
        private void ProfielAanmakenButton_Click(object sender, EventArgs e)
        {
            if (!HondCheckbox.Checked && !KatCheckbox.Checked && !ReptielCheckbox.Checked && !AmfibieCheckbox.Checked && !VissenCheckbox.Checked && InsectCheckbox.Checked && !KnaagdierCheckbox.Checked && !VogelCheckbox.Checked)
            {
                MessageBox.Show("Geef aan met welke dieren je ervaring hebt");
            }
            else if (!OppasCheckbox.Checked && !UitlaatCheckbox.Checked)
            {
                MessageBox.Show("Geef aan of je op wil passen, uit wil laten of geïntresseerd  bent in beide");
            }
            else if (VoornaamTextbox.Text == "")
            {
                MessageBox.Show("Je hebt 1 of meerdere velden leeggelaten!");
            }
            else if (AchternaamTextbox.Text == "")
            {
                MessageBox.Show("Je hebt 1 of meerdere velden leeggelaten!");
            }
            else if (WoonplaatsTextbox.Text == "")
            {
                MessageBox.Show("Je hebt 1 of meerdere velden leeggelaten!");
            }
            else if (VraagprijsTextbox.Text == "" && double.TryParse(VraagprijsTextbox.Text, out var n))
            {
                MessageBox.Show("Je hebt 1 of meerdere velden leeggelaten!");
            }
            else if (OverMijTextbox.Text == "")
            {
                MessageBox.Show("Vertel nog wat over jezelf");
            }
            else
            {
                List <CheckBox> CBList = new List <CheckBox>()
                {
                    HondCheckbox, KatCheckbox, KnaagdierCheckbox, VogelCheckbox, ReptielCheckbox, AmfibieCheckbox, InsectCheckbox, VissenCheckbox
                };
                string diertypes = "";
                foreach (var checkbox in CBList)
                {
                    if (checkbox.Checked)
                    {
                        diertypes += checkbox.Text + ", ";
                    }
                }
                if (diertypes != "")
                {
                    diertypes = diertypes.Substring(0, diertypes.Length - 2);
                }

                var gebruiker = new Gebruiker
                {
                    voornaam   = VoornaamTextbox.Text,
                    achternaam = AchternaamTextbox.Text,
                    woonplaats = WoonplaatsTextbox.Text,
                    vraagprijs = Convert.ToDouble(VraagprijsTextbox.Text),
                    verified   = PremiumCheckbox.Checked,
                    admin      = false,
                    diertypes  = diertypes,
                    oppassen   = OppasCheckbox.Checked,
                    uitlaten   = UitlaatCheckbox.Checked,
                    overmij    = OverMijTextbox.Text,
                    email      = EmailTextbox.Text,
                    password   = WachtwoordTextbox.Text,
                };
                GebruikerManager.GebruikerToevoegen(gebruiker);
                MessageBox.Show("De gebruiker is toegevoegd!");
            }
        }
Пример #2
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);
        }