Пример #1
0
        /// <summary>
        /// Load all dashboards for the user
        /// </summary>
        public List <Dashboard> GetDashboards()
        {
            try
            {
                if (Dashboards == null)
                {
                    Dashboards = new List <Dashboard>();
                }
                //personal
                if (HasPersonalDashboardFolder)
                {
                    foreach (var p in Directory.GetFiles(DashboardPersonalFolder, "*." + Repository.SealDashboardExtension))
                    {
                        LoadPersonalDashboard(p);
                    }
                }

                //public
                foreach (var f in SecurityDashboardFolders.Where(i => i.Right != DashboardFolderRight.None))
                {
                    var dir = Path.Combine(Security.Repository.DashboardPublicFolder, FileHelper.CleanFilePath(f.Name));
                    if (!Directory.Exists(dir))
                    {
                        Directory.CreateDirectory(dir);
                    }
                    foreach (var p in Directory.GetFiles(dir, "*." + Repository.SealDashboardExtension))
                    {
                        LoadPublicDashboard(p, f.FolderPath, f.Name, f.Right == DashboardFolderRight.Edit);
                    }
                }

                //remove deleted
                Dashboards.RemoveAll(i => !File.Exists(i.Path));

                //Dashboards Script
                ScriptNumber = 1;
                foreach (var group in SecurityGroups.Where(i => !string.IsNullOrEmpty(i.DashboardsScript)).OrderBy(i => i.Name))
                {
                    RazorHelper.CompileExecute(group.DashboardsScript, this);
                    ScriptNumber++;
                }
            }
            catch (Exception ex)
            {
                Debug.WriteLine(ex.Message);
            }
            return(Dashboards);
        }
Пример #2
0
        /// <summary>
        /// Load all dashboards for the user
        /// </summary>
        public List <Dashboard> GetDashboards()
        {
            try
            {
                if (_dashboards == null)
                {
                    _dashboards = new List <Dashboard>();
                }
                //personal
                if (HasPersonalDashboardFolder)
                {
                    foreach (var p in Directory.GetFiles(DashboardPersonalFolder, "*." + Repository.SealDashboardExtension))
                    {
                        LoadDashboard(p, SWIDashboardFolder.PersonalPath, "", true, true);
                    }
                }

                //public
                foreach (var f in SecurityDashboardFolders.Where(i => i.Right != DashboardFolderRight.None))
                {
                    var dir = Path.Combine(Security.Repository.DashboardPublicFolder, FileHelper.CleanFilePath(f.Name));
                    if (!Directory.Exists(dir))
                    {
                        Directory.CreateDirectory(dir);
                    }
                    foreach (var p in Directory.GetFiles(dir, "*." + Repository.SealDashboardExtension))
                    {
                        LoadDashboard(p, f.FolderPath, f.Name, f.Right == DashboardFolderRight.Edit, false);
                    }
                }

                //remove deleted
                _dashboards.RemoveAll(i => !File.Exists(i.Path));
            }
            catch (Exception ex)
            {
                Debug.WriteLine(ex.Message);
            }
            return(_dashboards);
        }