private ReferenceData CreateReferenceOfService(string serviceName, int?categoryId, object locationId)
        {
            ReferenceData serviceData = new ReferenceData();

            serviceData.Name        = serviceName;
            serviceData.Slug        = serviceName.ToSlug();
            serviceData.Title       = serviceName + " Title";
            serviceData.TemplateId  = CmsRegister.SERVICE_TEMPLATE_ID;
            serviceData.IsPublished = true;
            serviceData.IsMaster    = false;
            serviceData.EnableAds   = true;
            serviceData.EnableTopAd = true;
            serviceData.Description = serviceName + " Description";
            serviceData.LocationId  = locationId;

            if (categoryId != null)
            {
                serviceData.ReferenceCategorys.Add(new ReferenceCategoryData {
                    CategoryId = categoryId
                });
            }

            SubitemValueData value1 = new SubitemValueData();

            serviceData.Values.Add(value1);
            value1.SubitemId = BlockRegister.SubjectDetailBlock.Title;
            value1.ValueText = serviceName + " Title";
            SubitemValueData value2 = new SubitemValueData();

            serviceData.Values.Add(value2);
            value2.SubitemId = BlockRegister.SubjectDetailBlock.Description;
            value2.ValueHtml = string.Format("<p>{0} content</p>", serviceName);

            return(serviceData);
        }
        private ReferenceData CreateReferenceOfEvent(string eventName, int locationId)
        {
            ReferenceData eventData = new ReferenceData();

            eventData.Name        = eventName;
            eventData.Slug        = eventName.ToSlug();
            eventData.Title       = eventName + " Title";
            eventData.TemplateId  = CmsRegister.EVENT_TEMPLATE_ID;
            eventData.IsPublished = true;
            eventData.IsMaster    = false;
            eventData.EnableAds   = true;
            eventData.EnableTopAd = true;
            eventData.Description = eventName + " Description";
            eventData.LocationId  = locationId;

            SubitemValueData value1 = new SubitemValueData();

            eventData.Values.Add(value1);
            value1.SubitemId = BlockRegister.SubjectDetailBlock.Title;
            value1.ValueText = eventName + " Title";
            SubitemValueData value2 = new SubitemValueData();

            eventData.Values.Add(value2);
            value2.SubitemId = BlockRegister.SubjectDetailBlock.Image;
            value2.ValueUrl  = "http://placehold.it/500x300";
            SubitemValueData value3 = new SubitemValueData();

            eventData.Values.Add(value3);
            value3.SubitemId = BlockRegister.SubjectDetailBlock.Description;
            value3.ValueHtml = string.Format("<p>{0} description and content</p>", eventName);

            return(eventData);
        }
        public static SubitemValueData ConvertToData(DucValueDto entity)
        {
            SubitemValueData dto = new SubitemValueData();

            dto.Id        = entity.Id;
            dto.SubitemId = entity.DucId;
            dto.ValueText = entity.ValueText;
            dto.ValueHtml = entity.ValueHtml;
            dto.ValueInt  = entity.ValueInt;
            dto.ValueDate = entity.ValueDate;
            dto.ValueUrl  = entity.ValueUrl;

            return(dto);
        }
