public override void ExpandView(SiocCmsContext _context = null, IDbContextTransaction _transaction = null)
        {
            this.View = FETemplateViewModel.GetTemplateByPath(Template, Specificulture, _context, _transaction).Data;
            if (View != null)
            {
                switch (Type)
                {
                case CateType.Home:
                    GetSubModules(_context, _transaction);
                    break;

                case CateType.Blank:
                    break;

                case CateType.Article:
                    break;

                case CateType.Modules:
                    GetSubModules(_context, _transaction);
                    break;

                case CateType.List:
                    GetSubArticles(_context, _transaction);
                    break;

                case CateType.ListProduct:
                    GetSubProducts(_context, _transaction);
                    break;

                default:
                    break;
                }
            }
        }
示例#2
0
        public override void ExpandView(SiocCmsContext _context = null, IDbContextTransaction _transaction = null)
        {
            this.View = FETemplateViewModel.GetTemplateByPath(Template, Specificulture, _context, _transaction).Data;
            //Columns = new List<ModuleFieldViewModel>();
            //JArray arrField = !string.IsNullOrEmpty(Fields) ? JArray.Parse(Fields) : new JArray();
            //foreach (var field in arrField)
            //{
            //    ModuleFieldViewModel thisField = new ModuleFieldViewModel()
            //    {
            //        Name = CommonHelper.ParseJsonPropertyName(field["Name"].ToString()),
            //        DataType = (SWCmsConstants.DataType)(int)field["DataType"],
            //        Width = field["Width"] != null ? field["Width"].Value<int>() : 3,
            //        IsDisplay = field["IsDisplay"] != null ? field["IsDisplay"].Value<bool>() : true
            //    };
            //    Columns.Add(thisField);
            //}

            //this.Templates = Templates ?? TemplateRepository.Instance.GetTemplates(SWCmsConstants.TemplateFolder.Modules);

            var getDataResult = InfoModuleDataViewModel.Repository
                                .GetModelListBy(m => m.ModuleId == Id && m.Specificulture == Specificulture
                                                , "Priority", OrderByDirection.Ascending, null, null
                                                , _context, _transaction);

            if (getDataResult.IsSucceed)
            {
                getDataResult.Data.JsonItems = new List <JObject>();
                getDataResult.Data.Items.ForEach(d => getDataResult.Data.JsonItems.Add(d.JItem));
                Data = getDataResult.Data;
            }

            //LoadData(ArticleId, CategoryId, _context: _context, _transaction: _transaction);

            var getArticles = NavModuleArticleViewModel.Repository.GetModelListBy(n => n.ModuleId == Id && n.Specificulture == Specificulture
                                                                                  , SWCmsConstants.Default.OrderBy, OrderByDirection.Ascending
                                                                                  , 4, 0
                                                                                  , _context: _context, _transaction: _transaction
                                                                                  );

            if (getArticles.IsSucceed)
            {
                Articles = getArticles.Data;
            }

            var getProducts = NavModuleProductViewModel.Repository.GetModelListBy(
                m => m.ModuleId == Id && m.Specificulture == Specificulture
                , SWCmsConstants.Default.OrderBy, OrderByDirection.Ascending
                , null, null
                , _context: _context, _transaction: _transaction
                );

            if (getProducts.IsSucceed)
            {
                Products = getProducts.Data;
            }
        }
        public override void ExpandView(SiocCmsContext _context = null, IDbContextTransaction _transaction = null)
        {
            this.View  = FETemplateViewModel.GetTemplateByPath(Template, Specificulture, _context, _transaction).Data;
            Properties = new List <ExtraProperty>();
            if (!string.IsNullOrEmpty(ExtraProperties))
            {
                JArray arr = JArray.Parse(ExtraProperties);
                foreach (JObject item in arr)
                {
                    Properties.Add(item.ToObject <ExtraProperty>());
                }
            }

            var getModulesResult = FEArticleModuleViewModel.Repository.GetModelListBy(
                m => m.ArticleId == Id && m.Specificulture == Specificulture
                , _context, _transaction);

            if (getModulesResult.IsSucceed)
            {
                this.Modules = new List <FEModuleViewModel>();
                foreach (var item in getModulesResult.Data)
                {
                    var getModules = FEModuleViewModel.Repository.GetSingleModel(
                        m => m.Id == item.ModuleId && m.Specificulture == item.Specificulture
                        , _context, _transaction);
                    if (getModules.IsSucceed)
                    {
                        this.Modules.Add(getModules.Data);
                    }
                }
            }

            var getArticleMedia = NavArticleMediaViewModel.Repository.GetModelListBy(n => n.ArticleId == Id && n.Specificulture == Specificulture, _context, _transaction);

            if (getArticleMedia.IsSucceed)
            {
                MediaNavs = getArticleMedia.Data.OrderBy(p => p.Priority).ToList();
                MediaNavs.ForEach(n => n.IsActived = true);
            }
        }