Exemple #1
0
        public override void GenerateUIComposition(List <EntityUICompositionDTO> UICompositions)
        {
            foreach (var uiCompositionItem in UICompositions.OrderBy(x => x.Position))
            {
                if (uiCompositionItem.ObjectCategory == DatabaseObjectCategory.Entity)
                {
                    GenerateUIComposition(uiCompositionItem.ChildItems);
                }
                else if (uiCompositionItem.ObjectCategory == DatabaseObjectCategory.Group)
                {
                    GenerateUIComposition(uiCompositionItem.ChildItems);
                }
                else if (uiCompositionItem.ObjectCategory == DatabaseObjectCategory.TabControl)
                {
                    GenerateUIComposition(uiCompositionItem.ChildItems);
                }
                else if (uiCompositionItem.ObjectCategory == DatabaseObjectCategory.TabPage)
                {
                    GenerateUIComposition(uiCompositionItem.ChildItems);
                }
                else if (uiCompositionItem.ObjectCategory == DatabaseObjectCategory.Column)
                {
                    var columnControl = SimpleColumnControls.FirstOrDefault(x => x.Column.ID == Convert.ToInt32(uiCompositionItem.ObjectIdentity));
                    if (columnControl != null)
                    {
                        SpecializedDataView.AddUIControlPackage(columnControl.SimpleControlManager, columnControl.ControlManager.LabelControlManager);
                        columnControl.Visited = true;
                    }
                }
                else if (uiCompositionItem.ObjectCategory == DatabaseObjectCategory.Relationship)
                {
                    var columnControl = RelationshipColumnControls.FirstOrDefault(x => x.Relationship != null && x.Relationship.ID == Convert.ToInt32(uiCompositionItem.ObjectIdentity));
                    if (columnControl != null)
                    {
                        SpecializedDataView.AddView(columnControl.ControlManager, columnControl.ControlManager.LabelControlManager);
                        columnControl.Visited = true;
                    }
                }
                //حالت تب اضافه شود
                //uiControlPackageList.Add(item);
                //if (uiCompositionItem.ObjectCategory == DatabaseObjectCategory.Group)
                //{

                //}
            }
        }
        //public bool ApplyPreDefinedSearch(EntityPreDefinedSearchDTO message)
        //{
        //    if (message.IsSimpleSearch)
        //    {
        //        if (message.EntitySearchID == SearchInitializer.SearchEntityID)
        //        {
        //            foreach (var item in message.SimpleColumns)
        //            {
        //                SimpleSearchColumnControl columnControl = null;
        //                if (item.EntitySearchColumnsID != 0)
        //                {
        //                    columnControl = SimpleColumnControls.FirstOrDefault(x => x.EntitySearchColumn != null && x.EntitySearchColumn.ID == item.EntitySearchColumnsID);
        //                }
        //                else if (item.ColumnID != 0)
        //                {
        //                    columnControl = SimpleColumnControls.FirstOrDefault(x => x.Column.ID == item.ColumnID);
        //                }
        //                if (columnControl != null)
        //                {
        //                    columnControl.ControlPackage.SetOperator(item.Operator);
        //                    columnControl.ControlPackage.SetValue(item.Value);
        //                }
        //                else
        //                    return false;
        //            }
        //            return true;
        //        }
        //    }
        //    return false;
        //}
        public bool ShowSearchRepository(DP_SearchRepository item)
        {
            firstRepository = item;
            List <SearchProperty> listProperties = GetSearchProperties(item.Phrases);

            foreach (SearchProperty prop in listProperties)
            {
                SimpleSearchColumnControl columnControl = null;
                if (prop.SearchColumnID != 0)
                {
                    columnControl = SimpleColumnControls.FirstOrDefault(x => x.Column.ID == prop.ColumnID && x.EntitySearchColumn != null && x.EntitySearchColumn.ID == prop.SearchColumnID);
                }
                else
                {
                    columnControl = SimpleColumnControls.FirstOrDefault(x => x.Column.ID == prop.ColumnID);
                }
                if (columnControl == null)
                {
                    return(false);
                }
            }
            foreach (SearchProperty prop in listProperties)
            {
                SimpleSearchColumnControl columnControl = null;
                if (prop.SearchColumnID != 0)
                {
                    columnControl = SimpleColumnControls.FirstOrDefault(x => x.Column.ID == prop.ColumnID && x.EntitySearchColumn != null && x.EntitySearchColumn.ID == prop.SearchColumnID);
                }
                else
                {
                    columnControl = SimpleColumnControls.FirstOrDefault(x => x.Column.ID == prop.ColumnID);
                }

                //برای عادی ها جواب میده اگر خودش کمنترل بود چی
                columnControl.ControlManager.SetValue(null, prop.Value);
                if (columnControl.ControlManager.HasOperator())
                {
                    columnControl.ControlManager.SetOperator(prop.Operator);
                }
            }
            return(true);
        }
