Ejemplo n.º 1
0
        private void frmSecurityOverView_Load(object sender, EventArgs e)
        {
            treeListView1.Columns[0].Text = SynapseForm.GetLabel("frmSecurityOverView.olvc_GROUP");
            treeListView1.Columns[1].Text = SynapseForm.GetLabel("frmSecurityOverView.olvc_VISIBLE");
            treeListView1.Columns[2].Text = SynapseForm.GetLabel("frmSecurityOverView.olvc_ACTIVE");
            treeListView1.Columns[3].Text = SynapseForm.GetLabel("frmSecurityOverView.olvc_Text");
            treeListView1.Columns[4].Text = SynapseForm.GetLabel("frmSecurityOverView.olvc_Comment");

            ModuleCollection = SynapseModule.Load();
            myControls       = (from c in ControlSecurityOverview.Load() where c.GROUP != "Everybody" select c).ToList();
            myProfiles       = SynapseProfile.Load();
            myModules        = SynapseModule.Load();
            fillModules();

            foreach (SynapseModule mod in myModules)
            {
                HashMod.Add(mod.TECHNICALNAME, mod.ID);
            }
            List <E_module> modules = new List <E_module>();

            foreach (string str in (from m in myControls select m.MODULE).Distinct())
            {
                modules.Add((E_module)str);
            }

            treeListView1.SetObjects(modules);
        }
Ejemplo n.º 2
0
        private void listModule()
        {
            ctxEdit.Enabled   = false;
            tsbEdit.Enabled   = false;
            ctxDelete.Enabled = false;
            tsbDelete.Enabled = false;

            var stats = ComboBoxObject.LoadFromQuery("SELECT [FK_MODULE_ID] as Value,cast(ROUND(cast(sum([ACTIVITY_TIME]) as float)/3600,2) as nvarchar) + 'h ('+cast(ROUND((cast(sum([ACTIVITY_TIME]) as float)/cast(sum([OPENED_TIME]) as float))*100,1) as nvarchar)+'%) - ' + CAST(COUNT(Distinct FORMNAME) as nvarchar) + ' Forms - ' + cast(COUNT(DISTINCT USERID) as nvarchar) + ' Users' as Text FROM [SYNAPSE].[dbo].[Synapse_Statistics] GROUP BY FK_MODULE_ID");

            usage.Clear();

            foreach (ComboBoxObject stat in stats)
            {
                usage.Add(stat.Value, stat.Text);
            }

            modules = SynapseModule.Load();
            foreach (SynapseModule module in modules)
            {
                if (File.Exists(Application.StartupPath + "\\ModulesIcons\\" + module.TECHNICALNAME + ".ico"))
                {
                    LargeImageList.Images.Add(module.TECHNICALNAME, Image.FromFile(Application.StartupPath + "\\ModulesIcons\\" + module.TECHNICALNAME + ".ico"));
                }
                else
                {
                    LargeImageList.Images.Add(module.TECHNICALNAME, Image.FromFile(Application.StartupPath + "\\ModulesIcons\\Default.png"));
                }
            }

            olvModules.SetObjects(modules.OrderBy(x => x.FriendlyName.ToString()).ToList());
        }
Ejemplo n.º 3
0
        private void StartOtherModule(string path, bool checkIfSynapseModule)
        {
            if (checkIfSynapseModule)
            {
                SynapseModule mod = SynapseModule.Load("WHERE PATH='" + path + "'").FirstOrDefault();
                if (mod != null)
                {
                    StartSynapseModule(mod);
                    return;
                }
            }

            try
            {
                if (path.Substring(path.Length - 3, 3) == "lnk")
                {
                    Process.Start(path);
                }
                else
                {
                    ProcessStartInfo pStart = new ProcessStartInfo(path);
                    pStart.WorkingDirectory = path.Substring(0, path.LastIndexOf("\\"));
                    pStart.UseShellExecute  = false;

                    Process.Start(pStart);
                }
            }
            catch (Exception ex)
            {
                MessageBox.Show(string.Format("This Module ({0}) could not be Started: {1}", path, ex.Message), GetLabel("Err"), MessageBoxButtons.OK, MessageBoxIcon.Error);
            }

            treeFavorites.SelectedNode = null;
        }
