Exemplo n.º 1
0
        /// <summary>
        ///     Create Collection
        /// </summary>
        /// <param name="sender"></param>
        /// <param name="e"></param>
        private void CreateMongoCollectionToolStripMenuItem_Click(object sender, EventArgs e)
        {
            //Advance CreateCollection
            var frm =
                new FrmCreateCollection
            {
                StrSvrPathWithTag = RuntimeMongoDbContext.SelectObjectTag,
                TreeNode          = trvsrvlst.SelectedNode
            };

            Utility.OpenForm(frm, true, true);
            if (frm.Result)
            {
                //这里表示: Client / Server  一个Client 可能连结复数Server
                var srvkey = RuntimeMongoDbContext.GetCurrentServerKey() + "/" +
                             RuntimeMongoDbContext.GetCurrentServerKey();
                var newCol =
                    UiHelper.FillCollectionInfoToTreeNode(
                        RuntimeMongoDbContext.GetCurrentIMongoDataBase().GetCollection <BsonDocument>(frm.CollectionName),
                        srvkey);
                foreach (TreeNode item in trvsrvlst.SelectedNode.Nodes)
                {
                    var strNodeType = TagInfo.GetTagType(item.Tag.ToString());
                    if (strNodeType == ConstMgr.CollectionListTag)
                    {
                        //自己添加的Collection不是SystemCollection
                        item.Nodes.Add(newCol);
                        break;
                    }
                }
                DisableAllOpr();
            }
        }
Exemplo n.º 2
0
        /// <summary>
        ///     Create Collection
        /// </summary>
        /// <param name="sender"></param>
        /// <param name="e"></param>
        private void CreateMongoCollectionToolStripMenuItem_Click(object sender, EventArgs e)
        {
            //Advance CreateCollection
            var frm =
                new FrmCreateCollection
            {
                StrSvrPathWithTag = RuntimeMongoDbContext.SelectObjectTag,
                TreeNode          = trvsrvlst.SelectedNode
            };

            Utility.OpenForm(frm, true, true);
            if (frm.Result)
            {
                DisableAllOpr();
            }
        }