public void UpdateWorkflow(Workflow workflow)
        {
            MetaManagerServices.GetConfigurationManagementService().CheckOutDomainObject(workflow.Id, typeof(Workflow));

            Workflow readWorkflow = WorkflowDao.FindById(workflow.Id);

            XDocument x = XDocument.Load(XmlReader.Create(new StringReader(readWorkflow.WorkflowXoml)));

            var dialogs = from d in x.Descendants()
                          where d.Attribute("DialogId") != null
                          select d;

            foreach (XElement element in dialogs)
            {
                Dialog d = DialogDao.FindById(new Guid(element.Attribute("DialogId").Value));
                element.Name = XName.Get(WorkflowTypeFactory.GetDialogActivityClassName(d), element.Name.NamespaceName);
            }

            var serviceMethods = from s in x.Descendants()
                                 where s.Attribute("ServiceMethodId") != null
                                 select s;

            foreach (XElement element in serviceMethods)
            {
                ServiceMethod s = ServiceMethodDao.FindById(new Guid(element.Attribute("ServiceMethodId").Value));
                element.Name = XName.Get(WorkflowTypeFactory.GetServiceMethodActivityClassName(s), element.Name.NamespaceName);
            }

            readWorkflow.WorkflowXoml = x.ToString();

            WorkflowDao.SaveOrUpdate(readWorkflow);
        }
        public void SetDialogInterface(Dialog dialog, View view)
        {
            Dialog readDialog = DialogDao.FindById(dialog.Id);

            if (readDialog != null)
            {
                readDialog.InterfaceView = view;

                DialogDao.SaveOrUpdate(readDialog);
            }
        }
        public Dialog GetDialog(Guid dialogId)
        {
            Dialog dialog = DialogDao.FindById(dialogId);

            if (dialog != null)
            {
                NHibernateUtil.Initialize(dialog);
            }

            return(dialog);
        }
        public Dialog GetDialogWithViewTree(Guid dialogId)
        {
            Dialog dialog = DialogDao.FindById(dialogId);

            if (dialog != null)
            {
                NHibernateUtil.Initialize(dialog);
                NHibernateUtil.Initialize(dialog.SearchPanelView);
                NHibernateUtil.Initialize(dialog.InterfaceView);
                NHibernateUtil.Initialize(dialog.Module);

                if (dialog != null && dialog.RootViewNode != null)
                {
                    WalkTheNodeTree(dialog.RootViewNode);
                }
            }

            return(dialog);
        }