protected void Page_Load(object sender, EventArgs e) { var user = (RollingRides.WebApp.Components.Datalayer.Models.User)Session["User"]; var settings = new SettingsRepository().GetSettings(); if (settings != null) { companyLogo.ImageUrl = settings.CompanyLogoUrl; } var adRepo = new AdvertisementRepository(); var ad1 = adRepo.GetAdvertisement((int)LocationType.Top); var ad2 = adRepo.GetAdvertisement((int)LocationType.SideBar); var ad3 = adRepo.GetAdvertisement((int)LocationType.Footer); if (ad1 != null) { litAd.Text = "<a href='" + ad1.Link + "' > <img src='" + ad1.DisplayObjectUrl + "' /></a>"; } if (ad2 != null) { litSideAd.Text = "<a href='" + ad2.Link + "' > <img src='" + ad2.DisplayObjectUrl + "' /></a>"; } if (ad3 != null) { litAd3.Text = "<a href='" + ad3.Link + "' > <img src='" + ad3.DisplayObjectUrl + "' /></a>"; } if (user == null) { lblUsername.Text = "Hello Guest"; btnSignOut.Visible = false; return; } var name = user.Username; if (!string.IsNullOrEmpty(user.LastName) && !string.IsNullOrEmpty(user.FirstName)) { name = user.FirstName + " " + user.LastName; } lblUsername.Text = "Hello " + name; }
protected void Page_Load(object sender, EventArgs e) { var user = (RollingRides.WebApp.Components.Datalayer.Models.User) Session["User"]; var settings = new SettingsRepository().GetSettings(); if(settings != null) { companyLogo.ImageUrl = settings.CompanyLogoUrl; } var adRepo = new AdvertisementRepository(); var ad1 = adRepo.GetAdvertisement((int)LocationType.Top); var ad2 = adRepo.GetAdvertisement((int)LocationType.SideBar); var ad3 = adRepo.GetAdvertisement((int)LocationType.Footer); if (ad1 != null) { litAd.Text = "<a href='" + ad1.Link + "' > <img src='" + ad1.DisplayObjectUrl + "' /></a>"; } if (ad2 != null) { litSideAd.Text = "<a href='" + ad2.Link + "' > <img src='" + ad2.DisplayObjectUrl + "' /></a>"; } if (ad3 != null) { litAd3.Text = "<a href='" + ad3.Link + "' > <img src='" + ad3.DisplayObjectUrl + "' /></a>"; } if (user == null) { lblUsername.Text = "Hello Guest"; btnSignOut.Visible = false; return; } var name = user.Username; if (!string.IsNullOrEmpty(user.LastName) && !string.IsNullOrEmpty(user.FirstName)) name = user.FirstName + " " + user.LastName; lblUsername.Text = "Hello "+ name; }