Ejemplo n.º 1
0
        public DashboardDataSourceWizardViewBase(ScriptDashboardWizardParameters parameters, IObjectSpace objectSpace, XafApplication application)
        {
            ObjectSpace      = objectSpace;
            WizardParameters = parameters;
            Application      = application;

            ParamsObjectSpace = application.CreateObjectSpace();
            paramsView        = CreateDetailView(ParamsObjectSpace);
            paramsView.CreateControls();
            paramsView.LayoutManager.CustomizationEnabled = false;
            panelBaseContent.Controls.Add((XafLayoutControl)paramsView.LayoutManager.Container);
        }
Ejemplo n.º 2
0
        public void CreateViewItems(DetailView view, List <ConfigurationStatic> configurations)
        {
            view.CreateControls();
            var layoutControl = (DevExpress.XtraLayout.LayoutControl)view.Control;
            var mainGroup     = new TabbedControlGroup()
            {
                TextVisible = false
            };

            layoutControl.AddItem(mainGroup);

            var groups = new List <LayoutControlGroup>();

            foreach (var configurationStatic in configurations)
            {
                var item = new LayoutControlItem()
                {
                    Name = configurationStatic.ParameterName, OptionsToolTip = new BaseLayoutItemOptionsToolTip()
                    {
                        ToolTip = configurationStatic.Description
                    }
                };
                var group = groups.FirstOrDefault(x => x.Name == configurationStatic.GroupName);
                if (group == null)
                {
                    group = new LayoutControlGroup()
                    {
                        Name = configurationStatic.GroupName, DefaultLayoutType = LayoutType.Vertical
                    };
                    groups.Add(group);
                    mainGroup.AddTabPage(group);
                }
                var type = configurationStatic.ParameterType;
                switch (type)
                {
                case ConfigurationStatic.ParameterTypeEnum.String:
                    item.Control = new StringEdit(250)
                    {
                        Dock = DockStyle.Fill, EditValue = configurationStatic.ParameterValue, ToolTip = configurationStatic.Description
                    }; break;

                case ConfigurationStatic.ParameterTypeEnum.Int:
                    item.Control = new IntegerEdit()
                    {
                        Dock = DockStyle.Fill, EditValue = Convert.ToInt32(configurationStatic.ParameterValue), ToolTip = configurationStatic.Description
                    }; break;

                case ConfigurationStatic.ParameterTypeEnum.Decimal:
                    item.Control = new DecimalEdit()
                    {
                        Dock = DockStyle.Fill, EditValue = Convert.ToDecimal(configurationStatic.ParameterValue), ToolTip = configurationStatic.Description
                    }; break;

                case ConfigurationStatic.ParameterTypeEnum.Bool:
                    item.Control = new BooleanEdit()
                    {
                        Dock = DockStyle.Fill, EditValue = Convert.ToBoolean(configurationStatic.ParameterValue), ToolTip = configurationStatic.Description, Text = string.Empty
                    }; break;
                }

                (item.Control as BaseEdit).EditValueChanged += (s, e) => ConfigurationStaticController_EditValueChanged(s, e, configurationStatic);
                group.AddItem(item);
            }
            mainGroup.SelectedTabPageIndex = 0;
        }
