コード例 #1
0
        private LayoutModel ProcessStaticLayout(string ID, LayoutModel layout)
        {
            var itemCtrl = _menu.GetControl.SingleOrDefault(o => o.Code.ToLower() == layout.TypeView.ToLower());

            if (itemCtrl == null)
            {
                itemCtrl = new CModule()
                {
                    Code       = "Static",
                    FullName   = "",
                    Name       = "No Exist",
                    Properties = null
                };
            }
            var properties = itemCtrl.Properties;

            layout.LayoutName += "(" + itemCtrl.Name + ")";
            layout.CModule     = itemCtrl.FullName;
            var detailsTemplate             = _templateDetailsService.GetItemStaticByID(ID, layout.PartialID);
            List <ProperyCModule> properyCs = new List <ProperyCModule>();

            if (detailsTemplate != null)
            {
                layout.TypeView    = detailsTemplate.TypeView;
                layout.PartialView = detailsTemplate.PartialView;
                var property = _propertyService.Find(true, o => o.TemplateDetailID == detailsTemplate.ID)?.ToList();

                if (property != null && properties != null)
                {
                    string _continue = "";
                    for (int x = 0; x < properties.Count; x++)
                    {
                        var            itemPro  = properties[x];
                        ProperyCModule properyC = new ProperyCModule()
                        {
                            Key   = itemPro.Key,
                            Name  = itemPro.Name,
                            Type  = itemPro.Type,
                            Value = itemPro.Value
                        };
                        foreach (var itemzPRo in property)
                        {
                            if (_continue != "" && _continue == itemzPRo.Name)
                            {
                                continue;
                            }
                            if (itemPro.Key == itemzPRo.Name)
                            {
                                properyC.Value = itemzPRo.Value;
                                _continue      = itemzPRo.Name;
                                break;
                            }
                        }
                        properyCs.Add(properyC);
                    }
                    layout.Properties = properyCs;
                }
                else
                {
                    layout.Properties = properties;
                }
            }
            else
            {
                layout.Properties = properties;
            }
            return(layout);
        }
コード例 #2
0
        private LayoutModel ProccessDynamicLayout(SysTemplateDetailEntity dItem)
        {
            LayoutModel dLI = new LayoutModel
            {
                LayoutName    = dItem.LayoutName,
                CModule       = dItem.CModule,
                PartialID     = dItem.PartialID,
                ParrentLayout = dItem.ParentID,
                IsDynamic     = true,
                IsBody        = dItem.IsBody,
                PartialView   = dItem.PartialView,
                TypeView      = dItem.TypeView,
                Order         = dItem.Order
            };

            if (!dItem.IsBody)
            {
                var itemCtrl = _menu.GetControl.SingleOrDefault(o => o.FullName.ToLower() == dItem.CModule.ToLower());
                if (itemCtrl == null)
                {
                    itemCtrl = new CModule()
                    {
                        Code       = "Static",
                        FullName   = "",
                        Name       = "No Exist",
                        Properties = null
                    };
                }
                var properties = itemCtrl.Properties;
                var property   = _propertyService.Find(true, o => o.TemplateDetailID == dItem.ID)?.ToList();
                if (property != null && properties != null)
                {
                    List <ProperyCModule> properyCs = new List <ProperyCModule>();
                    string _continue = "";
                    for (int z = 0; z < properties.Count; z++)
                    {
                        var            itemPro  = properties[z];
                        ProperyCModule properyC = new ProperyCModule()
                        {
                            Key   = itemPro.Key,
                            Name  = itemPro.Name,
                            Type  = itemPro.Type,
                            Value = itemPro.Value
                        };
                        foreach (var itemzPRo in property)
                        {
                            if (_continue != "" && _continue == itemzPRo.Name)
                            {
                                continue;
                            }
                            if (itemPro.Key == itemzPRo.Name)
                            {
                                properyC.Value = itemzPRo.Value;
                                _continue      = itemzPRo.Name;
                                break;
                            }
                        }
                        properyCs.Add(properyC);
                    }
                    dLI.Properties = properyCs;
                }
            }
            return(dLI);
        }