protected void Page_Load(object sender, EventArgs e) { if (!IsPostBack) { DDL_SiteList.DataSource = adsSiteDal.SelectAllSite(); DDL_SiteList.DataValueField = "SiteId"; DDL_SiteList.DataTextField = "SiteName"; DDL_SiteList.DataBind(); DDL_SiteList.Items.Insert(0, new ListItem("所有", Guid.Empty.ToString())); //显示网站名称和地址 if (!string.IsNullOrEmpty(Request.QueryString["siteid"])) { try { DDL_SiteList.SelectedValue = Request.QueryString["siteid"]; IList <SiteAdsInfo> list = new SiteAdsService().SelectSiteAdsById(new Guid(DDL_SiteList.SelectedValue)); RPT_AdsList.DataSource = list; RPT_AdsList.DataBind(); } catch (Exception ex) { } } DDL_AdsList.DataSource = CacheCollection.GetAllAdsInfo(); DDL_AdsList.DataValueField = "AdsId"; DDL_AdsList.DataTextField = "AdsName"; DDL_AdsList.DataBind(); } }
protected void Page_Load(object sender, EventArgs e) { if (!IsPostBack) { DDL_SiteList.DataSource = adsSiteDal.SelectAllSite(); DDL_SiteList.DataValueField = "SiteUrl"; DDL_SiteList.DataTextField = "SiteName"; DDL_SiteList.DataBind(); DDL_SiteList.Items.Insert(0, new ListItem("所有", Guid.Empty.ToString())); //显示网站名称和地址 if (!string.IsNullOrEmpty(Request.QueryString["url"])) { try { IList <SiteAdsInfo> list = siteAdsDal.SelectAllSiteAds(Request.QueryString["url"]); RPT_AdsList.DataSource = list; RPT_AdsList.DataBind(); DDL_SiteList.SelectedValue = Request.QueryString["url"]; } catch (Exception ex) { } } } }
/// <summary> /// 所有网站信息缓存(12小时更新一次) /// </summary> /// <returns></returns> public static IList <SiteInfo> GetAllSiteList() { return(new CacheUtility <IList <SiteInfo> >().Get(KEY_ALLSITEINFO, delegate() { AdsSiteService adsSiteDal = new AdsSiteService(); return adsSiteDal.SelectAllSite(); }, 60 * 12)); }