Exemplo n.º 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);
        }
Exemplo n.º 2
0
        public ViewNode GetParentViewNode(ViewNode viewNode)
        {
            ViewNode readViewNode = ViewNodeDao.FindById(viewNode.Id);

            ViewNode parentNode = readViewNode.Parent;

            while (parentNode != null)
            {
                if ((parentNode.View.ResponseMap != null) && (parentNode.View.ResponseMap.MappedProperties.Count > 0))
                {
                    break;
                }

                parentNode = parentNode.Parent;
            }

            if (parentNode != null)
            {
                NHibernateUtil.Initialize(parentNode.View.Application);
                NHibernateUtil.Initialize(parentNode.View.BusinessEntity);
                MetaManagerUtil.InitializePropertyMap(parentNode.View.ResponseMap);
            }

            return(parentNode);
        }
Exemplo n.º 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);
        }
Exemplo n.º 4
0
        public void GetViewNodeMap(ViewNode viewNode, out PropertyMap viewNodeMap, out IList <IMappableProperty> sourceProperties, out IList <IMappableProperty> targetProperties)
        {
            ViewNode readViewNode = ViewNodeDao.FindById(viewNode.Id);

            if (readViewNode.View.RequestMap != null)
            {
                sourceProperties = new List <IMappableProperty>(
                    (from MappedProperty p in MetaManagerUtil.InitializePropertyMap(readViewNode.View.RequestMap).MappedProperties
                     where !(p.Target is UXSessionProperty)
                     select p).Cast <IMappableProperty>());
            }
            else
            {
                sourceProperties = new List <IMappableProperty>();
            }

            ViewNode parentNode = readViewNode.Parent;

            while (parentNode != null)
            {
                if ((parentNode.View.ResponseMap != null) && (parentNode.View.ResponseMap.MappedProperties.Count > 0))
                {
                    break;
                }

                parentNode = parentNode.Parent;
            }

            if (parentNode != null)
            {
                targetProperties = new List <IMappableProperty>(MetaManagerUtil.InitializePropertyMap(parentNode.View.ResponseMap).MappedProperties.Cast <IMappableProperty>());
            }
            else
            {
                targetProperties = new List <IMappableProperty>();
            }

            IList <UXSessionProperty> sessionProperties = ApplicationService.GetUXSessionProperties(readViewNode.View.Application);

            targetProperties = new List <IMappableProperty>(targetProperties.Concat <IMappableProperty>(sessionProperties.Cast <IMappableProperty>()));

            viewNodeMap = readViewNode.ViewMap;

            if (viewNodeMap != null)
            {
                MetaManagerUtil.InitializePropertyMap(viewNodeMap);
            }
        }
Exemplo n.º 5
0
        public ViewNode GetViewNodeById(Guid viewNodeId)
        {
            ViewNode viewNode = ViewNodeDao.FindById(viewNodeId);

            NHibernateUtil.Initialize(viewNode.Dialog);
            NHibernateUtil.Initialize(viewNode.Parent);
            NHibernateUtil.Initialize(viewNode.ViewMap);
            NHibernateUtil.Initialize(viewNode);

            foreach (ViewAction va in viewNode.ViewActions)
            {
                NHibernateUtil.Initialize(va.Action);
            }

            InitializeView(viewNode.View);

            return(viewNode);
        }
Exemplo n.º 6
0
        public ViewAction AddToView(UXAction action, ViewNode viewNode, ViewActionType viewActionType, MappedProperty mappedProperty)
        {
            ViewNode readViewNode = ViewNodeDao.FindById(viewNode.Id);
            UXAction readAction   = UXActionDao.FindById(action.Id);

            NHibernateUtil.Initialize(readAction);
            NHibernateUtil.Initialize(readAction.Dialog);
            NHibernateUtil.Initialize(readAction.ServiceMethod);
            NHibernateUtil.Initialize(readAction.CustomDialog);
            NHibernateUtil.Initialize(readViewNode.View);

            IList <ViewAction> viewActions = ViewActionDao.FindAllByViewNodeId(viewNode.Id);

            int nextSequence = 1;

            if (viewActions != null && viewActions.Count > 0)
            {
                // Get the maxsequence
                nextSequence = viewActions.Max(vAction => vAction.Sequence);

                // Add one so we get a unique sequence.
                nextSequence++;
            }

            // Create the new Viewaction
            ViewAction viewAction = new ViewAction();

            viewAction.ViewNode = readViewNode;
            viewAction.Action   = readAction;
            viewAction.Sequence = nextSequence;
            viewAction.Type     = viewActionType;
            viewAction.DrilldownFieldMappedProperty = ((viewActionType == ViewActionType.Drilldown) || (viewActionType == ViewActionType.JumpTo)) ? mappedProperty : null;

            viewAction = ViewActionDao.Save(viewAction);

            NHibernateUtil.Initialize(viewAction.ViewNode);
            NHibernateUtil.Initialize(viewAction.ViewNode.ViewActions);
            NHibernateUtil.Initialize(viewAction.Action);
            NHibernateUtil.Initialize(viewAction.DrilldownFieldMappedProperty);

            return(viewAction);
        }
Exemplo n.º 7
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);
        }