コード例 #1
0
        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);
        }
コード例 #2
0
        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);
        }