Exemple #1
0
        private void GetLink(Int32 itemId)
        {
            using (IDataReader reader = DBLinks.GetLink(itemId))
            {
                if (reader.Read())
                {
                    this.itemID        = Convert.ToInt32(reader["ItemID"], CultureInfo.InvariantCulture);
                    this.moduleID      = Convert.ToInt32(reader["ModuleID"], CultureInfo.InvariantCulture);
                    this.createdByUser = Convert.ToInt32(reader["CreatedBy"], CultureInfo.InvariantCulture);
                    this.createdDate   = Convert.ToDateTime(reader["CreatedDate"], CultureInfo.CurrentCulture);
                    this.title         = reader["Title"].ToString();
                    this.url           = reader["Url"].ToString();
                    this.viewOrder     = Convert.ToInt32(reader["ViewOrder"]);
                    this.description   = reader["Description"].ToString();
                    this.target        = reader["Target"].ToString();

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

                    this.itemGuid   = new Guid(reader["ItemGuid"].ToString());
                    this.moduleGuid = new Guid(reader["ModuleGuid"].ToString());
                    string user = reader["UserGuid"].ToString();
                    if (user.Length == 36)
                    {
                        this.userGuid = new Guid(user);
                    }
                }
            }
        }
Exemple #2
0
        private void GetItem(Int32 itemId)
        {
            string content = string.Empty;

            using (IDataReader reader = DBLinks.GetLink(itemId))
            {
                if (reader.Read())
                {
                    this.itemID        = Convert.ToInt32(reader["ItemID"], CultureInfo.InvariantCulture);
                    this.moduleID      = Convert.ToInt32(reader["ModuleID"], CultureInfo.InvariantCulture);
                    this.createdByUser = Convert.ToInt32(reader["CreatedBy"], CultureInfo.InvariantCulture);
                    this.createdDate   = Convert.ToDateTime(reader["CreatedDate"], CultureInfo.CurrentCulture);
                    this.title         = reader["Title"].ToString();
                    this.url           = reader["Url"].ToString();
                    this.viewOrder     = Convert.ToInt32(reader["ViewOrder"]);

                    content     = reader["Description"].ToString();
                    this.target = reader["Target"].ToString();

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

                    this.itemGuid   = new Guid(reader["ItemGuid"].ToString());
                    this.moduleGuid = new Guid(reader["ModuleGuid"].ToString());
                    string user = reader["UserGuid"].ToString();
                    if (user.Length == 36)
                    {
                        this.userGuid = new Guid(user);
                    }
                }
            }
            OtherSettings others = ParseOtherSettings(content);

            if (others != null)
            {
                this.content        = others.Content;
                this.cssClass       = others.CssClass;
                this.mobileCssClass = others.MobileCssClass;
                this.featuredImage  = others.FeaturedImage;
            }
            else
            {
                try
                {
                    this.contentItems = JsonConvert.DeserializeObject <List <ContentItem> >(content);
                }
                catch (JsonSerializationException ex)
                {
                    this.content = content;
                }
            }
        }