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);
        }
        public IList <Dialog> GetAllDialogsWithInterfaceView(Guid applicationId, DialogType?dialogType)
        {
            IList <Dialog> dialogList = null;

            if (dialogType == null)
            {
                dialogList = DialogDao.FindAllDialogsWithInterfaceView(applicationId);
            }
            else
            {
                dialogList = DialogDao.FindAllDialogsWithInterfaceViewByDialogType(applicationId, (DialogType)dialogType);
            }

            foreach (Dialog dialog in dialogList)
            {
                NHibernateUtil.Initialize(dialog.Module);
            }

            return(dialogList);
        }
        public Dialog CreateOrUpdateSearchPanelView(Dialog dialog)
        {
            dialog = this.GetDialogWithViewTree(dialog.Id);

            if (dialog != null)
            {
                View interfaceView = dialog.InterfaceView;

                View view = dialog.SearchPanelView;

                if (view != null)
                {
                    view = this.GetViewById(view.Id);
                    if (!view.IsLocked || view.LockedBy != Environment.UserName)
                    {
                        return(dialog);
                    }
                }
                else
                {
                    if (!dialog.IsLocked || dialog.LockedBy != Environment.UserName)
                    {
                        return(dialog);
                    }
                    view                = new Cdc.MetaManager.DataAccess.Domain.View();
                    view.Application    = interfaceView.Application;
                    view.BusinessEntity = interfaceView.BusinessEntity;
                    view.RequestMap     = interfaceView.RequestMap;
                    view.ResponseMap    = interfaceView.RequestMap;
                    view.Type           = ViewType.Standard;
                    view.Name           = string.Format("{0}SearchPanel", dialog.Name);
                    view.Title          = view.Name;

                    MetaManagerServices.GetModelService().SaveDomainObject(view);

                    MetaManagerServices.GetConfigurationManagementService().CheckOutDomainObject(view.Id, typeof(View));

                    dialog.SearchPanelView = view;

                    DialogDao.SaveOrUpdate(dialog);
                }

                if (view.VisualTree == null)
                {
                    view.VisualTree = new UXSearchPanel("SearchPanel");
                }

                view.Name  = string.Format("{0}SearchPanel", dialog.Name);
                view.Title = view.Name;

                ViewDao.SaveOrUpdate(view);

                foreach (MappedProperty property in interfaceView.RequestMap.MappedProperties)
                {
                    if ((property.IsSearchable) && (FindComponentInSearchPanel(view.VisualTree, property) == null))
                    {
                        UXSearchPanelItem item = new UXSearchPanelItem();

                        item.Caption = property.Name;

                        UXTextBox textBox = new UXTextBox(property.Name);
                        textBox.MappedProperty = property;
                        textBox.Width          = -1;
                        textBox.Height         = 21;

                        item.Children.Add(textBox);
                        item.IsDefaultVisible = true;

                        view.VisualTree.Children.Add(item);
                    }
                    else if (!property.IsSearchable)
                    {
                        UXComponent component = FindComponentInSearchPanel(view.VisualTree, property);

                        if (component != null)
                        {
                            Helpers.ViewHelper.ReplaceComponentInVisualTree(component.Parent, null);
                        }
                    }
                }

                SaveView(view);
            }

            return(dialog);
        }
 public IList <Dialog> FindDialogsByNameAndModule(Guid applicationId, string moduleName, string dialogName)
 {
     return(DialogDao.FindDialogsByNameAndModule(applicationId, moduleName, dialogName));
 }