public Prompt(string name, PromptType type, string label, PromptGroup parent)
        {
            this.Name = name;
            this.Type = type;
            this.Parent = parent;
            this.OrderKey = Parent.Count;

            this.Description = "Description here";
            this.Hint = "Hint here";
            this.Label = "Label here";
            this.DefaultValue = "Default here";
        }
Пример #2
0
        public DbOperationResult<PromptGroup> SavePromptGroup(PromptGroup promptGroup)
        {
            var result = new DbOperationResult<PromptGroup>();

            try
            {
                using (var cee = new CmsEntities())
                {
                    PromptGroup originalObject = (from x in cee.PromptGroups where x.Id == promptGroup.Id select x).FirstOrDefault();

                    if (originalObject == null)
                    {
                        cee.PromptGroups.Add(promptGroup);
                        cee.SaveChanges();
                        result.EntityResult = promptGroup;
                    }
                    else
                    {
                        originalObject.Name = promptGroup.Name;
                        originalObject.Description = promptGroup.Description;
                        originalObject.Ordinal = promptGroup.Ordinal;
                        cee.SaveChanges();
                        result.EntityResult = originalObject;
                    }
                }
            }
            catch (Exception ex)
            {
                return BuildOperationalErrorResults<PromptGroup>(ex);
            }

            return result;
        }
 public static string GetVariableName(PromptGroup promptGroup, string promtName)
 {
     string variable = "";
     if (promptGroup.Repeatable)
     {
         variable = "\r\n<#list " + promptGroup.Name + ".repeats as var>\r\n";
         variable += "${var." + promtName + "}\r\n";
         variable += "</#list>";
     }
     else
     {
         variable = "${" + promptGroup.Name + "." + promtName + "}";
     }
     return variable;
 }