Ejemplo n.º 4
0
        private void loadModules()
        {
            lvModule.Items.Clear();

            Modules = SynapseModule.Load();
            var UserModuleID = from m in FormUser.Modules select m.ID;

            foreach (SynapseModule Module in from m in Modules where !UserModuleID.Contains(m.ID) select m)
            {
                if (Module.IS_ACTIVE && Module.IS_REQUESTABLE)
                {
                    if (File.Exists(Application.StartupPath + "\\ModulesIcons\\" + Module.TECHNICALNAME + ".ico"))
                    {
                        smallImages.Images.Add(Module.TECHNICALNAME, Image.FromFile(Application.StartupPath + "\\ModulesIcons\\" + Module.TECHNICALNAME + ".ico"));
                    }
                    else
                    {
                        smallImages.Images.Add(Module.TECHNICALNAME, Image.FromFile(Application.StartupPath + "\\ModulesIcons\\Default.png"));
                    }

                    ListViewItem item;
                    item     = new ListViewItem(Module.FriendlyName.ToString());
                    item.Tag = 0;
                    item.SubItems.Add(Module.Description.ToString());
                    item.SubItems.Add(Module.VERSION);
                    item.ImageKey = Module.TECHNICALNAME;

                    lvModule.Items.Add(item);
                }
            }
        }
Ejemplo n.º 5
0
        public override void initForm(SynapseCore.Security.Tools.SecureAndTranslateMode Mode)
        {
            base.initForm(Mode);

            ModuleCollection     = SynapseModule.Load();
            AllUserCollection    = SynapseUser.Load();
            AllProfileCollection = SynapseProfile.Load();
            initTree();
        }
Ejemplo n.º 6
0
 private void LoadModules()
 {
     Prd_Modules = SynapseModule.Load();
     Acc_Modules = ACCSynapseModule.Load();
     olv_Acc_Modules.ClearObjects();
     olv_Modules.ClearObjects();
     olv_Modules.SetObjects(Prd_Modules);
     olv_Acc_Modules.SetObjects(Acc_Modules);
     comboBox1.DisplayMember = "TECHNICALNAME";
     comboBox1.ValueMember   = "ID";
     comboBox1.DataSource    = Acc_Modules;
     comboBox2.DisplayMember = "TECHNICALNAME";
     comboBox2.ValueMember   = "ID";
     comboBox2.DataSource    = Acc_Modules;
 }
Ejemplo n.º 7
0
        void SecurityEditLoad(object sender, EventArgs e)
        {
            tsbAddControl.Enabled    = false;
            tsbDeleteControl.Enabled = false;
            tsbRemoveControl.Enabled = false;

            AllControls = SynapseControl.Load();

            var Modules = SynapseModule.Load();

            cb_Module.DataSource    = Modules.OrderBy(x => x.FriendlyName.ToString()).ToList();
            cb_Module.ValueMember   = "ID";
            cb_Module.DisplayMember = "FriendlyName";
            cb_Module.SelectedIndex = 0;

            lst_ListOfControl.DisplayMember = "CTRL_NAME";
            lst_ListOfControl.ValueMember   = "ID";
        }
Ejemplo n.º 8
0
 private void fillModule()
 {
     cbModule.DataSource    = SynapseModule.Load().OrderBy(x => x.FriendlyName.ToString()).ToList();
     cbModule.DisplayMember = "FriendlyName";
     cbModule.ValueMember   = "ID";
 }
