Ejemplo n.º 1
0
        public AdminStoreItem(ProductStoreDataModel dbModel, AdminStoreData parendData)
        {
            Id         = dbModel.Id;
            DateCreate = dbModel.Date.ToString("s");
            NativeName = dbModel.Property.TranslateText.En.Name;
            Active     = !dbModel.Trash;
            Properties = dbModel.Property.Property;

            ProductTypeIds tType;

            Enum.TryParse(dbModel.ProductTypeId.ToString(), out tType);

            ProductType = new NameIdInt((int)tType, tType.ToString());

            ImagePath = dbModel.Property.ImgCollectionImg.Store;
            L10N      = dbModel.Property.TranslateText;
            Currency  = parendData.CurrencyList[tType == ProductTypeIds.Cc ? 0 : 1];
            Price     = (double)dbModel.Cost;

            Duration = parendData.DurationList[0];
            if (tType == ProductTypeIds.Premium)
            {
                var premProps = ProductPropertyHelper.GetPremiumProperties(Properties);
                Duration = _getDaysFromSecond(premProps.Duration, parendData.DurationList);
            }
            else if (tType == ProductTypeIds.Booster)
            {
                var props = ProductPropertyHelper.GetBooserProperty(Properties);
                Duration = _getDaysFromSecond(props.Duration, parendData.DurationList);
            }
        }