/// <summary> /// This function is responsible for generating the actual data which will be displayed by the report /// </summary> protected void GenerateReportData() { // Create a string representation of the publisher filter list passed to us // We need to get the entire licensing information at this point ApplicationsDAO lwDataAccess = new ApplicationsDAO(); //AssetGroup.GROUPTYPE displayType = AssetGroup.GROUPTYPE.userlocation; //DataTable table = new LocationsDAO().GetGroups(new AssetGroup(displayType)); //AssetGroup _cachedAssetGroups = new AssetGroup(table.Rows[0], displayType); //_cachedAssetGroups.Populate(true, _ignoreChildAssets, true); //// Now apply the filter to these groups //_cachedAssetGroups.ApplyFilters(_selectedGroups, _selectedAssets, _ignoreChildAssets); _selectedAssets = new AssetDAO().GetSelectedAssets(); selectedAssetList = new List <int>(); foreach (string id in _selectedAssets.Split(',')) { selectedAssetList.Add(Convert.ToInt32(id)); } // If we have selected all publishers and all applications then apply the publisher filter //if (_selectedPublishers == "" && _selectedApplications == "") _selectedPublishers = _publisherFilter; DataTable applicationsTable = lwDataAccess.GetApplications(_selectedPublishers, true, false); // ...then create InstalledApplication objects for each returned and add to the view for (int rowIndex = 0; rowIndex < applicationsTable.Rows.Count;) { // Get the data row DataRow row = applicationsTable.Rows[rowIndex]; // Create the object from the data row InstalledApplication thisApplication = new InstalledApplication(row); // ...and if we are only displaying the report for a specific application and this is not it then // delete this row from the table and skip it if ((_selectedApplications != "") && (!_selectedApplications.Contains(thisApplication.Name))) { applicationsTable.Rows.Remove(row); continue; } // Read instances and licenses of this application thisApplication.LoadData(); // If we are only displaying applications that have Serial numbers or CD Keys then apply that filter here if ((_showWithKeysOnly) && (!thisApplication.HaveSerialNumbers())) { applicationsTable.Rows.Remove(row); continue; } // Ensure that we look at the next row in the next loop rowIndex++; ResetSelectedAssets(); bool addApplication = false; foreach (ApplicationInstance app in thisApplication.Instances) { //if (FilterRecord(app.ComputerLocation, app.InstalledOnComputer)) // addApplication = true; if (selectedAssetList.Contains(app.InstalledOnComputerID)) { addApplication = true; } //foreach (int assetID in selectedAssetList) //{ // if (app.InstalledOnComputerID == assetID) // { // addApplication = true; // break; // } //} } if (addApplication) { AddApplication(thisApplication, _showWithKeysOnly); } } }