/// <summary> /// This function is responsible for the actual generation of the Applications Report /// It overrides the abstract definition in the base class and stores it's data in the DataSet /// </summary> public override void GenerateReport(UltraGrid grid) { // Begin initialization of the Grid grid.BeginUpdate(); // Save the grid layout to a temporary file SaveTemporaryLayout(grid); // Clear any existing data out of the dataset _reportDataSet.Tables["Instances"].Rows.Clear(); _reportDataSet.Tables["Licenses"].Rows.Clear(); _reportDataSet.Tables["Applications"].Rows.Clear(); // Set the grid datasource to be this dataset grid.DataSource = _reportDataSet; // Generate the data for the report GenerateReportData(); // reload the temprary layout saved around the report generation LoadTemporaryLayout(grid); // ...and perform any required initialization of the grid //InitializeGrid(grid); // End of the update for the grid grid.EndUpdate(); }
/// <summary> /// This function is responsible for the actual generation of the Applications Report /// It overrides the abstract definition in the base class and stores it's data in the DataSet /// </summary> public override void GenerateReport(UltraGrid grid) { // Delete any cached data as we are re-running the report _cachedAssetGroups = null; // Begin initialization of the Grid grid.BeginUpdate(); // Save the grid layout to a temporary file if (grid.Rows.Count != 0) { SaveTemporaryLayout(grid); } // Create a new dataSource _reportDataSet = new DataSet("auditdataDataSet"); grid.DataSource = _reportDataSet; // We will always need the list of assets so we may as well get it now LocationsDAO lwDataAccess = new LocationsDAO(); AssetGroup.GROUPTYPE displayType = AssetGroup.GROUPTYPE.userlocation; DataTable table = lwDataAccess.GetGroups(new AssetGroup(displayType)); _cachedAssetGroups = new AssetGroup(table.Rows[0], displayType); _cachedAssetGroups.Populate(true, _ignoreChildAssets, true); // Now apply the filter to these groups _cachedAssetGroups.ApplyFilters(_selectedGroups, _selectedAssets, _ignoreChildAssets); // Now that we have a definitive list of the assets (as objects) which we want to include in the // report we could really do with expanding this list so that ALL of the assets are in a single list // and not distributed among the publishers _cachedAssetList = _cachedAssetGroups.GetAllAssets(); // Create the list of report columns which will maintain the data for this report _auditDataReportColumns.Populate(_listSelectedFields , _dictionaryLabels , _publisherFilter , _showIncluded , _showIgnored); // Create the tables, columns and relationships as these may have changed since we loaded the report CreateTables(); // Clear any existing data out of the dataset _reportDataSet.Tables["AuditData"].Rows.Clear(); // Generate the data for the report GenerateReportData(); // reload the temprary layout saved around the report generation //LoadTemporaryLayout(grid); // ...and perform any required initialization of the grid InitializeGrid(grid); grid.EndUpdate(); }
public static void ExportExcel(SaveFileDialog sfd, UltraGridExcelExporter exporter, UltraGrid grid, string strTitle, string strOperName) { //Helper.ExportExcel(saveFileDialog1,ultraGridExcelExporter1,ultraGrid1); try { if (grid.Rows.Count == 0) { throw new BusinessException("导出", "请先查询出结果再导出"); } grid.BeginUpdate(); //grid.DisplayLayout.BorderStyle = UIElementBorderStyle.None; //grid.UseAppStyling = false; //grid.DisplayLayout.Override.RowSelectors = DefaultableBoolean.False;; AddGridTitle(grid, strTitle, strOperName); grid.EndUpdate(); sfd.Filter = "Excel文件 (*.xls)|*.xls|All files (*.*)|*.*"; sfd.FilterIndex = 1; sfd.RestoreDirectory = true; if (sfd.ShowDialog() == DialogResult.OK) { string strFileName = sfd.FileName; exporter.Export(grid, strFileName); } grid.BeginUpdate(); //this.ultraGrid1.DisplayLayout.Bands[0].Columns[0].Hidden = false; //grid.DisplayLayout.BorderStyle = UIElementBorderStyle.Solid; //grid.UseAppStyling = true; //grid.DisplayLayout.Override.RowSelectors = DefaultableBoolean.True; RemoveGridTitle(grid, strOperName); grid.EndUpdate(); } catch (BusinessException bex) { MessageBox.Show(bex.Message, bex.Type, MessageBoxButtons.OK, MessageBoxIcon.Error); } catch (System.Exception ex) { MessageBox.Show(ex.Message, "系统错误", MessageBoxButtons.OK, MessageBoxIcon.Error); } }
public static void Print(System.Windows.Forms.IWin32Window owner, UltraGrid grid, UltraGridPrintDocument doc, UltraPrintPreviewDialog dlg) { //打印汉化 Infragistics.Shared.ResourceCustomizer rc = Infragistics.Win.Printing.Resources.Customizer; //Resources.Customizer; rc.SetCustomizedString("PrintPreview_DialogCaption", "打印预览"); rc.SetCustomizedString("PrintPreview_Tool_Print", "打印(&P)"); rc.SetCustomizedString("PrintPreview_Tool_ClosePreview", "关闭(&C)"); rc.SetCustomizedString("PrintPreview_Tool_ContextMenuPreviewZoom", "显示比例"); rc.SetCustomizedString("PrintPreview_Tool_Current_Page", "当前页"); rc.SetCustomizedString("PrintPreview_Tool_Exit", "退出(&X)"); rc.SetCustomizedString("PrintPreview_Tool_First_Page", "第一页"); rc.SetCustomizedString("PrintPreview_Tool_Go_To", "跳至"); rc.SetCustomizedString("PrintPreview_Tool_Last_Page", "最后一页"); rc.SetCustomizedString("PrintPreview_Tool_Next_Page", "下一页"); rc.SetCustomizedString("PrintPreview_Tool_Previous_Page", "前一页"); rc.SetCustomizedString("PrintPreview_Tool_Next_View", "下一视图(&N)"); rc.SetCustomizedString("PrintPreview_Tool_Previous_View", "前一视图(&P)"); rc.SetCustomizedString("PrintPreview_Tool_Hand_Tool", "手型工具(&H)"); rc.SetCustomizedString("PrintPreview_Tool_Page_Setup", "页面设置(&U)"); rc.SetCustomizedString("PrintPreview_Tool_Snapshot_Tool", "快照工具(&S)"); rc.SetCustomizedString("PrintPreview_Tool_View", "视图(&V)"); rc.SetCustomizedString("PrintPreview_Tool_Whole_Page", "合适页"); rc.SetCustomizedString("PrintPreview_Tool_Zoom", "缩放(&Z)"); rc.SetCustomizedString("PrintPreview_Tool_Zoom_In", "放大"); rc.SetCustomizedString("PrintPreview_Tool_Zoom_Out", "缩小"); rc.SetCustomizedString("PrintPreview_ToolCategory_Context_Menus", "上下文菜单"); rc.SetCustomizedString("PrintPreview_ToolCategory_File", "文件"); rc.SetCustomizedString("PrintPreview_ToolCategory_Menus", "菜单"); rc.SetCustomizedString("PrintPreview_ToolCategory_Tools", "工具栏"); rc.SetCustomizedString("PrintPreview_ToolCategory_View", "视图"); rc.SetCustomizedString("PrintPreview_ToolCategory_Zoom_Mode", "缩放模式"); rc.SetCustomizedString("PrintPreview_ToolTip_ClosePreview", "关闭"); rc.SetCustomizedString("PrintPreview_ToolTip_Zoom", "缩放"); rc.SetCustomizedString("StatusBar_Page_X_OF_X", "页:{0}/{1}"); rc.SetCustomizedString("CustomizeImg_ToolBar_MenuBar", "菜单"); rc.SetCustomizedString("CustomizeImg_ToolBar_Standard", "标准"); rc.SetCustomizedString("CustomizeImg_ToolBar_View", "视图"); rc.SetCustomizedString("PrintPreview_Tool_File", "文件(&F)"); rc.SetCustomizedString("PrintPreview_Tool_Tools", "工具(&T)"); rc.SetCustomizedString("PrintPreview_Tool_Dynamic_Zoom_Tool", "动态缩放工具(&D)"); rc.SetCustomizedString("PrintPreview_Tool_Zoom_Out_Tool", "缩小工具"); rc.SetCustomizedString("PrintPreview_Tool_Zoom_In_Tool", "放大工具"); // rc.SetCustomizedString("PrintPreview_Tool_Page_Layout","菜单"); rc.SetCustomizedString("PreviewRowColSelection_Cancel", "取消"); rc.SetCustomizedString("PreviewRowColSelection_SelectedPages", "{0} x {1} 页"); rc.SetCustomizedString("PreviewRowColSelection_Cancel", "取消"); rc.SetCustomizedString("PrintPreview_Tool_Page_Width", "页宽"); rc.SetCustomizedString("PrintPreview_ZoomListItem_MarginWidth", "文字宽度"); rc.SetCustomizedString("PrintPreview_ZoomListItem_PageWidth", "页宽"); rc.SetCustomizedString("PrintPreview_ZoomListItem_WholePage", "合适页"); rc.SetCustomizedString("PrintPreview_Tool_Page_Layout", "页面布局"); rc.SetCustomizedString("PrintPreview_Tool_Margin_Width", "文字宽度"); rc.SetCustomizedString("ContextMenuPreviewHand", "缩放视图"); rc.SetCustomizedString("PrintPreview_Tool_Reduce_Page_Thumbnails", "缩小"); rc.SetCustomizedString("PrintPreview_Tool_Show_Page_Numbers", "显示页号"); rc.SetCustomizedString("PrintPreview_Tool_ContextMenuThumbnail", "缩略图"); rc.SetCustomizedString("PrintPreview_Tool_Enlarge_Page_Thumbnails", "放大"); rc.SetCustomizedString("PrintPreview_Tool_Thumbnails", "缩略图"); rc.SetCustomizedString("PrintPreview_Tool_Continuous", "连续排序"); //说明 rc.SetCustomizedString("StatusBar_DynamicZoom_Instructions", "单击并拖动进行缩放操作"); rc.SetCustomizedString("StatusBar_Page_X_OF_X", "当前页: {0} / {1}"); rc.SetCustomizedString("StatusBar_SnapShot_Instructions", "单击并拖动,系统将选定矩型区域复制到剪帖板"); rc.SetCustomizedString("StatusBar_ZoomIn_Instructions", "单击并拖动,系统将放大选定矩型区域"); rc.SetCustomizedString("StatusBar_ZoomOut_Instructions", "单击并拖动,系统将缩小选定矩型区域"); rc.SetCustomizedString("StatusBar_Hand_Instructions", "单击并拖动以便显示更多内容"); grid.BeginUpdate(); grid.DisplayLayout.BorderStyle = UIElementBorderStyle.None; grid.UseAppStyling = false; grid.DisplayLayout.Override.RowSelectors = DefaultableBoolean.False;; grid.EndUpdate(); doc.Grid = grid; dlg.Document = doc; dlg.ShowDialog(owner); grid.BeginUpdate(); //this.ultraGrid1.DisplayLayout.Bands[0].Columns[0].Hidden = false; grid.DisplayLayout.BorderStyle = UIElementBorderStyle.Solid; grid.UseAppStyling = true; grid.DisplayLayout.Override.RowSelectors = DefaultableBoolean.True; grid.EndUpdate(); }