Ejemplo n.º 1
0
        int PopulateTreeView(TagElements parentTag, int curentPosition, TreeNode parentNode)
        {
            // parentTag.hierarchicalPosition = curentPosition;

            int j = 0;
            foreach (TagElements tag in tagMap)
            {
                if (tag == null) break;

                if (tag.parentName == parentTag.tagName)
                {
                    TreeNode curentNode = new TreeNode();
                    curentNode.Text = tag.tagName;
                    curentNode.NavigateUrl = "TagInfo.aspx?tagName=" + tag.tagName;
                    curentNode.Collapse();
                    parentNode.ChildNodes.Add(curentNode);
                    PopulateTreeView(tag, curentPosition + 1, curentNode);
                }

                j++;

                // Response.Write(tag.tagName + "   " + tag.parentName + "<br />");
            }

            return 0;
        }
    /// <summary>
    /// Recursively checks for any nodes with a check and expands to that node.
    /// </summary>
    /// <param name="node"></param>
    /// <returns></returns>
    private bool RecursiveSelectedExpand(TreeNode node)
    {
        if (node.ChildNodes.Count == 0 && node.Checked)
        {
            return(true);
        }
        bool returnVal = false;

        foreach (TreeNode childNode in node.ChildNodes)
        {
            returnVal = (RecursiveSelectedExpand(childNode) || returnVal);
        }
        if (returnVal)
        {
            node.Expand();
        }
        else
        {
            node.Collapse();
        }
        return(returnVal);
    }
Ejemplo n.º 3
0
        //string js = @"function ";Page.Server.UrlEncode
        void buildAsyncSub(string pageUrl, string webUrl, SPFolder root, TreeNodeCollection nodes )
        {
            foreach (SPFolder f in root.SubFolders)
            {
                //if (f.Name.ToLower() == "forms") continue;
                if (IsHiddenFolder(f)) continue;

                TreeNode n = new TreeNode();
                n.Text = f.Name ; //  +"(" + f.Files.Count + ")";
                n.ImageUrl = "/_layouts/images/folder.gif";
                n.Collapse();
                n.NavigateUrl = String.Format("javascript:TreeListViewWebPart_LoadFolderContent('{0}','{1}')", pageUrl ,(webUrl + f.Url));

                nodes.Add(n);

                buildAsyncSub(pageUrl, webUrl, f, n.ChildNodes);
            }
        }
Ejemplo n.º 4
0
		private void ShowSelectionTree ()
			{
			
			TreeView SelectionTreeView = new TreeView ();
			SelectionTreeView.CssClass = "CSS_SelectionTreeView";
			this.ContentPlaceHolderNavigationPlace.Controls.Add (SelectionTreeView);
			LoadPossibleValues ();
			TreeNode StartNode = new TreeNode ("Kalender Durchsuchen nach..");
			StartNode.SelectAction = TreeNodeSelectAction.Expand;
			SelectionTreeView.Nodes.Add (StartNode);
			foreach (DataTable Table in PossibleValues.Tables)
				{
				String TableName = Table.TableName;
				String ColumnName = Table.Columns [0].ColumnName;
				TreeNode TableNode = new TreeNode (ColumnName);
				TableNode.SelectAction = TreeNodeSelectAction.Expand;
				StartNode.ChildNodes.Add (TableNode);
				foreach (DataRow TableRow in Table.Rows)
					{
					String Entry = TableRow [0].ToString ();
					TreeNode ContentNode = new TreeNode (Entry);
					TableNode.ChildNodes.Add (ContentNode);
					ContentNode.NavigateUrl = "./WPMediaCalendarDisplay.aspx?Search=Future&Table=Kalender"
						+ "&Column=" + ColumnName + "&Entry=" + Entry;
					}
				TableNode.Collapse ();
				}
			}
 private void AddTask(TreeNode parent, IAzManItem item, TreeNode applicationNode)
 {
     TreeNode node = new TreeNode(item.Name, item.Name, this.getImageUrl("Task_16x16.gif"));
     node.ToolTip = item.Description;
     parent.ChildNodes.Add(node);
     foreach (IAzManItem subItem in item.Members.Values)
     {
         if (subItem.ItemType == ItemType.Task)
         {
             this.AddTask(node, subItem, applicationNode);
         }
     }
     if (item.Application.Store.Storage.Mode == NetSqlAzManMode.Developer)
     {
         foreach (IAzManItem subItem in item.Members.Values)
         {
             if (subItem.ItemType == ItemType.Operation)
             {
                 this.AddOperation(node, subItem, applicationNode);
             }
         }
     }
     node.Collapse();
 }
 private void AddOperation(TreeNode parent, IAzManItem item, TreeNode applicationNode)
 {
     TreeNode node = new TreeNode(item.Name, item.Name, this.getImageUrl("Operation_16x16.gif"));
     node.ToolTip = item.Description;
     parent.ChildNodes.Add(node);
     foreach (IAzManItem subItem in item.Members.Values)
     {
         this.AddOperation(node, subItem, applicationNode);
     }
     node.Collapse();
 }
 private void add(TreeNode parent, IAzManApplication app)
 {
     TreeNode node = new TreeNode(app.Name, app.Name, this.getImageUrl("Application_16x16.gif"));
     node.ToolTip = app.Description;
     parent.ChildNodes.Add(node);
     node.Expand();
     foreach (IAzManItem item in app.Items.Values)
     {
         if (item.ItemType == ItemType.Role)
         {
             if (item.ItemsWhereIAmAMember.Count == 0) this.AddRole(node, item, node);
         }
     }
     foreach (IAzManItem item in app.Items.Values)
     {
         if (item.ItemType == ItemType.Task)
         {
             if (item.ItemsWhereIAmAMember.Count == 0) this.AddTask(node, item, node);
         }
     }
     if (app.Store.Storage.Mode == NetSqlAzManMode.Developer)
     {
         foreach (IAzManItem item in app.Items.Values)
         {
             if (item.ItemType == ItemType.Operation)
             {
                 if (item.ItemsWhereIAmAMember.Count == 0) this.AddOperation(node, item, node);
             }
         }
     }
     node.Collapse();
 }
Ejemplo n.º 8
0
    public void crea_menuweb(DataTable pdtDatos, ref System.Web.UI.WebControls.TreeView objmenu)
    {
        System.Web.UI.WebControls.TreeNode objmenp = new System.Web.UI.WebControls.TreeNode();
        System.Web.UI.WebControls.TreeNode objmenh = new System.Web.UI.WebControls.TreeNode();
        string strmenp = "";

        objmenu.Nodes.Clear();

        int intindex = 0;

        foreach (DataRow dr in pdtDatos.Rows)
        {
            //Creo menus principales
            if (strmenp != dr["MEN_CODIGO"].ToString())
            {
                if ((dr["MEN_NIVEL"].ToString() == "0"))
                {
                    objmenu.SelectedNodeChanged += new EventHandler(this.Click_menuweb);
                    strmenp = dr["MEN_CODIGO"].ToString();
                    objmenp = new System.Web.UI.WebControls.TreeNode();
                    objmenu.Nodes.Add(objmenp);
                    intindex     = objmenp.ChildNodes.IndexOf(objmenp);
                    objmenp.Text = dr["MEN_DESCRIPCION"].ToString();
                    objmenu.SelectedNodeChanged += new EventHandler(this.Click_menuweb);
                    objmenp.Collapse();
                    ingresamenu(intindex, strmenp, "");
                }
                else
                {
                    objmenu.SelectedNodeChanged += new EventHandler(this.Click_menuweb);
                    strmenp  = dr["MEN_CODIGO"].ToString();
                    objmenp  = new System.Web.UI.WebControls.TreeNode();
                    intindex = int.Parse(buscamenu(dr["MEN_PADRE"].ToString(), 1, 0));
                    objmenu.Nodes[intindex].ChildNodes.Add(objmenp);
                    intindex     = objmenp.ChildNodes.IndexOf(objmenp);
                    objmenp.Text = dr["MEN_DESCRIPCION"].ToString();
                    objmenu.SelectedNodeChanged += new EventHandler(this.Click_menuweb);
                    objmenp.Collapse();
                }
            }
            //Creo tareas de menu
            objmenu.SelectedNodeChanged += new EventHandler(this.Click_menuweb);
            objmenh = new System.Web.UI.WebControls.TreeNode();
            objmenp.ChildNodes.Add(objmenh);
            intindex             = objmenp.ChildNodes.IndexOf(objmenh);
            objmenh.Text         = dr["TAR_DESCRIPCION"].ToString();
            objmenh.SelectAction = System.Web.UI.WebControls.TreeNodeSelectAction.Select;
            if (dr["TAR_PROGRAMA"].ToString() != "")
            {
                if (dr["TAR_PROGRAMA"].ToString().ToUpper().Substring((dr["TAR_PROGRAMA"].ToString().Length - 3), 3) == "RSI")
                {
                    objmenh.NavigateUrl = "reportes/Reporte.asp?strNomRep=" + dr["TAR_PROGRAMA"].ToString() + "&strTitRep=" + dr["TAR_CODIGO"].ToString();
                }
                else
                {
                    objmenh.NavigateUrl = dr["TAR_PROGRAMA"].ToString();
                }
                objmenh.Target = dr["PANTALLA"].ToString(); //"CENTRO";
                objmenu.SelectedNodeChanged += new EventHandler(this.Click_menuweb);
            }
        }
    }
