public void SetDialogInterface(Dialog dialog, View view) { Dialog readDialog = DialogDao.FindById(dialog.Id); if (readDialog != null) { readDialog.InterfaceView = view; DialogDao.SaveOrUpdate(readDialog); } }
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); }