Ejemplo n.º 9
0
        private void loadModules(string cat = "")
        {
            smallImages.Images.Clear();
            largeImages.Images.Clear();
            if (SynapseCore.Database.DBFunction.ConnectionName != "Default")
            {
                CurrentMode = SynapseModule.SynapseModuleMode.Development;
            }
            IList <SynapseModule> AllModules = SynapseModule.Load();

            lvModule.Items.Clear();
            lvModule.Groups.Clear();
            treeFavorites.Nodes.Clear();
            string[] SynapseDirs = new string[] { "ModulesIcons", "Prod", "Dev", "Resources", "AllSynapseResources" };
            foreach (DirectoryInfo dir in new DirectoryInfo(Application.StartupPath).GetDirectories("*", SearchOption.TopDirectoryOnly))
            {
                if (!SynapseDirs.Contains(dir.Name))
                {
                    dir.Delete(true);
                }
            }
            IEnumerable <SynapseModule> Modules;

            if (cat == "")
            {
                Modules = from x in FormUser.Modules where x.ID != 1 select x;
            }
            else
            {
                Modules = from x in FormUser.Modules where x.ID != 1 && x.MODULECATEGORY == cat select x;
            }

            //clean modules
            foreach (SynapseModule mod in (from m in AllModules where !FormUser.Modules.Select(mod => mod.ID).Contains(m.ID) select m))
            {
                mod.UnInstall(Application.StartupPath, CurrentMode);
            }

            foreach (SynapseModule module in Modules)
            {
                if (!module.is_uptodate(Application.StartupPath, CurrentMode))
                {
                    module.Update(Application.StartupPath, CurrentMode);
                }

                ListViewItem lvi = new ListViewItem();
                lvi.UseItemStyleForSubItems = false;
                lvi.Font      = new System.Drawing.Font(lvi.Font, FontStyle.Bold);
                lvi.ForeColor = Color.DarkBlue;
                lvi.Name      = module.TECHNICALNAME;
                lvi.Text      = module.FriendlyName.ToString();
                lvi.SubItems.Add(module.Description.ToString());
                lvi.SubItems.Add(module.VERSION);
                lvi.SubItems.Add(module.PATH);
                lvi.SubItems.Add(module.VERSIONDATE);

                lvi.Tag = module;

                ListViewGroup lgroup = new ListViewGroup(module.MODULECATEGORY, module.MODULECATEGORY);
                if (!lvModule.Groups.Contains(lgroup))
                {
                    lvModule.Groups.Add(lgroup);
                }
                lvi.Group = lvModule.Groups[module.MODULECATEGORY];

                string IconFile = Application.StartupPath + (CurrentMode == SynapseModule.SynapseModuleMode.Production?"\\Prod\\":"\\Dev\\") + module.TECHNICALNAME + "\\" + module.TECHNICALNAME + ".ico";

                Image img;
                if (File.Exists(IconFile))
                {
                    img = Image.FromFile(IconFile);
                }
                else
                {
                    img = Image.FromFile(Application.StartupPath + "\\ModulesIcons\\Default.png");
                }

                smallImages.Images.Add(module.TECHNICALNAME, img);
                largeImages.Images.Add(module.TECHNICALNAME, img);

                Bitmap bm = MakeGrayscale(new Bitmap(img));
                smallImages.Images.Add(module.TECHNICALNAME + "_INACTIVE", bm);
                largeImages.Images.Add(module.TECHNICALNAME + "_INACTIVE", bm);

                string Inactive = module.IS_ACTIVE ? "" : "_INACTIVE";
                lvi.ImageKey = module.TECHNICALNAME + Inactive;

                lvModule.Items.Add(lvi);
            }
        }