Ejemplo n.º 9
0
        private TreeNode[] recurseSOATree(SOA soa)
        {
            string strCPU = null;
            string strWCF = null;
            string strASPNET = null;
            if (soa.ConnectedSOAs == null || soa.ConnectedSOAs.Count == 0)
                return null;
            TreeNode[] returnNodes = new TreeNode[soa.ConnectedSOAs.Count];
            for (int i = 0; i < soa.ConnectedSOAs.Count; i++)
            {
                int imageIndex = 0;
                if (soa.ConnectedSOAs[i].Status.Equals(ConfigSettings.MESSAGE_CIRCULAR_REF_TERMINAL))
                    imageIndex = 3;
                else
                    if (soa.ConnectedSOAs[i].Status.Equals(ConfigSettings.MESSAGE_OFFLINE))
                        imageIndex = 1;
                string rootName = "<span><Font color='#84BDEC'>" + soa.ConnectedSOAs[i].SOAName + "</font></span>";
                TreeNode root = new TreeNode(rootName, imageIndex.ToString(), imageList[imageIndex]);
                root.ToolTip = "Connected Service Domain";
                root.Expand();
                imageIndex = 0;
                int offset = 0;
                string prefix = "";
                string deployment = "";
                string display="";
                if (soa.ConnectedSOAs[i].MyVirtualHost != null)
                {
                    if (soa.ConnectedSOAs[i].MyVirtualHost.ServiceNodes != null && soa.ConnectedSOAs[i].MyVirtualHost.ServiceNodes.Count > 0 && soa.ConnectedSOAs[i].MyVirtualHost.ServiceNodes[0] != null)
                    {
                        if (soa.ConnectedSOAs[i].MyVirtualHost.Status == ConfigSettings.MESSAGE_OFFLINE)
                            offset = 0;
                        else
                        {
                            if (soa.ConnectedSOAs[i].MyVirtualHost.ServiceNodes[0].RuntimePlatform!=null && soa.ConnectedSOAs[i].MyVirtualHost.ServiceNodes[0].RuntimePlatform.ToLower().Contains("azure"))
                            {
                                offset = 1;
                                prefix = "Azure Platform Cloud Deployed ";
                            }
                            else
                                if (soa.ConnectedSOAs[i].MyVirtualHost.ServiceNodes[0].RuntimePlatform != null && soa.ConnectedSOAs[i].MyVirtualHost.ServiceNodes[0].RuntimePlatform.ToLower().Contains("hyper"))
                                {
                                    offset = 2;
                                    prefix = "On-premise Deployed (Hyper-V) ";
                                }
                                else
                                {
                                    offset = 0;
                                    prefix = "On-premise Deployed ";
                                }
                        }
                    }
                    if (soa.ConnectedSOAs[i].MyVirtualHost.Status == ConfigSettings.MESSAGE_ONLINE)
                        imageIndex = 4 + offset;
                    else
                        if (soa.ConnectedSOAs[i].MyVirtualHost.Status == ConfigSettings.MESSAGE_OFFLINE)
                            imageIndex = 7 + offset;
                        else
                            if (soa.ConnectedSOAs[i].MyVirtualHost.Status == ConfigSettings.MESSAGE_SOME_NODES_DOWN)
                                imageIndex = 10 + offset;
                    TreeNode myVHost = new TreeNode(prefix + soa.ConnectedSOAs[i].MyVirtualHost.VHostName, imageIndex.ToString(), imageList[imageIndex]);
                    myVHost.Expand();
                    TreeNode[] clusterNodes = new TreeNode[soa.ConnectedSOAs[i].MyVirtualHost.ServiceNodes.Count];
                    
                    for (int h = 0; h < soa.ConnectedSOAs[i].MyVirtualHost.ServiceNodes.Count; h++)
                    {
                        TreeNode primaryEPs = new TreeNode("", "23", imageList[23]);
                        primaryEPs.ToolTip = "Primary Endpoints are those defined by the business application developer to service business requests via their custom business logic.";
                        primaryEPs.Collapse();
                        TreeNode configEPs = new TreeNode("", "22", imageList[22]);
                        configEPs.ToolTip = "Configuration Service Endpoints are infrastructure endpoints available for the Configuration Service itself, for example an endpoint to which ConfigWeb connects.";
                        configEPs.Collapse();
                     //   TreeNode dcEPs = new TreeNode("", "24", imageList[24]);
                     //   dcEPs.Collapse();
                        TreeNode[] endPointNodesPrimary = new TreeNode[soa.ConnectedSOAs[i].MyVirtualHost.ServiceNodes[h].PrimaryListenEndpoints.Count];
                        TreeNode[] endPointNodesConfig = new TreeNode[soa.ConnectedSOAs[i].MyVirtualHost.ServiceNodes[h].ConfigServiceListenEndpoints.Count];
                     //   TreeNode[] endPointNodesDC = new TreeNode[soa.ConnectedSOAs[i].MyVirtualHost.ServiceNodes[h].DCServiceListenEndpoints.Count];
                        for (int j = 0; j < soa.ConnectedSOAs[i].MyVirtualHost.ServiceNodes[h].PrimaryListenEndpoints.Count; j++)
                        {
                            string NAT = "";
                            string NAT2 = "";
                            int endPointImageIndex = 0;
                            switch (soa.ConnectedSOAs[i].MyVirtualHost.ServiceNodes[h].PrimaryListenEndpoints[j].Status)
                            {
                                case ConfigSettings.MESSAGE_ONLINE: { endPointImageIndex = 25; break; }
                                case ConfigSettings.MESSAGE_OFFLINE: { endPointImageIndex = 26; break; }
                                case ConfigSettings.MESSAGE_UNKNOWN: { endPointImageIndex = 27; break; }
                            }
                            if (soa.ConnectedSOAs[i].MyVirtualHost.ServiceNodes[h].PrimaryListenEndpoints[j].LoadBalanceType.Equals(1))
                            {
                                NAT = "<span style=\"color:#FFFFFF\"> --> {" + soa.ConnectedSOAs[i].MyVirtualHost.ServiceNodes[h].PrimaryListenEndpoints[j].LoadBalanceAddress + "}</span>";
                                NAT2 = "<span style=\"color:#FFFFFF\"> --> {NAT Load-Balanced}</span>";
                            }
                            TreeNode endpointnode = null;
                            if (CheckBoxEndpointDetail.Checked)
                            {
                                endpointnode = new TreeNode("<span style=\"color:#848483;\">" + soa.ConnectedSOAs[i].MyVirtualHost.ServiceNodes[h].PrimaryListenEndpoints[j].RemoteAddress + "</span>" + NAT, endPointImageIndex.ToString(), imageList[endPointImageIndex]);
                            }
                            else
                            {
                                endpointnode = new TreeNode("<span style=\"color:#848483;\">" +soa.ConnectedSOAs[i].MyVirtualHost.ServiceNodes[h].PrimaryListenEndpoints[j].ServiceFriendlyName + "</span>" + NAT2, endPointImageIndex.ToString(), imageList[endPointImageIndex]);
                            }
                            endpointnode.ToolTip = soa.ConnectedSOAs[i].MyVirtualHost.ServiceNodes[h].PrimaryListenEndpoints[j].Exception;
                            endPointNodesPrimary[j] = endpointnode;
                        }
                        for (int j = 0; j < soa.ConnectedSOAs[i].MyVirtualHost.ServiceNodes[h].ConfigServiceListenEndpoints.Count; j++)
                        {
                            string NAT = "";
                            string NAT2 = "";
                            int endPointImageIndex = 0;
                            switch (soa.ConnectedSOAs[i].MyVirtualHost.ServiceNodes[h].ConfigServiceListenEndpoints[j].Status)
                            {
                                case ConfigSettings.MESSAGE_ONLINE: { endPointImageIndex = 25; break; }
                                case ConfigSettings.MESSAGE_OFFLINE: { endPointImageIndex = 26; break; }
                                case ConfigSettings.MESSAGE_UNKNOWN: { endPointImageIndex = 27; break; }
                            }
                            if (soa.ConnectedSOAs[i].MyVirtualHost.ServiceNodes[h].ConfigServiceListenEndpoints[j].LoadBalanceType.Equals(1))
                            {
                                NAT = "<span style=\"color:#FFFFFF\"> --> {" + soa.ConnectedSOAs[i].MyVirtualHost.ServiceNodes[h].ConfigServiceListenEndpoints[j].LoadBalanceAddress + "}</span>";
                                NAT2 = "<span style=\"color:#FFFFFF\"> --> {NAT Load-Balanced}</span>";
                            }
                            TreeNode endpointnode = null;
                            if (CheckBoxEndpointDetail.Checked)
                            {
                                endpointnode = new TreeNode("<span style=\"color:#848483;\">" + soa.ConnectedSOAs[i].MyVirtualHost.ServiceNodes[h].ConfigServiceListenEndpoints[j].RemoteAddress + "</span>" +  NAT, endPointImageIndex.ToString(), imageList[endPointImageIndex]);
                            }
                            else
                            {
                                endpointnode = new TreeNode("<span style=\"color:#848483;\">" + soa.ConnectedSOAs[i].MyVirtualHost.ServiceNodes[h].ConfigServiceListenEndpoints[j].ServiceFriendlyName + "</span>" + NAT2, endPointImageIndex.ToString(), imageList[endPointImageIndex]);
                            }
                            endpointnode.ToolTip = soa.ConnectedSOAs[i].MyVirtualHost.ServiceNodes[h].ConfigServiceListenEndpoints[j].Exception;
                            endPointNodesConfig[j] = endpointnode;
                        }
                        /*
                        for (int j = 0; j < soa.ConnectedSOAs[i].MyVirtualHost.ServiceNodes[h].DCServiceListenEndpoints.Count; j++)
                        {
                            int endPointImageIndex = 0;
                            switch (soa.ConnectedSOAs[i].MyVirtualHost.ServiceNodes[h].DCServiceListenEndpoints[j].Status)
                            {
                                case ConfigSettings.MESSAGE_ONLINE: { endPointImageIndex = 25; break; }
                                case ConfigSettings.MESSAGE_OFFLINE: { endPointImageIndex = 26; break; }
                                case ConfigSettings.MESSAGE_UNKNOWN: { endPointImageIndex = 27; break; }
                            }
                            TreeNode endpointnode = null;
                            if (CheckBoxEndpointDetail.Checked)
                            {
                                endpointnode = new TreeNode("<span style=\"color:#848483;\">"+ soa.ConnectedSOAs[i].MyVirtualHost.ServiceNodes[h].DCServiceListenEndpoints[j].RemoteAddress+ "</span>", endPointImageIndex.ToString(), imageList[endPointImageIndex]);
                            }
                            else
                            {
                                endpointnode = new TreeNode("<span style=\"color:#848483;\">" +soa.ConnectedSOAs[i].MyVirtualHost.ServiceNodes[h].DCServiceListenEndpoints[j].ServiceFriendlyName + "</span>", endPointImageIndex.ToString(), imageList[endPointImageIndex]);
                            }
                            endpointnode.ToolTip = soa.ConnectedSOAs[i].MyVirtualHost.ServiceNodes[h].DCServiceListenEndpoints[j].Exception;
                            endPointNodesDC[j] = endpointnode;
                        }
                        for (int k = 0; k < endPointNodesDC.Length; k++)
                        {
                            dcEPs.ChildNodes.Add(endPointNodesDC[k]);
                        }
                         * */
                        for (int k = 0; k < endPointNodesConfig.Length; k++)
                        {
                            configEPs.ChildNodes.Add(endPointNodesConfig[k]);
                        }
                        for (int k = 0; k < endPointNodesPrimary.Length; k++)
                        {
                            primaryEPs.ChildNodes.Add(endPointNodesPrimary[k]);
                        }
                        int nodeimageIndex = 0;
                        offset = 0;
                        if (soa.ConnectedSOAs[i].MyVirtualHost.ServiceNodes[h].RuntimePlatform != null)
                        {
                            if (soa.ConnectedSOAs[i].MyVirtualHost.ServiceNodes[h].RuntimePlatform.ToLower().Contains("azure"))
                            {
                                offset = 1;
                                deployment = "Windows Azure";
                            }
                            else
                                if (soa.ConnectedSOAs[i].MyVirtualHost.ServiceNodes[h].RuntimePlatform.ToLower().Contains("hyper"))
                                {
                                    offset = 2;
                                    deployment = "On-Premise/Private Cloud (Hyper-V)";
                                }
                                else
                                {
                                    offset = 0;
                                    deployment = "On-Premise/Private Cloud";
                                }
                        }
                        else
                        {
                            offset = 0;
                        }
                            switch (soa.ConnectedSOAs[i].MyVirtualHost.ServiceNodes[h].Status)
                            {
                                case ConfigSettings.MESSAGE_ONLINE: { nodeimageIndex = 13 + offset; break; }
                                case ConfigSettings.MESSAGE_OFFLINE: { nodeimageIndex = 16 + offset; break; }
                                case ConfigSettings.MESSAGE_UNKNOWN: { nodeimageIndex = 19 + offset; break; }
                                case ConfigSettings.MESSAGE_SOME_NODES_DOWN: { nodeimageIndex = 50 + offset; break; }
                            }
                        TreeNode node = null;
                        string vhostname = null;
                        string azureRoleInstanceID = "";
                        if (soa.ConnectedSOAs[i].MyVirtualHost.ServiceNodes[h].AzureRoleInstanceID!=null && soa.ConnectedSOAs[i].MyVirtualHost.ServiceNodes[h].AzureRoleInstanceID!="")
                            azureRoleInstanceID = "<span style=\"font-size:.85em;\">&nbsp;&nbsp;&nbsp;{" + soa.ConnectedSOAs[i].MyVirtualHost.ServiceNodes[h].AzureRoleInstanceID + "}</span>";
                        if (CheckBoxEndpointDetail.Checked)
                        {
                            vhostname = soa.ConnectedSOAs[i].MyVirtualHost.ServiceNodes[h].Address + azureRoleInstanceID;
                        }
                        else
                        {
                            vhostname = soa.ConnectedSOAs[i].MyVirtualHost.ServiceNodes[h].NodeServiceName + azureRoleInstanceID;

                        }
                        if (soa.ConnectedSOAs[i].MyVirtualHost.ServiceNodes[h].CPU != -1f)
                            strCPU = System.Math.Round(soa.ConnectedSOAs[i].MyVirtualHost.ServiceNodes[h].CPU).ToString();
                        else
                            strCPU = "*";
                        if (soa.ConnectedSOAs[i].MyVirtualHost.ServiceNodes[h].ASPNETReqPerSec != -1f)
                            strASPNET = System.Math.Round(soa.ConnectedSOAs[i].MyVirtualHost.ServiceNodes[h].ASPNETReqPerSec).ToString();
                        else
                            strASPNET = "*";
                        if (soa.ConnectedSOAs[i].MyVirtualHost.ServiceNodes[h].WCFReqPerSec != -1f)
                            strWCF = System.Math.Round(soa.ConnectedSOAs[i].MyVirtualHost.ServiceNodes[h].WCFReqPerSec).ToString();
                        else
                            strWCF = "*";
                        string runtime;
                        if (soa.ConnectedSOAs[i].MyVirtualHost.ServiceNodes[h].OSVersionString == null)
                            runtime = "";
                        else
                            runtime = soa.ConnectedSOAs[i].MyVirtualHost.ServiceNodes[h].RuntimePlatform + ": OS v " + soa.ConnectedSOAs[i].MyVirtualHost.ServiceNodes[h].OSVersionString;
                        if (CheckBoxNoDetail.Checked)
                        {
                            display = "<span style=\"padding-left:10px;color:#848483;\">" + vhostname + "</span>";
                        }
                        else
                        {
                            display = "<table align=\"right\" width='1675px' style='color:#848483;border:0px;table-layout:fixed;border-collpase:collapse'>" +
                                                    "<col width=\"775\"/><col width=\"200\"/><col width=\"200\"/><col width=\"200\"/><col width=\"300\"/> <tr>" +
                                                    "<td style=\"width:770;padding-left:10px;\">" + vhostname + "</td>" +
                                                    "<td style=\"width:200;font-size:.9em\">ASP.NET Request/Sec: <span style=\"Color:#6B8EAA;\">" + strASPNET + "</td></span>" +
                                                    "<td style=\"width:200;font-size:.9em\">WCF Requests/Sec: <span style=\"Color:#6B8EAA;\">" + strWCF + "</td></span>" +
                                                    "<td style=\"width:200;font-size:.9em\">Current CPU  : <span style=\"Color:#6B8EAA;\">" + strCPU + "%</span></td>" +
                                                    "<td style=\"width:300;font-size:.9em\">Runtime Platform: " + runtime + "</td></tr></table>";
                        }
                        node = new TreeNode(display, nodeimageIndex.ToString(), imageList[nodeimageIndex]);

                        if (soa.ConnectedSOAs[i].MyVirtualHost.ServiceNodes[h].Exception == "Online" && soa.ConnectedSOAs[i].MyVirtualHost.ServiceNodes[h].EndPointData != null && soa.ConnectedSOAs[i].MyVirtualHost.ServiceNodes[h].EndPointData.Count > 0)
                            if (soa.ConnectedSOAs[i].MyVirtualHost.ServiceNodes[h].PrimaryListenEndpoints.Count > 0 || soa.ConnectedSOAs[i].MyVirtualHost.ServiceNodes[h].EndPointData[0].RequestsPerDay > 0)
                            {
                                if (soa.ConnectedSOAs[i].MyVirtualHost.ServiceNodes[h].PrimaryListenEndpoints.Count > 0)
                                    node.ToolTip = "Active Since: " + soa.ConnectedSOAs[i].MyVirtualHost.ServiceNodes[h].EndPointData[0].ActiveSince.ToString() + "\nTotal Primary Business Service Requests Since Active: " + soa.ConnectedSOAs[i].MyVirtualHost.ServiceNodes[h].EndPointData[0].TotalRequests.ToString() + "\nPrimary Business Service Requests per Day: " + soa.ConnectedSOAs[i].MyVirtualHost.ServiceNodes[h].EndPointData[0].RequestsPerDay.ToString();
                                else
                                    node.ToolTip = "Active Since: " + soa.ConnectedSOAs[i].MyVirtualHost.ServiceNodes[h].EndPointData[0].ActiveSince.ToString() + "\nTotal Measured Page Requests Since Active: " + soa.ConnectedSOAs[i].MyVirtualHost.ServiceNodes[h].EndPointData[0].TotalRequests.ToString() + "\nMeasured Page Requests per Day: " + soa.ConnectedSOAs[i].MyVirtualHost.ServiceNodes[h].EndPointData[0].RequestsPerDay.ToString();
                            }
                            else
                                node.ToolTip = "Active Since: " + soa.ConnectedSOAs[i].MyVirtualHost.ServiceNodes[h].EndPointData[0].ActiveSince.ToString();
                        else
                            node.ToolTip = soa.ConnectedSOAs[i].MyVirtualHost.ServiceNodes[h].Exception;
                        node.Collapse();
                       // node.ChildNodes.Add(dcEPs);
                        node.ChildNodes.Add(configEPs);
                        node.ChildNodes.Add(primaryEPs);
                        clusterNodes[h] = node;
                    }
                    if (soa.ConnectedSOAs[i].MyVirtualHost.AvgCPU != -1f)
                        strCPU = System.Math.Round(soa.ConnectedSOAs[i].MyVirtualHost.AvgCPU).ToString();
                    else
                        strCPU = "*";
                    if (soa.ConnectedSOAs[i].MyVirtualHost.TotalASPNETRecPerSec != -1f)
                        strASPNET = System.Math.Round(soa.ConnectedSOAs[i].MyVirtualHost.TotalASPNETRecPerSec).ToString();
                    else
                        strASPNET = "*";
                    if (soa.ConnectedSOAs[i].MyVirtualHost.TotalWCFRecPerSec != -1f)
                        strWCF = System.Math.Round(soa.ConnectedSOAs[i].MyVirtualHost.TotalWCFRecPerSec).ToString();
                    else
                        strWCF = "*";
                    string display2 = "";
                    if (CheckBoxNoDetail.Checked)
                    {

                        display2 = "<span style=\"color:#FFFFFF;padding-left:10px\">" + soa.ConnectedSOAs[i].MyVirtualHost.VHostName + "  (Node Count=" + soa.ConnectedSOAs[i].MyVirtualHost.ServiceNodes.Count.ToString() + ")</span>";
                    }
                    else
                    {
                          display2 = "<table align=\"right\" width=\"1700px\" style=\"color:#FFFFFF;border:0px;table-layout:fixed;border-collapse:collapse\">" +
                          "<col width=\"800\"/><col width=\"200\"/><col width=\"200\"/><col width=\"200\"/><col width=\"300\"/><tr>" +
                                                  "<td style=\"width:800;padding-left:10px;border:0px\">" + soa.ConnectedSOAs[i].MyVirtualHost.VHostName + "  (Node Count=" + soa.ConnectedSOAs[i].MyVirtualHost.ServiceNodes.Count.ToString() + ")</td>" +
                                                  "<td style=\"width:200;font-size:.9em\">ASP.NET Request/Sec: <span style=\"Color:#6B8EAA;font-weight:bold;\">" + strASPNET + "</span></td>" +
                                                  "<td style=\"width:200;font-size:.9em\">WCF Requests/Sec: <span style=\"Color:#6B8EAA;font-weight:bold;\">" + strWCF + "</td></span>" +
                                                  "<td style=\"width:200;font-size:.9em\">Avg. Node CPU: <span style=\"Color:#6B8EAA;font-weight:bold;\">" + strCPU + "%</td></span>" +
                                                  "<td style=\"width:300;font-size:.9em\">Deployment: " + deployment + "</td></tr></table>";
                    }
                    myVHost.Text = display2;
                    for (int c = 0; c < clusterNodes.Length; c++)
                    {
                        myVHost.ChildNodes.Add(clusterNodes[c]);
                    }
                    TreeNode myDatabases = getMyDatabases(soa.ConnectedSOAs[i]);
                    TreeNode myDistributedCaches = getMyDistributedCaches(soa.ConnectedSOAs[i]);
                    root.ChildNodes.Add(myDatabases);
                    root.ChildNodes.Add(myDistributedCaches);
                    string prefix2 = "Service Domain ";
                    if (deployment.ToLower().Contains("azure"))
                        prefix2 = "Windows Azure Service Domain ";
                    else
                        if (deployment.ToLower().Contains("hyper-v"))
                            prefix2 = "Windows Server Hyper-V Service Domain ";
                    if (soa.ConnectedSOAs[i].MyVirtualHost.ServiceNodes != null && soa.ConnectedSOAs[i].MyVirtualHost.ServiceNodes.Count > 0)
                    {
                        if (soa.ConnectedSOAs[i].MyVirtualHost.ServiceNodes[0].PrimaryListenEndpoints.Count > 0 || soa.ConnectedSOAs[i].MyVirtualHost.RequestsPerDay > 0)
                        {
                            if (soa.ConnectedSOAs[i].MyVirtualHost.ServiceNodes[0].PrimaryListenEndpoints.Count>0)
                                myVHost.ToolTip = prefix2 + "\nTotal Primary Business Service Requests Since Active: " + soa.ConnectedSOAs[i].MyVirtualHost.TotalRequests.ToString() + "\nPrimary Business Service Requests per Day: " + soa.ConnectedSOAs[i].MyVirtualHost.RequestsPerDay.ToString();
                            else
                                myVHost.ToolTip = prefix2 + "\nTotal Measured Page Requests Since Active: " + soa.ConnectedSOAs[i].MyVirtualHost.TotalRequests.ToString() + "\nPrimary Measured Page Requests per Day: " + soa.ConnectedSOAs[i].MyVirtualHost.RequestsPerDay.ToString();
                        }
                        else
                            myVHost.ToolTip = prefix2;
                    }
                    root.ChildNodes.Add(myVHost);
                    if (soa.ConnectedSOAs[i].ConnectedSOAs != null && soa.ConnectedSOAs[i].ConnectedSOAs.Count > 0)
                    {
                        TreeNode[] csnodes = recurseSOATree(soa.ConnectedSOAs[i]);
                        for (int k = 0; k < csnodes.Length; k++)
                        {
                            root.ChildNodes[2].ChildNodes.Add(csnodes[k]);
                        }
                    }

                }
                returnNodes[i] = root;
            }
            return returnNodes;
        }
