Ejemplo n.º 1
0
 public static bool ExistValue(this HtmlHelper helper, ContentBindingList Model, string Value)
 {
     var _Item = Model.Items.Where(m => m.ContentPropertyAlias.Equals(Value)).SingleOrDefault();
     if (_Item != null && _Item.ContentCultures.ToList()[0].ContentPropertyValue != null)
     {
         return !string.IsNullOrEmpty(_Item.ContentCultures.ToList()[0].ContentPropertyValue);
     }
     return false;
 }
Ejemplo n.º 2
0
 public static ICollection<ContentBindingList> FindItems(this HtmlHelper helper, ContentBindingList Model, string Value, bool AllowNull)
 {
     try
     {
         return Model.Items.Where(m => m.ContentPropertyAlias.Equals(Value)).SingleOrDefault().Items;
     }
     catch (NullReferenceException e)
     {
         if (AllowNull) return new List<ContentBindingList>();
         throw new NullReferenceException("List=" + Value + " in " + Model.ContentPropertyAlias + " is NULL", e.InnerException);
     }
 }
Ejemplo n.º 3
0
 public static MvcHtmlString FindValue(ContentBindingList Model, string Value, bool AllowNull)
 {
     try
     {
         var _Item = Model.Items.Where(m => m.ContentPropertyAlias.Equals(Value)).SingleOrDefault();
         return new MvcHtmlString(_Item.ContentCultures.ToList()[0].ContentPropertyValue);
     }
     catch (ArgumentNullException e)
     {
         if (AllowNull) return new MvcHtmlString(string.Empty);
         throw new ArgumentNullException("Value=" + Value + " in " + Model.ContentPropertyAlias + " is NULL", e.InnerException);
     }
     catch (NullReferenceException e)
     {
         if (AllowNull) return new MvcHtmlString(string.Empty);
         throw new NullReferenceException("Value=" + Value + " in " + Model.ContentPropertyAlias + " is NULL", e.InnerException);
     }
     catch (ArgumentOutOfRangeException e)
     {
         if (AllowNull) return new MvcHtmlString(string.Empty);
         throw new ArgumentOutOfRangeException("Value=" + Value + " in " + Model.ContentPropertyAlias + " is NULL", e.InnerException);
     }
 }
Ejemplo n.º 4
0
        public int Save(ContentBindingList Model)
        {
            using (var _c = db)
            {
                var _CP = new ContentProperty
                {
                    ContentPropertyParentID = Model.ContentPropertyParentID,
                    SiteID = Model.SiteID,
                    ContentPropertyType = Model.ContentPropertyType,
                    ContentPropertyAlias = Model.ContentPropertyAlias,
                    Priority = Model.Priority,
                    Lock = Model.Lock,
                    ShowInContent = Model.ShowInContent,
                    Enabled = true
                };
                _c.ContentProperties.Add(_CP);
                _c.SaveChanges();
                //SAVE ROOT
                AddRoot(_CP.ContentPropertyID, _CP.ContentPropertyParentID);

                var _NumCultureSite = _c.Cultures.Where(m => m.SiteID == Model.SiteID).Count();
                if (_NumCultureSite < Model.ContentCultures.Count())
                    throw new RuleException(ContentRuleExceptionCode.MORECULTURES.ToString(), "Content Alias:" + Model.ContentPropertyAlias + " with " + Model.ContentCultures.Count() + " and Site have " + _NumCultureSite + " Cultures");
                foreach (var item in Model.ContentCultures)
                {
                    item.ContentPropertyID = _CP.ContentPropertyID;
                    SaveCulture(item, Model.SiteID);
                }
                return _CP.ContentPropertyID;
            }
        }
Ejemplo n.º 5
0
 public static ICollection<ContentBindingList> FindItems(this HtmlHelper helper, ContentBindingList Model, string Value)
 {
     return FindItems(helper, Model, Value,false);
 }
Ejemplo n.º 6
0
 public static ContentBindingList Find(this HtmlHelper helper, ContentBindingList Model, string Value)
 {
     return Model.Items.Where(m => m.ContentPropertyAlias.Equals(Value)).SingleOrDefault();
 }
Ejemplo n.º 7
0
        public static MvcHtmlString GetValue(this HtmlHelper helper, ContentBindingList Model)
        {
            return new MvcHtmlString(Model.ContentCultures.ToList()[0].ContentPropertyValue);

        }
Ejemplo n.º 8
0
 public static MvcHtmlString FindValue(this HtmlHelper helper, ContentBindingList Model, string Value)
 {
     return FindValue(helper, Model, Value, false);
 }
Ejemplo n.º 9
0
 public static MvcHtmlString FindValue(this HtmlHelper helper, ContentBindingList Model, string Value, bool AllowNull)
 {
     return FindValue(Model, Value, AllowNull);
 }