public void RefreshDisplayTree( ) { DisplayTreeListCtrl.TableName = this.TableName; DisplayTreeListCtrl.InnerTreeList.Columns.Clear(); DisplayTreeListCtrl.ColumnConfigs = this.ColumnList; DisplayTreeListCtrl.Manager.ConfigList = this.Manager.ConfigList;//new DisplayTreeListCtrl.InitColumns(); #region Script if (String.IsNullOrWhiteSpace(this.TableName)) { if (String.IsNullOrWhiteSpace(Script) == false) { DataSet ds = DataQueryProvider.RunQuery(Script); if (ds != null && ds.Tables.Count > 0) { Manager.Invalidate(ds); DisplayTreeListCtrl.InnerTreeList.ColumnsCustomization(); } } return; } #endregion if (DataCachingProvider.LookupTables.ContainsKey(this.TableName)) { Manager.Invalidate(DataCachingProvider.LookupTables[this.TableName]); } else { ABCHelper.ConditionBuilder strBuilder = new ABCHelper.ConditionBuilder(); strBuilder.Append(String.Format(@"SELECT TOP 5 * FROM {0} ", this.TableName)); if (DataStructureProvider.IsExistABCStatus(this.TableName)) { strBuilder.AddCondition(QueryGenerator.GenerateCondition(this.TableName, ABCCommon.ABCColumnType.ABCStatus)); } strBuilder.Append(String.Format(@" ORDER BY {0} DESC", DataStructureProvider.GetPrimaryKeyColumn(this.TableName))); try { DataSet ds = DataQueryProvider.RunQuery(strBuilder.ToString()); if (ds != null && ds.Tables.Count > 0) { this.DisplayTreeListCtrl.InnerTreeList.DataSource = ds.Tables[0]; } } catch (Exception ex) { } } this.DisplayTreeListCtrl.InnerTreeList.RefreshDataSource(); DisplayTreeListCtrl.InnerTreeList.ColumnsCustomization(); }
public void RefreshDataConfigTree( ) { this.DataConfigTreeCtrl.Columns.Clear(); TreeListColumn colNo = new TreeListColumn(); colNo.Name = "Name"; colNo.FieldName = "Name"; colNo.Caption = "Config Name"; colNo.Visible = true; colNo.VisibleIndex = 0; TreeListColumn colTableName = new TreeListColumn(); colTableName.Name = "TableName"; colTableName.FieldName = "TableName"; colTableName.Caption = "TableName"; colTableName.Visible = true; colTableName.VisibleIndex = 0; colTableName.ColumnEdit = this.repoTableNameChooser; TreeListColumn[] lstCols = new TreeListColumn[ColumnList.Count + 2]; lstCols[0] = colNo; lstCols[1] = colTableName; int iCount = 1; foreach (ABCTreeListColumn.ColumnConfig col in ColumnList) { TreeListColumn configCol = new TreeListColumn(); configCol.Caption = col.Caption; configCol.Tag = col; configCol.Visible = col.Visible; configCol.VisibleIndex = col.VisibleIndex; configCol.Width = col.Width; configCol.ColumnEdit = this.repoFieldNameChooser; iCount++; lstCols[iCount] = configCol; } this.DataConfigTreeCtrl.Columns.AddRange(lstCols); this.DataConfigTreeCtrl.DataSource = Manager.RootConfig; this.DataConfigTreeCtrl.RefreshDataSource(); this.DataConfigTreeCtrl.ExpandAll(); DisplayTreeListCtrl.RefreshDataSource(); DataConfigTreeCtrl.BestFitColumns(); }
void repoFieldNameChooser_ButtonClick(object sender, DevExpress.XtraEditors.Controls.ButtonPressedEventArgs e) { String strTableName = this.TableName; TreeConfigNode obj = (TreeConfigNode)DataConfigTreeCtrl.GetDataRecordByNode(DataConfigTreeCtrl.FocusedNode); if (obj == null || (TreeConfigData)obj.InnerData == null) { return; } TreeConfigData configData = (TreeConfigData)obj.InnerData; strTableName = configData.TableName; if (String.IsNullOrWhiteSpace(strTableName) == false) { String strOldFieldName = String.Empty; if (configData.ColumnFieldNames.ContainsKey(this.DataConfigTreeCtrl.FocusedColumn.Caption)) { strOldFieldName = configData.ColumnFieldNames[this.DataConfigTreeCtrl.FocusedColumn.Caption]; } FieldChooserEx chooser = new FieldChooserEx(strTableName, strOldFieldName); if (chooser.ShowDialog() == System.Windows.Forms.DialogResult.OK) { if (configData.ColumnFieldNames.ContainsKey(this.DataConfigTreeCtrl.FocusedColumn.Caption)) { configData.ColumnFieldNames[this.DataConfigTreeCtrl.FocusedColumn.Caption] = chooser.Result; } else { configData.ColumnFieldNames.Add(this.DataConfigTreeCtrl.FocusedColumn.Caption, chooser.Result); } } DataConfigTreeCtrl.RefreshNode(DataConfigTreeCtrl.FocusedNode); DataConfigTreeCtrl.RefreshDataSource(); UpdateDataConfigs(); DisplayTreeListCtrl.RefreshDataSource(); } }
void DataConfigTreeCtrl_CellValueChanged(object sender, CellValueChangedEventArgs e) { UpdateDataConfigs(); DisplayTreeListCtrl.RefreshDataSource(); }