Beispiel #4
0
        private IList <SubitemValueData> GetSubitemValues()
        {
            // Subitem values
            IList <SubitemValueData> values = new List <SubitemValueData>();
            // name
            SubitemValueData name = new SubitemValueData();

            values.Add(name);
            name.SubitemId = BlockRegister.RecipeBlock.Name;
            name.ValueText = "RecipeInstance.Name";
            // prepare time
            SubitemValueData prepareTime = new SubitemValueData();

            values.Add(prepareTime);
            prepareTime.SubitemId = BlockRegister.RecipeBlock.PrepareTime;
            prepareTime.ValueInt  = 15;
            // cook time
            SubitemValueData cookTime = new SubitemValueData();

            values.Add(cookTime);
            cookTime.SubitemId = BlockRegister.RecipeBlock.CookTime;
            cookTime.ValueInt  = 15;
            // servings
            SubitemValueData servings = new SubitemValueData();

            values.Add(servings);
            servings.SubitemId = BlockRegister.RecipeBlock.Servings;
            servings.ValueInt  = 2;
            // description
            SubitemValueData description = new SubitemValueData();

            values.Add(description);
            description.SubitemId = BlockRegister.RecipeBlock.Abstract;
            description.ValueHtml = "RecipeInstance.Abstract";
            // image
            SubitemValueData image = new SubitemValueData();

            values.Add(image);
            image.SubitemId = BlockRegister.RecipeBlock.Image;
            image.ValueUrl  = "/test/test.jpg";

            return(values);
        }
        private ReferenceData CreateReferenceOfEventLanding(string eventLandingName, string slug)
        {
            ReferenceData eventLanding = new ReferenceData();

            eventLanding.Name = eventLandingName;
            eventLanding.Slug = slug;
            //eventLanding.Title = "Event list";
            eventLanding.TemplateId  = CmsRegister.SUBJECTLIST_TEMPLATE_ID;
            eventLanding.IsPublished = true;
            eventLanding.EnableAds   = true;
            eventLanding.EnableTopAd = true;
            eventLanding.Description = eventLandingName;
            eventLanding.IsMaster    = false;

            SubitemValueData value1 = new SubitemValueData();

            eventLanding.Values.Add(value1);
            value1.SubitemId = BlockRegister.ListViewWidget.ReferenceList;
            value1.ValueInt  = CmsRegister.EVENT_TEMPLATE_ID;

            return(eventLanding);
        }
        private ReferenceData CreateReferenceOfServiceLanding(string servieLandingName, string slug)
        {
            ReferenceData serviceLanding = new ReferenceData();

            serviceLanding.Name = servieLandingName;
            serviceLanding.Slug = slug;
            //serviceLanding.Title = "Service list";
            serviceLanding.TemplateId  = CmsRegister.SUBJECTLIST_TEMPLATE_ID;
            serviceLanding.IsPublished = true;
            serviceLanding.EnableAds   = true;
            serviceLanding.EnableTopAd = true;
            serviceLanding.Description = servieLandingName;
            serviceLanding.IsMaster    = false;

            SubitemValueData value1 = new SubitemValueData();

            serviceLanding.Values.Add(value1);
            value1.SubitemId = BlockRegister.ListViewWidget.ReferenceList;
            value1.ValueInt  = CmsRegister.SERVICE_TEMPLATE_ID;

            return(serviceLanding);
        }
        private ReferenceData CreateReferenceOfSupplier(string supplierName, int categoryId, int locationId, bool allowDefaultImage = false)
        {
            ReferenceData supplier = new ReferenceData();

            supplier.Name        = supplierName;
            supplier.Slug        = "";
            supplier.Title       = supplierName;
            supplier.TemplateId  = CmsRegister.SUPPLIER_TEMPLATE_ID;
            supplier.IsPublished = true;
            supplier.EnableAds   = true;
            supplier.EnableTopAd = true;
            supplier.Description = supplierName + " home page";
            supplier.IsMaster    = true;
            supplier.LocationId  = locationId;

            supplier.ReferenceCategorys.Add(new ReferenceCategoryData {
                CategoryId = categoryId
            });

            SubitemValueData value1 = new SubitemValueData();

            supplier.Values.Add(value1);
            value1.SubitemId = BlockRegister.SubjectDetailBlock.Title;
            value1.ValueText = supplierName + " Title";
            if (allowDefaultImage)
            {
                SubitemValueData value2 = new SubitemValueData();
                supplier.Values.Add(value2);
                value2.SubitemId = BlockRegister.SubjectDetailBlock.Image;
                value2.ValueUrl  = "http://placehold.it/500x300";
            }
            SubitemValueData value3 = new SubitemValueData();

            supplier.Values.Add(value3);
            value3.SubitemId = BlockRegister.SubjectDetailBlock.Description;
            value3.ValueHtml = string.Format("<p>{0} home page content</p>", supplierName);

            return(supplier);
        }