protected void Page_Load(object sender, EventArgs e) { if(!IsPostBack) { var banner = new Logic.Banner(); string programId = Session["ProgramId"] != null ? Session["ProgramId"].ToString() : null; Tuple<string,string> bannerPaths = banner.GetBannerPath(programId, Server); pgmBanner.Visible = true; pgmBanner.Src = bannerPaths.Item1; if(!string.IsNullOrEmpty(bannerPaths.Item2)) { pgmBanner.Attributes.Add("srcset", string.Format("{0} 1x, {1} 2x", VirtualPathUtility.ToAbsolute(bannerPaths.Item1), VirtualPathUtility.ToAbsolute(bannerPaths.Item2))); } } }
protected void Page_Load(object sender, EventArgs e) { if (!IsPostBack) { var banner = new Logic.Banner(); string programId = Session["ProgramId"] != null ? Session["ProgramId"].ToString() : null; Tuple <string, string> bannerPaths = banner.GetBannerPath(programId, Server); pgmBanner.Visible = true; pgmBanner.Src = bannerPaths.Item1; if (!string.IsNullOrEmpty(bannerPaths.Item2)) { pgmBanner.Attributes.Add("srcset", string.Format("{0} 1x, {1} 2x", VirtualPathUtility.ToAbsolute(bannerPaths.Item1), VirtualPathUtility.ToAbsolute(bannerPaths.Item2))); } } }
protected void Page_Load(object sender, EventArgs e) { if (!Page.IsPostBack) { var crLoginHtml = DAL.SRPSettings.GetSettingValue("CRLoginHtml"); if (!string.IsNullOrEmpty(crLoginHtml)) { CRLoginHtml.Text = crLoginHtml; CRLoginHtml.Visible = true; } else { CRLoginHtml.Visible = false; } var defaultRibbon = StandardModuleRibbons.DefaultRibbon(); if (defaultRibbon.Count > 0) { SetPageRibbon(defaultRibbon); } } if (CRTenantID != null) { var result = new TenantStatus((int)CRTenantID).CurrentStatus(); RegisteredPatrons.Text = result.RegisteredPatrons.ToString("N0"); PointsEarned.Text = result.PointsEarned.ToString("N0"); PointsEarnedReading.Text = result.PointsEarnedReading.ToString("N0"); ChallengesCompleted.Text = result.ChallengesCompleted.ToString("N0"); AdventuresCompleted.Text = result.AdventuresCompleted.ToString("N0"); BadgesAwarded.Text = result.BadgesAwarded.ToString("N0"); SecretCodesRedeemed.Text = result.SecretCodesRedeemed.ToString("N0"); ProgramCodesRedeemed.Text = result.RedeemedProgramCodes.ToString("N0"); if (DAL.ProgramCodes.GetCountByTenantId((int)CRTenantID) > 0) { ProgramCodesDiv.Visible = true; var redeemed = result.SecretCodesRedeemed.ToString(); string codeName = StringResources.getString("myaccount-program-reward-code"); if (!codeName.EndsWith("s")) { codeName += "s"; } ProgramRewardCodeLabel.Text = codeName; } else { ProgramCodesDiv.Visible = false; } MasterPage.PageTitle = "At-a-glance Program Status - Items Earned by Patrons"; var tenant = GRA.SRP.Core.Utilities.Tenant.FetchObject((int)CRTenantID); OrganizationName.Text = tenant.LandingName; var bannerPath = new Logic.Banner().GetBannerPath( DAL.Programs.GetDefaultProgramID().ToString(), Server); ProgramImage.ImageUrl = bannerPath.Item1; ProgramImage.CssClass = new WebTools().CssEnsureClass("img-rounded", ProgramImage.CssClass); StatusPanel.Visible = true; } else { MasterPage.PageTitle = "Control Room"; StatusPanel.Visible = false; } }
protected void Page_Load(object sender, EventArgs e) { AvatarBackLink.NavigateUrl = "~/"; SystemName.Text = SystemNamePrint.Text = StringResources.getString("system-name"); SystemSlogan.Text = SystemSloganPrint.Text = StringResources.getString("slogan"); SystemSlogan.Visible = SystemSloganPrint.Visible = SystemSlogan.Text != "slogan"; string programId = null; AvatarBackLink.Text = StringResources.getString("avatar-return"); if (AvatarBackLink.Text == "avatar-return") { AvatarBackLink.Text = "Back"; } var patron = Session[SessionKey.Patron] as DAL.Patron; if (patron != null) { programId = patron.ProgID.ToString(); MyAvatarPrint.Text = Tools.DisplayHelper.FormatName(patron.FirstName, patron.LastName, patron.Username); } else { MyAvatarPrint.Text = "My Avatar"; } if (string.IsNullOrEmpty(programId)) { var sessionProgId = Session["ProgramId"]; if (sessionProgId != null) { programId = sessionProgId.ToString(); } } if (string.IsNullOrEmpty(programId)) { try { programId = DAL.Programs.GetDefaultProgramID().ToString(); } catch (Exception) { } } string bannerPath = new Logic.Banner().FullMetadataBannerPath( WebTools.GetBaseUrl(Request), programId, Server); if (!string.IsNullOrEmpty(bannerPath)) { BannerImagePrint.ImageUrl = bannerPath; } else { BannerImagePrint.Visible = false; } string avatarPath = null; string avatarMdPath = null; bool validAvatar = false; string avatarId = Request.QueryString["AvatarId"]; if (!string.IsNullOrEmpty(avatarId) && avatarId.Length <= 24) { char[] avatarIdArray = avatarId.ToCharArray(); avatarIdArray = Array.FindAll <char>(avatarIdArray, (c => (char.IsLetterOrDigit(c)))); avatarId = new string(avatarIdArray); avatarPath = string.Format("~/Images/AvatarCache/{0}.png", avatarId); avatarMdPath = string.Format("~/Images/AvatarCache/md_{0}.png", avatarId); if (File.Exists(Server.MapPath(avatarPath))) { validAvatar = true; AvatarImage.ImageUrl = AvatarImagePrint.ImageUrl = avatarPath; AvatarPanel.Visible = true; } } if (!validAvatar) { AvatarPanel.Visible = false; } else { // begin social var wt = new WebTools(); var fbDescription = StringResources.getStringOrNull("facebook-description"); var hashtags = StringResources.getStringOrNull("socialmedia-hashtags"); var title = string.Format("{0} avatar", SystemName.Text); var description = string.Format("Check out this awesome avatar in {0}!", SystemName.Text); var baseUrl = WebTools.GetBaseUrl(Request); var avatarDetailPath = string.Format("{0}/Avatar/View.aspx?AvatarId={1}", baseUrl, avatarId); var fullAvatarPath = string.Format("{0}{1}", baseUrl, VirtualPathUtility.ToAbsolute(avatarPath)); var fullAvatarMdPath = string.Format("{0}{1}", baseUrl, VirtualPathUtility.ToAbsolute(avatarMdPath)); if (patron != null) { title = string.Format("My {0} avatar", SystemName.Text); description = string.Format("Check out my awesome avatar in {0}!", SystemName.Text); } wt.AddOgMetadata(Metadata, title, wt.BuildFacebookDescription(description, hashtags, fbDescription), fullAvatarPath, avatarDetailPath, facebookApp: StringResources.getString("facebook-appid")); wt.AddTwitterMetadata(Metadata, title, description, fullAvatarMdPath, StringResources.getString("twitter-username")); TwitterShare.NavigateUrl = wt.GetTwitterLink(description, Server.UrlEncode(avatarDetailPath), hashtags); TwitterShare.Visible = true; FacebookShare.NavigateUrl = wt.GetFacebookLink(Server.UrlEncode(avatarDetailPath)); FacebookShare.Visible = true; // end social } AvatarPrintPanel.Visible = AvatarPanel.Visible; AvatarAlert.Visible = !AvatarPanel.Visible; }
protected void UpdateReport() { if (CRTenantID == null) { this.Log().Info("CRTenantID is null, unable to call UpdateReport(), probable session expiration"); return; } var ts = new TenantStatus((int)CRTenantID); if (ProgramList.SelectedValue != "0") { ts.ProgramId = int.Parse(ProgramList.SelectedValue); } if (LibraryBranchList.SelectedValue != "0") { ts.BranchId = int.Parse(LibraryBranchList.SelectedValue); } else { if (LibraryDistrictList.SelectedValue != "0") { ts.DistrictId = int.Parse(LibraryDistrictList.SelectedValue); } } var result = ts.CurrentStatus(); RegisteredPatrons.Text = result.RegisteredPatrons.ToString("N0"); PointsEarned.Text = result.PointsEarned.ToString("N0"); PointsEarnedReading.Text = result.PointsEarnedReading.ToString("N0"); ChallengesCompleted.Text = result.ChallengesCompleted.ToString("N0"); AdventuresCompleted.Text = result.AdventuresCompleted.ToString("N0"); BadgesAwarded.Text = result.BadgesAwarded.ToString("N0"); SecretCodesRedeemed.Text = result.SecretCodesRedeemed.ToString("N0"); ProgramCodesRedeemed.Text = result.RedeemedProgramCodes.ToString("N0"); if (DAL.ProgramCodes.GetCountByTenantId((int)CRTenantID) > 0) { ProgramCodesDiv.Visible = true; var redeemed = result.SecretCodesRedeemed.ToString(); string codeName = StringResources.getString("myaccount-program-reward-code"); if (!codeName.EndsWith("s")) { codeName += "s"; } ProgramRewardCodeLabel.Text = codeName; } else { ProgramCodesDiv.Visible = false; } ProgramName.Text = ProgramList.SelectedItem.Text; DistrictName.Text = LibraryDistrictList.SelectedItem.Text; BranchName.Text = LibraryBranchList.SelectedItem.Text; var selectedProgram = ProgramList.SelectedValue; if (selectedProgram == "0") { selectedProgram = DAL.Programs.GetDefaultProgramID().ToString(); } var bannerPath = new Logic.Banner().GetBannerPath(selectedProgram, Server); ProgramImage.ImageUrl = bannerPath.Item1; ProgramImage.CssClass = new WebTools().CssEnsureClass("img-rounded", ProgramImage.CssClass); }
protected void UpdateReport() { if (CRTenantID == null) { this.Log().Error("CRTenantID is null, unable to call UpdateReport()"); return; } var ts = new TenantStatus((int)CRTenantID); if (ProgramList.SelectedValue != "0") { ts.ProgramId = int.Parse(ProgramList.SelectedValue); } if (LibraryBranchList.SelectedValue != "0") { ts.BranchId = int.Parse(LibraryBranchList.SelectedValue); } else { if (LibraryDistrictList.SelectedValue != "0") { ts.DistrictId = int.Parse(LibraryDistrictList.SelectedValue); } } var result = ts.CurrentStatus(); RegisteredPatrons.Text = result.RegisteredPatrons.ToString("N0"); PointsEarned.Text = result.PointsEarned.ToString("N0"); PointsEarnedReading.Text = result.PointsEarnedReading.ToString("N0"); ChallengesCompleted.Text = result.ChallengesCompleted.ToString("N0"); AdventuresCompleted.Text = result.AdventuresCompleted.ToString("N0"); BadgesAwarded.Text = result.BadgesAwarded.ToString("N0"); SecretCodesRedeemed.Text = result.SecretCodesRedeemed.ToString("N0"); ProgramCodesRedeemed.Text = result.RedeemedProgramCodes.ToString("N0"); if (DAL.ProgramCodes.GetCountByTenantId((int)CRTenantID) > 0) { ProgramCodesDiv.Visible = true; var redeemed = result.SecretCodesRedeemed.ToString(); string codeName = StringResources.getString("myaccount-program-reward-code"); if (!codeName.EndsWith("s")) { codeName += "s"; } ProgramRewardCodeLabel.Text = codeName; } else { ProgramCodesDiv.Visible = false; } ProgramName.Text = ProgramList.SelectedItem.Text; DistrictName.Text = LibraryDistrictList.SelectedItem.Text; BranchName.Text = LibraryBranchList.SelectedItem.Text; var selectedProgram = ProgramList.SelectedValue; if (selectedProgram == "0") { selectedProgram = DAL.Programs.GetDefaultProgramID().ToString(); } var bannerPath = new Logic.Banner().GetBannerPath(selectedProgram, Server); ProgramImage.ImageUrl = bannerPath.Item1; ProgramImage.CssClass = new WebTools().CssEnsureClass("img-rounded", ProgramImage.CssClass); }
protected void Page_Load(object sender, EventArgs e) { AvatarBackLink.NavigateUrl = "~/"; SystemName.Text = SystemNamePrint.Text = StringResources.getString("system-name"); SystemSlogan.Text = SystemSloganPrint.Text = StringResources.getString("slogan"); SystemSlogan.Visible = SystemSloganPrint.Visible = SystemSlogan.Text != "slogan"; string programId = null; AvatarBackLink.Text = StringResources.getString("avatar-return"); if (AvatarBackLink.Text == "avatar-return") { AvatarBackLink.Text = "Back"; } var patron = Session[SessionKey.Patron] as DAL.Patron; if (patron != null) { programId = patron.ProgID.ToString(); MyAvatarPrint.Text = Tools.DisplayHelper.FormatName(patron.FirstName, patron.LastName, patron.Username); } else { MyAvatarPrint.Text = "My Avatar"; } if (string.IsNullOrEmpty(programId)) { var sessionProgId = Session["ProgramId"]; if (sessionProgId != null) { programId = sessionProgId.ToString(); } } if (string.IsNullOrEmpty(programId)) { try { programId = DAL.Programs.GetDefaultProgramID().ToString(); } catch (Exception) { } } string bannerPath = new Logic.Banner().FullMetadataBannerPath( WebTools.GetBaseUrl(Request), programId, Server); if (!string.IsNullOrEmpty(bannerPath)) { BannerImagePrint.ImageUrl = bannerPath; } else { BannerImagePrint.Visible = false; } string avatarPath = null; string avatarMdPath = null; bool validAvatar = false; string avatarId = Request.QueryString["AvatarId"]; if (!string.IsNullOrEmpty(avatarId) && avatarId.Length <= 24) { char[] avatarIdArray = avatarId.ToCharArray(); avatarIdArray = Array.FindAll<char>(avatarIdArray, (c => (char.IsLetterOrDigit(c)))); avatarId = new string(avatarIdArray); avatarPath = string.Format("~/Images/AvatarCache/{0}.png", avatarId); avatarMdPath = string.Format("~/Images/AvatarCache/md_{0}.png", avatarId); if (File.Exists(Server.MapPath(avatarPath))) { validAvatar = true; AvatarImage.ImageUrl = AvatarImagePrint.ImageUrl = avatarPath; AvatarPanel.Visible = true; } } if (!validAvatar) { AvatarPanel.Visible = false; } else { // begin social var wt = new WebTools(); var fbDescription = StringResources.getStringOrNull("facebook-description"); var hashtags = StringResources.getStringOrNull("socialmedia-hashtags"); var title = string.Format("{0} avatar", SystemName.Text); var description = string.Format("Check out this awesome avatar in {0}!", SystemName.Text); var baseUrl = WebTools.GetBaseUrl(Request); var avatarDetailPath = string.Format("{0}/Avatar/View.aspx?AvatarId={1}", baseUrl, avatarId); var fullAvatarPath = string.Format("{0}{1}", baseUrl, VirtualPathUtility.ToAbsolute(avatarPath)); var fullAvatarMdPath = string.Format("{0}{1}", baseUrl, VirtualPathUtility.ToAbsolute(avatarMdPath)); if (patron != null) { title = string.Format("My {0} avatar", SystemName.Text); description = string.Format("Check out my awesome avatar in {0}!", SystemName.Text); } wt.AddOgMetadata(Metadata, title, wt.BuildFacebookDescription(description, hashtags, fbDescription), fullAvatarPath, avatarDetailPath, facebookApp: StringResources.getString("facebook-appid")); wt.AddTwitterMetadata(Metadata, title, description, fullAvatarMdPath, StringResources.getString("twitter-username")); TwitterShare.NavigateUrl = wt.GetTwitterLink(description, Server.UrlEncode(avatarDetailPath), hashtags); TwitterShare.Visible = true; FacebookShare.NavigateUrl = wt.GetFacebookLink(Server.UrlEncode(avatarDetailPath)); FacebookShare.Visible = true; // end social } AvatarPrintPanel.Visible = AvatarPanel.Visible; AvatarAlert.Visible = !AvatarPanel.Visible; }