public UXAction GetUXActionByIdWithMap(Guid uxActionId) { UXAction action = UXActionDao.FindById(uxActionId); if (action.ServiceMethod != null) { NHibernateUtil.Initialize(action.ServiceMethod.MappedToAction); if (action.ServiceMethod.MappedToAction != null) { NHibernateUtil.Initialize(action.ServiceMethod.MappedToAction.MappedToObject); } } if (action.RequestMap != null) { MetaManagerUtil.InitializePropertyMap(action.RequestMap); } if ((action.Dialog != null) && (action.Dialog.InterfaceView != null)) { if (action.Dialog.InterfaceView.ServiceMethod != null) { NHibernateUtil.Initialize(action.Dialog.InterfaceView.ServiceMethod); NHibernateUtil.Initialize(action.Dialog.InterfaceView.ServiceMethod.MappedToAction); } } return(action); }
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); }