Ejemplo n.º 10
0
        private TreeNode getMyDatabases(SOA mySOA)
        {
            int imageIndex = 0;
            bool rootYellow=false;
            if (mySOA.MyDatabaseServers!=null)
            {
                for (int i = 0; i < mySOA.MyDatabaseServers.Count; i++)
                {
                    if (mySOA.MyDatabaseServers[i].Status != ConfigUtility.DATABASE_ONLINE)
                        rootYellow = true;
                }
            }
            if (rootYellow)
                imageIndex = 54;
            else
                imageIndex = 38;
            TreeNode root = new TreeNode("<span style=\"color:#8D7A59;padding-left:10px;\">Database Servers</span>", imageIndex.ToString(), imageList[imageIndex]);
            if (rootYellow)
                root.ToolTip = "Connected Databases - Some Offline!";
            else
                root.ToolTip = "Connected Databases";
            if (mySOA.MyDatabaseServers == null || mySOA.MyDatabaseServers.Count == 0)
                return root;
            root.Collapse();
            imageIndex = 0;
            int offset = 0;
            TreeNode[] clusterNodes = new TreeNode[mySOA.MyDatabaseServers.Count];
            string prefix = "";
            for (int i = 0; i < mySOA.MyDatabaseServers.Count; i++)
            {
                if (mySOA.MyDatabaseServers[i].Edition == null)
                {
                    mySOA.MyDatabaseServers[i].Edition = "Unknown";
                    mySOA.MyDatabaseServers[i].Version = "Unknown";
                }
                else
                    if (mySOA.MyDatabaseServers[i].Edition.ToLower().Contains("azure"))
                    {
                        offset = 1;
                        prefix = "SQL Azure Cloud RDBMS ";
                    }
                    else
                    {
                        offset = 0;
                        prefix = "On-Premise SQL Server ";
                    }
                if (mySOA.MyDatabaseServers[i].Status.Equals(ConfigUtility.DATABASE_ONLINE))
                    imageIndex = 28 + offset;
                else
                    if (mySOA.MyDatabaseServers[i].Status.Equals(ConfigUtility.DATABASE_OFFLINE))
                        imageIndex = 30 + offset;
                    else
                        imageIndex = 32 + offset;
                TreeNode dbServer;
                if (CheckBoxNoDetail.Checked)
                {
                    dbServer = new TreeNode("<span style=\"color:#8D7A59;padding-left:10px\">" + prefix + mySOA.MyDatabaseServers[i].ServerName + "</span>", imageIndex.ToString(), imageList[imageIndex]);
                }
                else
                {
                    dbServer = new TreeNode("<span style=\"color:#8D7A59;padding-left:10px\">" + prefix + mySOA.MyDatabaseServers[i].ServerName + " : " + mySOA.MyDatabaseServers[i].Edition + " : " + mySOA.MyDatabaseServers[i].Version + "</span>", imageIndex.ToString(), imageList[imageIndex]);
                }
                dbServer.ToolTip = mySOA.MyDatabaseServers[i].Exception;
                dbServer.Collapse();
                TreeNode[] databases = new TreeNode[mySOA.MyDatabaseServers[i].MyDatabases.Count];
                for (int j = 0; j < mySOA.MyDatabaseServers[i].MyDatabases.Count; j++)
                {
                    if (mySOA.MyDatabaseServers[i].MyDatabases[j].Edition == null)
                    {
                        mySOA.MyDatabaseServers[i].MyDatabases[j].Edition = "Unknown";
                    }
                    if (mySOA.MyDatabaseServers[i].MyDatabases[j].Edition.ToLower().Contains("azure"))
                        offset = 1;
                    else
                        offset = 0;
                    switch (mySOA.MyDatabaseServers[i].MyDatabases[j].Status)
                    {
                        case ConfigUtility.DATABASE_ONLINE: { imageIndex = 34 + offset; break; }
                        case ConfigUtility.DATABASE_OFFLINE: { imageIndex = 36 + offset; break; }
                        default: { imageIndex = 36 + offset; break; }
                    }
                    //the most likely cause of not having data here is that the user does not permissions for stats on SQL Server.  For the detailed query stats, you need the login user to be in an admin role or some sort.
                    //For ConfigWeb, the config administrator needs to be granted these permissions on a per database case; if desired.  If not desired,
                    //you  just will get no additional info.
               
                    databases[j] = new TreeNode("<span style=\"color:#8D7A59;padding-left:10px;\">" + mySOA.MyDatabaseServers[i].MyDatabases[j].DatabaseName +  " : Size=  </span><span style=\"Color:#6B8EAA;\">" + (mySOA.MyDatabaseServers[i].MyDatabases[j].DatabaseSize*1000f).ToString() + " (MB)</span>", imageIndex.ToString(), imageList[imageIndex]);
                    databases[j].ToolTip = mySOA.MyDatabaseServers[i].MyDatabases[j].Exception;
                    TreeNode[] queries = new TreeNode[5];
                    TreeNode latency = new TreeNode("<span style=\"color:#63553D;\">Latency to SQL Database ms: " + mySOA.MyDatabaseServers[i].MyDatabases[j].Latency.ToString() + "</span>", "42", imageList[42]);
                    latency.ToolTip = "The amount of time in ms to execute a simple query and retrieve the single row-result set from the remote SQL database. Note that service-domains co-located with their SQL Azure databases in the same Azure region will typically have lower latency on database calls.";
                    queries[0] = latency;
                    databases[j].ChildNodes.Add(queries[0]);
                    //top slowest first.
                    if (mySOA.MyDatabaseServers[i].MyDatabases[j].TopWorstByExecTime != null)
                    {
                        TreeNode topSlowSQL = new TreeNode("<span style=\"color:#63553D;\">Top " + mySOA.MyDatabaseServers[i].MyDatabases[j].TopWorstByExecTime.Count.ToString() + " Slowest SQL Statements</span>", "39", imageList[39]);
                        topSlowSQL.ToolTip = "The slowest n queries as returned by SQL Server Dynamic Management View statistics.  Pay attention to the number of times executed, and the last vs. Avg completion time. A database beginning to approach capacity (CPU and/or IO) will show an increasing last-exec time deviation from avg-exec time. You can easily adjust the number of queries shown using ConfigWeb.";
                        TreeNode[] sqlData0;
                        for (int queryslowestcount = 0; queryslowestcount < mySOA.MyDatabaseServers[i].MyDatabases[j].TopWorstByExecTime.Count; queryslowestcount++)
                        {
                            Queries query0 = mySOA.MyDatabaseServers[i].MyDatabases[j].TopWorstByExecTime[queryslowestcount];
                            sqlData0 = new TreeNode[5];
                            sqlData0[0] = new TreeNode("<span style=\"color:#848483;font-size:.9em\">Avg Completion Time ms: " + "<span span style=\"color:#ffffff;font-size:.9em\">" + (query0.AvgExecutionTime / 1000).ToString() + "</span></span>", "41", imageList[41]);
                            sqlData0[1] = new TreeNode("<span style=\"color:#848483;font-size:.9em\">Last Completion Time ms: " + "<span span style=\"color:#ffffff;font-size:.9em\">" + (query0.LastExecutionTime / 1000).ToString() + "</span></span>", "41", imageList[41]);
                            sqlData0[2] = new TreeNode("<span style=\"color:#848483;font-size:.9em\">Avg CPU Time ms: " + "<span span style=\"color:#ffffff;font-size:.9em\">" + (query0.AvgCPUTime / 1000).ToString() + "</span></span>", "41", imageList[41]);
                            sqlData0[3] = new TreeNode("<span style=\"color:#848483;font-size:.9em\">Last CPU Time ms: " + "<span span style=\"color:#ffffff;font-size:.9em\">" + (query0.LastCPUTime / 1000).ToString() + "</span></span>", "41", imageList[41]);
                            sqlData0[4] = new TreeNode("<span style=\"color:#848483;font-size:.9em\">Total Executions: " + "<span span style=\"color:#ffffff;font-size:.9em\">" + (query0.TotalExecutions).ToString() + "</span></span>", "41", imageList[41]);
                            TreeNode queryNode0 = new TreeNode("<span style=\"color:#848483;font-size:.8em\">" + query0.SQLStatement + "</span>", "40", imageList[40]);
                            for (int childcount = 0; childcount < sqlData0.Length; childcount++)
                            {
                                queryNode0.ChildNodes.Add(sqlData0[childcount]);
                            }
                            queries[1] = queryNode0;
                            topSlowSQL.ChildNodes.Add(queryNode0);
                        }
                        databases[j].ChildNodes.Add(topSlowSQL);
                    }

                    //top worst CPU use next
                    if (mySOA.MyDatabaseServers[i].MyDatabases[j].TopWorstByCPUTime != null)
                    {
                        TreeNode topExpensiveSQL = new TreeNode("<span style=\"color:#63553D;\">Top " + mySOA.MyDatabaseServers[i].MyDatabases[j].TopWorstByCPUTime.Count.ToString() + " Most CPU Intense SQL Statements</span>", "39", imageList[39]);
                        topExpensiveSQL.ToolTip = "The SQL queries that consume the most CPU time as returned by SQL Server Dynamic Management View statistics.  Pay attention to the number of times executed--focus on queries executed frequently within the application, as you will also see here one-off admin queries as executed over time. You can easily adjust the number of queries shown using ConfigWeb.";
                        TreeNode[] sqlData1;
                        for (int queryworstexpensivecount = 0; queryworstexpensivecount < mySOA.MyDatabaseServers[i].MyDatabases[j].TopWorstByCPUTime.Count; queryworstexpensivecount++)
                        {
                            Queries query1 = mySOA.MyDatabaseServers[i].MyDatabases[j].TopWorstByCPUTime[queryworstexpensivecount];
                            sqlData1 = new TreeNode[5];
                            sqlData1[0] = new TreeNode("<span style=\"color:#848483;font-size:.9em\">Avg Completion Time ms: " + "<span span style=\"color:#ffffff;font-size:.9em\">" + (query1.AvgExecutionTime / 1000).ToString() + "</span></span>", "41", imageList[41]);
                            sqlData1[1] = new TreeNode("<span style=\"color:#848483;font-size:.9em\">Last Completion Time ms: " + "<span span style=\"color:#ffffff;font-size:.9em\">" + (query1.LastExecutionTime / 1000).ToString() + "</span></span>", "41", imageList[41]);
                            sqlData1[2] = new TreeNode("<span style=\"color:#848483;font-size:.9em\">Avg CPU Time ms: " + "<span span style=\"color:#ffffff;font-size:.9em\">" + (query1.AvgCPUTime / 1000).ToString() + "</span></span>", "41", imageList[41]);
                            sqlData1[3] = new TreeNode("<span style=\"color:#848483;font-size:.9em\">Last CPU Time ms: " + "<span span style=\"color:#ffffff;font-size:.9em\">" + (query1.LastCPUTime / 1000).ToString() + "</span></span>", "41", imageList[41]);
                            sqlData1[4] = new TreeNode("<span style=\"color:#848483;font-size:.9em\">Total Executions: " + "<span span style=\"color:#ffffff;font-size:.9em\">" + (query1.TotalExecutions).ToString() + "</span></span>", "41", imageList[41]);
                            TreeNode queryNode1 = new TreeNode("<span style=\"color:#848483;font-size:.8em\">" + query1.SQLStatement + "</span>", "40", imageList[40]);
                            for (int childcount = 0; childcount < sqlData1.Length; childcount++)
                            {
                                queryNode1.ChildNodes.Add(sqlData1[childcount]);
                            }
                            queries[2] = queryNode1;
                            topExpensiveSQL.ChildNodes.Add(queryNode1);
                        }
                        databases[j].ChildNodes.Add(topExpensiveSQL);
                    }

                    //Now the best.  Save for last!
                    if (mySOA.MyDatabaseServers[i].MyDatabases[j].TopBestByExecTime != null)
                    {
                        TreeNode topFastestSQL = new TreeNode("<span style=\"color:#63553D;\">Top " + mySOA.MyDatabaseServers[i].MyDatabases[j].TopBestByExecTime.Count.ToString() + " Fastest SQL Statements</span>", "39", imageList[39]);
                        TreeNode[] sqlData2;
                        topFastestSQL.ToolTip = "The fastest n queries as returned by SQL Server Dynamic Management View statistics. You can easily adjust the number of queries shown using ConfigWeb.";
                        for (int queryfastestcount = 0; queryfastestcount < mySOA.MyDatabaseServers[i].MyDatabases[j].TopBestByExecTime.Count; queryfastestcount++)
                        {
                            Queries query2 = mySOA.MyDatabaseServers[i].MyDatabases[j].TopBestByExecTime[queryfastestcount];
                            sqlData2 = new TreeNode[5];
                            sqlData2[0] = new TreeNode("<span style=\"color:#848483;font-size:.9em\">Avg Completion Time ms: " + "<span span style=\"color:#ffffff;font-size:.9em\">" + (query2.AvgExecutionTime / 1000).ToString() + "</span></span>", "41", imageList[41]);
                            sqlData2[1] = new TreeNode("<span style=\"color:#848483;font-size:.9em\">Last Completion Time ms: " + "<span span style=\"color:#ffffff;font-size:.9em\">" + (query2.LastExecutionTime / 1000).ToString() + "</span></span>", "41", imageList[41]);
                            sqlData2[2] = new TreeNode("<span style=\"color:#848483;font-size:.9em\">Avg CPU Time ms: " + "<span span style=\"color:#ffffff;font-size:.9em\">" + (query2.AvgCPUTime / 1000).ToString() + "</span></span>", "41", imageList[41]);
                            sqlData2[3] = new TreeNode("<span style=\"color:#848483;font-size:.9em\">Last CPU Time ms: " + "<span span style=\"color:#ffffff;font-size:.9em\">" + (query2.LastCPUTime / 1000).ToString() + "</span></span>", "41", imageList[41]);
                            sqlData2[4] = new TreeNode("<span style=\"color:#848483;font-size:.9em\">Total Executions: " + "<span span style=\"color:#ffffff;font-size:.9em\">" + (query2.TotalExecutions).ToString() + "</span></span>", "41", imageList[41]);
                            TreeNode queryNode2 = new TreeNode("<span style=\"color:#848483;font-size:.8em\">" + query2.SQLStatement + "</span>", "40", imageList[40]);
                            for (int childcount = 0; childcount < sqlData2.Length; childcount++)
                            {
                                queryNode2.ChildNodes.Add(sqlData2[childcount]);
                            }
                            queries[3] = queryNode2;
                            topFastestSQL.ChildNodes.Add(queryNode2);
                        }
                        databases[j].ChildNodes.Add(topFastestSQL);
                    }

                    //Now best by CPU use
                    if (mySOA.MyDatabaseServers[i].MyDatabases[j].TopBestByCPUTime != null)
                    {
                        TreeNode topFreeSQL = new TreeNode("<span style=\"color:#63553D;\">Top " + mySOA.MyDatabaseServers[i].MyDatabases[j].TopBestByCPUTime.Count.ToString() + " Least CPU Intense SQL Statements</span>", "39", imageList[39]);
                        topFreeSQL.ToolTip = "The SQL queries that consume the least CPU time as returned by SQL Server Dynamic Management View statistics. You can easily adjust the number of queries shown using ConfigWeb.";
                        TreeNode[] sqlData3;
                        for (int queryleastexpcount = 0; queryleastexpcount < mySOA.MyDatabaseServers[i].MyDatabases[j].TopBestByCPUTime.Count; queryleastexpcount++)
                        {
                            Queries query3 = mySOA.MyDatabaseServers[i].MyDatabases[j].TopBestByCPUTime[queryleastexpcount];
                            sqlData3 = new TreeNode[5];
                            sqlData3[0] = new TreeNode("<span style=\"color:#848483;font-size:.9em\">Avg Completion Time ms: " + "<span span style=\"color:#ffffff;font-size:.9em\">" + (query3.AvgExecutionTime / 1000).ToString() + "</span></span>", "41", imageList[41]);
                            sqlData3[1] = new TreeNode("<span style=\"color:#848483;font-size:.9em\">Last Completion Time ms: " + "<span span style=\"color:#ffffff;font-size:.9em\">" + (query3.LastExecutionTime / 1000).ToString() + "</span></span>", "41", imageList[41]);
                            sqlData3[2] = new TreeNode("<span style=\"color:#848483;font-size:.9em\">Avg CPU Time ms: " + "<span span style=\"color:ffffff;font-size:.9em\">" + (query3.AvgCPUTime / 1000).ToString() + "</span></span>", "41", imageList[41]);
                            sqlData3[3] = new TreeNode("<span style=\"color:#848483;font-size:.9em\">Last CPU Time ms: " + "<span span style=\"color:#ffffff;font-size:.9em\">" + (query3.LastCPUTime / 1000).ToString() + "</span></span>", "41", imageList[41]);
                            sqlData3[4] = new TreeNode("<span style=\"color:#848483;font-size:.9em\">Total Executions: " + "<span span style=\"color:#ffffff;font-size:.9em\">" + (query3.TotalExecutions).ToString() + "</span></span>", "41", imageList[41]);
                            TreeNode queryNode3 = new TreeNode("<span style=\"color:#848483;font-size:.8em\">" + query3.SQLStatement + "</span>", "40", imageList[40]);
                            for (int childcount = 0; childcount < sqlData3.Length; childcount++)
                            {
                                queryNode3.ChildNodes.Add(sqlData3[childcount]);
                            }
                            queries[4] = queryNode3;
                            topFreeSQL.ChildNodes.Add(queryNode3);
                        }
                        databases[j].ChildNodes.Add(topFreeSQL);
                    }
                }
                for (int nodecount = 0; nodecount < databases.Length; nodecount++)
                {
                    dbServer.ChildNodes.Add(databases[nodecount]);
                }
                clusterNodes[i] = dbServer;
            }
            if (clusterNodes != null && clusterNodes.Length > 0)
            {
                for (int i = 0; i < clusterNodes.Length; i++)
                {
                    root.ChildNodes.Add(clusterNodes[i]);
                }
            }
            return root;
        }
