controlbanner.ascx.cs
来自「PetShop实现的是一个网上购物的系统功能」· CS 代码 · 共 66 行
CS
66 行
namespace PetShop.Web.Inc {
using System;
using System.Data;
using System.Drawing;
using System.Web;
using System.Web.UI.WebControls;
using System.Web.UI.HtmlControls;
using PetShop.Components;
/// <summary>
/// Hide or show the banner depending on user preference.
/// </summary>
public partial class ControlBanner : System.Web.UI.UserControl {
protected void Page_Load(object sender, System.EventArgs e) {
if (Page.IsPostBack == false)
ShowBanner();
}
/// <summary>
/// Hide or show the banner depending on user preference.
/// </summary>
private void ShowBanner() {
if (Request.IsAuthenticated == true) {
// determine who is logged in
HttpCookie customerCookie = Request.Cookies["CustomerID"];
if ((customerCookie != null) && (customerCookie.Value.Length > 0)) {
bool showBanner;
string bannerPath;
// get banner option info
Profile profile = new Profile();
profile.GetBannerOptions( (string)customerCookie.Value, out showBanner, out bannerPath);
// update banner display
areaBanner.Visible = showBanner;
areaImage.InnerHtml = bannerPath;
}
}
else {
// no one is logged in
areaBanner.Visible = false;
}
}
#region Web Form Designer generated code
private void InitializeComponent() {
}
public ControlBanner() {
this.Init += new System.EventHandler(Page_Init);
}
protected void Page_Init(object sender, EventArgs e) {
InitializeComponent();
}
#endregion
}
}
⌨️ 快捷键说明
复制代码Ctrl + C
搜索代码Ctrl + F
全屏模式F11
增大字号Ctrl + =
减小字号Ctrl + -
显示快捷键?