상속: System.Windows.Forms.UserControl
 /// <summary>
 ///     Fill Server Status to treeview
 /// </summary>
 /// <param name="trvSvrStatus"></param>
 public static void FillSrvStatusToList(TreeViewColumns trvSvrStatus)
 {
     var SrvDocList = new List<BsonDocument>();
     foreach (String mongoSvrKey in _mongoConnSvrLst.Keys)
     {
         try
         {
             MongoServer mongoSvr = _mongoConnSvrLst[mongoSvrKey];
             if (!SystemManager.GetCurrentServerConfig(mongoSvrKey).Health)
             {
                 continue;
             }
             //flydreamer提供的代码
             //感谢 魏琼东 的Bug信息,一些命令必须以Admin执行
             if (SystemManager.GetCurrentServerConfig(mongoSvrKey).LoginAsAdmin)
             {
                 BsonDocument ServerStatusDoc = CommandHelper.ExecuteMongoSvrCommand(CommandHelper.serverStatus_Command, mongoSvr).Response;
                 SrvDocList.Add(ServerStatusDoc);
             }
         }
         catch (Exception ex)
         {
             SystemManager.ExceptionDeal(ex);
         }
     }
     FillDataToTreeView("Server Status", trvSvrStatus, SrvDocList, 0);
     //打开第一层
     foreach (TreeNode item in trvSvrStatus.DatatreeView.Nodes)
     {
         item.Expand();
     }
 }
 /// <summary>
 /// 
 /// </summary>
 /// <param name="RootName"></param>
 /// <param name="doc"></param>
 /// <param name="IsOpen"></param>
 /// <returns></returns>
 public static String ConvertBsonTozTreeJson(String RootName, BsonDocument doc, Boolean IsOpen)
 {
     TreeViewColumns trvStatus = new TreeViewColumns();
     MongoDBHelper.FillDataToTreeView(RootName, trvStatus, doc);
     if (IsOpen)
     {
         trvStatus.TreeView.Nodes[0].Expand();
     }
     return ConvertTreeViewTozTreeJson(trvStatus.TreeView);
 }
 /// <summary>
 /// </summary>
 /// <returns></returns>
 public static String GetCollectionzTreeJSON()
 {
     //获得数据
     WebDataViewInfo.LimitCnt = 100;
     List<BsonDocument> dataList = GetDataList(ref WebDataViewInfo);
     String collectionName =
         SystemManager.GetTagData(WebDataViewInfo.strDBTag).Split("/".ToCharArray())[(int) PathLv.CollectionLv];
     var tree = new TreeViewColumns();
     FillDataToTreeView(collectionName, tree, dataList, WebDataViewInfo.SkipCnt);
     var array = new BsonArray();
     foreach (TreeNode item in tree.TreeView.Nodes)
     {
         array.Add(UIHelper.ConvertTreeNodeTozTreeBsonDoc(item));
     }
     return array.ToJson(SystemManager.JsonWriterSettings);
     ;
 }
 /// <summary>
 /// 将数据放入TreeView里进行展示
 /// </summary>
 /// <param name="collectionName"></param>
 /// <param name="trvData"></param>
 /// <param name="dataList"></param>
 public static void FillDataToTreeView(String collectionName, TreeViewColumns trvData, List<BsonDocument> dataList, int mSkip)
 {
     trvData.DatatreeView.Nodes.Clear();
     int SkipCnt = mSkip;
     int Count = 1;
     foreach (BsonDocument item in dataList)
     {
         TreeNode dataNode = new TreeNode(collectionName + "[" + (SkipCnt + Count).ToString() + "]");
         //这里保存真实的主Key数据,删除的时候使用
         switch (collectionName)
         {
             case COLLECTION_NAME_GFS_FILES:
                 dataNode.Tag = item.GetElement(1).Value;
                 break;
             case COLLECTION_NAME_USER:
                 dataNode.Tag = item.GetElement(1).Value;
                 break;
             default:
                 //SelectDocId属性的设置,
                 //2012/03/19 不一定id是在第一位
                 BsonElement id;
                 item.TryGetElement(KEY_ID, out id);
                 if (id != null)
                 {
                     dataNode.Tag = id.Value;
                 }
                 else
                 {
                     dataNode.Tag = item.GetElement(0).Value;
                 }
                 break;
         }
         AddBsonDocToTreeNode(dataNode, item);
         trvData.DatatreeView.Nodes.Add(dataNode);
         Count++;
     }
 }
 /// <summary>
 /// 将数据放入TreeView里进行展示
 /// </summary>
 /// <param name="collectionName"></param>
 /// <param name="trvData"></param>
 /// <param name="dataList"></param>
 public static void FillDataToTreeView(String collectionName, TreeViewColumns trvData, BsonDocument dataList)
 {
     List<BsonDocument> DocList = new List<BsonDocument>();
     DocList.Add(dataList);
     FillDataToTreeView(collectionName, trvData, DocList, 0);
 }
 /// <summary>
 ///     将数据放入TreeView里进行展示
 /// </summary>
 /// <param name="collectionName"></param>
 /// <param name="trvData"></param>
 /// <param name="dataList"></param>
 public static void FillDataToTreeView(String collectionName, TreeViewColumns trvData,
     List<BsonDocument> dataList, int mSkip)
 {
     trvData.DatatreeView.BeginUpdate();
     trvData.DatatreeView.Nodes.Clear();
     int SkipCnt = mSkip;
     int Count = 1;
     foreach (BsonDocument item in dataList)
     {
         var dataNode = new TreeNode(collectionName + "[" + (SkipCnt + Count) + "]");
         //这里保存真实的主Key数据,删除的时候使用
         switch (collectionName)
         {
             case COLLECTION_NAME_GFS_FILES:
                 dataNode.Tag = item.GetElement(1).Value;
                 break;
             case COLLECTION_NAME_USER:
                 dataNode.Tag = item.GetElement(1).Value;
                 break;
             //case COLLECTION_NAME_ROLE:
             //    dataNode.Tag = item.GetElement(1).Value;
             //    break;
             default:
                 //SelectDocId属性的设置,
                 //2012/03/19 不一定id是在第一位
                 //这里是为了操作顶层节点的删除,修改用的,所以必须要放item.GetElement(0).Value;
                 BsonElement id;
                 item.TryGetElement(KEY_ID, out id);
                 dataNode.Tag = id != null ? id.Value : item.GetElement(0).Value;
                 break;
         }
         AddBsonDocToTreeNode(dataNode, item);
         trvData.DatatreeView.Nodes.Add(dataNode);
         Count++;
     }
     trvData.DatatreeView.EndUpdate();
 }