/// <summary> /// Initialize template and default data /// </summary> public void Initialize() { if (_templateServices.GetTemplateByName(DefaultTemplate) == null) { var template = new Template { Name = DefaultTemplate, DataType = typeof(BannerCurlyBracket).AssemblyQualifiedName, CurlyBracket = "{Banner}", Content = string.Empty, IsDefaultTemplate = true }; _templateServices.Insert(template); } }
/// <summary> /// Initialize template and default data /// </summary> public void Initialize() { if (_templateServices.GetTemplateByName(DefaultTemplate) == null) { var template = new Template { Name = DefaultTemplate, DataType = typeof(GroupGalleryModel).AssemblyQualifiedName, CurlyBracket = "{RotatingImages}", Content = string.Empty, IsDefaultTemplate = true }; _templateServices.Insert(template); } }
/// <summary> /// Parse params from parameters /// </summary> /// <param name="parameters"></param> private void ParseParams(string[] parameters) { /* * Params: * * Parent Id * * Show Parent * * Parent Template * * Children Template */ ParentTemplateName = DefaultTemplate; ChildTemplateName = DefaultChildTemplate; ChildMobileTemplateName = DefaultChildMobileTemplate; //ParentId if (parameters.Length > 1 && !string.IsNullOrEmpty(parameters[1])) { ParentId = parameters[1].ToNullableInt(); } //ShowParentMenu if (parameters.Length > 2 && !string.IsNullOrEmpty(parameters[2]) && ParentId.HasValue) { ShowParentMenu = parameters[1].ToBool(false); } //ParentTemplateName if (parameters.Length > 3 && !string.IsNullOrEmpty(parameters[3])) { ParentTemplateName = parameters[3]; } //ChildTemplateName if (parameters.Length > 4 && !string.IsNullOrEmpty(parameters[4])) { ChildTemplateName = parameters[4]; } //ChildTemplateName if (parameters.Length > 5 && !string.IsNullOrEmpty(parameters[5])) { ChildMobileTemplateName = parameters[5]; } _parentTemplate = _templateServices.GetTemplateByName(ParentTemplateName); if (_parentTemplate == null) { throw new Exception(string.Format("Template {0} is not founded.", ParentTemplateName)); } _childTemplate = _templateServices.GetTemplateByName(ChildTemplateName); if (_childTemplate == null) { throw new Exception(string.Format("Template {0} is not founded.", ChildTemplateName)); } _childMobileTemplate = _templateServices.GetTemplateByName(ChildMobileTemplateName); if (_childMobileTemplate == null) { throw new Exception(string.Format("Template {0} is not founded.", ChildMobileTemplateName)); } }