Пример #1
0
        public override void ExpandView(MixCmsContext _context = null, IDbContextTransaction _transaction = null)
        {
            Cultures = LoadCultures(Specificulture, _context, _transaction);

            StrNormalPrice = MixCmsHelper.FormatPrice(NormalPrice);
            StrDealPrice   = MixCmsHelper.FormatPrice(DealPrice);
            StrImportPrice = MixCmsHelper.FormatPrice(ImportPrice);

            if (!string.IsNullOrEmpty(this.Tags))
            {
                ListTag = JArray.Parse(this.Tags);
            }
            Properties = new List <ExtraProperty>();
            if (!string.IsNullOrEmpty(ExtraProperties))
            {
                JArray arr = JArray.Parse(ExtraProperties);
                foreach (JToken item in arr)
                {
                    Properties.Add(item.ToObject <ExtraProperty>());
                }
            }

            //Get Templates
            this.Templates = this.Templates ?? MixTemplates.UpdateViewModel.Repository.GetModelListBy(
                t => t.Theme.Name == ActivedTheme && t.FolderType == this.TemplateFolderType).Data;
            View = MixTemplates.UpdateViewModel.GetTemplateByPath(Template, Specificulture, MixEnums.EnumTemplateFolder.Products, _context, _transaction);

            this.View = View ?? Templates.FirstOrDefault();

            if (this.View == null)
            {
                this.View = MixTemplates.UpdateViewModel.GetDefault(MixEnums.EnumTemplateFolder.Products, Specificulture);
            }

            this.Template = CommonHelper.GetFullPath(new string[]
            {
                this.View?.FileFolder
                , this.View?.FileName
            });

            var getProductMedia = MixProductMedias.ReadViewModel.Repository.GetModelListBy(n => n.ProductId == Id && n.Specificulture == Specificulture, _context, _transaction);

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

            ProductNavs = GetRelated(_context, _transaction);
        }
Пример #2
0
 public static string ToMoney(this double value)
 {
     return(MixCmsHelper.FormatPrice(value));
 }