Ejemplo n.º 10
0
        public frmAccessRights()
        {
            InitializeComponent();

            AllUserCollection    = SynapseUser.Load();
            AllProfileCollection = SynapseProfile.Load();
            ModuleCollection     = SynapseModule.Load();

            olvUsers_USERID.ImageGetter = delegate(object row)
            {
                return(1);
            };

            olvUsers2_USERID.ImageGetter = delegate(object row)
            {
                return(1);
            };

            olvGroups_Group.ImageGetter = delegate(object row)
            {
                return(0);
            };

            olvGroups_Description.AspectGetter = delegate(object x)
            {
                return(((SynapseProfile)x).Description.ToString());
            };
            olvGroups_Owner.AspectGetter = delegate(object x)
            {
                return(((SynapseProfile)x).IS_OWNER);
            };
            olvGroups_Owner.Renderer = new MappedImageRenderer(new Object[] { true, imageList2.Images[0], "x", imageList2.Images[1] });

            olvGroup2_Group.ImageGetter = delegate(object row)
            {
                return(0);
            };

            olvGroup2_Owner.AspectGetter = delegate(object x)
            {
                return(((SynapseProfile)x).IS_OWNER);
            };
            olvGroup2_Owner.Renderer = new MappedImageRenderer(new Object[] { true, imageList2.Images[0], "x", imageList2.Images[1] });

            olvUserGroup_GroupName.ImageGetter = delegate(object row)
            {
                return(0);
            };

            olvUserGroup_GroupName.AspectGetter = delegate(object x)
            {
                SynapseUser_Profile SUserProfile = (SynapseUser_Profile)x;

                foreach (SynapseProfile Sp in AllProfileCollection)
                {
                    if (Sp.ID == SUserProfile.FK_SECURITY_PROFILE)
                    {
                        return(Sp.TECHNICALNAME);
                    }
                }
                return("Unknown");
            };
            olvUserGroup_Description.AspectGetter = delegate(object x)
            {
                SynapseUser_Profile SUserProfile = (SynapseUser_Profile)x;

                foreach (SynapseProfile Sp in AllProfileCollection)
                {
                    if (Sp.ID == SUserProfile.FK_SECURITY_PROFILE)
                    {
                        return(Sp.Description.ToString());
                    }
                }
                return("");
            };
            olvUserGroup_Module.AspectGetter = delegate(object x)
            {
                SynapseUser_Profile SUserProfile = (SynapseUser_Profile)x;

                foreach (SynapseProfile Sp in AllProfileCollection)
                {
                    if (Sp.ID == SUserProfile.FK_SECURITY_PROFILE)
                    {
                        foreach (SynapseModule Module in ModuleCollection)
                        {
                            if (Module.ID == Sp.FK_ModuleID)
                            {
                                return(Module.FriendlyName);
                            }
                        }
                    }
                }
                return("Unknown");
            };
            olvUserGroups.PrimarySortColumn = olvUserGroup_Module;

            olvGroupUsers_USERID.ImageGetter = delegate(object row)
            {
                return(1);
            };

            olvGroupUsers_USERID.AspectGetter = delegate(object x)
            {
                SynapseUser_Profile SUserProfile = (SynapseUser_Profile)x;

                foreach (SynapseUser Su in AllUserCollection)
                {
                    if (Su.ID == SUserProfile.FK_SECURITY_USER)
                    {
                        return(Su.UserID);
                    }
                }
                return("Unknown");
            };

            olvGroupUsers_FIRSTNAME.AspectGetter = delegate(object x)
            {
                SynapseUser_Profile SUserProfile = (SynapseUser_Profile)x;

                foreach (SynapseUser Su in AllUserCollection)
                {
                    if (Su.ID == SUserProfile.FK_SECURITY_USER)
                    {
                        return(Su.FIRSTNAME);
                    }
                }
                return("Unknown");
            };

            olvGroupUsers_LASTNAME.AspectGetter = delegate(object x)
            {
                SynapseUser_Profile SUserProfile = (SynapseUser_Profile)x;

                foreach (SynapseUser Su in AllUserCollection)
                {
                    if (Su.ID == SUserProfile.FK_SECURITY_USER)
                    {
                        return(Su.LASTNAME);
                    }
                }
                return("Unknown");
            };
            olvGroupUsers.PrimarySortColumn = olvGroupUsers_USERID;
        }
