Beispiel #1
0
        public static int GetHighestSortRank(int moduleId)
        {
            List <SuperFlexiItem> items    = SuperFlexiItem.GetModuleItems(moduleId);
            SuperFlexiItem        lastItem = items[items.Count - 1];

            return(lastItem.ViewOrder);
        }
Beispiel #2
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);
        }