Ejemplo n.º 1
0
        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;
                }
            }
        }
Ejemplo n.º 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;
            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()),
                    Title     = field["title"]?.ToString(),
                    Priority  = field["priority"] != null ? field["priority"].Value <int>() : 0,
                    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);
            }

            var getDataResult = BEModuleDataViewModel.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;
            }

            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)
        {
            UrlAlias = InfoUrlAliasViewModel.Repository.GetSingleModel(u => u.Specificulture == Specificulture && u.SourceId == Id.ToString()).Data;
            if (UrlAlias == null)
            {
                UrlAlias = new InfoUrlAliasViewModel()
                {
                    Type           = SWCmsConstants.UrlAliasType.Module,
                    Specificulture = Specificulture,
                    Alias          = Name
                };
            }

            this.View = FETemplateViewModel.GetTemplateByPath(Template, Specificulture, _context, _transaction).Data;

            var getDataResult = ApiModuleDataViewModel.Repository
                                .GetModelListBy(m => m.ModuleId == Id && m.Specificulture == Specificulture
                                                , "Priority", 0, 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;
            }

            var getArticles = NavModuleArticleViewModel.Repository.GetModelListBy(n => n.ModuleId == Id && n.Specificulture == Specificulture
                                                                                  , SWCmsConstants.Default.OrderBy, 0
                                                                                  , 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, 0
                , null, null
                , _context: _context, _transaction: _transaction
                );

            if (getProducts.IsSucceed)
            {
                Products = getProducts.Data;
            }
        }
Ejemplo n.º 5
0
        public override void ExpandView(SiocCmsContext _context = null, IDbContextTransaction _transaction = null)
        {
            UrlAlias = ApiUrlAliasViewModel.Repository.GetSingleModel(u => u.Specificulture == Specificulture && u.SourceId == Id.ToString()).Data;
            if (UrlAlias == null)
            {
                UrlAlias = new ApiUrlAliasViewModel()
                {
                    Specificulture = Specificulture,
                    Alias          = SeoName
                };
            }
            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;
                }
            }
        }
Ejemplo n.º 6
0
        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);
            }
        }
        public override void ExpandView(SiocCmsContext _context = null, IDbContextTransaction _transaction = null)
        {
            this.Image = SWCmsHelper.GetFullPath(new string[] {
                GlobalConfigurationService.Instance.GetLocalString("Domain", Specificulture),
                Image
            });
            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;
                }
            }
        }