protected virtual bool IsSortableView(ViewDefinition view, int viewLevel) { if (view == null || viewLevel < 0 || viewLevel >= view.Filters.Count) { return false; } string sWhere = ((FilterDefinition)view.Filters[viewLevel]).Where; if (sWhere.Length == 0) { return true; } switch (sWhere.ToLower()) { case "timesplayed": return false; default: return true; } }
/// <summary> /// Add a new View entry /// </summary> /// <param name="sender"></param> /// <param name="e"></param> private void btnAdd_Click(object sender, EventArgs e) { updating = true; ViewDefinition view = new ViewDefinition(); view.Name = "..new"; datasetViews.Rows.Add( new object[] { view.LocalizedName, view.Name, view, } ); dataGridViews.Rows[dataGridViews.Rows.Count - 1].Selected = true; dataGridViews.FirstDisplayedScrollingRowIndex = dataGridViews.Rows.Count - 1; dataGridViews.CurrentCell = dataGridViews.Rows[dataGridViews.Rows.Count - 1].Cells[1]; dataGridViews.BeginEdit(false); currentView = view; datasetFilters.Rows.Clear(); DataRow row = datasetFilters.NewRow(); row[0] = row[1] = row[2] = row[3] = row[5] = ""; row[4] = ViewsAs[0]; // Set default Value row[6] = true; row[7] = false; datasetFilters.Rows.Add(row); updating = false; }
public void Restore(ViewDefinition view, int level) { currentView = view; currentLevel = level; }
private void UpdateView() { datasetFilters.Clear(); int selectedRow = 0; if (dataGridViews.SelectedRows.Count > 0) { selectedRow = dataGridViews.SelectedRows[0].Index; } currentView = (ViewDefinition)datasetViews.Rows[selectedRow][2]; if (currentView == null) { return; } //fill in all rows... for (int i = 0; i < currentView.Filters.Count; ++i) { FilterDefinition def = (FilterDefinition)currentView.Filters[i]; string limit = def.Limit.ToString(); if (def.Limit < 0) { limit = ""; } datasetFilters.Rows.Add( new object[] { def.Where, def.SqlOperator, def.Restriction, limit, def.DefaultView, def.DefaultSort, def.SortAscending, def.SkipLevel, } ); } }