コード例 #1
0
        private void RunCustomReport_Click(object sender, EventArgs e)
        {
            if (cmbCustomReports.SelectedValue == null)
            {
                return;
            }

            DataTable reportsDataTable = new ReportsDAO().GetReportById(Convert.ToInt32(cmbCustomReports.SelectedValue));
            string    lReportData      = reportsDataTable.Rows[0][2].ToString();
            string    reportName       = ((DataRowView)(cmbCustomReports.SelectedItem)).Row.ItemArray[1].ToString();

            BinaryFormatter bf  = new BinaryFormatter();
            MemoryStream    mem = new MemoryStream(Convert.FromBase64String(lReportData));

            List <string> lReportDataList = (List <string>)bf.Deserialize(mem);

            // is this a 'group results by asset' report
            bool lDisplayAsAssetRegister = false;

            foreach (string lReportCondition in lReportDataList)
            {
                if (lReportCondition.StartsWith("ASSET_REGISTER:"))
                {
                    lDisplayAsAssetRegister = Convert.ToBoolean(lReportCondition.Substring(15));
                    break;
                }
            }

            ReportsWorkItemController wiController = (ReportsWorkItemController)workItem.Controller;

            wiController.RunCustomReport(reportName, lReportDataList);

            cbAssetRegister1.Checked = lDisplayAsAssetRegister;
        }
コード例 #2
0
        private void CreateNewCustomReport_Click(object sender, EventArgs e)
        {
            ReportsWorkItemController wiController = (ReportsWorkItemController)workItem.Controller;

            wiController.NewReport();
            RefreshView();
        }
コード例 #3
0
        private void bnSaveReport_Click(object sender, EventArgs e)
        {
            ReportsWorkItemController wiController = (ReportsWorkItemController)workItem.Controller;

            wiController.SaveReport();
            RefreshView();
        }
コード例 #4
0
        /// <summary>
        /// Generate a report targeted at Application Licensing
        /// </summary>
        protected void GeneratePresetReport(string reportName)
        {
            // Get our work item controller as some of the report filters are not specific to the report as such
            ReportsWorkItemController wiController = (ReportsWorkItemController)workItem.Controller;

            // Pass this report definition to the WIC who will in turn pass it to the TabView to display
            wiController.RunReport(reportName);
        }
コード例 #5
0
 public FormComplianceReport(ReportsWorkItemController wiController)
 {
     InitializeComponent();
     lblUnits.Text                = "";
     _wiController                = wiController;
     _filterConditions            = new List <string>();
     _reportSaved                 = false;
     cbBooleanValue.SelectedIndex = 0;
 }
コード例 #6
0
        private void bnRunExistingComplianceReport_Click(object sender, EventArgs e)
        {
            if (cmbComplianceReports.SelectedItem != null)
            {
                int lRepordId = Convert.ToInt32(cmbComplianceReports.SelectedValue);

                ReportsWorkItemController wiController = (ReportsWorkItemController)workItem.Controller;
                wiController.RunExistingComplianceReport(lRepordId);
            }
        }
コード例 #7
0
ファイル: FormCustomReport.cs プロジェクト: windygu/AW-master
        public FormCustomReport(ReportsWorkItemController wiController)
        {
            InitializeComponent();
            _selectedFields = new List <string>();
            _wiController   = wiController;
            _editingReport  = false;
            _reportSaved    = false;

            lvSelectedItems.ViewSettingsDetails.ImageSize = System.Drawing.Size.Empty;
        }
コード例 #8
0
        private void CreateNewSQLReport_Click(object sender, EventArgs e)
        {
            FormSQLReport form = new FormSQLReport();

            if ((form.ShowDialog() == DialogResult.OK) && (form.SQLString != null))
            {
                ReportsWorkItemController wiController = (ReportsWorkItemController)workItem.Controller;
                wiController.RunSQLReport(form.ReportName, form.SQLString);
                RefreshView();
            }
        }
