public long GetNextSequence(ITypeInfo typeInfo, string prefix) { if (typeInfo == null) { throw new ArgumentNullException("typeInfo"); } return(GetNextSequence(XpoTypesInfoHelper.GetXpoTypeInfoSource().XPDictionary.GetClassInfo(typeInfo.Type), prefix)); }
internal static void SetNextSequence(ITypeInfo typeInfo, string prefix, long nextId) { if (_sequenceGenerator == null) _sequenceGenerator = new SequenceGenerator(); var objectByKey = _sequenceGenerator._explicitUnitOfWork.GetObjectByKey(_sequenceObjectType, prefix + typeInfo.FullName, true); _sequenceGenerator._sequence = objectByKey != null ? (ISequenceObject)objectByKey : CreateSequenceObject(prefix + typeInfo.FullName, _sequenceGenerator._explicitUnitOfWork); _sequenceGenerator._sequence.NextSequence = nextId; _sequenceGenerator._explicitUnitOfWork.FlushChanges(); _sequenceGenerator.Accept(); }
public static void SetNextSequence(ITypeInfo typeInfo, string prefix, long nextId) { if (_sequenceGenerator == null) { _sequenceGenerator = new SequenceGenerator(); } var objectByKey = _sequenceGenerator._explicitUnitOfWork.GetObjectByKey(_sequenceObjectType, prefix + typeInfo.FullName, true); _sequenceGenerator._sequence = objectByKey != null ? (ISequenceObject)objectByKey : CreateSequenceObject(prefix + typeInfo.FullName, _sequenceGenerator._explicitUnitOfWork); _sequenceGenerator._sequence.NextSequence = nextId; _sequenceGenerator._explicitUnitOfWork.FlushChanges(); _sequenceGenerator.Accept(); }
private void ListViewFilterPanelController_Activated(object sender, EventArgs e) { // Скрываем саму кнопку ListViewClearFilter.Enabled[DO_NOT_ENABLED] = false; ListViewApplyFilter.Enabled[DO_NOT_ENABLED] = false; frame = Frame; view = View; listView = view as DevExpress.ExpressApp.ListView; if (listView == null) { return; } objectTypeInfo = listView.CollectionSource.ObjectTypeInfo; typeObjectOfListView = objectTypeInfo.Type; // Критерий из модели для самого ListView listViewCriteria = listView.Model.Criteria; View.ControlsCreated += new EventHandler(View_ControlsCreated); FilteringCriterionListAction.Items.Clear(); foreach (IModelDetailView node in View.Model.Application.Views.GetNodes <IModelDetailView>()) { if (node.ModelClass.TypeInfo.Type.Name.StartsWith(typeObjectOfListView.Name + "Filter")) { ChoiceActionItem current = new ChoiceActionItem(node.Id, node.Caption, node); FilteringCriterionListAction.Items.Add(current); } } IModelDetailView imdvFullTextSearch = Application.FindModelView(Application.FindDetailViewId(typeof(FilteringCriterion))) as IModelDetailView; string FullTextSearchCaption = imdvFullTextSearch.Caption; FilteringCriterionListAction.Items.Add(new ChoiceActionItem("CriteriaBuilder", FullTextSearchCaption, null)); FilteringCriterionListAction.SelectedIndex = 0; if (standardFullTextFilterAction != null) { standardFullTextFilterAction.Active["IsPersistentType"] = true; // string searchText = ""; // if (standardFullTextFilterAction.Value != null) searchText = standardFullTextFilterAction.Value.ToString(); // InitVariablesForLikeSearchPathListAttribute(searchText, out criteriaForLikeSearchPathListAttribute, out propertiesForLikeSearchPathListAttribute); } }
public long GetNextSequence(ITypeInfo typeInfo) { return(GetNextSequence(typeInfo, null)); }
public static void SetNextSequence(ITypeInfo typeInfo, long nextId) { SetNextSequence(typeInfo, null, nextId); }
public static void GenerateSequence(ISupportSequenceObject supportSequenceObject, ITypeInfo typeInfo) { if (_defaultDataLayer == null) return; if (supportSequenceObject.Session is NestedUnitOfWork || !supportSequenceObject.Session.IsNewObject(supportSequenceObject)) return; if (_sequenceGenerator == null) _sequenceGenerator = new SequenceGenerator(); long nextSequence = _sequenceGenerator.GetNextSequence(typeInfo, supportSequenceObject.Prefix); Session session = supportSequenceObject.Session; if (IsNotNestedUnitOfWork(session)) { SessionManipulationEventHandler[] sessionOnAfterCommitTransaction = { null }; sessionOnAfterCommitTransaction[0] = (sender, args) => { if (_sequenceGenerator != null) { try { _sequenceGenerator.Accept(); } finally { session.AfterCommitTransaction -= sessionOnAfterCommitTransaction[0]; _sequenceGenerator.Dispose(); _sequenceGenerator = null; } } }; session.AfterCommitTransaction += sessionOnAfterCommitTransaction[0]; } supportSequenceObject.Sequence = nextSequence; }
public static long GetNowSequence(ITypeInfo typeInfo){ var xpClassInfo = XpandModuleBase.Dictiorary.GetClassInfo(typeInfo.Type); return GetNowSequence(xpClassInfo,null); }
public static void GenerateSequence(ISupportSequenceObject supportSequenceObject, ITypeInfo typeInfo) { if (_defaultDataLayer == null) { return; } if (_sequenceGenerator == null) { _sequenceGenerator = new SequenceGenerator(); } long nextSequence = _sequenceGenerator.GetNextSequence(typeInfo, supportSequenceObject.Prefix); Session session = supportSequenceObject.Session; if (!(session is NestedUnitOfWork)) { SessionManipulationEventHandler[] sessionOnAfterCommitTransaction = { null }; sessionOnAfterCommitTransaction[0] = (sender, args) => { if (_sequenceGenerator != null) { try { _sequenceGenerator.Accept(); } finally { session.AfterCommitTransaction -= sessionOnAfterCommitTransaction[0]; _sequenceGenerator.Dispose(); _sequenceGenerator = null; } } }; session.AfterCommitTransaction += sessionOnAfterCommitTransaction[0]; } supportSequenceObject.Sequence = nextSequence; }
void showDV(object sender, CustomProcessListViewSelectedItemEventArgs e) { Frame frame = Frame; View view = View; DevExpress.ExpressApp.ListView listView = view as DevExpress.ExpressApp.ListView; IEnumerable <MiniNavigationAttribute> mAttr = null; bool AttrExists = false; object currentObject = (object)view.CurrentObject; if (currentObject == null) { return; } Type objType = typeof(object); //string DetailViewID = ""; TargetWindow openMode = TargetWindow.Default; IObjectSpace objectSpace; Type NavigationChoiceType = (System.Type)(view.CurrentObject.GetType()); //.UnderlyingSystemType; //typeof(object); // Вставка механизма проверки модели на предмет умолчательного view для показа по 2-клик или Ввод { string path = ""; //string caption = ""; //TargetWindow openMode = TargetWindow.Default; IModelView modelView = null; bool IsMiniNavigationDefined = false; // Узел в модели IModelView node = null; node = View.Model.Application.Views[listView.Id]; //IModelListView node = View.Model.Application.Views.GetNode<IModelListView>(listView.Id); if (node != null) { // Перебираем все подузлы // node.GetNode(1) {ModelListViewFilters} DevExpress.ExpressApp.Model.IModelNode {ModelListViewFilters} for (int i = 0; i < node.NodeCount; i++) { IModelMiniNavigations miniNavigationNode = node.GetNode(i) as IModelMiniNavigations; if (miniNavigationNode != null) { // Сначала заполняем тот, что прописан по умолчанию IModelMiniNavigationItem miniNavigationDefaultItem = miniNavigationNode.DefaultMiniNavigationNode; if (miniNavigationDefaultItem != null) { path = miniNavigationDefaultItem.NavigationPath; //caption = miniNavigationDefaultItem.NavigationCaption; openMode = miniNavigationDefaultItem.TargetWindow; modelView = miniNavigationDefaultItem.View; IsMiniNavigationDefined = true; } //if (modelView == null) { if (!IsMiniNavigationDefined) { foreach (IModelMiniNavigationItem miniNavigationItem in miniNavigationNode.GetNodes <IModelMiniNavigationItem>()) { if (miniNavigationItem != miniNavigationDefaultItem) { path = miniNavigationItem.NavigationPath; //caption = miniNavigationItem.NavigationCaption; openMode = miniNavigationItem.TargetWindow; modelView = miniNavigationItem.View; IsMiniNavigationDefined = true; break; // Берём первый по расположению } } } break; } } // Если в модели ничего не найдено, то читаем атрибуты. if (!IsMiniNavigationDefined) { DevExpress.ExpressApp.DC.ITypeInfo objectTypeInfo = null; objectTypeInfo = listView.CollectionSource.ObjectTypeInfo; //typeObjectOfListView = objectTypeInfo.Type; mAttr = objectTypeInfo.FindAttributes <MiniNavigationAttribute>(); // Если ничего нет, то покидаем if (mAttr == null & !IsMiniNavigationDefined) { return; } SortedDictionary <int, MiniNavigationAttribute> sd = new SortedDictionary <int, MiniNavigationAttribute>(); IEnumerator <MiniNavigationAttribute> _enum = mAttr.GetEnumerator(); while (_enum.MoveNext()) { MiniNavigationAttribute attr = ((MiniNavigationAttribute)(_enum.Current)); sd.Add(attr.Order, attr); } foreach (KeyValuePair <int, MiniNavigationAttribute> kvp in sd) { AttrExists = true; MiniNavigationAttribute attr = kvp.Value; path = attr.NavigationPath; //caption = attr.NavigationCaptin; openMode = attr.TargetWindow; break; // Берём первый по порядку Order (он же и тот, что по умолчанию) } } if (AttrExists || IsMiniNavigationDefined) { // Получаем объект obj для показа BaseObject obj = GetObjectOnPathEnd(path, currentObject as BaseObject); if (obj == null) { DevExpress.XtraEditors.XtraMessageBox.Show( CommonMethods.GetMessage(MiniNavigatorControllerMessages.SHOWING_OBJECT_NOT_DEFINED), messageCaption, System.Windows.Forms.MessageBoxButtons.OK, System.Windows.Forms.MessageBoxIcon.Exclamation); return; } Type ChoiceType = (System.Type)(obj.GetType()); //.UnderlyingSystemType; //typeof(object); string ViewID = Application.FindDetailViewId(ChoiceType); // По умолчанию - DetailView Frame resultFrame = frame; // Application.CreateFrame("new"); //TargetWindow openMode = (TargetWindow)e.SelectedChoiceActionItem.Data; // Небольшая разборка с сочетанием значений openMode в целях определения фрейма, в который грузить if (MasterDetailViewFrame != null && (openMode == TargetWindow.Current & ((frame as NestedFrame) != null | !view.IsRoot))) { // Тогда Current трактуем как корневое окно resultFrame = MasterDetailViewFrame; { objectSpace = resultFrame.Application.CreateObjectSpace(); //.View.ObjectSpace; object representativeObj = objectSpace.GetObject(obj); View dv = null; if (modelView != null) { if ((modelView as IModelDetailView) != null) { ViewID = (modelView as IModelDetailView).Id; dv = resultFrame.Application.CreateDetailView(objectSpace, ViewID, true, representativeObj) as DetailView; } else if ((modelView as IModelListView) != null) { ViewID = (modelView as IModelListView).Id; //ListView dv = resultFrame.Application.CreateListView(objectSpace, ChoiceType, true); CollectionSource colSource = new CollectionSource(objectSpace, ChoiceType); if (!colSource.IsLoaded) { colSource.Reload(); } dv = resultFrame.Application.CreateListView((modelView as IModelListView), colSource, true) as ListView; } } else { // Если навигация орпделена в модели, а view не определено, то образуем DetailView по умолчанию ViewID = Application.FindDetailViewId(ChoiceType); dv = resultFrame.Application.CreateDetailView(objectSpace, ViewID, true, representativeObj) as DetailView; } resultFrame.SetView(dv, true, resultFrame); } return; } // Общий алгоритм { objectSpace = resultFrame.Application.CreateObjectSpace(); object representativeObj = objectSpace.GetObject(obj); View dv = null; if (modelView != null) { if ((modelView as IModelDetailView) != null) { ViewID = (modelView as IModelDetailView).Id; dv = resultFrame.Application.CreateDetailView(objectSpace, ViewID, true, representativeObj) as DetailView; } else if ((modelView as IModelListView) != null) { ViewID = (modelView as IModelListView).Id; //ListView dv = resultFrame.Application.CreateListView(objectSpace, ChoiceType, true); //objectSpace = resultFrame.Application.CreateObjectSpace(); CollectionSource colSource = new CollectionSource(objectSpace, ChoiceType); if (!colSource.IsLoaded) { colSource.Reload(); } dv = resultFrame.Application.CreateListView((modelView as IModelListView), colSource, true) as ListView; } } else { // Если навигация определена в модели, а view не определено, то образуем DetailView по умолчанию ViewID = Application.FindDetailViewId(ChoiceType); dv = resultFrame.Application.CreateDetailView(objectSpace, ViewID, true, representativeObj) as DetailView; } ShowViewParameters svp = new ShowViewParameters(); svp.CreatedView = dv; svp.TargetWindow = openMode; svp.Context = TemplateContext.View; svp.CreateAllControllers = true; e.InnerArgs.ShowViewParameters.Assign(svp); return; } } } } // ПРОЧИЕ LISTVIEW // Грузим в отдельном окне e.Handled = false; openMode = TargetWindow.NewWindow; if (Frame as NestedFrame != null | !View.IsRoot) { openMode = TargetWindow.NewModalWindow; } e.InnerArgs.ShowViewParameters.TargetWindow = openMode; }
public long GetNextSequence(ITypeInfo typeInfo, string prefix) { if (typeInfo == null) throw new ArgumentNullException("typeInfo"); return GetNextSequence(XpoTypesInfoHelper.GetXpoTypeInfoSource().XPDictionary.GetClassInfo(typeInfo.Type), prefix); }
public long GetNextSequence(ITypeInfo typeInfo) { if (typeInfo == null) throw new ArgumentNullException("typeInfo"); return GetNextSequence(XafTypesInfo.XpoTypeInfoSource.XPDictionary.GetClassInfo(typeInfo.Type), null); }
public static void GenerateSequence(ISupportSequenceObject supportSequenceObject, ITypeInfo typeInfo) { if (_sequenceGenerator == null) try { _sequenceGenerator = new SequenceGenerator(); } catch (NullReferenceException) { return; } long nextSequence = _sequenceGenerator.GetNextSequence(typeInfo, supportSequenceObject.Prefix); Session session = supportSequenceObject.Session; if (!(session is NestedUnitOfWork)) { SessionManipulationEventHandler[] sessionOnAfterCommitTransaction = { null }; sessionOnAfterCommitTransaction[0] = (sender, args) => { if (_sequenceGenerator != null) { try { _sequenceGenerator.Accept(); } finally { session.AfterCommitTransaction -= sessionOnAfterCommitTransaction[0]; _sequenceGenerator.Dispose(); _sequenceGenerator = null; } } }; session.AfterCommitTransaction += sessionOnAfterCommitTransaction[0]; } supportSequenceObject.Sequence = nextSequence; }
private void DetailViewAnalysisFilterPanelController_Activated(object sender, EventArgs e) { frame = Frame; view = View; detailView = view as DetailView; if (detailView == null) { return; } DevExpress.ExpressApp.DC.ITypeInfo objectTypeInfo = detailView.ObjectTypeInfo; // Подключаемся к ListViewProcessCurrentObjectController analysisDataBindController = frame.GetController <AnalysisDataBindController>(); if (frame.Context.Name == TemplateContext.LookupControl || frame.Context.Name == TemplateContext.LookupWindow) { return; } Type typeAnalysingObject = GetChoiceType(); // typeof(object); ExecStandartAction(null); if (typeAnalysingObject == null) { return; } #region ОБРАБОТКА ОПЦИЙ ФИЛЬТРАЦИИ ИЗ ПОДУЗЛА Filters текущего ListView СРЕДСТВАМИ ДАННОГО КОНТРОЛЛЕРА ВМЕСТО СТАНДАРТНОГО КОНТРОЛЛЕРА FilterController View.ControlsCreated += new EventHandler(View_ControlsCreated); AnalysisCriterionListAction.Items.Clear(); #endregion // Виды фильтрации // Список DetailView, которые представляют формы ввода параметров // Считаем пока, что имя DetailView с фильром формируется из имени типа фильтуемого списка прибавлением // слова Filter и номера, например, WorkPlanFilter01_DetailView. foreach (IModelDetailView node in View.Model.Application.Views.GetNodes <IModelDetailView>()) { //if (node.ModelClass == View.Model.ModelClass) { if (node.ModelClass.TypeInfo.Type.Name.StartsWith(typeAnalysingObject.Name + "Filter")) { ChoiceActionItem current = new ChoiceActionItem(node.Id, node.Caption, node); AnalysisCriterionListAction.Items.Add(current); //if (node == View.Model) SelectViewAction.SelectedItem = current; } } // AnalysisCriterionListAction.SelectedIndex = 0; ClearFilterFields.Active.Clear(); ClearFilterFields.Enabled.Clear(); ClearFilterFields.Active.SetItemValue("ResultValue", true); }
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; } }
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); }
public long GetNextSequence(ITypeInfo typeInfo) { return GetNextSequence(typeInfo, null); }
public static long GetNowSequence(ITypeInfo typeInfo) { var xpClassInfo = XpandModuleBase.Dictiorary.GetClassInfo(typeInfo.Type); return(GetNowSequence(xpClassInfo, null)); }