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() { 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 defaultBannerPath = string.Format("~/images/Banners/{0}.png", selectedProgram); var defaultBannerFilePath = Server.MapPath(defaultBannerPath); if (System.IO.File.Exists(defaultBannerFilePath)) { ProgramImage.ImageUrl = defaultBannerPath; ProgramImage.CssClass = new WebTools().CssRemoveClass("img-rounded", ProgramImage.CssClass); } else { ProgramImage.ImageUrl = "~/images/meadow.jpg"; ProgramImage.CssClass = new WebTools().CssEnsureClass("img-rounded", ProgramImage.CssClass); } }