示例#1
0
        public ContactenForm(Gebruiker _gebruiker)
        {
            InitializeComponent();
            var imagelist = new ImageList();

            imagelist.Images.Add("GS", Properties.Resources.Afbeelding_ContactPersoon_GastSpreker);
            imagelist.Images.Add("GD", Properties.Resources.Afbeelding_ContactPersoon_GastDocent);
            imagelist.Images.Add("BD", Properties.Resources.Afbeelding_ContactPersoon_Bedrijf);
            imagelist.Images.Add("SB", Properties.Resources.Afbeelding_ContactPersoon_StageBegeleider);
            imagelist.ImageSize        = new Size(50, 50);
            lvContacten.LargeImageList = imagelist;
            ShowMenu          = false;
            ShowZoeken        = false;
            ShowSave          = false;
            EditMode          = false;
            this._gebruiker   = _gebruiker;
            lblGebruiker.Text = lblGebruiker.Text + " " + this._gebruiker.Gebruikersnaam;

            // Vul de combobox van bedrijven met bedrijven
            BedrijfController bc = new BedrijfController();

            bedrijfCbx.DataSource    = bc.haalBedrijfLijstOp();
            bedrijfCbx.DisplayMember = "Bedrijfnaam";
            bedrijfCbx.ValueMember   = "Bedrijfscode";
        }
        private void btnWijzig_Click(object sender, EventArgs e)
        {
            if (lvStage.SelectedItems.Count != 0)
            {
                Stageopdracht opdracht    = new Stageopdracht();
                int           bedrijfcode = Convert.ToInt32(lvStage.SelectedItems[0].SubItems[6].Text); // bedrijfcode
                int           contactcode = Convert.ToInt32(lvStage.SelectedItems[0].SubItems[7].Text); // contactcode
                opdracht.Code         = Convert.ToInt32(lvStage.SelectedItems[0].SubItems[0].Text);
                opdracht.Naam         = lvStage.SelectedItems[0].SubItems[1].Text;
                opdracht.Omschrijving = lvStage.SelectedItems[0].SubItems[2].Text;
                opdracht.Status       = lvStage.SelectedItems[0].SubItems[3].Text;

                // Haal bedrijfinfo op
                BedrijfController bc      = new BedrijfController();
                Bedrijfcontact    bedrijf = bc.SelecteerBedrijf(bedrijfcode);
                opdracht.Bedrijf = bedrijf;

                //Haal contactinfo op
                ContactenController cc      = new ContactenController();
                Persooncontact      contact = cc.HaalInfoOp(contactcode.ToString());
                opdracht.Contact = contact;

                opdrachtEditForm OEF = new opdrachtEditForm();
                OEF.Editopdracht(opdracht);
                OEF.ShowDialog();
                if (OEF.DialogResult == DialogResult.OK)
                {
                    setListBox();
                }
            }
        }
        public opdrachtEditForm()
        {
            InitializeComponent();
            getStatus();
            BedrijfController bc = new BedrijfController();

            bedrijfCbx.DataSource    = bc.haalBedrijfLijstOp();
            bedrijfCbx.DisplayMember = "Bedrijfnaam";
            bedrijfCbx.ValueMember   = "Bedrijfscode";
        }
        public ContactBewerk(Persooncontact contact)
        {
            InitializeComponent();

            // Vult de bedrijven combobox met bedrijven
            BedrijfController bc = new BedrijfController();

            bedrijfCbx.DataSource    = bc.haalBedrijfLijstOp();
            bedrijfCbx.DisplayMember = "Bedrijfnaam";
            bedrijfCbx.ValueMember   = "Bedrijfscode";

            // Zet de combobox selectie naar het huidige bedrijf
            bedrijfCbx.SelectedIndex = bedrijfCbx.FindStringExact(contact.Bedrijf.Bedrijfnaam);

            // Koppelt alle contact data aan de texboxes
            voornaamTb.Text   = contact.Voornaam;
            achternaamTb.Text = contact.Achternaam;
            functieTb.Text    = contact.Functie;
            locatieTb.Text    = contact.Locatie;
            emailTb.Text      = contact.Email;
            contactcode       = contact.Contactcode;
            bedrijfcode       = contact.Bedrijf.Bedrijfscode;
        }