Ejemplo n.º 3
0
        private void FilteringCriterionListAction_Execute(object sender, SingleChoiceActionExecuteEventArgs e)
        {
            // Глушим стандартный полнотекстовый поиск
            standardFilterController.FullTextFilterAction.Enabled[FTS_DO_NOT_ENABLED] = false;
            ListViewClearFilter.Enabled[DO_NOT_ENABLED] = true;
            ListViewApplyFilter.Enabled[DO_NOT_ENABLED] = true;


            // В зависимости от выбранного пункта вызывается та или иная форма

            //frame = Frame;
            //view = View;
            //listView = view as DevExpress.ExpressApp.ListView;

            if (listView == null)
            {
                return;
            }

            // Находим, если задан, фильтр из модели
            string           choiceActionItemFilterString = "";
            FilterController fc = Frame.GetController <FilterController>();
            ChoiceActionItem choiceActionItem = ((SingleChoiceAction)(fc.Actions["SetFilter"])).SelectedItem;

            if (choiceActionItem != null)
            {
                choiceActionItemFilterString = choiceActionItem.Data.ToString();
            }


            if (e.SelectedChoiceActionItem.Id == "CriteriaBuilder")
            {
                // Показ формы построения запроса с помощью построителя критериев

                if (FilterIsShowihg)
                {
                    if (currentFilterId == "CriteriaBuilder")
                    {
                        FilterPanelHide();
                        return;
                    }
                }

                currentFilterId = "CriteriaBuilder";
                FilterIsShowihg = true;

                // Разблокируем кнопку применения фильтра
                ListViewApplyFilter.Enabled.Clear();
                ListViewApplyFilter.Enabled[DO_NOT_ENABLED] = true;

                // Тип объекта-фильтра
                Type filterObjType = typeof(FilteringCriterion);

                string strCriteria = this.criteriaBuilderString;

                IObjectSpace       objectSpace = frame.Application.CreateObjectSpace();
                FilteringCriterion objFilter   = objectSpace.CreateObject(filterObjType) as FilteringCriterion; // objectSpace.GetObject(currentObject);
                if (objFilter == null)
                {
                    return;
                }
                //objFilter.LV = listView;
                objFilter.objectTypeInfo = objectTypeInfo;
                //objFilter.CriteriaController = this;

                objFilter.Criterion = strCriteria; // Остаётся для построителя запросов в форме FilteringCriterion.cs
                //objFilter.AdditionalCriterionString = choiceActionItemFilterString;

                wp = objFilter as ICustomFilter;
                if (wp == null)
                {
                    return;
                }

                string DetailViewId = frame.Application.FindDetailViewId(objFilter.GetType());

                DetailView newView = frame.Application.CreateDetailView(objectSpace, DetailViewId, false, objFilter);
                newView.CreateControls();

                filterPanel.Controls.Clear();
                DevExpress.ExpressApp.Win.Layout.XafLayoutControl ctrlFilter = ((DevExpress.ExpressApp.Win.Layout.XafLayoutControl)newView.Control);
                filterPanel.Controls.Add(ctrlFilter);

                FilteringCriterionListAction.SelectedIndex = 0;

                FilterPanelShow(130);

                return;
            }

            if (e.SelectedChoiceActionItem.Data != null)
            {
                // Показ формы с полями от NonPersistent объекта, через которую формировать критерий поиска, присваивать его
                // списку и reload() этого списка

                // Разблокируем кнопку применения фильтра
                ListViewApplyFilter.Enabled.Clear();
                ListViewApplyFilter.Enabled[DO_NOT_ENABLED] = true;

                IModelDetailView node = e.SelectedChoiceActionItem.Data as IModelDetailView;

                // Тип объекта-фильтра
                Type filterObjType = node.ModelClass.TypeInfo.Type;

                string strCriteria = this.criteriaBuilderString;

                IObjectSpace  objectSpace = frame.Application.CreateObjectSpace();
                ICustomFilter objFilter   = objectSpace.CreateObject(filterObjType) as ICustomFilter;
                if (objFilter == null)
                {
                    return;
                }
                //objFilter.LV = listView;
                objFilter.objectTypeInfo = objectTypeInfo;
                //objFilter.CriteriaController = this;

                //objFilter.AdditionalCriterionString = choiceActionItemFilterString;

                //objFilter.Criterion = strCriteria;

                string DetailViewId = frame.Application.FindDetailViewId(objFilter.GetType());

                if (FilterIsShowihg & currentFilterId == DetailViewId)
                {
                    FilterPanelHide();
                    return;
                }

                currentFilterId = DetailViewId;
                FilterIsShowihg = true;

                wp = objFilter as ICustomFilter;
                if (wp == null)
                {
                    return;
                }

                DetailView newView = frame.Application.CreateDetailView(objectSpace, DetailViewId, false, objFilter);
                newView.CreateControls();

                filterPanel.Controls.Clear();
                DevExpress.ExpressApp.Win.Layout.XafLayoutControl ctrlFilter = ((DevExpress.ExpressApp.Win.Layout.XafLayoutControl)newView.Control);
                filterPanel.Controls.Add(ctrlFilter);

                FilteringCriterionListAction.SelectedIndex = 0;

                //FilterPanelShow(100);
                FilterPanelShow(GetFilterHight(newView) + 30);

                return;
            }
        }
