예제 #1
0
        public void InvalidateCachingAllNodes( )
        {
            DataList.Clear();
            foreach (TreeConfigNode configNode in ConfigList.Values)
            {
                try
                {
                    if (configNode.InnerData != null && configNode.ParentNode != null)
                    {
                        DataView view = DataCachingProvider.TryToGetDataView(configNode.InnerData.TableName, false);
                        BusinessObjectController Controller = BusinessControllerFactory.GetBusinessController(configNode.InnerData.TableName);

                        //DataSet ds=Controller.GetAllObjects();
                        //if ( ds!=null&&ds.Tables.Count>0 )
                        //{
                        foreach (DataRow dr in view.Table.Rows)
                        {
                            BusinessObject obj = Controller.GetObjectFromDataRow(dr);
                            if (obj != null)
                            {
                                ABCTreeListNode node = new ABCTreeListNode(null, configNode.InnerData.Name, obj);
                                node.Manager = this;
                                node.CachingNode();
                            }
                        }
                        //     }
                    }
                }
                catch (Exception ex)
                {
                }
            }
        }
예제 #2
0
        public void Invalidate(DataTable table, String strObjectName)
        {
            InvalidateCachingAllNodes();

            RootData         = new ABCTreeListNode(null, null, null);
            RootData.Manager = this;

            if (RootConfig.ChildrenNodes.ContainsKey(strObjectName))
            {
                String strTableName = RootConfig.ChildrenNodes[strObjectName].InnerData.TableName;
                BusinessObjectController Controller = BusinessControllerFactory.GetBusinessController(strTableName);
                foreach (DataRow dr in table.Rows)
                {
                    BusinessObject objChild = Controller.GetObjectFromDataRow(dr);
                    if (objChild != null)
                    {
                        ABCTreeListNode node = new ABCTreeListNode(RootData, strObjectName, objChild);
                        node.CachingNode();
                    }
                }
            }

            ExpandDataAll();

            TreeList.InnerTreeList.DataSource = RootData;
            TreeList.InnerTreeList.RefreshDataSource();
        }
예제 #3
0
        public void Invalidate(IList dataList)
        {
            InvalidateCachingAllNodes();

            RootData         = new ABCTreeListNode(null, null, null);
            RootData.Manager = this;

            if (RootConfig.ChildrenNodes.Count > 0)
            {
                foreach (String strObjectName in RootConfig.ChildrenNodes.Keys)
                {
                    String strTableName = RootConfig.ChildrenNodes[strObjectName].InnerData.TableName;
                    BusinessObjectController Controller = BusinessControllerFactory.GetBusinessController(strTableName);
                    foreach (object objChild in dataList)
                    {
                        if (objChild is BusinessObject == false)
                        {
                            continue;
                        }

                        ABCTreeListNode node = new ABCTreeListNode(RootData, strObjectName, objChild as BusinessObject);
                        node.CachingNode();
                    }

                    break;
                }
            }
            ExpandDataAll();

            TreeList.InnerTreeList.DataSource = RootData;
            TreeList.InnerTreeList.RefreshDataSource();
        }
예제 #4
0
        public void RefreshData(Boolean includeParent, Boolean includeChildren, Boolean defaultOnly)
        {
            #region Current Node
            if (InnerData != null)
            {
                BusinessObjectController ctrller = BusinessControllerFactory.GetBusinessController(InnerData.AATableName);
                String strPK = DataStructureProvider.GetPrimaryKeyColumn(InnerData.AATableName);
                Guid   iID   = ABCHelper.DataConverter.ConvertToGuid(ABCBusinessEntities.ABCDynamicInvoker.GetValue(InnerData, strPK));
                InnerData = ctrller.GetObjectByID(iID);
                if (InnerData == null)
                {
                    if (this.ParentNode != null)
                    {
                        this.ParentNode.ChildrenNodes.Remove(iID);
                        this.ParentNode = null;
                    }
                    Dictionary <Guid, ABCTreeListNode> innerList = null;
                    if (this.Manager.DataList.TryGetValue(this.ObjectName, out innerList))
                    {
                        if (innerList.ContainsKey(iID))
                        {
                            innerList.Remove(iID);
                        }
                    }
                }
            }
            #endregion

            List <ABCTreeListNode> lstTemps = new List <ABCTreeListNode>();
            foreach (ABCTreeListNode childNode in this.ChildrenNodes.Values)
            {
                lstTemps.Add(childNode);
            }

            if (includeChildren)
            {
                foreach (ABCTreeListNode childNode in lstTemps)
                {
                    childNode.RefreshData(false, includeChildren, defaultOnly);
                }
            }
            if (includeParent && this.ParentNode != null)
            {
                this.ParentNode.RefreshData(true, false, defaultOnly);
            }

            ExpandData(includeChildren, defaultOnly);
        }
예제 #5
0
        public void RefreshCachingNodes(TreeConfigNode configNode)
        {
            try
            {
                if (configNode.InnerData != null && configNode.ParentNode != null)
                {
                    Dictionary <Guid, ABCTreeListNode> innerList = null;
                    if (this.DataList.TryGetValue(configNode.InnerData.Name, out innerList) == false)
                    {
                        innerList = new Dictionary <Guid, ABCTreeListNode>();
                        this.DataList.Add(configNode.InnerData.Name, innerList);
                    }

                    DataView view = DataCachingProvider.TryToGetDataView(configNode.InnerData.TableName, false);
                    BusinessObjectController Controller = BusinessControllerFactory.GetBusinessController(configNode.InnerData.TableName);
                    String strPK = DataStructureProvider.GetPrimaryKeyColumn(configNode.InnerData.TableName);
                    foreach (DataRow dr in view.Table.Rows)
                    {
                        BusinessObject obj = Controller.GetObjectFromDataRow(dr);
                        if (obj != null)
                        {
                            Guid iID = ABCHelper.DataConverter.ConvertToGuid(ABCBusinessEntities.ABCDynamicInvoker.GetValue(obj, strPK));
                            if (innerList.ContainsKey(iID) == false)
                            {
                                ABCTreeListNode node = new ABCTreeListNode(null, configNode.InnerData.Name, obj);
                                node.Manager = this;
                                node.CachingNode();
                            }
                            else
                            {
                                innerList[iID].InnerData = obj;
                            }
                        }
                    }
                }
            }
            catch (Exception ex)
            {
            }
        }
예제 #6
0
        public ABCTreeListNode(ABCTreeListNode parent, String strObjectName, BusinessObject _data)
        {
            this.ObjectName = strObjectName;
            this.ParentNode = parent;
            if (parent != null)
            {
                this.Level   = parent.Level + 1;
                this.Manager = this.ParentNode.Manager;
            }

            this.InnerData = _data;
            if (this.InnerData != null)
            {
                Guid iID = ABCHelper.DataConverter.ConvertToGuid(ABCBusinessEntities.ABCDynamicInvoker.GetValue(this.InnerData, DataStructureProvider.GetPrimaryKeyColumn(this.InnerData.AATableName)));
                if (this.ParentNode != null)
                {
                    this.ParentNode.ChildrenNodes.Add(iID, this);
                }

                CachingNode();
            }
        }
예제 #7
0
 public void Clear( )
 {
     RootData = new ABCTreeListNode(null, null, null);
 }