コード例 #9
0
ファイル: FormCustomReport.cs プロジェクト: windygu/AW-master
        public FormCustomReport(ReportsWorkItemController wiController, int aCustomReportId)
        {
            InitializeComponent();
            _selectedFields = new List <string>();
            _customReportId = aCustomReportId;
            _wiController   = wiController;
            _editingReport  = true;
            _reportSaved    = true;

            this.Text = "Edit existing custom report";
            selectAuditedDataFieldsControl.Focus();

            lvSelectedItems.ViewSettingsDetails.ImageSize = System.Drawing.Size.Empty;
        }
コード例 #10
0
        private void bnEditSQLReport_Click(object sender, EventArgs e)
        {
            if (cmbSQLReports.SelectedValue == null)
            {
                return;
            }

            FormSQLReport form = new FormSQLReport(Convert.ToInt32(cmbSQLReports.SelectedValue));

            if (form.ShowDialog() == DialogResult.OK)
            {
                ReportsWorkItemController wiController = (ReportsWorkItemController)workItem.Controller;
                wiController.RunSQLReport(form.ReportName, form.SQLString);
            }
        }
コード例 #11
0
        /// <summary>
        /// Generate a report targeted at File System Usage
        /// </summary>
        protected void GenerateFileSystemReport()
        {
            // Ensure any options are saved
            UpdateReportOptions();

            // Get our work item controller as some of the report filters are not specific to the report as such
            ReportsWorkItemController wiController = (ReportsWorkItemController)workItem.Controller;

            // Create the licensing report object
            FileSystemReportDefinition report = (FileSystemReportDefinition)wiController.CurrentReport;

            report.PublisherFilter = wiController.PublisherFilter;

            // Pass this report definition to the WIC who will in turn pass it to the TabView to display
            wiController.RunReport(report);
        }
コード例 #12
0
        /// <summary>
        /// Generate a report targeted at Application Licensing
        /// </summary>
        protected void GenerateLicensingReport()
        {
            // Get our work item controller as some of the report filters are not specific to the report as such
            ReportsWorkItemController wiController = (ReportsWorkItemController)workItem.Controller;

            // Create the licensing report object
            LicensingReportDefinition report = (LicensingReportDefinition)wiController.CurrentReport;

            report.PublisherFilter = wiController.PublisherFilter;

            // Set show included/ignored applications flags
            report.ShowIgnoredApplications  = wiController.ShowIgnoredApplications;
            report.ShowIncludedApplications = wiController.ShowIncludedApplications;

            // Pass this report definition to the WIC who will in turn pass it to the TabView to display
            wiController.RunReport(report);
        }
コード例 #13
0
        /// <summary>
        /// This is the tool click handler for the Print ribbon group
        /// </summary>
        /// <param name="sender"></param>
        /// <param name="e"></param>
        private void print_ToolClick(object sender, ToolClickEventArgs e)
        {
            ReportsWorkItemController controller = workItem.Controller as ReportsWorkItemController;

            switch (e.Tool.SharedProps.Caption)
            {
            case CommonToolNames.Print:
                controller.PrintGrid();
                break;

            case CommonToolNames.PrintPreview:
                controller.PrintPreviewGrid();
                break;

            default:
                break;
            }
        }
コード例 #14
0
        /// <summary>
        /// This is the tool click handler for the Print ribbon group
        /// </summary>
        /// <param name="sender"></param>
        /// <param name="e"></param>
        private void schedule_ToolClick(object sender, ToolClickEventArgs e)
        {
            ReportsWorkItemController controller = workItem.Controller as ReportsWorkItemController;

            switch (e.Tool.SharedProps.Caption)
            {
            case CommonToolNames.Schedule:
                controller.ScheduleReports();
                break;

            case CommonToolNames.LocationFilter:
                controller.FilterLocations();
                break;

            default:
                break;
            }
        }
コード例 #15
0
        private void bnRunSQLReport_Click(object sender, EventArgs e)
        {
            if (cmbSQLReports.SelectedValue == null)
            {
                return;
            }

            DataTable reportsDataTable = new ReportsDAO().GetReportById(Convert.ToInt32(cmbSQLReports.SelectedValue));
            string    lReportData      = reportsDataTable.Rows[0][2].ToString();
            string    reportName       = ((DataRowView)(cmbSQLReports.SelectedItem)).Row.ItemArray[1].ToString();

            BinaryFormatter bf              = new BinaryFormatter();
            MemoryStream    mem             = new MemoryStream(Convert.FromBase64String(lReportData));
            List <string>   lReportDataList = (List <string>)bf.Deserialize(mem);

            ReportsWorkItemController wiController = (ReportsWorkItemController)workItem.Controller;

            wiController.RunSQLReport(reportName, lReportDataList[0]);
        }