Ejemplo n.º 4
0
        private void FilteringCriterionListAction_Execute(object sender, SingleChoiceActionExecuteEventArgs e)
        {
            // В зависимости от выбранного пункта вызывается та или иная форма
            if (detailView == null)
            {
                return;
            }
            DevExpress.ExpressApp.DC.ITypeInfo objectTypeInfo = detailView.ObjectTypeInfo;

            XafExtAnalysis currentObject = detailView.CurrentObject as XafExtAnalysis;

            if (currentObject == null)
            {
                return;
            }

            // Находим, если задан, фильтр из модели
            string           choiceActionItemFilterString = "";
            FilterController fc = Frame.GetController <FilterController>();
            ChoiceActionItem choiceActionItem = ((SingleChoiceAction)(fc.Actions["SetFilter"])).SelectedItem;

            if (choiceActionItem != null)
            {
                choiceActionItemFilterString = choiceActionItem.Data.ToString();
            }

            if (e.SelectedChoiceActionItem.Data != null)
            {
                IModelDetailView node = e.SelectedChoiceActionItem.Data as IModelDetailView;

                // Тип объекта-фильтра
                Type filterObjType = node.ModelClass.TypeInfo.Type;

                string strCriteria = this.criteriaBuilderString;

                IObjectSpace  objectSpace = frame.Application.CreateObjectSpace();
                ICustomFilter objFilter   = objectSpace.CreateObject(filterObjType) as ICustomFilter;
                if (objFilter == null)
                {
                    return;
                }
                objFilter.LV                 = null;
                objFilter.DV                 = detailView;
                objFilter.objectTypeInfo     = objectTypeInfo;
                objFilter.CriteriaController = this;

                objFilter.AdditionalCriterionString = choiceActionItemFilterString;

                //objFilter.Criterion = strCriteria;

                string DetailViewId = frame.Application.FindDetailViewId(objFilter.GetType());

                if (FilterIsShowihg & currentFilterId == DetailViewId)
                {
                    FilterPanelHide();
                    return;
                }

                currentFilterId = DetailViewId;
                FilterIsShowihg = true;

                wp = objFilter as ICustomFilter;
                if (wp == null)
                {
                    return;
                }
                wp.ClearFilter();

                DetailView newView = frame.Application.CreateDetailView(objectSpace, DetailViewId, false, objFilter);
                newView.CreateControls();

                filterPanel.Controls.Clear();
                DevExpress.ExpressApp.Win.Layout.XafLayoutControl ctrlFilter = ((DevExpress.ExpressApp.Win.Layout.XafLayoutControl)newView.Control);
                filterPanel.Controls.Add(ctrlFilter);

                AnalysisCriterionListAction.SelectedIndex = 0;

                //FilterPanelShow(100);
                //FilterPanelShow(GetFilterHight(newView) + 30);

                // Устанавливаем преднастроенный фильтр, если он определён
                currentObject.Criteria = currentObject.AdminCriteria;

                //AnalysisEditorWin analysisEditor = null;
                //IList<AnalysisEditorWin> analysisEditors = detailView.GetItems<AnalysisEditorWin>();
                //if (analysisEditors.Count == 1) {
                //    analysisEditor = analysisEditors[0];
                //}
                //if (analysisEditor != null) {
                //    ChartControl chartControl = ((AnalysisControlWin)analysisEditor.Control).ChartControl;
                //    PivotGridControl pivotGridControl = ((AnalysisControlWin)analysisEditor.Control).PivotGrid;
                //    // Do what you want with the chart and pivot grid controls
                //    pivotGridControl.RefreshData();
                //    chartControl.RefreshData();
                //    //pivotGridControl.Update();
                //}

                ExecStandartAction(analysisDataBindController.UnbindDataAction);

                FilterPanelShow(GetFilterHight(newView) + 30);

                return;
            }
        }
