/// <summary> /// Refresh Data /// </summary> public override void RefreshGui() { Clear(); mDataViewInfo.SkipCnt = 0; RuntimeMongoDbContext.SelectObjectTag = mDataViewInfo.strCollectionPath; var datalist = DataViewInfo.GetDataList(ref mDataViewInfo, RuntimeMongoDbContext.GetCurrentServer()); ViewHelper.FillDataToControl(datalist, DataShower, mDataViewInfo); InitControlsEnable(); SetDataNav(); if (mDataViewInfo.Query != string.Empty) { txtQuery.Text = mDataViewInfo.Query; if (!tabDataShower.TabPages.Contains(tabQuery)) { tabDataShower.TabPages.Add(tabQuery); } } else { if (tabDataShower.TabPages.Contains(tabQuery)) { tabDataShower.TabPages.Remove(tabQuery); } } IsNeedRefresh = false; }
/// <summary> /// 重新加载数据 /// </summary> private void ReloadData() { if (mDataViewInfo == null) { return; } Clear(); RuntimeMongoDbContext.SelectObjectTag = mDataViewInfo.strCollectionPath; var datalist = DataViewInfo.GetDataList(ref mDataViewInfo, RuntimeMongoDbContext.GetCurrentServer()); ViewHelper.FillDataToControl(datalist, DataShower, mDataViewInfo); SetDataNav(); IsNeedRefresh = false; }
/// <summary> /// 换页操作 /// </summary> /// <param name="pageChangeMode"></param> /// <param name="mDataViewInfo"></param> /// <param name="dataShower"></param> public static void PageChanged(PageChangeOpr pageChangeMode, ref DataViewInfo mDataViewInfo, List <Control> dataShower) { switch (pageChangeMode) { case PageChangeOpr.FirstPage: mDataViewInfo.SkipCnt = 0; break; case PageChangeOpr.LastPage: if (mDataViewInfo.CurrentCollectionTotalCnt % mDataViewInfo.LimitCnt == 0) { //没有余数的时候,600 % 100 == 0 => Skip = 600-100 = 500 mDataViewInfo.SkipCnt = mDataViewInfo.CurrentCollectionTotalCnt - mDataViewInfo.LimitCnt; } else { // 630 % 100 == 30 => Skip = 630-30 = 600 mDataViewInfo.SkipCnt = mDataViewInfo.CurrentCollectionTotalCnt - mDataViewInfo.CurrentCollectionTotalCnt % mDataViewInfo.LimitCnt; } break; case PageChangeOpr.NextPage: mDataViewInfo.SkipCnt += mDataViewInfo.LimitCnt; if (mDataViewInfo.SkipCnt >= mDataViewInfo.CurrentCollectionTotalCnt) { mDataViewInfo.SkipCnt = mDataViewInfo.CurrentCollectionTotalCnt - 1; } break; case PageChangeOpr.PrePage: mDataViewInfo.SkipCnt -= mDataViewInfo.LimitCnt; if (mDataViewInfo.SkipCnt < 0) { mDataViewInfo.SkipCnt = 0; } break; default: break; } var datalist = DataViewInfo.GetDataList(ref mDataViewInfo, RuntimeMongoDbContext.GetCurrentServer()); FillDataToControl(datalist, dataShower, mDataViewInfo); }
/// <summary> /// </summary> /// <returns></returns> public static string GetCollectionzTreeJSON(MongoServer mServer) { //获得数据 WebDataViewInfo.LimitCnt = 100; var dataList = DataViewInfo.GetDataList(ref WebDataViewInfo, mServer); var collectionName = Utility.GetTagData(WebDataViewInfo.strDBTag).Split("/".ToCharArray())[(int)EnumMgr.PathLv.CollectionLv]; var tree = new ctlTreeViewColumns(); UIHelper.FillDataToTreeView(collectionName, tree, dataList, WebDataViewInfo.SkipCnt); var array = new BsonArray(); foreach (TreeNode item in tree.TreeView.Nodes) { array.Add(ConvertTreeNodeTozTreeBsonDoc(item)); } return(array.ToJson(MongoUtility.Basic.Utility.JsonWriterSettings)); }