Example #1
0
        public static List <SuperFlexiItem> GetModuleItems(Int32 moduleId)
        {
            string content = string.Empty;
            List <SuperFlexiItem> items = new List <SuperFlexiItem>();

            using (IDataReader reader = DBLinks.GetLinks(moduleId))
            {
                while (reader.Read())
                {
                    SuperFlexiItem item = new SuperFlexiItem();

                    item.itemID        = Convert.ToInt32(reader["ItemID"], CultureInfo.InvariantCulture);
                    item.moduleID      = Convert.ToInt32(reader["ModuleID"], CultureInfo.InvariantCulture);
                    item.createdByUser = Convert.ToInt32(reader["CreatedBy"], CultureInfo.InvariantCulture);
                    item.createdDate   = Convert.ToDateTime(reader["CreatedDate"], CultureInfo.CurrentCulture);
                    item.title         = reader["Title"].ToString();
                    item.url           = reader["Url"].ToString();
                    item.viewOrder     = Convert.ToInt32(reader["ViewOrder"]);
                    content            = reader["Description"].ToString();
                    OtherSettings others = ParseOtherSettings(content);
                    if (others != null)
                    {
                        item.content        = others.Content;
                        item.cssClass       = others.CssClass;
                        item.mobileCssClass = others.MobileCssClass;
                        item.featuredImage  = others.FeaturedImage;
                    }
                    else
                    {
                        try
                        {
                            item.contentItems = JsonConvert.DeserializeObject <List <ContentItem> >(content);
                        }
                        catch (JsonSerializationException ex)
                        {
                            item.content = content;
                        }
                    }
                    item.target = reader["Target"].ToString();

                    //string test = reader["ItemGuid"].ToString();

                    item.itemGuid   = new Guid(reader["ItemGuid"].ToString());
                    item.moduleGuid = new Guid(reader["ModuleGuid"].ToString());
                    string user = reader["UserGuid"].ToString();
                    if (user.Length == 36)
                    {
                        item.userGuid = new Guid(user);
                    }
                    items.Add(item);
                }
            }
            return(items);
        }
Example #2
0
 public static IDataReader GetLinks(Int32 moduleId)
 {
     return(DBLinks.GetLinks(moduleId));
 }