//------------------------------------------------------------------- // # Topic Infos public void getTopicInfos(ListBox.ObjectCollection TopicList) { foreach (var TopicListItem in TopicList) { topicInfo.Add(TopicListItem.ToString()); } }
private ListResult <TopicListItem> GetTopic(int supplierId) { ListResult <TopicListItem> data = null; DataTable dt = VShopHelper.GetHomeTopics(ClientType.App, supplierId); List <TopicListItem> items = new List <TopicListItem>(); if (dt != null && dt.Rows.Count > 0) { TopicListItem item = null; foreach (DataRow current in dt.Rows) { item = new TopicListItem(); item.TopicId = 0; if (current["TopicId"] != DBNull.Value) { item.TopicId = (int)current["TopicId"]; } item.TopicName = ""; if (current["Title"] != DBNull.Value) { item.TopicName = (string)current["Title"]; } item.Icon = ""; if (current["IconUrl"] != DBNull.Value) { item.Icon = Util.AppendImageHost(((string)current["IconUrl"])); } item.Content = ""; if (current["Content"] != DBNull.Value) { var regex = new Regex(@"""/Storage/master"); item.Content = regex.Replace((string)current["Content"], "\"" + base.STORAGE_HOST + @"/Storage/master"); } item.DisplaySequence = 0; if (current["DisplaySequence"] != DBNull.Value) { item.DisplaySequence = (int)current["DisplaySequence"]; } item.SupplierId = supplierId; items.Add(item); } } data = new ListResult <TopicListItem>(); data.TotalNumOfRecords = items.Count; data.Results = items; return(data); }
private ListResult <TopicListItem> GetTopic(int siteId, int pageIndex, int pageSize) { ListResult <TopicListItem> data = null; if (base.IsUseCache) { data = MemoryCacher.GetValue("SITE-TOPIC") as ListResult <TopicListItem>; if (data != null) { return(data); } } DataTable dt = VshopBrowser.GetTopics(ClientType.App); List <TopicListItem> items = new List <TopicListItem>(); if (dt != null) { TopicListItem item = null; foreach (DataRow current in dt.Rows) { item = new TopicListItem(); item.TopicId = 0; if (current["TopicId"] != DBNull.Value) { item.TopicId = (int)current["TopicId"]; } item.TopicName = ""; if (current["Title"] != DBNull.Value) { item.TopicName = (string)current["Title"]; } item.Icon = ""; if (current["IconUrl"] != DBNull.Value) { item.Icon = Util.AppendImageHost(((string)current["IconUrl"])); } item.Content = ""; if (current["Content"] != DBNull.Value) { var regex = new Regex(@"""/Storage/master"); item.Content = regex.Replace((string)current["Content"], "\"" + base.STORAGE_HOST + @"/Storage/master"); } item.DisplaySequence = 0; if (current["DisplaySequence"] != DBNull.Value) { item.DisplaySequence = (int)current["DisplaySequence"]; } items.Add(item); } } data = new ListResult <TopicListItem>(); data.TotalNumOfRecords = items.Count; data.Results = items; if (base.IsUseCache) { MemoryCacher.Add("SITE-TOPIC", data, DateTimeOffset.UtcNow.AddMinutes(SITE_CACHE_KEEP_TIME)); } return(data); }