Ejemplo n.º 11
0
 private TreeNode getMyDistributedCaches(SOA mySOA)
 {
     bool rootYellow = false;
     if (mySOA.MyDistributedCaches != null)
     {
         for (int i = 0; i < mySOA.MyDistributedCaches.Count; i++)
         {
             if (mySOA.MyDistributedCaches[i].Status != ConfigUtility.DISTRIBUTED_CACHE_ONLINE)
                 rootYellow = true;
         }
     }
     int imageIndex = 0;
     if (rootYellow)
         imageIndex = 53;
     else
         imageIndex = 49;
     TreeNode root = new TreeNode("<span style=\"color:#8D7A59;padding-left:10px;\">Distributed Caches</span>", imageIndex.ToString(), imageList[imageIndex]);
     if (rootYellow)
         root.ToolTip = "Distributed Caches - Some Offline!";
     else
         root.ToolTip = "Distributed Caches";
     if (mySOA.MyDistributedCaches == null || mySOA.MyDistributedCaches.Count == 0)
         return root;
     root.Collapse();
     imageIndex=0;
     int offset = 0;
     TreeNode[] clusterNodes = new TreeNode[mySOA.MyDistributedCaches.Count];
     string prefix = "";
     for (int i = 0; i < mySOA.MyDistributedCaches.Count; i++)
     {
         if (mySOA.MyDistributedCaches[i].Status == null)
         {
             mySOA.MyDistributedCaches[i].Status = "Unknown";
         }
         else
             if (mySOA.MyDistributedCaches[i].CacheServers!=null && mySOA.MyDistributedCaches[i].CacheServers.Count != 0)
             {
                 if (mySOA.MyDistributedCaches[i].CacheServers[0].ServerName.ToLower().Contains("windows.net"))
                 {
                     offset = 1;
                     prefix = "Windows Azure AppFabric ";
                 }
                 else
                 {
                     offset = 0;
                     prefix = "Windows Server AppFabric ";
                 }
             }
         if (mySOA.MyDistributedCaches[i].Status.Equals(ConfigUtility.DISTRIBUTED_CACHE_ONLINE))
             imageIndex = 43 + offset;
         else
             if (mySOA.MyDistributedCaches[i].Status.Equals(ConfigUtility.DISTRIBUTED_CACHE_OFFLINE))
             {
                 imageIndex = 45 + offset;
             }
             else
             {
                 imageIndex = 47 + offset;
             }
         TreeNode cacheServer;
         if (CheckBoxNoDetail.Checked)
         {
             cacheServer = new TreeNode("<span style=\"color:#8D7A59;padding-left:10px\">" + prefix + mySOA.MyDistributedCaches[i].Name + "</span>", imageIndex.ToString(), imageList[imageIndex]);
         }
         else
         {
             cacheServer = new TreeNode("<span style=\"color:#8D7A59;padding-left:10px\">" + prefix + mySOA.MyDistributedCaches[i].Name + "</span>", imageIndex.ToString(), imageList[imageIndex]);
         }
         cacheServer.ToolTip = mySOA.MyDistributedCaches[i].Exception;
         cacheServer.Collapse();
         TreeNode[] cacheservers = new TreeNode[mySOA.MyDistributedCaches[i].CacheServers.Count];
         TreeNode latencyLocal = new TreeNode("<span style=\"color:#63553D;\">Latency for Client Local Cache Get ms: " + mySOA.MyDistributedCaches[i].LocalCacheLatency.ToString() + "</span>", "42", imageList[42]);
         TreeNode latencyDistributed = new TreeNode("<span style=\"color:#63553D;\">Latency for Client Distributed Cache Get ms: " + mySOA.MyDistributedCaches[i].DistributedCacheLatency.ToString() + "</span>", "42", imageList[42]);
         latencyLocal.ToolTip = "The amount of time in ms to pull from the in-memory local cache a 3K custom object that exists in the local cache, inclusive of deserialization time. Since the test object exists in the local cache, a network request to the distributed cache cluster is not necessary and is not performed by the AppFabric cache client.";
         latencyDistributed.ToolTip = "The amount of time in ms to pull from the distributed cache cluster a 3K custom object. This is inclusive of the remote network call, and deserialization time.  The cache client is gauranteed to make a distributed network call on this request, as the local cache will not contain the test object.";
         if (offset == 1)
             imageIndex = 5;
         else
             imageIndex = 13;
         for (int j = 0; j < mySOA.MyDistributedCaches[i].CacheServers.Count; j++)
         {
             if (mySOA.MyDistributedCaches[i].CacheServers[j].ServerName == null || mySOA.MyDistributedCaches[i].CacheServers[j].ServerName == "")
                 break;
             cacheservers[j] = new TreeNode("<span style=\"color:#8D7A59;padding-left:10px;\">" + mySOA.MyDistributedCaches[i].CacheServers[j].ServerName + ":" + mySOA.MyDistributedCaches[i].CacheServers[j].Port.ToString(), imageIndex.ToString(), imageList[imageIndex]);
             if (imageIndex == 5)
                 cacheservers[j].ToolTip = "Windows Azure AppFabric Cache Namespace: Multiple Servers Service This Cache Behind Azure AppFabric Load Balancer";
             else
                 cacheservers[j].ToolTip = "Windows Server AppFabric Cache Host";
         }
         if (mySOA.MyDistributedCaches[i].Status == ConfigUtility.DISTRIBUTED_CACHE_ONLINE)
         {
             cacheServer.ChildNodes.Add(latencyDistributed);
             cacheServer.ChildNodes.Add(latencyLocal);
         }
         if (cacheservers != null)
         {
             for (int nodecount = 0; nodecount < cacheservers.Length; nodecount++)
             {
                 cacheServer.ChildNodes.Add(cacheservers[nodecount]);
             }
         }
         clusterNodes[i] = cacheServer;
     }
     if (clusterNodes != null && clusterNodes.Length > 0)
     {
         for (int i = 0; i < clusterNodes.Length; i++)
         {
             root.ChildNodes.Add(clusterNodes[i]);
         }
     }
     return root;
 }
        /*
         * We need to pass in 2 nodes here, since the Groups tree is different from the agents tree
         * The nAgents will contain users in addition to group members.
         * nGroups will only contain members that are groups.
         */
        private void AddAgentsRecursively(TreeNode nAgents, TreeNode nGroups)
        {
            try
            {
                if (nAgents.ImageUrl.CompareTo(userImage) != 0)// Do not process if it is a user
                {
                    int groupID = Convert.ToInt32(nAgents.Value);

                    //Should Filter by Wrapper
                    IntTag[] userTags = brokerDB.GetIntTags("Group_RetrieveUserTags",
                        FactoryDB.CreateParameter("@groupID", groupID, DbType.Int32));
                    Group[] groups = AdministrativeAPI.GetGroups(
                    brokerDB.GetInts("Group_RetrieveChildrenGroupIDs",
                        FactoryDB.CreateParameter("@groupID", groupID, DbType.Int32)).ToArray());

                    //int[] childUserIDs = wrapper.ListUserIDsInGroupWrapper(Convert.ToInt32(nAgents.Value));
                    //int[] childGroupIDs = wrapper.ListSubgroupIDsWrapper(Convert.ToInt32(nAgents.Value));

                    //User[] usersList = wrapper.GetUsersWrapper(childUserIDs);
                    //List<User> childUsersList = new List<User>();
                    //childUsersList.AddRange(usersList);
                    //childUsersList.Sort();

                    //Group[] groupsList = wrapper.GetGroupsWrapper(childGroupIDs);
                    //List<Group> childGroupsList = new List<Group>();
                    //childGroupsList.AddRange(groupsList);
                    //childGroupsList.Sort();

                    foreach (IntTag u in userTags)
                    {
                        TreeNode childNode = new TreeNode(u.tag, u.id.ToString(), userImage);
                        //childNode.Status = 1;
                        childNode.ShowCheckBox = true;
                        childNode.SelectAction = TreeNodeSelectAction.None;
                        childNode.Expanded = false;
                        nAgents.ChildNodes.Add(childNode);
                    }

                    if (groups == null || groups.Length < 1)
                    {
                        nAgents.Expanded = false;
                    }
                    foreach (Group g in groups)
                    {
                        if (g.groupID > 0)
                        {
                            TreeNode childNode = new TreeNode(g.groupName, g.groupID.ToString(), groupImage);
                            childNode.SelectAction = TreeNodeSelectAction.None;
                            childNode.ShowCheckBox = isRegular(g);
                            childNode.Collapse();
                            TreeNode groupChildNode = new TreeNode(g.groupName, g.groupID.ToString(), groupImage);
                            groupChildNode.ShowCheckBox = true;
                            groupChildNode.SelectAction = TreeNodeSelectAction.None;
                            this.AddAgentsRecursively(childNode, groupChildNode);
                            nAgents.ChildNodes.Add(childNode);
                            nGroups.ChildNodes.Add(groupChildNode);
                        }
                    }
                }
            }
            catch (Exception ex)
            {
                lblResponse.Text = Utilities.FormatErrorMessage("Cannot list users and groups. "+ex.GetBaseException());
                lblResponse.Visible = true;
            }
        }
