public void CanGetDataByPeriodAndClientID() { using (var test = new ReportsTestManager()) { DateTime period = DateTime.Parse("2019-02-01"); int clientId; DataTable dt; DataTable expected; clientId = 3592; dt = RoomBillingByOrgBL.GetDataByPeriodAndClientID(test.ContextBase, period.Year, period.Month, clientId); expected = GetExpectedTable( new object[] { 39, "Wayne State University", 40M, 0M, 40M, 0M }); AssertDataTablesAreEqual(expected, dt); test.ContextBase.Session.Remove("UserUsageSummaryTables20110701"); clientId = 81; dt = RoomBillingByOrgBL.GetDataByPeriodAndClientID(test.ContextBase, period.Year, period.Month, clientId); expected = GetExpectedTable( new object[] { 221, "MicroKosmos LLC", 192M, 0M, 192M, 0M }, new object[] { 17, "University of Michigan", 0M, 0M, 0M, 0M }); AssertDataTablesAreEqual(expected, dt); test.ContextBase.Session.Remove("UserUsageSummaryTables20110701"); clientId = 2691; dt = RoomBillingByOrgBL.GetDataByPeriodAndClientID(test.ContextBase, period.Year, period.Month, clientId); expected = GetExpectedTable( new object[] { 291, "Hawk Semiconductor, LLC", 498M, 0M, 498M, 0M }, new object[] { 50, "Numed Technologies, LLC", 0M, 0M, 0M, 0M }, new object[] { 30, "Evigia Systems, Inc.", 0M, 0M, 0M, 0M }, new object[] { 240, "Houston Methodist Research Institute", 696M, 0M, 696M, 0M }, new object[] { 249, "NVision Labs", 0M, 0M, 0M, 0M }, new object[] { 17, "University of Michigan", 578M, 0M, 578M, 0M }, new object[] { 281, "Micro Inertial LLC", 81M, 0M, 81M, 0M }); AssertDataTablesAreEqual(expected, dt); } }
protected override void RunReport(DateTime period, int clientId) { if (clientId <= 0) { lblClientID.ForeColor = System.Drawing.Color.Red; lblClientID.Text = "← Required"; return; } Session.Remove("UserUsageSummaryTables"); Session.Remove("UserUsageSummaryTables20110701"); //Because of this cutoff date, the stored procedure BillingTables_Select20110701 should always be used DateTime cutoff = new DateTime(2011, 10, 1); if (period < cutoff) { Response.Redirect($"~/IndUserUsageSummary20110401.aspx?p={period:yyyy-MM-dd}&cid={clientId}"); return; } // 01) Billing Details: Room PopulateRoomDetailData(period, clientId); // 02) Billing Details: Tool PopulateToolDetailData(period, clientId); // 03) Billing Details: Store PopulateStoreDetailData(period, clientId); // 04) Aggregate by Organization: Room gvAggByOrgRoom.DataSource = RoomBillingByOrgBL.GetDataByPeriodAndClientID(ContextBase, period.Year, period.Month, clientId); gvAggByOrgRoom.DataBind(); // 05) Aggregate by Organization: Tool gvToolOrg20110701.DataSource = ToolBillingByOrgBL.GetDataByPeriodAndClientID(ContextBase, period.Year, period.Month, clientId); gvToolOrg20110701.DataBind(); gvToolOrg20110701.Visible = true; // 06) Aggregate by Organization: Store var dtStore = BillingTablesBL.GetMultipleTables(ContextBase, period.Year, period.Month, clientId, BillingTableType.StoreByOrg); gvStoreOrg.DataSource = dtStore; gvStoreOrg.DataBind(); // 07) Aggregate by Organization: Subsidy var dtSubsidy = TieredSubsidyBillingBL.GetDataByPeriodAndClientID(ContextBase, period.Year, period.Month, clientId); AddStoreChargesToSubsidyTable(dtStore, dtSubsidy); gvSubsidy.DataSource = dtSubsidy; gvSubsidy.DataBind(); // 08) Aggregate by Accounts: Room gvRoomAccount.DataSource = RoomBillingByAccountBL.GetDataByPeriodAndClientID(ContextBase, period.Year, period.Month, clientId); gvRoomAccount.DataBind(); // 09) Aggregate by Accounts: Tool gvToolAccount20110701.DataSource = ToolBillingByAccountBL.GetDataByPeriodAndClientID20110701(ContextBase, period.Year, period.Month, clientId); gvToolAccount20110701.DataBind(); gvToolAccount20110701.Visible = true; // 10) Aggregate by Accounts: Store gvStoreAccount.DataSource = StoreBillingByAccountBL.GetDataByPeriodAndClientID(ContextBase, period.Year, period.Month, clientId); gvStoreAccount.DataBind(); // 11) Billing Details: Misc gvMisc.DataSource = MiscBillingBL.GetMiscBillingByClientID(ContextBase, period.Year, period.Month, clientId); gvMisc.DataBind(); PopulateReportInfo(divReportInfo, SelectedClientID, pp1.SelectedPeriod); HandlePageDisplay(period, clientId); }
protected override void RunReport(DateTime period, int clientId) { Session.Remove("UserUsageSummaryTables"); Session.Remove("UserUsageSummaryTables20110701"); DateTime CutoffStart = new DateTime(2010, 7, 1); DateTime CutoffEnd = new DateTime(2011, 4, 1); if (period < CutoffStart) { Response.Redirect(string.Format("~/IndUserUsageSummary.aspx?p={0:yyyy-MM-dd}&cid={1}", period, clientId)); return; } if (period >= CutoffEnd) { Response.Redirect(string.Format("~/IndUserUsageSummary20110401.aspx?p={0:yyyy-MM-dd}&cid={1}", period, clientId)); return; } if (period >= new DateTime(DateTime.Now.Year, DateTime.Now.Month, 1)) { divAggReports.Visible = false; } else { divAggReports.Visible = true; } PopulateRoomData(period, clientId); if (period < CutoffEnd) { PopulateToolData(period, clientId); divTool.Visible = true; divTool20110401.Visible = false; } else { PopulateToolData20110401(period, clientId); divTool.Visible = false; divTool20110401.Visible = true; } PopulateStoreData(period, clientId); divReportContent.Visible = true; lblClientID.Text = clientId.ToString(); gvRoomOrg.DataSource = RoomBillingByOrgBL.GetDataByPeriodAndClientID(ContextBase, period.Year, period.Month, clientId); gvRoomOrg.DataBind(); gvStoreOrg.DataSource = BillingTablesBL.GetMultipleTables(ContextBase, period.Year, period.Month, clientId, BillingTableType.StoreByOrg); gvStoreOrg.DataBind(); gvSubsidy.DataSource = TieredSubsidyBillingBL.GetDataByPeriodAndClientID(ContextBase, period.Year, period.Month, clientId); gvSubsidy.DataBind(); gvRoomAccount.DataSource = RoomBillingByAccountBL.GetDataByPeriodAndClientID(ContextBase, period.Year, period.Month, clientId); gvRoomAccount.DataBind(); gvStoreAccount.DataSource = StoreBillingByAccountBL.GetDataByPeriodAndClientID(ContextBase, period.Year, period.Month, clientId); gvStoreAccount.DataBind(); gvMisc.DataSource = MiscBillingBL.GetMiscBillingByClientID(ContextBase, period.Year, period.Month, clientId); gvMisc.DataBind(); if (period < CutoffEnd) { gvToolOrg.DataSource = ToolBillingByOrgBL.GetDataByPeriodAndClientID(ContextBase, period.Year, period.Month, clientId); gvToolOrg.DataBind(); gvToolOrg.Visible = true; gvToolAccount.DataSource = ToolBillingByAccountBL.GetDataByPeriodAndClientID(ContextBase, period.Year, period.Month, clientId); gvToolAccount.DataBind(); gvToolAccount.Visible = true; gvToolOrg20110401.Visible = false; gvToolAccount20110401.Visible = false; } else { gvToolOrg20110401.DataSource = ToolBillingByOrgBL.GetDataByPeriodAndClientID(ContextBase, period.Year, period.Month, clientId); gvToolOrg20110401.DataBind(); gvToolOrg20110401.Visible = true; gvToolAccount20110401.DataSource = ToolBillingByAccountBL.GetDataByPeriodAndClientID20110401(ContextBase, period.Year, period.Month, clientId); gvToolAccount20110401.DataBind(); gvToolAccount20110401.Visible = true; gvToolOrg.Visible = false; gvToolAccount.Visible = false; } }