Exemple #3
0
        public void GenerateUIComposition(List <EntityUICompositionDTO> UICompositions, object container, UIControlPackageTree parentUIControlPackage, List <UIControlPackageTree> parentList)
        {
            //I_View_GridContainer container;
            //if (parentUIControlPackage == null)
            //{
            //    container = SpecializedDataView;
            //    parentList = UIControlPackageTree;
            //}
            //else
            //{
            //    parentList = parentUIControlPackage.ChildItems;
            //    container = parentUIControlPackage.Item as I_View_GridContainer;
            //}

            foreach (var uiCompositionItem in UICompositions.OrderBy(x => x.Position))
            {
                UIControlPackageTree item = new UIControlPackageTree();
                item.ParentItem = parentUIControlPackage;
                item.Container  = container;
                //if (parentUIControlPackage == null)
                //{
                //    item.UIComposition = uiCompositionItem;
                //    item.Container = DataView;

                //}+
                //if (uiCompositionItem.ObjectCategory == DatabaseObjectCategory.Entity)
                //{
                //    item.Item = DataView;
                //    parentList.Add(item);
                //    GenerateUIComposition(uiCompositionItem.ChildItems, DataView, item, item.ChildItems);

                //}
                if (uiCompositionItem.ObjectCategory == DatabaseObjectCategory.Group)
                {
                    var groupSetting = uiCompositionItem.GroupUISetting;
                    if (groupSetting == null)
                    {
                        groupSetting                      = new GroupUISettingDTO();
                        groupSetting.Expander             = true;
                        groupSetting.InternalColumnsCount = GetEntityUISetting().UIColumnsCount;
                        groupSetting.UIColumnsType        = Enum_UIColumnsType.Full;
                    }
                    var groupItem = AgentUICoreMediator.GetAgentUICoreMediator.UIManager.GenerateGroup(groupSetting);
                    item.Item   = groupItem;
                    item.UIItem = groupItem.UIMainControl;

                    groupItem.UIControlPackageTreeItem = item;
                    GenerateUIComposition(uiCompositionItem.ChildItems, groupItem, item, item.ChildItems);

                    if (item.ChildItems.Count != 0)
                    {
                        (container as I_View_GridContainer).AddGroup(groupItem, uiCompositionItem.Title, groupSetting);
                        parentList.Add(item);
                    }
                }
                else if (uiCompositionItem.ObjectCategory == DatabaseObjectCategory.TabControl)
                {
                    var tabgroupSetting = uiCompositionItem.TabGroupUISetting;
                    if (tabgroupSetting == null)
                    {
                        tabgroupSetting               = new TabGroupUISettingDTO();
                        tabgroupSetting.Expander      = true;
                        tabgroupSetting.UIColumnsType = Enum_UIColumnsType.Full;
                    }
                    var tabGroupContainer = AgentUICoreMediator.GetAgentUICoreMediator.UIManager.GenerateTabGroup(tabgroupSetting);
                    tabGroupContainer.UIControlPackageTreeItem = item;
                    item.Item   = tabGroupContainer;
                    item.UIItem = tabGroupContainer.UIMainControl;

                    GenerateUIComposition(uiCompositionItem.ChildItems, tabGroupContainer, item, item.ChildItems);
                    if (item.ChildItems.Count != 0)
                    {
                        (container as I_View_GridContainer).AddTabGroup(tabGroupContainer, uiCompositionItem.Title, tabgroupSetting);
                        parentList.Add(item);
                    }
                }
                else if (uiCompositionItem.ObjectCategory == DatabaseObjectCategory.TabPage)
                {
                    var tabpageSetting = uiCompositionItem.TabPageUISetting;
                    if (tabpageSetting == null)
                    {
                        tabpageSetting = new TabPageUISettingDTO();
                        tabpageSetting.InternalColumnsCount = GetEntityUISetting().UIColumnsCount;
                    }
                    var tabPage = AgentUICoreMediator.GetAgentUICoreMediator.UIManager.GenerateTabPage(tabpageSetting);
                    item.Item   = tabPage;
                    item.UIItem = tabPage.UIMainControl;
                    tabPage.UIControlPackageTreeItem = item;
                    GenerateUIComposition(uiCompositionItem.ChildItems, tabPage, item, item.ChildItems);
                    if (item.ChildItems.Count != 0)
                    {
                        var parentTabGroupContainer = parentUIControlPackage.Item as I_TabGroupContainer;
                        parentTabGroupContainer.AddTabPage(tabPage, uiCompositionItem.Title, tabpageSetting, tabPage.HasHeader);
                        parentList.Add(item);
                    }
                }
                else if (uiCompositionItem.ObjectCategory == DatabaseObjectCategory.Column)
                {
                    var columnControl = SimpleColumnControls.FirstOrDefault(x => x.Column.ID == Convert.ToInt32(uiCompositionItem.ObjectIdentity));
                    if (columnControl != null)
                    {
                        columnControl.UIControlPackageTreeItem = item;
                        item.Item   = columnControl.ControlManager;
                        item.UIItem = columnControl.ControlManager.GetUIControl(null);
                        (container as I_View_GridContainer).AddUIControlPackage(columnControl.SimpleControlManager, columnControl.ControlManager.LabelControlManager);
                        parentList.Add(item);
                        columnControl.Visited = true;
                    }
                }
                else if (uiCompositionItem.ObjectCategory == DatabaseObjectCategory.Relationship)
                {
                    var columnControl = RelationshipColumnControls.FirstOrDefault(x => x.Relationship != null && x.Relationship.ID == Convert.ToInt32(uiCompositionItem.ObjectIdentity));
                    if (columnControl != null)
                    {
                        columnControl.UIControlPackageTreeItem = item;
                        if (UICompositions.Count == 1 && parentUIControlPackage != null && parentUIControlPackage.Item is I_TabPageContainer)
                        {
                            (columnControl.ControlManager as I_RelationshipControlManager).TabPageContainer = parentUIControlPackage.Item as I_TabPageContainer;
                        }
                        item.Item   = columnControl.ControlManager;
                        item.UIItem = columnControl.ControlManager.GetUIControl(null);
                        (container as I_View_GridContainer).AddView(columnControl.ControlManager, columnControl.ControlManager.LabelControlManager);
                        parentList.Add(item);
                        columnControl.Visited = true;
                    }
                }
                else if (uiCompositionItem.ObjectCategory == DatabaseObjectCategory.EmptySpace)
                {
                    var setting = uiCompositionItem.EmptySpaceUISetting;
                    if (setting == null)
                    {
                        setting               = new EmptySpaceUISettingDTO();
                        setting.ExpandToEnd   = false;
                        setting.UIColumnsType = Enum_UIColumnsType.Normal;
                    }
                    //var emptyItem = SpecializedDataView.GenerateEmptySpace(setting);
                    //item.Item = emptyItem;
                    (container as I_View_GridContainer).AddEmptySpace(setting);
                    parentList.Add(item);
                }
                //حالت تب اضافه شود
                //uiControlPackageList.Add(item);
                //if (uiCompositionItem.ObjectCategory == DatabaseObjectCategory.Group)
                //{

                //}
            }
        }