Пример #1
0
        int BuildTemplates(out TemplateCollection templates,
            out string strError)
        {
            strError = "";

            templates = new TemplateCollection();

            for (int i = 0; i < this.listView_objects.Items.Count; i++)
            {
                ListViewItem item = this.listView_objects.Items[i];
                if (item.Checked == false)
                    continue;

                if (item.ImageIndex == ResTree.RESTYPE_FOLDER
                    || item.ImageIndex == ResTree.RESTYPE_FILE)
                {
                    continue;
                }

                string strDbName = item.Text;
                string strUrl = item.SubItems[1].Text;

                DatabaseObjectTree tree = new DatabaseObjectTree();
                tree.Initial(MainForm.Servers,
                    MainForm.Channels,
                    MainForm.stopManager,
                    strUrl,
                    strDbName);
                // 

                RmsChannel channel = MainForm.Channels.GetChannel(strUrl);
                if (channel == null)
                    goto ERROR1;
                List<string[]> logicNames = null;
                string strType;
                string strSqlDbName;
                string strKeysDef;
                string strBrowseDef;

                long nRet = channel.DoGetDBInfo(
                    strDbName,
                    "all",
                    out logicNames,
                    out strType,
                    out strSqlDbName,
                    out strKeysDef,
                    out strBrowseDef,
                    out strError);
                if (nRet == -1)
                    goto ERROR1;

                Template template = new Template();
                template.LogicNames = logicNames;
                template.Type = strType;
                template.SqlDbName = strSqlDbName;
                template.KeysDef = strKeysDef;
                template.BrowseDef = strBrowseDef;

                template.Object = tree.Root;

                templates.Add(template);
            }

            return 0;
            ERROR1:
            return -1;
        }