void Filter() { long bytesSize; Collection = MongoGeneralLogic.GetCollection(ConnectionString, DbName, CollectionName, out bytesSize); if (DDFilterOperator.Text == "==") { Collection = Collection.Where(x => x[TxtFilterCol.Text] != null && x.ContainsKey(TxtFilterCol.Text) && x[TxtFilterCol.Text].ToString().ToLower() == TxtFilterValue.Text.ToLower()).ToList(); } if (DDFilterOperator.Text == "!=") { Collection = Collection.Where(x => x[TxtFilterCol.Text] != null && x.ContainsKey(TxtFilterCol.Text) && x[TxtFilterCol.Text].ToString().ToLower() != TxtFilterValue.Text.ToLower()).ToList(); } if (DDFilterOperator.Text == "Contains") { Collection = Collection.Where(x => x[TxtFilterCol.Text] != null && x.ContainsKey(TxtFilterCol.Text) && x[TxtFilterCol.Text].ToString().ToLower().Contains(TxtFilterValue.Text.ToLower())).ToList(); } if (DDFilterOperator.Text == "! Contains") { Collection = Collection.Where(x => x[TxtFilterCol.Text] != null && x.ContainsKey(TxtFilterCol.Text) && !x[TxtFilterCol.Text].ToString().ToLower().Contains(TxtFilterValue.Text.ToLower())).ToList(); } BindGrid(); }
public CollectionExplorerTab(string ConnectionString, string DbName, string CollectionName) { InitializeComponent(); this.DbName = DbName; this.ConnectionString = ConnectionString; this.CollectionName = CollectionName; long bytesSize; Collection = MongoGeneralLogic.GetCollection(ConnectionString, DbName, CollectionName, out bytesSize); CmbItemPerPage.SelectedIndex = 0; BindGrid(); LblCollectionName.Text = DbName + "." + CollectionName; float bytesSizeF = bytesSize; if (bytesSizeF < 1000) { LblSize.Text = Math.Round(bytesSizeF, 2) + " Bytes"; } else if (bytesSize < 1000 * 1000) { LblSize.Text = Math.Round(bytesSizeF / 1000, 2) + " KB"; } else if (bytesSize < 1000 * 1000 * 1000) { LblSize.Text = Math.Round(bytesSizeF / 1000000, 2) + " MB"; } }
private void BtnReload_Click(object sender, EventArgs e) { long bytesSize; Collection = MongoGeneralLogic.GetCollection(ConnectionString, DbName, CollectionName, out bytesSize); BindGrid(); HiddenColumns.Clear(); }