Ejemplo n.º 5
0
        void ViewController2_HandleCreated(object sender, EventArgs e)
        {
            // Вставка Layout
            if (AnalysisCriterionListAction.Items.Count == 0)
            {
                return;
            }

            //DevExpress.XtraEditors.PanelControl filterPanel = new DevExpress.XtraEditors.PanelControl();
            filterPanel             = new DevExpress.XtraEditors.PanelControl();
            filterPanel.Height      = 80;
            filterPanel.MinimumSize = new System.Drawing.Size(0, 0);
            filterPanel.Dock        = System.Windows.Forms.DockStyle.Top;
            filterPanel.AutoSize    = false;
            //filterPanel.GetPreferredSize(
            filterPanel.AutoSizeMode = AutoSizeMode.GrowAndShrink;
            //filterPanel.Hide();
            //filterPanel.Show();
            //filterPanel.Controls.Add(splitter);

            splitter          = new DevExpress.XtraEditors.SplitterControl();
            splitter.Height   = 50;
            splitter.Dock     = System.Windows.Forms.DockStyle.Top;
            splitter.AutoSize = false;
            //splitter.Hide();
            //splitter.Show();
            //splitter.Controls.Add(filterPanel);

            //DevExpress.XtraEditors.PanelControl dataPanel = new DevExpress.XtraEditors.PanelControl();
            dataPanel              = new DevExpress.XtraEditors.PanelControl();
            dataPanel.Height       = 50;
            dataPanel.MinimumSize  = new System.Drawing.Size(0, 0);
            dataPanel.Dock         = System.Windows.Forms.DockStyle.Fill;
            dataPanel.AutoSize     = false;
            dataPanel.AutoSizeMode = AutoSizeMode.GrowAndShrink;
            //dataPanel.Hide();
            //dataPanel.Show();
            //dataPanel.Controls.Add(splitter);

            if (((System.Windows.Forms.Control)sender).Parent == null)
            {
                return;
            }
            ((System.Windows.Forms.Control)sender).Parent.Controls.Add(dataPanel);
            ((System.Windows.Forms.Control)sender).Parent.Controls.Add(splitter);
            ((System.Windows.Forms.Control)sender).Parent.Controls.Add(filterPanel);

            // Находим контрол, показывающий DetailView
            System.Windows.Forms.Control ctrl = ((System.Windows.Forms.Control)sender).Parent.Controls[0];
            ctrl.Parent = dataPanel;

            // DetailView с фильтром
            IObjectSpace objectSpace = Application.CreateObjectSpace();

            // Находим 1-й элемент списка фильтров
            IModelDetailView node = AnalysisCriterionListAction.Items[0].Data as IModelDetailView;
            // Тип объекта-фильтра
            Type filterObjType = node.ModelClass.TypeInfo.Type;

            wp = objectSpace.CreateObject(filterObjType) as ICustomFilter;
            if (wp == null)
            {
                return;
            }

            string DetailViewId = frame.Application.FindDetailViewId(wp.GetType());
            //TargetWindow openMode = TargetWindow.Current;

            DetailView newView = frame.Application.CreateDetailView(objectSpace, DetailViewId, false, wp);

            newView.CreateControls();

            // Назначения:
            //DevExpress.ExpressApp.ListView listView = sender as DevExpress.ExpressApp.ListView;
            DevExpress.ExpressApp.DetailView detailView = View as DevExpress.ExpressApp.DetailView;
            if (detailView == null)
            {
                return;
            }
            // ((System.Windows.Forms.Control)sender).Parent.Parent.Parent.Parent.Parent  as DevExpress.ExpressApp.ListView
            DevExpress.ExpressApp.DC.ITypeInfo objectTypeInfo = detailView.ObjectTypeInfo;

            wp.LV = null;
            wp.DV = detailView;
            //wp.objectType = typeObjectOfListView;
            wp.objectTypeInfo     = objectTypeInfo;
            wp.CriteriaController = this;

            DevExpress.ExpressApp.Win.Layout.XafLayoutControl ctrlFilter = ((DevExpress.ExpressApp.Win.Layout.XafLayoutControl)newView.Control);

            filterPanel.Controls.Add(ctrlFilter);

            // Показ панели с фильтром
            FilterPanelShow(GetFilterHight(newView) + 30);
        }