コード例 #16
0
        public FormComplianceReport(ReportsWorkItemController wiController, int aReportId)
        {
            InitializeComponent();
            lblUnits.Text = "";
            _wiController = wiController;
            _reportSaved  = false;
            cbBooleanValue.SelectedIndex = 0;

            DataTable reportsDataTable = new ReportsDAO().GetReportById(aReportId);

            _originalFileName = reportsDataTable.Rows[0][1].ToString();
            tbReportName.Text = _originalFileName;
            string lReportData = reportsDataTable.Rows[0][2].ToString();

            BinaryFormatter bf  = new BinaryFormatter();
            MemoryStream    mem = new MemoryStream(Convert.FromBase64String(lReportData));

            _filterConditions = (List <string>)bf.Deserialize(mem);

            selectedFields.Focus();
        }
コード例 #17
0
        /// <summary>
        /// This is the tool click handler for the Applications>Export ribbon group
        /// </summary>
        /// <param name="sender"></param>
        /// <param name="e"></param>
        private void export_ToolClick(object sender, ToolClickEventArgs e)
        {
            ReportsWorkItemController controller = workItem.Controller as ReportsWorkItemController;

            switch (e.Tool.SharedProps.Caption)
            {
            case CommonToolNames.ExportPDF:
                controller.ExportToPDF();
                break;

            case CommonToolNames.ExportXLS:
                controller.ExportToXLS();
                break;

            case CommonToolNames.ExportXPS:
                controller.ExportToXPS();
                break;

            default:
                break;
            }
        }
コード例 #18
0
        /// <summary>
        /// This is the tool click handler for the Filters ribbon group
        /// </summary>
        /// <param name="sender"></param>
        /// <param name="e"></param>
        private void filter_ToolClick(object sender, ToolClickEventArgs e)
        {
            StateButtonTool           sbt        = null;
            ReportsWorkItemController controller = workItem.Controller as ReportsWorkItemController;

            switch (e.Tool.SharedProps.Caption)
            {
            case CommonToolNames.ViewIncluded:
                sbt = e.Tool as StateButtonTool;
                controller.ShowIncludedApplications = sbt.Checked;

                // Ensure that at least one option is selected
                StateButtonTool sbtShowIgnored = filtersRibbonGroup.Tools["reports" + CommonToolNames.ViewIgnored] as StateButtonTool;
                if (!sbt.Checked && !sbtShowIgnored.Checked)
                {
                    sbtShowIgnored.Checked = true;
                }
                break;

            case CommonToolNames.ViewIgnored:
                sbt = e.Tool as StateButtonTool;
                controller.ShowIgnoredApplications = sbt.Checked;

                // Ensure that at least one option is selected
                StateButtonTool sbtShowIncluded = filtersRibbonGroup.Tools["reports" + CommonToolNames.ViewIncluded] as StateButtonTool;
                if (!sbt.Checked && !sbtShowIncluded.Checked)
                {
                    sbtShowIncluded.Checked = true;
                }
                break;

            case CommonToolNames.FilterPublishers:
                controller.FilterPublishers();
                break;

            default:
                break;
            }
        }
コード例 #19
0
        /// <summary>
        /// This is the tool click handler for the Applications>Export ribbon group
        /// </summary>
        /// <param name="sender"></param>
        /// <param name="e"></param>
        private void reportType_ToolClick(object sender, ToolClickEventArgs e)
        {
            ReportsWorkItemController controller = workItem.Controller as ReportsWorkItemController;

            switch (e.Tool.SharedProps.Caption)
            {
            case ToolNames.ApplicationByApplication:
                //controller.ApplicationByApplication();
                break;

            case ToolNames.ComputerByComputer:
                //controller.ComputerByComputer();
                break;

            case ToolNames.SupportContracts:
                //controller.SupportContracts();
                break;

            default:
                break;
            }
        }
