Пример #1
0
        public void MoveUp(Guid moverViewNodeId, Guid staticViewNodeId, out ViewNode moverViewNode, out ViewNode staticViewNode)
        {
            moverViewNode  = ViewNodeDao.FindById(moverViewNodeId);
            staticViewNode = ViewNodeDao.FindById(staticViewNodeId);

            int seq1 = moverViewNode.Sequence;
            int seq2 = staticViewNode.Sequence;

            if (seq1 != seq2)
            {
                int temp = seq2;
                seq2 = seq1;
                seq1 = temp;
            }
            else
            {
                seq2++;
            }

            moverViewNode.Sequence  = seq1;
            staticViewNode.Sequence = seq2;

            ViewNodeDao.SaveOrUpdate(moverViewNode);
            ViewNodeDao.SaveOrUpdate(staticViewNode);
        }
Пример #2
0
        public void UnmapViewComponents(View view)
        {
            View readView = ViewDao.FindById(view.Id);

            // Remove all maps for the ViewNodes connected to the View
            IList <ViewNode> viewNodeList = ViewNodeDao.FindAllByViewId(readView.Id);

            foreach (ViewNode viewNode in viewNodeList)
            {
                // Delete the ViewMap
                if (viewNode.ViewMap != null)
                {
                    PropertyMapDao.Delete(viewNode.ViewMap);
                }

                // Remove ViewMap from the ViewNode
                viewNode.ViewMap = null;

                // Save ViewNode
                ViewNodeDao.SaveOrUpdate(viewNode);
            }

            // Remove the connections from ViewComponents to MappedProperty
            WalkViewComponentsAndUnmap(readView.VisualTree);
        }
Пример #3
0
        public void SaveOrUpdateViewNodeMap(ViewNode viewNode, PropertyMap viewNodeMap)
        {
            ViewNode readViewNode = ViewNodeDao.FindById(viewNode.Id);

            if (viewNodeMap != null)
            {
                PropertyMapDao.SaveOrUpdate(viewNodeMap);
                readViewNode.ViewMap = viewNodeMap;
            }

            ViewNodeDao.SaveOrUpdate(readViewNode);
        }
Пример #4
0
        public ViewNode ConnectViewToViewNode(View view, ViewNode parentViewNode)
        {
            if (view != null && parentViewNode != null)
            {
                // First update/create the view
                View readView = ViewDao.FindById(view.Id);
                parentViewNode = ViewNodeDao.FindById(parentViewNode.Id);

                // Create viewnode to connect the view to
                ViewNode viewNode = new ViewNode();

                viewNode.Dialog   = parentViewNode.Dialog;
                viewNode.Parent   = parentViewNode;
                viewNode.Sequence = viewNode.Dialog.ViewNodes.Max(node => node.Sequence) + 1;
                viewNode.Title    = null;
                viewNode.View     = readView;

                // Save the new ViewNode
                viewNode = ViewNodeDao.SaveOrUpdate(viewNode);

                if (NHibernateUtil.IsInitialized(parentViewNode.Dialog) && NHibernateUtil.IsInitialized(parentViewNode.Dialog.ViewNodes))
                {
                    // Connect the ViewNode to the Dialogs ViewNodes
                    parentViewNode.Dialog.ViewNodes.Add(viewNode);
                }

                if (NHibernateUtil.IsInitialized(parentViewNode.Children))
                {
                    // Connect the ViewNode as a child to the Parent ViewNode
                    parentViewNode.Children.Add(viewNode);
                }

                return(viewNode);
            }

            return(null);
        }
Пример #5
0
 public ViewNode SaveViewNode(ViewNode viewNode)
 {
     return(ViewNodeDao.SaveOrUpdate(viewNode));
 }