示例#1
0
        public void Refresh()
        {
            HRBuilding[] bb = _dbContext.Buildings.OrderBy(x => x.Name).ToArray();
            foreach(HRBuilding b in bb)
            {
                AnvilTreeNode bn = new AnvilTreeNode()
                {
                    Text = b.Name,
                    Value = b.BuildingKey.ToString(),
                    InitGlyph = "fa fa-building",
                    ItemGlyphCss = "fa-building",
                    SelectedItemGlyphCss = "fa-building-o"
                };

            }
        }
示例#2
0
        public void Refresh()
        {
            try
            {
                ApplicationBase app = LcpsDbContext.DefaultApp;

                RemoteComputer c = new RemoteComputer(this.Server, app.LDAPDomainUserName, app.LDAPPassword);

                foreach(Win32_Share s in c.SharedFolders)
                {
                    AnvilTreeNode n = new AnvilTreeNode()
                    {
                        Text = s.Name,
                        Value = "\\\\" + this.Server + "\\" + s.Name,
                        SelectedItemGlyphCss = "fa-folder-open-o",
                        ItemGlyphCss = "fa-folder-o",
                        InitGlyph = "fa fa-folder-o",
                        LinkClass = "folder"
                    };

                    if (Recursive)
                    {
                        string sp = "\\\\" + this.Server + "\\" + s.Name;
                        try
                        {

                            DirectoryInfo d = new DirectoryInfo(sp);

                            GetFolders(d, ref n);
                        }
                        catch (Exception ex)
                        {
                            n.ItemError = ex;
                        }
                    }

                    Children.Add(n);
                }
            }
            catch(Exception ex)
            {
                throw new Exception("Error enumerating shares on server", ex);
            }
        }
示例#3
0
        private void GetFolders(DirectoryInfo d, ref AnvilTreeNode n)
        {
            AnvilTreeNode dn = new AnvilTreeNode()
            {
                Text = d.Name,
                Value = d.FullName,
                SelectedItemGlyphCss = "fa-folder-open-o",
                ItemGlyphCss = "fa-folder-o",
                InitGlyph = "fa-folder-o"
            };

            DirectoryInfo[] dd = null;

            try
            {
                dd = d.GetDirectories();
                foreach (DirectoryInfo child in dd)
                {
                    GetFolders(child, ref dn);
                }
            }
            catch (Exception ex)
            {
                n.ItemError = ex;
            }

            n.Children.Add(dn);
        }
示例#4
0
        private void CreateUl(AnvilTreeNode n, ref string output)
        {
            if (n.ItemError == null)
            {
                bool IsParent = (n.Children.Count() > 0);

                if (IsParent)
                {
                    output += "<li><span style='margin-right: 8px;' selectedGlyph='" + n.SelectedItemGlyphCss + "' normalGlyph='" + n.ItemGlyphCss + "'><i class='" + n.InitGlyph + "'></i></span><a value='" + n.Value + "' class='" + n.LinkClass + "'>" + n.Text + "</a>\n";
                    output += "<ul>\n";
                    foreach (AnvilTreeNode child in n.Children)
                    {
                        CreateUl(child, ref output);
                    }
                    output += "</ul></li>\n";
                }
                else
                {
                    output += "<li><span style='margin-right: 8px;' selectedGlyph='" + n.SelectedItemGlyphCss + "' normalGlyph='" + n.ItemGlyphCss + "'><i class='" + n.InitGlyph + "'></i></span><a value='" + n.Value + "' class='" + n.LinkClass + "'>" + n.Text + "</a></li>\n";
                }

            }
            else
            {
                AnvilExceptionCollector ec = new AnvilExceptionCollector(ItemError);
                string result = "<li class='text-danger'>";
                result += ec.ToUL() + "</li>\n";
                output += result;
            }
        }
示例#5
0
        private void LoadChildren(ref AnvilTreeNode n, LcpsAdsContainer parent)
        {
            LcpsAdsObjectTypes t = LcpsAdsObjectTypes.OrganizationalUnit;

            if (Groups)
                t = t | LcpsAdsObjectTypes.Group;

            List<LcpsAdsContainer> cc = parent.GetContainers(parent, t, false);
            foreach (LcpsAdsContainer c in cc)
            {
                AnvilTreeNode child = new AnvilTreeNode()
                {
                    Text = c.Name,
                    Value = c.ObjectGuid.ToString(),
                    LinkClass = c.ObjectCategory.ToString()
                };

                if(String.IsNullOrEmpty(c.Name))
                    child.Text = c.AdsPath;

                switch (c.ObjectType)
                {
                    case LcpsAdsObjectTypes.Unknown:
                        child.InitGlyph = "fa fa-question";
                        child.ItemGlyphCss = "fa-question";
                        child.SelectedItemGlyphCss = "fa-question";
                        break;
                    case LcpsAdsObjectTypes.Container:
                        child.InitGlyph = "fa fa-folder-o";
                        child.ItemGlyphCss = "fa-folder-o";
                        child.SelectedItemGlyphCss = "fa-folder-o";
                        break;
                    case LcpsAdsObjectTypes.Domain:
                        child.InitGlyph = "fa fa-globe";
                        child.ItemGlyphCss = "fa-globe";
                        child.SelectedItemGlyphCss = "fa-globe";
                        break;
                    case LcpsAdsObjectTypes.OrganizationalUnit:
                        child.InitGlyph = "fa fa-folder-o";
                        child.ItemGlyphCss = "fa-folder-o";
                        child.SelectedItemGlyphCss = "fa-folder-o";
                        break;
                    case LcpsAdsObjectTypes.Group:
                        child.InitGlyph = "fa fa-group";
                        child.ItemGlyphCss = "fa-group";
                        child.SelectedItemGlyphCss = "fa-group";
                        break;
                }

                if (c.ObjectType == LcpsAdsObjectTypes.OrganizationalUnit | c.ObjectType == LcpsAdsObjectTypes.Container)
                    LoadChildren(ref child, c);

                n.Children.Add(child);
            }
        }
示例#6
0
 public void Load()
 {
     _rootNode = new AnvilTreeNode(Domain.Name, Domain.ObjectGuid.ToString(), "domain");
     LoadChildren(ref _rootNode, _domain);
 }