コード例 #20
0
        private void RunApplicationByLocationOption(string reportName)
        {
            //MessageBox.Show("Assets By Location Selected");
            //Hide the tab first
            //Display the asset selection dialog..
            FormAppByLocation AppByLocation = new FormAppByLocation();

            if (AppByLocation.ShowDialog() == DialogResult.OK)
            {
                //run the query based on for the recordset..

                string strQuery = "SELECT APP._PUBLISHER, APP._NAME + ' (' + APP._VERSION + ')' AS [Application & Version], A._NAME AS Asset, L._NAME AS Location " +
                                  "FROM APPLICATIONS APP " +
                                  "INNER JOIN APPLICATION_INSTANCES APPI ON (APP._APPLICATIONID = APPI._APPLICATIONID) " +
                                  "INNER JOIN ASSETS A ON (A._ASSETID = APPI._ASSETID) " +
                                  "INNER JOIN LOCATIONS L ON (A._LOCATIONID = L._LOCATIONID) " +
                                  "WHERE APP._IGNORED = 0 ";

                string strSelectedApplicationSQL = "";
                string strSelectedLocationSQL    = "";

                if (AppByLocation.LastSavedSelectionItem.ApplicationItemList.Count > 0)
                {
                    strSelectedApplicationSQL = "AND (";

                    for (int i = 0; i < AppByLocation.LastSavedSelectionItem.ApplicationItemList.Count - 1; i++)
                    {
                        strSelectedApplicationSQL += "APP._NAME ='";
                        strSelectedApplicationSQL += AppByLocation.LastSavedSelectionItem.ApplicationItemList[i].ApplicationName;
                        strSelectedApplicationSQL += "' OR ";
                    }
                    strSelectedApplicationSQL += "APP._NAME =";
                    strSelectedApplicationSQL += AuditWizardDataAccess.PrepareSqlString(AppByLocation.LastSavedSelectionItem.ApplicationItemList[AppByLocation.LastSavedSelectionItem.ApplicationItemList.Count - 1].ApplicationName);
                    //strSelectedApplicationSQL += "";
                    strSelectedApplicationSQL += " )";

                    strQuery += strSelectedApplicationSQL;
                }
                if (AppByLocation.LastSavedSelectionItem.LocationNames.Count > 0)
                {
                    strSelectedLocationSQL = "AND (";

                    for (int i = 0; i < AppByLocation.LastSavedSelectionItem.LocationNames.Count - 1; i++)
                    {
                        strSelectedLocationSQL += "L._NAME ='";
                        strSelectedLocationSQL += AppByLocation.LastSavedSelectionItem.LocationNames[i];
                        strSelectedLocationSQL += "' OR ";
                    }
                    strSelectedLocationSQL += "L._NAME ='";
                    strSelectedLocationSQL += AppByLocation.LastSavedSelectionItem.LocationNames[AppByLocation.LastSavedSelectionItem.LocationNames.Count - 1];
                    strSelectedLocationSQL += "'";
                    strSelectedLocationSQL += " )";

                    strQuery += strSelectedLocationSQL;
                }
                strQuery += "ORDER BY L._NAME";

                ReportsWorkItemController wiController = (ReportsWorkItemController)workItem.Controller;
                wiController.RunSQLReport(reportName, strQuery);

                //Filter the recodset based on the dialog settings
                if (AppByLocation.SaveAsUserDefinedReport)
                {
                    List <string> _filterConditions = new List <string>();
                    _filterConditions.Add(strQuery);

                    BinaryFormatter bf  = new BinaryFormatter();
                    MemoryStream    mem = new MemoryStream();
                    bf.Serialize(mem, _filterConditions);
                    string lReportData = Convert.ToBase64String(mem.ToArray());
                    new ReportsDAO().Insert(AppByLocation.UserDefinedReportName, ReportsDAO.ReportType.SqlReport, lReportData);

                    RefreshView();
                    AppByLocation.SaveAllSQLProfilesFromTheList();
                }
                AppByLocation.SaveItemSelection();

                //Fill the Report grid
                //Show the grid to the user
            }
            else
            {
            }
        }