Example #1
0
        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 );
        }