private void RepairSurveyResults() { ReportConfigurations rc = new ReportConfigurations(); rc.LoadReportsFromXml(ReportConfigurationType.User); if (rc.ContainsKey("SexualMedicineAssessmentSurveyResults")) { var report = rc.GetReportById("SexualMedicineAssessmentSurveyResults"); string sql = report.StoredProcedure; string datasetSQL = CacheManager.GetDatasetSQL(Session[SessionKey.DatasetId]); var sqlParams = new Dictionary <string, string> { { "FromDate", FromDate.Value }, // System.Data.SqlTypes.SqlDateTime.MinValue.Value.ToShortDateString() { "ToDate", ToDate.Value } // System.Data.SqlTypes.SqlDateTime.MaxValue.Value.ToShortDateString() }; AdminReportsDa da = new AdminReportsDa(); DataView results = da.GetAdminReport(datasetSQL, sql, sqlParams, false).Tables[0].DefaultView; results.Sort = "[SurveyDate] ASC, [MRN] ASC"; // reset counts totalCount = results.Count; differentCount = 0; SurveyGrid.DataSource = results; SurveyGrid.DataBind(); // set counts: should be updated on data bound TotalCount.Text = totalCount.ToString(); DifferentCount.Text = differentCount.ToString(); } }
private void ShowReport(string useReport) { if (useReport.Length < 1) { showReportInfo = true; return; } DataSet ds = new DataSet(); bool bindData = true; AdminReportsDa da = new AdminReportsDa(); ReportConfiguration rprt = reportConfigurations[useReport]; string datasetSql = CacheManager.GetDatasetSQL(System.Web.HttpContext.Current.Session[SessionKey.DatasetId]); if (rprt.UseGenericReportFormat) { bindData = true; lblPageTitle.Text = rprt.Title; string paramName = null; string paramValue = null; if (lblAdditionalFiltering.Text != "N/A") { paramName = lblAdditionalFiltering.Text; if (txtAdditionalFilter1.CssClass != "DisplayNone") { paramValue = txtAdditionalFilter1.Text; } else { paramValue = ddlAdditionalFilter1.SelectedItem.Text; } } if (Request.QueryString["paramValue"] != null && Request.Cookies["AdminReportUseQuerystring"].Value == "true") { paramValue = Request.QueryString["paramValue"]; paramName = Request.QueryString["paramName"]; lblAdditionalFiltering.Text = paramName; txtAdditionalFilter1.Text = paramValue; } if (rprt.UseTimePeriod) { ds = da.GetAdminReport(null, rprt.StoredProcedure, paramName, paramValue, txtFromDate.Value, txtToDate.Value, false); } else { ds = da.GetAdminReport(null, rprt.StoredProcedure, paramName, paramValue, false); } } else { #region userSummary if (useReport == "UserSummary") { if (ddlReportMenu.SelectedValue != "UserSummary") { if (Page.IsPostBack || Request.QueryString["report"] == null || Request.QueryString["report"].ToString() != "UserSummary") { return; } } lblAdminReportInfo.Visible = false; lblAdminPage.Visible = true; dgAdminReport.Visible = false; string iUserId; string userName, userFirstName, userLastName, userEmail, enteredBy, updatedBy; string enteredTime, updatedTime, deactivatedTime; TimeSpan timespan; Label lblAdminReportSubHeading2 = new Label(); lblAdminPage.Controls.Add(lblAdminReportSubHeading2); if (Request.QueryString["paramName"] == "userName" && Request.Cookies["AdminReportUseQuerystring"].Value == "true") { userName = Request.QueryString["paramValue"]; } else { userName = txtAdditionalFilter1.Text; } ds = da.GetUserInfo(userName); if (ds.Tables[0].Rows.Count != 1) { lblAdminReportSubHeading2.Text = "No matching user found."; lblAdminReportSubHeading2.Visible = true; } else { //TODO FIX "username" etc iUserId = ds.Tables[0].Rows[0]["UserId"].ToString(); userName = ds.Tables[0].Rows[0]["UserName"].ToString(); userFirstName = ds.Tables[0].Rows[0]["UserFirstName"].ToString(); userLastName = ds.Tables[0].Rows[0]["UserLastName"].ToString(); userEmail = ds.Tables[0].Rows[0]["UserEmail"].ToString(); enteredBy = ds.Tables[0].Rows[0]["EnteredBy"].ToString(); updatedBy = ds.Tables[0].Rows[0]["UpdatedBy"].ToString(); enteredTime = ds.Tables[0].Rows[0]["EnteredTime"].ToString(); updatedTime = ds.Tables[0].Rows[0]["UpdatedTime"].ToString(); if (PageUtil.IsDate(updatedTime)) { timespan = DateTime.Now - DateTime.Parse(updatedTime); } else { timespan = DateTime.Now - DateTime.Parse(enteredTime); } deactivatedTime = ds.Tables[0].Rows[0]["DeactivatedTime"].ToString(); lblPageTitle.Text = "User Summary: " + userName; lblAdminReportSubHeading2.Text = "<table><tr><td width=100>First name:</td><td>" + userFirstName + "</td></tr>" + "<tr><td>Last name:</td><td>" + userLastName + "</td></tr>" + "<tr><td>Email:</td><td><a href=\"mailto:" + userEmail + "\">" + userEmail + "</a></td></tr>" + "<tr><td>Entered time:</td><td>" + enteredTime + "</td></tr>" + "<tr><td>Entered by:</td><td>" + enteredBy + "</td></tr>" + "<tr><td>Updated time:</td><td>" + updatedTime + "</td></tr>" + "<tr><td>Updated by:</td><td>" + updatedBy + "</td></tr>" + "<tr><td>Days since update:</td><td>" + timespan.Days.ToString() + "</td></tr>" + "<tr><td>Deactivated time:</td><td>" + deactivatedTime + "</td></tr></tr></table><br><br>" + "<b>Last 5 logins for this user:</b> <br>"; lblAdminReportSubHeading2.Visible = true; Label lblAdminReportSubHeading3 = new Label(); DataGrid dgAdminReport01 = new DataGrid(); lblAdminPage.Controls.Add(dgAdminReport01); lblAdminPage.Controls.Add(lblAdminReportSubHeading3); ds = da.GetUsersLastFiveLogins(userName); if (ds.Tables[0].Rows.Count < 1) { lblAdminReportSubHeading2.Text += "<br>No logins for this user.<br><br>"; bindData = false; dgAdminReport01.Visible = false; } else { dgAdminReport01.AutoGenerateColumns = true; dgAdminReport01.DataSource = ds.Tables[0].DefaultView; dgAdminReport01.DataBind(); dgAdminReport01.Width = 630; dgAdminReport01.CssClass = "DatagridTable"; lblAdminReportSubHeading3.Text = "<a href=AdminSectionReports.aspx?report=LoginsForUser¶mValue=" + userName + "¶mName=userName onClick=\"javascript:setUseQueryStringCookie();\">View all logins for this user.</a><br><br>"; } lblAdminReportSubHeading3.Visible = true; lblAdminReportSubHeading3.Text += "<b>Last 5 patient views for this user:</B> <br>"; lblAdminPage.Controls.Add(lblAdminReportSubHeading3); DataGrid dgAdminReport2 = new DataGrid(); lblAdminPage.Controls.Add(dgAdminReport2); DataSet ds2 = new DataSet(); ds2 = da.GetUsersLastFivePatientViews(iUserId); dgAdminReport2.Width = 630; dgAdminReport2.Visible = true; Label lblAdminReportSubHeading4 = new Label(); lblAdminPage.Controls.Add(lblAdminReportSubHeading4); if (ds2.Tables[0].Rows.Count < 1) { dgAdminReport2.Visible = false; lblAdminReportSubHeading3.Text += "<br>No patient views for this user."; } else { dgAdminReport2.AutoGenerateColumns = true; dgAdminReport2.DataSource = ds2.Tables[0].DefaultView; dgAdminReport2.DataBind(); lblAdminReportSubHeading4.Visible = true; lblAdminReportSubHeading4.Text = "<a href=AdminSectionReports.aspx?report=PatientsViewsByUser¶mValue=" + userName + "¶mName=userName onClick=\"javascript:setUseQueryStringCookie()\">View all patient views for this user.</a>"; } /*user record changes*/ DataGrid dgAdminReport3 = new DataGrid(); lblAdminPage.Controls.Add(dgAdminReport3); DataSet ds3 = new DataSet(); ds3 = da.GetUsersLastFiveRecordChanges(iUserId); dgAdminReport3.Width = 630; dgAdminReport3.Visible = true; lblAdminReportSubHeading4.Text += "<br><br><b>Last 5 user record changes:</b> <br>"; Label lblAdminReportSubHeading5 = new Label(); if (ds3.Tables[0].Rows.Count < 1) { dgAdminReport3.Visible = false; lblAdminReportSubHeading4.Text += "<br>No patient views for this user."; } else { dgAdminReport3.AutoGenerateColumns = true; dgAdminReport3.DataSource = ds3.Tables[0].DefaultView; dgAdminReport3.DataBind(); lblAdminReportSubHeading5.Visible = true; lblAdminReportSubHeading5.Text = "<a href=AdminSectionReports.aspx?report=UsersRecordChanges¶mValue=" + userName + "¶mName=userName onClick=\"javascript:setUseQueryStringCookie()\">View all record changes for this user.</a><br>"; } lblAdminPage.Controls.Add(lblAdminReportSubHeading5); /*users groups*/ DataGrid dgAdminReport4 = new DataGrid(); lblAdminPage.Controls.Add(dgAdminReport4); DataSet ds4 = new DataSet(); ds4 = da.GetAdminReport(null, "spRptAdminGetAUsersGroups", "UserId", iUserId, false); dgAdminReport4.Width = 630; dgAdminReport4.Visible = true; lblAdminReportSubHeading5.Text += "<br><br><b>This user belongs to the following groups: </b><br>"; if (ds4.Tables[0].Rows.Count < 1) { dgAdminReport4.Visible = false; lblAdminReportSubHeading5.Text += "<br>This user does not belong to any group."; } else { dgAdminReport4.AutoGenerateColumns = true; dgAdminReport4.DataSource = ds4.Tables[0].DefaultView; dgAdminReport4.DataBind(); } } bindData = false; } #endregion } if (bindData) { doBindData(ds); btnExport.Enabled = true; } }