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 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); }