Ejemplo n.º 11
0
        private void SecurizeForm(bool AddMenu)
        {
            bool   UserHaveAccess      = false;
            string UserID              = string.Empty;
            bool   ScanControl         = false;
            bool   ShowTestEnvironment = true;

            if (_allModules == null)
            {
                _allModules = SynapseModule.Load();
            }
            try
            {
                ShowTestEnvironment = bool.Parse(ConfigurationManager.AppSettings["ShowTestEnvironment"]);
            }
            // TODO: Replace by more specific exception
            catch (Exception)
            {
                // TODO: Log exception
            }

            if (System.ComponentModel.LicenseManager.UsageMode != System.ComponentModel.LicenseUsageMode.Designtime)
            {
                if (log4net.LogManager.GetRepository().Configured == false)
                {
                    XmlConfigurator.Configure();
                }

                if (_formUser == null)
                {
                    UserID   = WindowsIdentity.GetCurrent().Name;
                    FormUser = new SynapseCore.Security.User(UserID, this.ModuleID);
                }

                if (_language == null)
                {
                    string languageFilter = null;
                    try
                    {
                        languageFilter = ConfigurationManager.AppSettings["ModuleLanguages"];
                    }
                    catch
                    {
                        SynapseLogger.Debug("ModuleLanguage not defined in app.config");
                    }
                    if (languageFilter != null && languageFilter != string.Empty && languageFilter != "")
                    {
                        _language = SynapseLanguage.Load("where CODE in (" + languageFilter + ")");
                    }
                    else
                    {
                        _language = SynapseLanguage.Load();
                    }
                }

                SynapseLogger.Debug("ModuleLanguage not defined in app.config");
                if (Control.ModifierKeys == (Keys.Control | Keys.Shift) && FormUser.IsMemberOf("SYNAPSE_SECURITY_USER_IMPERSONATE"))
                {
                    frm_EnterUser UserDialog = new frm_EnterUser();
                    UserDialog.ShowDialog();
                    UserID = UserDialog.UserID;
                    if (UserID != string.Empty)
                    {
                        FormUser = new SynapseCore.Security.User(UserID, this.ModuleID);
                    }
                }

                SynapseLogger.Debug("Check key modifier");
                if (FormUser.UserCulture != string.Empty && FormUser.UserCulture != null)
                {
                    _CurrentLanguage.CULTURE = FormUser.UserCulture;
                }
                else
                {
                    _CurrentLanguage.CULTURE = Thread.CurrentThread.CurrentCulture.Name;
                }

                SynapseLogger.Debug("Set Current Language");
                foreach (SynapseLanguage lang in _language)
                {
                    if (lang.CULTURE == _CurrentLanguage.CULTURE)
                    {
                        _CurrentLanguage = lang;
                    }
                }

                SynapseLogger.Debug("Set Current Language Label");
                if (_CurrentLanguage.LABEL == null)
                {
                    _CurrentLanguage = _language[0];
                }

                Security.Tools.SetCulture(_CurrentLanguage.CULTURE);
                SynapseLogger.Debug("Configure Resource Manager");
                ConfigureResourceManager();

                SynapseLogger.Debug("Set Current Module access");
                if (FormUser != null)
                {
                    foreach (SynapseModule Module in _allModules) //FormUser.Modules
                    {
                        if (_CurrentSynapse == null && Module.ID == 1)
                        {
                            _CurrentSynapse = Module;
                        }
                        if (_CurrentModule == null && Module.ID == _ModuleID)
                        {
                            _CurrentModule = Module;
                        }
                    }
                    if (FormUser.Modules.Select(m => m.ID).Contains(_CurrentModule.ID))
                    {
                        UserHaveAccess = true;
                    }
                }

                SynapseLogger.Debug("Check Module Mode");
                if (CurrentModule.ID == 1)
                {
                    if (SynapseCore.Database.DBFunction.ConnectionName != "Default")
                    {
                        Mode = SynapseModule.SynapseModuleMode.Development;
                    }
                    else
                    {
                        Mode = SynapseModule.SynapseModuleMode.Production;
                    }
                }
                else
                {
                    Mode = Application.ExecutablePath.Contains("\\Dev\\") ? SynapseModule.SynapseModuleMode.Development : SynapseModule.SynapseModuleMode.Production;
                }

                //redify
                List <Control> menupoint = Controls.OfType <ToolStrip>().Cast <Control>().ToList();
                if (menupoint.Count > 0)
                {
                    foreach (Control Ctrl in menupoint)
                    {
                        if (SynapseCore.Database.DBFunction.FormBackColor != SystemColors.Control && ShowTestEnvironment)
                        {
                            ((ToolStrip)Ctrl).BackColor = SynapseCore.Database.DBFunction.FormBackColor;
                        }
                    }
                }
                //end refify

                SynapseLogger.Debug("Add Menu");
                if (this.ShowMenu && AddMenu)
                {
                    ConfigureMenu();
                }

                SynapseLogger.Debug("Language Message");
                string LangMessage = "en";
                try
                {
                    LangMessage = _CurrentLanguage.CULTURE.Substring(0, 2).ToUpper();
                }
                // TODO: Replace by more specific exception
                catch (Exception)
                {
                    SynapseLogger.Error("Unable to determine language of message");
                }

                SynapseLogger.Debug("Message No Access");
                if (!UserHaveAccess && ModuleID != 1)
                {
                    MessageBox.Show(Properties.Resources.ResourceManager.GetString(LangMessage + "_NoAccess"));
                    Application.Exit();
                }

                SynapseLogger.Debug("Message Not Active");
                if (!CurrentModule.IS_ACTIVE && Mode == SynapseModule.SynapseModuleMode.Production)
                {
                    MessageBox.Show("(" + Mode.ToString() + ") " + Properties.Resources.ResourceManager.GetString(LangMessage + "_Maintenance"));
                    Application.Exit();
                }

                SynapseLogger.Debug("Message Not Up To Date");
                if (!CurrentModule.is_uptodate(Application.StartupPath, Mode) && !System.Diagnostics.Debugger.IsAttached)
                {
                    try
                    {
                        MessageBox.Show(Properties.Resources.ResourceManager.GetString(LangMessage + "_UpdateNeeded"));
                        string file = Application.ExecutablePath.Substring(0, Application.ExecutablePath.LastIndexOf(Mode == SynapseModule.SynapseModuleMode.Production ? "\\Prod\\" : "\\Dev\\")) + "\\Synapse.exe";
                        if (file != null)
                        {
                            SynapseCore.Controls.SynapseForm.SynapseLogger.Debug("starting " + file);
                            System.Diagnostics.Process proc = new System.Diagnostics.Process();
                            proc.EnableRaisingEvents        = false;
                            proc.StartInfo.WindowStyle      = System.Diagnostics.ProcessWindowStyle.Normal;
                            proc.StartInfo.FileName         = file;
                            proc.StartInfo.WorkingDirectory = Path.GetFullPath(file);
                            proc.StartInfo.Arguments        = Mode == SynapseModule.SynapseModuleMode.Production ? "" : "/con:ACC";
                            proc.Start();
                        }
                        else
                        {
                            SynapseCore.Controls.SynapseForm.SynapseLogger.Debug("Not exist " + file);
                        }
                        Application.Exit();
                    }
                    // TODO: Replace by more specific exception
                    catch (Exception)
                    {
                        if (!FormUser.IsMemberOf("SYNAPSE_SECURITY_ADMIN"))
                        {
                            MessageBox.Show("Application not in right location !");
                            Application.Exit();
                        }
                    }
                }

                SynapseLogger.Debug("Message Development");
                if (Mode == SynapseModule.SynapseModuleMode.Development && !DevACK)
                {
                    MessageBox.Show(Properties.Resources.ResourceManager.GetString(LangMessage + "_DevelopmentMode"));
                    DevACK = true;
                }
                try
                {
                    ScanControl = bool.Parse(ConfigurationManager.AppSettings["ScanControl"]);
                }
                // DONE: Replaced by more specific exception (see http://msdn.microsoft.com/en-us/library/vstudio/system.configuration.configurationmanager.appsettings(v=vs.90).aspx)
                catch (ConfigurationErrorsException)
                {
                    // TODO: Remove swallowing of Exception
                }

                if (UpdateControls && ModuleID != 0 && ScanControl)
                {
                    System.IO.TextWriter w = new System.IO.StreamWriter(Application.StartupPath + "\\" + this.Name + "_res.SynapseResource", false, System.Text.Encoding.Unicode);
                    w.Write(SynapseCore.Security.Tools.UpdateControlsInDB(this.Controls, this.ModuleID, null).ToString());

                    w.Flush();
                    w.Close();
                }

                SynapseLogger.Debug("Init Form");
                initForm(Security.Tools.SecureAndTranslateMode.Secure | Security.Tools.SecureAndTranslateMode.Transalte);
            }
        }
