Ejemplo n.º 1
0
        /// <summary>
        /// Should this record be included in the report based on teh selected locations and/or assets
        /// </summary>
        /// <param name="record"></param>
        /// <returns></returns>
        protected bool FilterRecord(InternetReportEntry record)
        {
            // check data filter first
            if ((!_showAllDates) && (record.Date < _startDate.Date || record.Date > _endDate.Date))
            {
                return(false);
            }

            // True if no filters applied
            if ((_selectedGroups == "") && (_selectedAssets == ""))
            {
                return(true);
            }

            // Check locations specified
            foreach (string group in SelectedGroupsList)
            {
                if (record.Location == group)
                {
                    return(true);
                }
            }

            // Not in the groups list so check the assets list also
            foreach (string assetName in SelectedAssetsList)
            {
                if (record.AssetName == assetName)
                {
                    return(true);
                }
            }
            return(false);
        }
Ejemplo n.º 2
0
        /// <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
            StatisticsDAO lwDataAccess  = new StatisticsDAO();
            DataTable     internetTable = lwDataAccess.GetInternetHistory(_startDate, _endDate, _filterURL);

            // Create a string representation of the publisher filter list passed to us
            // We need to get the entire licensing information at this point
            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);

            // 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
            AssetList _cachedAssetList = _cachedAssetGroups.GetAllAssets();

            _selectedAssets = String.Empty;

            foreach (Asset asset in _cachedAssetList)
            {
                _selectedAssets += asset.Name + ";";
            }

            char[] charsToTrim = { ';' };
            _selectedAssets.TrimEnd(charsToTrim);

            ResetSelectedAssets();

            // ...then create InternetReportEntry objects for each returned and add to the view
            foreach (DataRow row in internetTable.Rows)
            {
                // Create the object for this Internet record
                InternetReportEntry ieEntry = new InternetReportEntry(row);

                // Check for this being filtered by location/asset
                if (FilterRecord(ieEntry))
                {
                    AddRecord(ieEntry);
                }
            }
        }
Ejemplo n.º 3
0
        /// <summary>
        /// This function is called to add an application to the DataSet noting that the
        /// DataSet actually has 3 separate (but linked) tables for Applications, Instances and Licenses
        /// </summary>
        /// <param name="thisApplication"></param>
        protected void AddRecord(InternetReportEntry record)
        {
            // Get the Table from the DataSet
            DataTable internetTable = _reportDataSet.Tables["Internet"];

            // Add the row to the data set
            try
            {
                internetTable.Rows.Add(new object[]
                {                         //record
                    //, record.Location
                    record.AssetName
                    //, record.Source
                    //, record.Date.ToShortDateString()
                    , record.Date.ToString("yyyy-MM-dd")
                    , record.Url
                    , record.PagesAccessed.ToString()
                });
            }
            catch (Exception e)
            {
                MessageBox.Show(e.Message);
            }
        }