public void GetNewDataConfig( ) { NewDataConfig = new ABCScreenConfig(OwnerView); AddedList.Clear(); foreach (DevExpress.XtraTreeList.Nodes.TreeListNode node in this.treeBinding.Nodes) { ABCCommonTreeListNode obj = (ABCCommonTreeListNode)treeBinding.GetDataRecordByNode(node); if (obj == null || (ABCBindingConfig)obj.InnerData == null) { continue; } ABCBindingConfig bindInfo = (ABCBindingConfig)obj.InnerData; if (AddedList.Contains(bindInfo)) { continue; } ABCBindingConfig info = GetNewBindingInfo(node); if (NewDataConfig.BindingList.ContainsKey(bindInfo.Name) == false) { NewDataConfig.BindingList.Add(bindInfo.Name, bindInfo); } } }
public void UpdateFieldName(ABCCommonTreeListNode obj) { if (obj == null || obj.InnerData == null) { return; } if (obj.ParentNode != null) { ABCCommonTreeListNode objparent = obj.ParentNode; ABCBindingConfig currentBind = (ABCBindingConfig)obj.InnerData; ABCBindingConfig parentBind = (ABCBindingConfig)objparent.InnerData; if (currentBind != null && parentBind != null) { if (currentBind.ParentName != parentBind.TableName || (currentBind.ParentName == parentBind.TableName && (String.IsNullOrWhiteSpace(currentBind.ParentField) || String.IsNullOrWhiteSpace(currentBind.ChildField)))) { if (DataStructureProvider.IsExistedTable(parentBind.TableName)) { currentBind.ParentField = DataStructureProvider.GetPrimaryKeyColumn(parentBind.TableName); } if (DataStructureProvider.IsExistedTable(currentBind.TableName)) { currentBind.ChildField = DataStructureProvider.GetTable(currentBind.TableName).GetForeignKeyOfTableName(parentBind.TableName); } } currentBind.ParentName = parentBind.Name; } } //foreach ( TreeListNode nodeChild in node.Nodes ) // UpdateFieldName( nodeChild ); }
private ABCBindingConfig GetNewBindingInfo(DevExpress.XtraTreeList.Nodes.TreeListNode node) { ABCCommonTreeListNode obj = (ABCCommonTreeListNode)treeBinding.GetDataRecordByNode(node); if (obj == null || (ABCScreen.ABCBindingConfig)obj.InnerData == null) { return(null); } ABCBindingConfig bindInfo = (ABCBindingConfig)obj.InnerData; bindInfo.Children.Clear(); foreach (DevExpress.XtraTreeList.Nodes.TreeListNode childNode in node.Nodes) { ABCBindingConfig childInfo = GetNewBindingInfo(childNode); childInfo.Parent = bindInfo; childInfo.ParentName = bindInfo.Name; bindInfo.Children.Add(childInfo.Name, childInfo); } if (AddedList.Contains(bindInfo) == false) { AddedList.Add(bindInfo); } return(bindInfo); }
void Menu_ItemClick(object sender, DevExpress.XtraBars.ItemClickEventArgs e) { if (e.Item.Tag != null && e.Item.Tag.ToString() == "NewRoot") { foreach (String strNewItem in new TableChooserForm().ShowChoose()) { ABCBindingConfig newInfo = new ABCBindingConfig(strNewItem); newInfo.Name = GetNewName(newInfo.Name); if (this.treeBinding.FocusedNode == null) { newInfo.IsMainObject = true; } new ABCCommonTreeListNode((ABCCommonTreeListNode)this.treeBinding.DataSource, newInfo); } this.treeBinding.RefreshDataSource(); } if (e.Item.Tag != null && e.Item.Tag.ToString() == "New") { foreach (String strNewItem in new TableChooserForm().ShowChoose()) { ABCBindingConfig newInfo = new ABCBindingConfig(strNewItem); newInfo.Name = GetNewName(newInfo.Name); if (this.treeBinding.FocusedNode == null) { new ABCCommonTreeListNode((ABCCommonTreeListNode)this.treeBinding.DataSource, newInfo); newInfo.IsMainObject = true; } else { ABCCommonTreeListNode obj = (ABCCommonTreeListNode)treeBinding.GetDataRecordByNode(this.treeBinding.FocusedNode); if (obj == null || (ABCBindingConfig)obj.InnerData == null) { return; } ABCCommonTreeListNode node = new ABCCommonTreeListNode(obj, newInfo); UpdateFieldName(node); } } this.treeBinding.RefreshDataSource(); // this.treeBinding.FocusedNode.ExpandAll(); } if (e.Item.Tag != null && e.Item.Tag.ToString() == "Delete") { if (this.treeBinding.FocusedNode != null) { DialogResult result = ABCHelper.ABCMessageBox.Show("Do you want remove this Binding Information and all children ? ", "Message", MessageBoxButtons.YesNo, MessageBoxIcon.Question); if (result == System.Windows.Forms.DialogResult.Yes) { this.treeBinding.DeleteSelectedNodes(); this.treeBinding.RefreshDataSource(); } } } }
private void AddRoot_Click(object sender, EventArgs e) { foreach (String strNewItem in new TableChooserForm().ShowChoose()) { ABCBindingConfig newInfo = new ABCBindingConfig(strNewItem); newInfo.Name = GetNewName(newInfo.Name); new ABCCommonTreeListNode((ABCCommonTreeListNode)this.treeBinding.DataSource, newInfo); } this.treeBinding.RefreshDataSource(); treeBinding.ExpandAll(); }