private void cbbGebruikers_DropDown(object sender, EventArgs e)
        {
            try
            {
                dbLMandagenDataContext dm         = new dbLMandagenDataContext(pubConnectionString);
                List <string>          gebruikers = dm.Gebruikers.Select(x =>
                                                                         x.GebruikerId.ToString() + " " +
                                                                         x.Gebruikersnaam + " (" +
                                                                         (x.CanPrint ? "Canprint" : "NOprint") +
                                                                         (x.IsAdministrator ? ", +Admin" : "") +
                                                                         (x.IsManager ? ", +Mngr" : "") +
                                                                         (x.IsProjectleider ? ", +PrLdr" : "") +
                                                                         ")"
                                                                         ).ToList();

                cbbGebruikers.Items.Clear();
                foreach (string gebruiker in gebruikers)
                {
                    cbbGebruikers.Items.Add(gebruiker);
                }
            }
            catch { }

            // Pas breedte aan
            MszTools.AdjustWidthComboBox_DropDown(sender, e);
        }
        private void LoginAls()
        {
            if (cbbGebruikers.SelectedIndex < 0)
            {
                return;
            }
            pnlSettings.Visible = false;
            try
            {
                int g = Convert.ToInt16(cbbGebruikers.SelectedItem.ToString().Substring(0, cbbGebruikers.SelectedItem.ToString().IndexOf(" ")));
                dbLMandagenDataContext dm = new dbLMandagenDataContext(pubConnectionString);

                PDFSETTTINGS.Gebruiker = dm.Gebruikers.Where(x => x.GebruikerId == g).First();

                // Nieuwe user melden aan Juraci
                ApplicationState.SetValue(GlobaleVars.strApplicationState, PDFSETTTINGS);
                ApplicationState.SetValue(ApplicationVariables.intGebruikerId, PDFSETTTINGS.Gebruiker.GebruikerId);

                HalloUser();
                ET.Log("2e aanroep Bouwlijst");
                BouwLijst();
                ET.Log("2e aanroep Bouwlijst");
            }
            catch { }
        }
        private bool WindowsLogonIsManager()
        {
            ET.Log("getUserLogon");
            string stringmd;

            switch (pubOMGEVING)
            {
            case "BETA":
                stringmd = "MandagenRegistratieConnectionStringBETA";
                break;

            case "DEV":
                stringmd = "MandagenRegistratieConnectionStringDEV";
                break;

            default:     //"LIVE":
                stringmd = "MandagenRegistratieConnectionStringLIVE";
                break;
            }

            pubConnectionString = ConfigurationManager.ConnectionStrings[stringmd] != null ? ConfigurationManager.ConnectionStrings[stringmd].ConnectionString : "";

            // Bepaal ingelogde gebruiker
            dbLMandagenDataContext dm = new dbLMandagenDataContext(pubConnectionString);

            ET.Log("Gebruik security string: " + pubConnectionString);
            string    windowsentity = System.Security.Principal.WindowsIdentity.GetCurrent().Name;
            Gebruiker Geb           = new Gebruiker();
            bool      IsAdmin       = false;
            // GebruikersID indien doorgelogd door Mandagen!
            int Ui = ApplicationState.GetValue <int>(ApplicationVariables.intGebruikerId);

            try
            {
                Geb     = dm.Gebruikers.Where(x => x.Windowsidentity.ToUpper() == windowsentity.ToUpper()).FirstOrDefault();
                IsAdmin = Geb.IsAdministrator;
                // Haal nu de gegevens van degene als wie er is doorgelogt
                if (Ui > 0)
                {
                    Geb = dm.Gebruikers.Where(x => x.GebruikerId == Ui).FirstOrDefault();
                }
            }
            catch (Exception e)
            {
                MessageBox.Show("Uw Login gegevens zijn niet gevonden, bent u wel een gerigistreerd gebruiker?? \n" + e.ToString());
                return(false);
            }
            PDFSETTTINGS.Gebruiker = Geb;

            // Lijsten opnieuw inlezen uit Database
            Load_Lijsten();

            return(IsAdmin);
        }