예제 #1
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();
        }
예제 #2
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)
                {
                }
            }
        }
예제 #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 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)
            {
            }
        }