private void _InsertServerInTree(TreeListNode tlnParent, ObjectBaseHash colServer) { TreeListNode tlnServer; string UID_ParentServer; if (tlnParent != null) { NodeData nd = tlnParent.Tag as NodeData; UID_ParentServer = nd.Data1; } else { UID_ParentServer = ""; } // loop for each serverobject foreach (ObjectServer oServer in colServer) { if (oServer.GetData("uid_parentapplicationserver") == UID_ParentServer) { if (tlnParent != null) { tlnServer = tlnParent.Nodes.Add(oServer.GetData("displaytext"), 0); // insert as childs } else { tlnServer = tlcServer.Nodes.Add(oServer.GetData("displaytext"), 0); // insert as root in control } tlnServer.Tag = new NodeData(NodeType.Server, oServer.GetData("uid_applicationserver"), oServer.GetData("domain")); tlnServer.SubItems.Add(oServer.GetData("chgnr")); tlnServer.SubItems.Add(oServer.GetData("state_p")); tlnServer.SubItems.Add(oServer.GetData("state_s")); tlnServer.SubItems.Add(oServer.GetData("changed")); tlnServer.SubItems.Add(""); // call for all childs _InsertServerInTree(tlnServer, colServer); // assign the pictureindex tlnServer.ImageIndex = _GetPictureIndex(tlnServer); // open this Node tlnServer.Expand(false); } } if (tlnParent != null) { tlnParent.Nodes.Sort(new TreeListNodeComparerCaption()); } else { tlcServer.Nodes.Sort(new TreeListNodeComparerCaption()); } }
private void _InsertServerInTree(TreeListNode tlnParent, ObjectBaseHash colServers, string UID_ParentServer, string Ident_DomainRD) { TreeListNode tlnServer; foreach (ObjectServer2 pServer in colServers) { if (pServer.GetData("UID_ParentApplicationServer").ToUpperInvariant() == UID_ParentServer) { tlnServer = tlnParent.Nodes.Add(pServer.GetData("Ident_Applicationserver"), pServer.IconIndex); tlnServer.Tag = new NodeData(NodeType.Server, pServer.GetData("UID_ApplicationServer"), Ident_DomainRD); // call recursiv _InsertServerInTree(tlnServer, colServers, pServer.GetData("UID_ApplicationServer").ToUpperInvariant(), Ident_DomainRD); } } }
private static ObjectBaseHash _GetServerCollection(string Ident_Domain, string UID_Profile, NodeType nodeType) { ISqlFormatter isql = clsMain.Instance.CurrentConnection.Connection.SqlFormatter; SqlExecutor cSQL = clsMain.Instance.CurrentConnection.Connection.CreateSqlExecutor(clsMain.Instance.CurrentConnection.PublicKey); ObjectBaseHash colServers = new ObjectBaseHash(); ObjectServer oServer = null; string strSQL = ""; switch (nodeType) { case NodeType.AppProfile: strSQL = clsMain.Instance.CurrentConnection.Connection.SqlStrings["ApplicationProfileServer"]; break; case NodeType.DrvProfile: strSQL = clsMain.Instance.CurrentConnection.Connection.SqlStrings["DriverProfileServer"]; break; case NodeType.MacType: strSQL = clsMain.Instance.CurrentConnection.Connection.SqlStrings["MachineTypeServer"]; break; } // replace the Domain-Variable strSQL = strSQL.Replace("@Ident_Domain", isql.FormatValue(Ident_Domain, ValType.String, true)); // replace UID_Profile strSQL = strSQL.Replace("@UID_Profile", isql.FormatValue(UID_Profile, ValType.String, true)); // and now do it... using (IDataReader rData = new CachedDataReader(cSQL.SqlExecute(strSQL))) { while (rData.Read()) { // create a server-object oServer = new ObjectServer(rData); // and add to our Hash colServers.Add(oServer, "UID_ApplicationServer"); } } return(colServers); }
private void _DisplayServerForProfile(TreeListNode tlnProfile) { try { // lock controlupdate tlcServer.BeginUpdate(); // remove all items from this list tlcServer.Nodes.Clear(); m_tlnProfile = tlnProfile; if (tlnProfile != null) { NodeData nd = tlnProfile.Tag as NodeData; if ((nd.Type == NodeType.AppProfile) || (nd.Type == NodeType.DrvProfile) || (nd.Type == NodeType.MacType)) { // now load the collection ObjectBaseHash colServer = _GetServerCollection(nd.Data1, nd.Data2, nd.Type); // now insert in tree _InsertServerInTree(null, colServer); // start JobQueueThread _InitializeJobQueueThread(); } } } catch (Exception ex) { ExceptionDialog.Show(this.ParentForm, ex); } finally { // release controlupdatelock tlcServer.EndUpdate(); } }
private ObjectBaseHash _GetServerOfDomin(string parentDomain) { ISqlFormatter isql = clsMain.Instance.CurrentConnection.Connection.SqlFormatter; SqlExecutor cSQL = clsMain.Instance.CurrentConnection.Connection.CreateSqlExecutor(clsMain.Instance.CurrentConnection.PublicKey); string strSQL; ObjectBaseHash colServers = new ObjectBaseHash(); ObjectServer2 objServer; try { // get the gigantic SQL-Statement strSQL = clsMain.Instance.CurrentConnection.Connection.SqlStrings["ApplicationServer"]; // replace the Domain-Variable strSQL = strSQL.Replace("@Ident_DomainRD", isql.FormatValue(parentDomain, ValType.String)); using (IDataReader rData = new CachedDataReader(cSQL.SqlExecute(strSQL))) { while (rData.Read()) { // create a new Serverobject objServer = new ObjectServer2(rData); // appand to our list colServers.Add(objServer, "UID_ApplicationServer"); } } } catch (Exception ex) { ExceptionDialog.Show(this.ParentForm, ex); } return(colServers); }