Ejemplo n.º 12
0
        void UserEditLoad(object sender, EventArgs e)
        {
            Hashtable LevelForProfile = new Hashtable();

            this.ssl_StatusLabel.Text = FormUser.UserID;

            foreach (SynapseProfile Profile in SynapseForm.FormUser.Groups)
            {
                if (Profile.IS_OWNER)
                {
                    ModuleIdFilter += Profile.FK_ModuleID + ",";
                    if (!LevelForProfile.ContainsKey(Profile.FK_ModuleID))
                    {
                        LevelForProfile.Add(Profile.FK_ModuleID, Profile.LEVEL);
                    }
                    else
                    if ((Int64)LevelForProfile[Profile.FK_ModuleID] > Profile.LEVEL)
                    {
                        LevelForProfile[Profile.FK_ModuleID] = Profile.LEVEL;
                    }
                }
            }

            var UserCollection = SynapseUser.Load();


            if (SynapseForm.FormUser.IsMemberOf("SYNAPSE_SECURITY_ADMIN"))
            {
                ProfileCollection = SynapseProfile.Load();
            }
            else if (ModuleIdFilter.Length > 1)
            {
                ProfileCollection = (from p in SynapseProfile.Load("WHERE FK_ModuleID in (" + ModuleIdFilter.TrimEnd(',') + ")") where p.LEVEL > (Int64)LevelForProfile[p.FK_ModuleID] select p).ToList();
            }
            else
            {
                ProfileCollection = new List <SynapseProfile>();
            }
            IList <SynapseProfile> AllProfileCollection;

            AllProfileCollection = SynapseProfile.Load();

            ModuleCollection = SynapseModule.Load();

            olvcGroups.ImageGetter = delegate(object row) {
                return(0);
            };

            olvcUsers.ImageGetter = delegate(object row) {
                return(1);
            };

            olvc_GroupName.ImageGetter = delegate(object row) {
                return(0);
            };

            olvc_GroupName.AspectGetter = delegate(object x) {
                SynapseUser_Profile SUserProfile = (SynapseUser_Profile)x;

                foreach (SynapseProfile Sp in AllProfileCollection)
                {
                    if (Sp.ID == SUserProfile.FK_SECURITY_PROFILE)
                    {
                        return(Sp.TECHNICALNAME);
                    }
                }
                return("Unknown");
            };
            olvc_Module.AspectGetter = delegate(object x) {
                SynapseUser_Profile SUserProfile = (SynapseUser_Profile)x;

                foreach (SynapseProfile Sp in AllProfileCollection)
                {
                    if (Sp.ID == SUserProfile.FK_SECURITY_PROFILE)
                    {
                        foreach (SynapseModule Module in ModuleCollection)
                        {
                            if (Module.ID == Sp.FK_ModuleID)
                            {
                                return(Module.FriendlyName);
                            }
                        }
                    }
                }
                return("Unknown");
            };
            olv_GroupsOfUser.PrimarySortColumn = olvc_Module;
            olv_Groups.SetObjects(ProfileCollection);
            olv_Users.SetObjects(UserCollection);

            cb_Modules.DisplayMember = "FriendlyName";
            cb_Modules.ValueMember   = "ID";
            cb_Modules.Items.Clear();
            cb_Modules.Items.Add("ALL");
            foreach (SynapseModule Mod in ModuleCollection)
            {
                cb_Modules.Items.Add(Mod);
            }
            cb_Modules.SelectedIndex = 0;
        }