Ejemplo n.º 13
0
        int PopulateTreeView(CategoryElements parentCategory, int curentPosition, TreeNode parentNode)
        {
            // parentTag.hierarchicalPosition = curentPosition;

            int j = 0;
            foreach (CategoryElements category in categoryMap)
            {

                if (category.parentName == parentCategory.categoryName)
                {
                    TreeNode curentNode = new TreeNode();
                    curentNode.Text = category.categoryName;
                    curentNode.NavigateUrl = "CategoriesMap.aspx?category=" + category.categoryName;
                    curentNode.Collapse();
                    parentNode.ChildNodes.Add(curentNode);
                    PopulateTreeView(category, curentPosition + 1, curentNode);
                }

                j++;

                // Response.Write(tag.tagName + "   " + tag.parentName + "<br />");
            }

            return 0;
        }
Ejemplo n.º 14
0
        void PopulateCategories()
        {
            SqlCommand sqlQuery = new SqlCommand(
                "Select Cat_ID, CatName from TB_Cat_Product");
            DataSet resultSet;
            resultSet = RunQuery(sqlQuery);
            if (resultSet.Tables.Count > 0)
            {
                foreach (DataRow row in resultSet.Tables[0].Rows)
                {
                    TreeNode NewNode = new
                        TreeNode(row["CatName"].ToString(),
                        row["Cat_ID"].ToString());
                    //NewNode.PopulateOnDemand = true;
                    if (row["Cat_ID"].ToString().Equals(StrCatID) && !string.IsNullOrEmpty(StrCatID))
                    {
                        NewNode.Expand();
                    }
                    else
                    {
                        NewNode.Collapse();
                    }
                    NewNode.SelectAction = TreeNodeSelectAction.Expand;
                    PopulateSubCategories(NewNode);
                    //node.ChildNodes.Add(NewNode);
                    TreeView1.Nodes.Add(NewNode);

                }
            }
        }