示例#5
0
        private void btnOpslaan_Click(object sender, EventArgs e)
        {
            bool opslaan = false;

            if (contactSoortCbx.Text != "Bedrijf")
            {
                bool a = false;
                bool b = false;
                if ((tbVoornaam.Text.Count() <= 0 || tbAchternaam.Text.Count() <= 0 || tbEmail.Text.Count() <= 0 || bedrijfCbx.Text.Count() <= 0))
                {
                    a = false;
                    MessageBox.Show("Een of meer verplichte velden zijn leeg\nVul deze aan en probeer het opnieuw");
                }
                else
                {
                    a = true;
                }
                if (validemail == true && validmobiel == true)
                {
                    b = true;
                }
                else
                {
                    MessageBox.Show("Het ingevoerde emailadres of mobiel nr. is onjuist", "Warning", MessageBoxButtons.OK, MessageBoxIcon.Warning);
                }
                if (a == true && b == true)
                {
                    opslaan = true;
                }
            }
            else
            {
                bool a = false;
                bool b = false;
                if ((tbHoofdlocatie.Text.Count() <= 0 || tbBedrijfsnaam.Text.Count() <= 0) || (tbEadres.Text.Count() <= 0 && tbTelefoon.Text.Count() <= 0))
                {
                    a = false;
                    MessageBox.Show("Een of meer verplichte velden zijn leeg\nVul deze aan en probeer het opnieuw");
                }
                else
                {
                    a = true;
                }
                if (validbedrijfemail == true)
                {
                    b = true;
                }
                if (a == true && b == true)
                {
                    opslaan = true;
                }
            }
            if (opslaan == true)
            {
                if (contactSoortCbx.Text != "Bedrijf")
                {
                    Persooncontact persooncontact = new Persooncontact()
                    {
                        Voornaam = tbVoornaam.Text, Achternaam = tbAchternaam.Text, Functie = tbFunctie.Text, Afdeling = tbAfdeling.Text, Locatie = tbLocatie.Text, Email = tbEmail.Text, Gebruiker = _gebruiker
                    };
                    string contactSoort = Convert.ToString(contactSoortCbx.SelectedItem);
                    Console.WriteLine(tbFunctie.Text);
                    int bedrijfcode = Convert.ToInt32(bedrijfCbx.SelectedValue);
                    persooncontact.Bedrijf = new Bedrijfcontact()
                    {
                        Bedrijfscode = bedrijfcode
                    };

                    // Haal kwaliteiten op
                    string[] kwaliteiten = new string[tbKwaliteitenP.Lines.Count()];
                    int      i           = 0;
                    foreach (string line in tbKwaliteitenP.Lines)
                    {
                        kwaliteiten[i] = line;
                        i++;
                    }
                    persooncontact.Kwaliteiten = kwaliteiten;

                    switch (contactSoort)
                    {
                    case "Stagebegeleider":
                        persooncontact.Isstagebegeleider = true;
                        break;

                    case "Gastdocent":
                        persooncontact.Isgastdocent = true;
                        break;

                    default:
                        Console.WriteLine("ERROR");
                        break;
                    }
                    ContactenController contactencontroller = new ContactenController();
                    contactencontroller.controleerOfContactBestaat(_gebruiker, persooncontact);
                    SaveContact(persooncontact);
                    lvContacten.Clear();
                    vulContacten();
                }
                else
                {
                    string[] a = new string[tbKwaliteiten.Lines.Count()];
                    int      i = 0;
                    foreach (string line in tbKwaliteiten.Lines)
                    {
                        a[i] = line;
                        i++;
                    }
                    Bedrijfcontact bedrijfcontact = new Bedrijfcontact()
                    {
                        Bedrijfnaam = tbBedrijfsnaam.Text, Contactpersoon = tbContact.Text, Email = tbEadres.Text, Hoofdlocatie = tbHoofdlocatie.Text, Telefoonnr = tbTelefoon.Text, Website = tbWebsite.Text, Kwaliteiten = a
                    };
                    BedrijfController bc = new BedrijfController();
                    bc.voegBedrijfToe(bedrijfcontact);
                    SaveBedrijf(bedrijfcontact);
                }

                pnOptioneel.Visible     = false;
                persoonPnl.Visible      = false;
                pnbedrijf2.Visible      = false;
                bedrijfPnl.Visible      = false;
                bedrijfPnl.Visible      = false;
                btnZoeken.Visible       = true;
                lblSoort.Visible        = false;
                btnVoegtoe.Visible      = true;
                btnWijzig.Visible       = true;
                btnDelete.Visible       = true;
                btnAnnuleer.Visible     = false;
                btnOpslaan.Visible      = false;
                contactSoortCbx.Visible = false;
                lvContacten.Visible     = true;
                ShowSave = false;
            }
        }