private void _processDataSource(object sender, int inclusive, int exclusive, int pageSize) { WebQueryEventArgsNew args = new BenQGuru.eMES.Web.WebQuery.WebQueryEventArgsNew(inclusive, exclusive); this.LoadGridDataSource(sender, args); if (args.GridDataSource != null) { DomainObjectToGridRowEventArgsNew args1 = new DomainObjectToGridRowEventArgsNew(); DataRow lastRow = null; foreach (DomainObject obj in args.GridDataSource) { args1.DomainObject = obj; this.DomainObjectToGridRow(sender, args1); if (args1.GridRow != null) { DataRow row = this.buildMergedGridRow(args1.GridRow, lastRow); this.dtSource.Rows.Add(row); lastRow = args1.GridRow; } } } if (this.pagerSizeSelector != null) { this.pagerToolBar.PageSize = pageSize; } if (this.pagerToolBar != null) { this.pagerToolBar.RowCount = args.RowCount; } gridWebGrid.DataSource = dtSource; gridWebGrid.DataBind(); }
private void Display() { lblRetrievalNo.Text = manageStationeryRetrievalListControl.RetrievalId; retrievalList = manageStationeryRetrievalListControl.RetrievalList; int index = 0; int group = 0; int fulfillPage = SystemStoreInventorySystemUtil.Converter.objToInt(StationeryStoreInventorySystemController.Util.GetSession(fulfillPageSessionKey)); int startingShowIndex = fulfillPage > 1 ? fulfillPage * ManageStationeryRetrievalListControl.totalRetrievalToSet : 0; foreach (string key in retrievalList.Keys) { if (index++ >= startingShowIndex && group < ManageStationeryRetrievalListControl.totalRetrievalToSet) { WebGroupBox webGroupBox = (WebGroupBox)this.FindControl("ctl00$MainContent$FulfillWebGroupBox" + (++group)); if (webGroupBox != null) { Label lblBin = (Label)this.FindControl("ctl00$MainContent$FulfillWebGroupBox" + group + "$lblFulfillBin" + group); Label lblNeededQty = (Label)this.FindControl("ctl00$MainContent$FulfillWebGroupBox" + group + "$lblFulfillNeededQty" + group); Label lblActualQty = (Label)this.FindControl("ctl00$MainContent$FulfillWebGroupBox" + group + "$lblFulfillActualQty" + group); WebDataGrid webDataGrid = (WebDataGrid)this.FindControl("ctl00$MainContent$FulfillWebGroupBox" + group + "$FulfillWebDataGrid" + group); if (lblBin != null && lblNeededQty != null && lblActualQty != null && webDataGrid != null) { webGroupBox.Visible = true; webDataGrid.Visible = true; DataTable dt = (DataTable)retrievalList[key][COLUMN_TABLE]; webGroupBox.Text = retrievalList[key][COLUMN_DESCRIPTION].ToString(); lblBin.Text = retrievalList[key][COLUMN_BIN].ToString(); lblNeededQty.Text = retrievalList[key][COLUMN_NEEDED_QTY].ToString(); lblActualQty.Text = retrievalList[key][COLUMN_ACTUAL_QTY].ToString(); webDataGrid.DataSource = dt; webDataGrid.DataBind(); } } } } if (retrievalList.Count() > ManageStationeryRetrievalListControl.totalRetrievalToSet) { HyperLink fulfilledLink; for (int i = 0; i < SystemStoreInventorySystemUtil.Converter.objToInt(Math.Ceiling((double)(retrievalList.Count() / ManageStationeryRetrievalListControl.totalRetrievalToSet))); i++) { fulfilledLink = new HyperLink(); fulfilledLink.Attributes["style"] = "padding-left: 5px;"; if (i != fulfillPage - 1) { fulfilledLink.NavigateUrl = "~/storeUI/Clerk/ManageStationeryRetrievalList.aspx?fulfilledpage=" + (i + 1); } fulfilledLink.Text = (i + 1).ToString(); FulfilledPaginating.Controls.Add(fulfilledLink); } } if (retrievalList.Count() == 0) { fulfilledPanel.Visible = false; } index = 0; group = 0; int unfulfillPage = SystemStoreInventorySystemUtil.Converter.objToInt(StationeryStoreInventorySystemController.Util.GetSession(unfulfillPageSessionKey)); startingShowIndex = unfulfillPage > 1 ? unfulfillPage * ManageStationeryRetrievalListControl.totalRetrievalToSet : 0; unfulfilledRetrievalList = manageStationeryRetrievalListControl.UnfulfilledRetrievalList; foreach (string key in unfulfilledRetrievalList.Keys) { if (index++ >= startingShowIndex && group < ManageStationeryRetrievalListControl.totalRetrievalToSet) { WebGroupBox webGroupBox = (WebGroupBox)this.FindControl("ctl00$MainContent$WebGroupBox" + (++group)); if (webGroupBox != null) { Label lblBin = (Label)this.FindControl("ctl00$MainContent$WebGroupBox" + group + "$lblBin" + group); Label lblNeededQty = (Label)this.FindControl("ctl00$MainContent$WebGroupBox" + group + "$lblNeededQty" + group); Label lblActualQty = (Label)this.FindControl("ctl00$MainContent$WebGroupBox" + group + "$lblActualQty" + group); WebDataGrid webDataGrid = (WebDataGrid)this.FindControl("ctl00$MainContent$WebGroupBox" + group + "$DgvManageStationeryRetrievalList" + group); if (lblBin != null && lblNeededQty != null && lblActualQty != null && webDataGrid != null) { webGroupBox.Visible = true; webDataGrid.Visible = true; DataTable dt = (DataTable)unfulfilledRetrievalList[key][COLUMN_TABLE]; webGroupBox.Text = unfulfilledRetrievalList[key][COLUMN_DESCRIPTION].ToString(); lblBin.Text = unfulfilledRetrievalList[key][COLUMN_BIN].ToString(); lblNeededQty.Text = unfulfilledRetrievalList[key][COLUMN_NEEDED_QTY].ToString(); lblActualQty.Text = unfulfilledRetrievalList[key][COLUMN_ACTUAL_QTY].ToString(); webDataGrid.DataSource = dt; webDataGrid.DataBind(); } } } } if (unfulfilledRetrievalList.Count() > ManageStationeryRetrievalListControl.totalRetrievalToSet) { HyperLink unfulfilledLink; for (int i = 0; i < SystemStoreInventorySystemUtil.Converter.objToInt(Math.Ceiling((double)(unfulfilledRetrievalList.Count() / ManageStationeryRetrievalListControl.totalRetrievalToSet))); i++) { unfulfilledLink = new HyperLink(); unfulfilledLink.Attributes["style"] = "padding-left: 5px;"; if (i != unfulfillPage - 1) { unfulfilledLink.NavigateUrl = "~/storeUI/Clerk/ManageStationeryRetrievalList.aspx?unfulfilledpage=" + (i + 1); } unfulfilledLink.Text = (i + 1).ToString(); UnfulfilledPaginating.Controls.Add(unfulfilledLink); } } if (unfulfilledRetrievalList.Count() == 0) { unfulfilledPanel.Visible = false; } }
public async Task Export(CalculateRequest calculateRequest) { this.calculateRequest = calculateRequest; //InitOldData(); var grid1 = new WebDataGrid { //DataSource = this.chartService.GetJahresbetrachtungProzentual(IntervalType.M36) DataSource = (await meteoGtzService.GetYearsDataRelativeToCurrentYear(calculateRequest, true)).ToDataTable(p => p.Period1) }; grid1.DataBind(); var grid2 = new WebDataGrid { //DataSource = ChartService.CalculateSum(this.chartService.GetMonatsRelativeVerteilungJahr(false)) DataSource = (await meteoGtzService.GetRelativeVerteilung(calculateRequest, false)).ToDataTable().CalculateSum() }; grid2.DataBind(); var grid3 = new WebDataGrid { //DataSource = ChartService.CalculateSum(this.chartService.MonatsSummenGtzJahr) DataSource = (await meteoGtzService.GetGtzByPeriods(calculateRequest)).ToDataTable().CalculateSum() }; grid3.DataBind(); var wb = new Workbook(); var font = wb.Styles.NormalStyle.StyleFormat.Font; font.Name = "Microsoft Sans Serif"; font.Height = 9 * 20; var ws = wb.Worksheets.Add("Daten"); ws.Rows[3].Cells[0].Value = Title1; ws.Rows[3].Cells[0].CellFormat.Font.Bold = ExcelDefaultableBoolean.True; ws.Rows[12].Cells[0].Value = Title2; ws.Rows[12].Cells[0].CellFormat.Font.Bold = ExcelDefaultableBoolean.True; ws.Rows[29].Cells[0].Value = "Monatssummen der GTZ im Vergleich"; ws.Rows[29].Cells[0].CellFormat.Font.Bold = ExcelDefaultableBoolean.True; ws.Rows[8].Cells[0].Value = "Heizbedarf für das Abrechnungsjahr"; ws.Rows[8].Cells[0].CellFormat.Font.Bold = ExcelDefaultableBoolean.True; //ws.Rows[9].Cells[0].Value = this.chartService.GetJahrBedarfWithPromille(); ws.Rows[9].Cells[0].Value = await meteoGtzService.GetJahrBedarfWithPromille(calculateRequest, true); var wdge1 = new WebDataGridExport { Grid = grid1, RowOffset = 4 }; var wdge2 = new WebDataGridExport { Grid = grid2, RowOffset = 13 }; var wdge3 = new WebDataGridExport { Grid = grid3, RowOffset = 30 }; RegionFormat(ws.GetRegion("A5:C5"), true); RegionFormat(ws.GetRegion("A14:F14"), true); RegionFormat(ws.GetRegion("A27:F27")); RegionFormat(ws.GetRegion("A28:F28")); RegionFormatBold(ws.GetRegion("A27:A28")); RegionFormat(ws.GetRegion("A31:F31"), true); RegionFormat(ws.GetRegion("A44:F44")); RegionFormat(ws.GetRegion("A45:F45")); RegionFormatBold(ws.GetRegion("A44:A45")); RegionFormatBold(ws.GetRegion("A27:A28")); webExcelExporter.Export(ws, wdge1, wdge2, wdge3); }