示例#1
0
        /// <summary>
        /// Update the values specified for the Support Statistics
        /// </summary>
        private void UpdateSupportStatistics()
        {
            StatisticsDAO             awDataAccess = new StatisticsDAO();
            DataTable                 statisticsTable, statisticsTableAsset;
            SupportContractStatistics statistics, statisticsAsset;

            statisticsTable      = awDataAccess.SupportStatistics();
            statisticsTableAsset = awDataAccess.SupportStatisticsAsset();
            statistics           = new SupportContractStatistics(statisticsTable.Rows[0]);
            statisticsAsset      = new SupportContractStatistics(statisticsTableAsset.Rows[0]);


            int iCountExpired     = statistics.Expired + statisticsAsset.Expired;
            int iCountExpireToday = statistics.ExpireToday + statisticsAsset.ExpireToday;
            int iCountExpireWeek  = statistics.ExpireWeek + statisticsAsset.ExpireWeek;
            int iCountExpireMonth = statistics.ExpireMonth + statisticsAsset.ExpireMonth;


            //
            UltraExplorerBarGroup supportContracts = overviewExplorerBar.Groups["supportcontracts"];

            if (supportContracts == null)
            {
                return;
            }
            supportContracts.Items["expired"].Text          = StatisticTitles.SupportExpired + iCountExpired.ToString();
            supportContracts.Items["expirestoday"].Text     = StatisticTitles.SupportExpireToday + iCountExpireToday.ToString();
            supportContracts.Items["expiresthisweek"].Text  = StatisticTitles.SupportExpireThisWeek + iCountExpireWeek.ToString();
            supportContracts.Items["expiresthismonth"].Text = StatisticTitles.SupportExpireThisMonth + iCountExpireMonth.ToString();
        }
示例#2
0
 public static List <Order> GetOrder(DateTime start, DateTime end)
 {
     try
     {
         return(StatisticsDAO.GetOrder(start, end));
     }
     catch (Exception ex)
     {
         throw ex;
     }
 }
示例#3
0
 public static List <Order> GetOrder(DateTime start, DateTime end, int status)
 {
     try
     {
         return(StatisticsDAO.GetOrder(start, end, status));
     }
     catch (Exception)
     {
         throw;
     }
 }
        /// <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);
                }
            }
        }
示例#5
0
        public static Stats convertStats(StatisticsDAO dao)
        {
            Stats s = (Stats)Activator.CreateInstance(Type.GetType(dao.StatsClass));

            s.EndDateTime   = dao.EndDateTime;
            s.StartDateTime = dao.EndDateTime;
            s.idStatistics  = dao.idStatistics;
            s.idDailyTask   = dao.idDailyTask;
            s.StatsClass    = dao.StatsClass;

            if (s is WalkingStats)
            {
                ((WalkingStats)s).steps = ((WalkingStatsDAO)dao).Steps;
            }

            return(s);
        }
示例#6
0
        public void UploadStats(User me, Stats stats)
        {
            UserDAO myself = new UserDAO();

            myself.Username = me.Username;

            //The user does not exist.
            if (!myself.Find() || !myself.Password.Equals(me.Password))
            {
                return;
            }


            StatisticsDAO nStats = ObjectConverter.convertStats(stats);

            nStats.Insert();
        }
示例#7
0
        public static StatisticsDAO convertStats(Stats s)
        {
            //Type daoType = Type.GetType("Server." + s.StatsClass + "DAO", true);
            StatisticsDAO dao = (StatisticsDAO)Activator.CreateInstance("ActivityMonitorDatabase", "Server." + s.StatsClass + "DAO").Unwrap();

            dao.EndDateTime   = s.EndDateTime;
            dao.StartDateTime = s.EndDateTime;
            dao.idStatistics  = s.idStatistics;
            dao.idDailyTask   = s.idDailyTask;
            dao.StatsClass    = s.StatsClass;

            if (dao is WalkingStatsDAO)
            {
                ((WalkingStatsDAO)dao).Steps = ((WalkingStats)s).steps;
            }

            return(dao);
        }
示例#8
0
        public ServerDataWidget()
        {
            InitializeComponent();
            _statisticsDAO = new StatisticsDAO();

            cbServers.DataSource    = _statisticsDAO.GetServers();
            cbServers.DisplayMember = "_NAME";
            cbServers.ValueMember   = "_ASSETID";

            lStackColumnChart = CreateNewStackColumnChart();
            splitContainer1.Panel2.Controls.Add(lStackColumnChart);

            if (cbServers.SelectedValue != null)
            {
                lStackColumnChart.DataSource = PopulateChartData((int)cbServers.SelectedValue);
            }

            this.ContextMenu = new ContextMenu();
        }
示例#9
0
        private string HandleAuditedItemsData(string applicationFilter)
        {
            DataTable resultsTable;
            string    newIds = String.Empty;

            resultsTable = new StatisticsDAO().GetAuditedItems(applicationFilter);

            //rows = resultsTable.Select(applicationFilter + " and _assetid in (" + compliantIds + ")");

            foreach (DataRow compliantRow in resultsTable.Rows)
            {
                if (!newIds.Contains(compliantRow.ItemArray[0].ToString()))
                {
                    newIds += compliantRow.ItemArray[0].ToString() + ",";
                }
            }

            return(newIds.TrimEnd(','));
        }
示例#10
0
        /// <summary>
        /// Update the values specified for the Asset Statistics
        /// </summary>
        private void UpdateAssetStatistics()
        {
            // Get the current statistics
            StatisticsDAO awDataAccess    = new StatisticsDAO();
            DataTable     statisticsTable = awDataAccess.AssetStatistics();

            // Into an object for easier viewing
            AssetStatistics statistics = new AssetStatistics(statisticsTable.Rows[0]);

            // Update the Computer Statistics Explorer Bar
            //  Total, audited, not audited, stoc, in use ,pending, disposed
            //
            UltraExplorerBarGroup assetStatistics = overviewExplorerBar.Groups["assetstatistics"];

            if (assetStatistics == null)
            {
                return;
            }

            assetStatistics.Items["numberindatabase"].Text = StatisticTitles.ComputersDiscovered + statistics.Discovered.ToString();

            assetStatistics.Items["computersaudited"].Text = StatisticTitles.ComputersAudited + statistics.Audited.ToString();
            if (statistics.MostRecentAudit.Ticks == 0)
            {
                assetStatistics.Items["computersnotaudited"].Text = StatisticTitles.ComputerLastAudit + "No Audits Run";
            }
            else
            {
                assetStatistics.Items["computersnotaudited"].Text = StatisticTitles.ComputerLastAudit + statistics.MostRecentAudit.ToString("dd MMM HH:mm");
            }
            //
            assetStatistics.Items["assetsinstock"].Text         = StatisticTitles.AssetsInStock + statistics.Stock.ToString();
            assetStatistics.Items["assetsinuse"].Text           = StatisticTitles.AssetsInUse + statistics.InUse.ToString();
            assetStatistics.Items["assetspendingdisposal"].Text = StatisticTitles.AssetsPending + statistics.PendingDisposal.ToString();
            assetStatistics.Items["assetsdisposed"].Text        = StatisticTitles.AssetsDisposed + statistics.Disposed.ToString();

            statisticsTable = awDataAccess.AuditStatistics();
            AuditStatistics auditStatistics = new AuditStatistics(statisticsTable.Rows[0]);

            assetStatistics.Items["auditagentsdeployed"].Text = StatisticTitles.AgentsDeployed + auditStatistics.DeployedAgents.ToString();
        }
示例#11
0
        /// <summary>
        /// Update the values specified for the Alert Statistics
        /// </summary>
        private void UpdateAlertStatistics()
        {
            StatisticsDAO   awDataAccess    = new StatisticsDAO();
            DataTable       statisticsTable = awDataAccess.AlertStatistics();
            AlertStatistics statistics      = new AlertStatistics(statisticsTable.Rows[0]);

            // Update the ApplicationID Statistics Explorer Bar
            UltraExplorerBarGroup alerts = overviewExplorerBar.Groups["alerts"];

            if (alerts == null)
            {
                return;
            }

            string lastAlertDate = statistics.LastAlert.Ticks == 0 ? "<none>" : statistics.LastAlert.ToString("dd MMM HH:mm");

            alerts.Items["lastalerton"].Text     = StatisticTitles.LastAlert + lastAlertDate;
            alerts.Items["alertstoday"].Text     = StatisticTitles.AlertsToday + statistics.AlertsToday.ToString();
            alerts.Items["alertsthisweek"].Text  = StatisticTitles.AlertsThisWeek + statistics.AlertsThisWeek.ToString();
            alerts.Items["alertsthismonth"].Text = StatisticTitles.AlertsThisMonth + statistics.AlertsThisMonth.ToString();
        }
示例#12
0
        /// <summary>
        /// Update the Audit History Statistics
        /// </summary>
        private void UpdateAuditHistoryStatistics()
        {
            StatisticsDAO          awDataAccess    = new StatisticsDAO();
            DataTable              statisticsTable = awDataAccess.AuditHistoryStatisticsForDashboard();
            AuditHistoryStatistics statistics      = new AuditHistoryStatistics(statisticsTable.Rows[0]);

            // Update the ApplicationID Statistics Explorer Bar
            UltraExplorerBarGroup auditHistory = overviewExplorerBar.Groups["audithistory"];

            if (auditHistory == null)
            {
                return;
            }

            auditHistory.Items["auditedtoday"].Text = StatisticTitles.AuditedToday + statistics.AuditedToday.ToString();
            auditHistory.Items["notaudited7"].Text  = StatisticTitles.NotAudited7 + statistics.NotAudited7.ToString();
            auditHistory.Items["notaudited14"].Text = StatisticTitles.NotAudited14 + statistics.NotAudited14.ToString();
            auditHistory.Items["notaudited30"].Text = StatisticTitles.NotAudited30 + statistics.NotAudited30.ToString();
            auditHistory.Items["notaudited90"].Text = StatisticTitles.NotAudited90 + statistics.NotAudited90.ToString();
            auditHistory.Items["neveraudited"].Text = StatisticTitles.NotAudited + statistics.NotAudited.ToString();
        }
示例#13
0
        /// <summary>
        /// 根据综合条件读取客户总产值明细数据
        /// </summary>
        /// <param name="strStartTime"></param>
        /// <param name="strEndTime"></param>
        /// <param name="strCustomerName"></param>
        /// <param name="nOpStaffId"></param>
        /// <param name="strOpStaffName"></param>
        /// <param name="strErrText"></param>
        /// <returns></returns>
        public List <CustomerTotalOutputDetail> LoadCustomerTotalOutputDetailsByConditions(string strStartTime, string strEndTime, string strCustomerName, long nOpStaffId, string strOpStaffName, out string strErrText)
        {
            try
            {
                List <CustomerTotalOutputDetail> dataResult = null;
                strErrText = String.Empty;

                using (TransactionScope transScope = new TransactionScope(TransactionScopeOption.Required, new TimeSpan(2, 0, 0)))
                {
                    using (StatisticsDAO dao = new StatisticsDAO())
                    {
                        dataResult = dao.LoadCustomerTotalOutputDetailsByConditions(strStartTime, strEndTime, strCustomerName, nOpStaffId, strOpStaffName, out strErrText);
                    }
                    transScope.Complete();
                }
                return(dataResult);
            }
            catch (Exception e)
            {
                strErrText = e.Message;
                return(null);
            }
        }
示例#14
0
 /// <summary>
 /// 退回送货单重新调度
 /// </summary>
 /// <param name="nDeliverBillId"></param>
 /// <param name="nOpStaffId"></param>
 /// <param name="strOpStaffName"></param>
 /// <param name="strErrText"></param>
 /// <returns></returns>
 public bool ReturnDispatchDeliverBill(long nDeliverBillId, long nOpStaffId, string strOpStaffName, out string strErrText)
 {
     try
     {
         using (TransactionScope transScope = new TransactionScope(TransactionScopeOption.Required, new TimeSpan(2, 0, 0)))
         {
             using (StatisticsDAO dao = new StatisticsDAO())
             {
                 if (!dao.ReturnDispatchDeliverBill(nDeliverBillId, nOpStaffId, strOpStaffName, out strErrText))
                 {
                     return(false);
                 }
             }
             transScope.Complete();
         }
         return(true);
     }
     catch (Exception e)
     {
         strErrText = e.Message;
         return(false);
     }
 }
示例#15
0
        /// <summary>
        /// Called as this form is loaded
        /// </summary>
        /// <param name="sender"></param>
        /// <param name="e"></param>
        private void FormAppByLocation_Load(object sender, EventArgs e)
        {
            try
            {
                DataTable AppTable         = new StatisticsDAO().PerformQuery("SELECT DISTINCT APPLICATIONS._NAME, APPLICATIONS._PUBLISHER FROM APPLICATIONS ORDER BY APPLICATIONS._PUBLISHER");
                string    strCurrentVendor = "";
                TreeNode  AWNewTreeNode    = null;
                for (int i = 0; i < AppTable.Rows.Count; i++)
                {
                    if (strCurrentVendor != AppTable.Rows[i].ItemArray[1].ToString())
                    {
                        strCurrentVendor = AppTable.Rows[i].ItemArray[1].ToString();
                        AWNewTreeNode    = treeViewApplications.Nodes["Applications"].Nodes.Add(strCurrentVendor);
                        AWNewTreeNode.Nodes.Add(AppTable.Rows[i].ItemArray[0].ToString());
                    }
                    else
                    {
                        AWNewTreeNode.Nodes.Add(AppTable.Rows[i].ItemArray[0].ToString());
                    }
                }

                DataTable LocationTable = new StatisticsDAO().PerformQuery("SELECT LOCATIONS._NAME FROM LOCATIONS");

                for (int i = 0; i < LocationTable.Rows.Count; i++)
                {
                    treeViewLocations.Nodes["Locations"].Nodes.Add("Locations", LocationTable.Rows[i].ItemArray[0].ToString());
                }

                LoadTheLastSavedProfile();
                LoadAllItemsSelectionToTheTree();
            }
            catch (Exception Ex)
            {
                MessageBox.Show(Ex.Message);
            }
        }
示例#16
0
 public StatisticsBO()
 {
     dll = new StatisticsDAO("statisticDB");
 }
示例#17
0
        private string GetCompliantAssetIds(List <string> aReportConditions, string aAssetIds)
        {
            DataTable resultsTable = new DataTable();
            string    lReturnedIds = "";

            try
            {
                // an empty lSelectedAssets means that all assets have been selected
                if (aAssetIds == "")
                {
                    aAssetIds = new AssetDAO().GetAllAssetIdsAsString();
                }

                string lBooleanCondition = "";
                string lFilterCondition  = "";
                string lSQLString        = "SELECT _ASSETID FROM ASSETS WHERE (";

                // the user could have picked any of the audited categories
                // parse each filter condition and find the data
                foreach (string filterCondition in aReportConditions)
                {
                    string otherCompliantIds = "";

                    if (!filterCondition.StartsWith("1ST"))
                    {
                        lBooleanCondition = filterCondition.Substring(0, filterCondition.IndexOf("_category"));
                        lSQLString       += (lBooleanCondition == "And") ? ") " + lBooleanCondition + " (" : lBooleanCondition + " ";
                    }

                    lFilterCondition = filterCondition.Substring(filterCondition.IndexOf("_category"));

                    // APPLICATIONS
                    if (lFilterCondition.StartsWith("_category = 'Applications|"))
                    {
                        otherCompliantIds = HandleApplications(lFilterCondition, aAssetIds);
                    }
                    // USER-DEFINED DATA
                    else if (lFilterCondition.StartsWith("_category = 'UserData|"))
                    {
                        otherCompliantIds = HandleUserData(lFilterCondition);
                    }
                    // ASSET DETAILS
                    else if (lFilterCondition.StartsWith("_category = 'Asset Details'"))
                    {
                        otherCompliantIds = HandleAssetDetailsData(lFilterCondition);
                    }
                    // OPERATING SYSTEMS
                    else if (lFilterCondition.StartsWith("_category = 'Operating Systems'"))
                    {
                        otherCompliantIds = HandleOSData(lFilterCondition);
                    }
                    // SYSTEM PATCHES
                    else if (lFilterCondition.StartsWith("_category = 'System|Patches|"))
                    {
                        otherCompliantIds = HandlePatchesData(lFilterCondition);
                    }
                    // AUDITEDITEMS
                    else
                    {
                        otherCompliantIds = HandleAuditedItemsData(lFilterCondition);
                    }

                    otherCompliantIds = (otherCompliantIds == "") ? "''" : otherCompliantIds;
                    lSQLString       += String.Format("_ASSETID IN ({0}) ", otherCompliantIds);
                }

                lSQLString = lSQLString.Trim();

                // if we have only included Or statements we'll need to add a trailing bracket here
                if (CountOccurencesOfChar(lSQLString, '(') > CountOccurencesOfChar(lSQLString, ')'))
                {
                    lSQLString += ")";
                }

                lSQLString += String.Format(" AND _ASSETID IN ({0})", aAssetIds);

                DataTable lDataTable = new StatisticsDAO().PerformQuery(lSQLString);


                foreach (DataRow compliantRow in lDataTable.Rows)
                {
                    if (!lReturnedIds.Contains(compliantRow.ItemArray[0].ToString()))
                    {
                        lReturnedIds += compliantRow.ItemArray[0].ToString() + ",";
                    }
                }

                lReturnedIds = lReturnedIds.TrimEnd(',');
            }
            catch (Exception ex)
            {
                logger.Error(ex.Message);
            }

            return(lReturnedIds);
        }
示例#18
0
        private DataTable ReportDataDrilldown(string aRowLabel)
        {
            DataTable     reportDataSet  = new DataTable();
            StatisticsDAO lStatisticsDAO = new StatisticsDAO();

            string reportName = "";

            if (aRowLabel.StartsWith("Compliance : "))
            {
                reportName = aRowLabel.Substring(13);
            }
            else if (aRowLabel.StartsWith("Installations for : "))
            {
                reportName = aRowLabel.Substring(20);
            }
            else
            {
                reportName  = aRowLabel.Substring(0, aRowLabel.IndexOf(":"));
                reportName += ": ";
            }

            switch (reportName)
            {
            case StatisticTitles.ComputersDiscovered:
                reportDataSet = lStatisticsDAO.ComputersDiscovered();
                break;

            case StatisticTitles.ComputersAudited:
                reportDataSet = lStatisticsDAO.ComputersAudited();
                break;

            case StatisticTitles.ComputerLastAudit:
                reportDataSet = lStatisticsDAO.ComputerLastAudit();
                break;

            case StatisticTitles.AssetsInStock:
                reportDataSet = lStatisticsDAO.AssetsInStock();
                break;

            case StatisticTitles.AssetsInUse:
                reportDataSet = lStatisticsDAO.AssetsInUse();
                break;

            case StatisticTitles.AssetsPending:
                reportDataSet = lStatisticsDAO.AssetsPending();
                break;

            case StatisticTitles.AssetsDisposed:
                reportDataSet = lStatisticsDAO.AssetsDisposed();
                break;

            case StatisticTitles.AgentsDeployed:
                reportDataSet = lStatisticsDAO.AgentsDeployed();
                break;

            case StatisticTitles.UniqueApplications:
                reportDataSet = lStatisticsDAO.UniqueApplications();
                break;

            case StatisticTitles.TotalApplications:
                reportDataSet = lStatisticsDAO.TotalApplications();
                break;

            case StatisticTitles.AuditedToday:
                reportDataSet = lStatisticsDAO.AuditedToday();
                break;

            case StatisticTitles.NotAudited7:
                reportDataSet = lStatisticsDAO.NotAudited7();
                break;

            case StatisticTitles.NotAudited14:
                reportDataSet = lStatisticsDAO.NotAudited14();
                break;

            case StatisticTitles.NotAudited30:
                reportDataSet = lStatisticsDAO.NotAudited30();
                break;

            case StatisticTitles.NotAudited90:
                reportDataSet = lStatisticsDAO.NotAudited90();
                break;

            case StatisticTitles.NotAudited:
                reportDataSet = lStatisticsDAO.NotAudited();
                break;

            case StatisticTitles.LastAlert:
                reportDataSet = lStatisticsDAO.LastAlert();
                break;

            case StatisticTitles.OutstandingAlerts:
                reportDataSet = lStatisticsDAO.StatisticsAssetsStatusDrilldown(aRowLabel);
                break;

            case StatisticTitles.AlertsToday:
                reportDataSet = lStatisticsDAO.AlertsToday();
                break;

            case StatisticTitles.AlertsThisWeek:
                reportDataSet = lStatisticsDAO.AlertsThisWeek();
                break;

            case StatisticTitles.AlertsThisMonth:
                reportDataSet = lStatisticsDAO.AlertsThisMonth();
                break;

            case StatisticTitles.SupportExpired:
                reportDataSet = lStatisticsDAO.SupportExpired();
                break;

            case StatisticTitles.SupportExpireToday:
                reportDataSet = lStatisticsDAO.SupportExpireToday();
                break;

            case StatisticTitles.SupportExpireThisWeek:
                reportDataSet = lStatisticsDAO.SupportExpireThisWeek();
                break;

            case StatisticTitles.SupportExpireThisMonth:
                reportDataSet = lStatisticsDAO.SupportExpireThisMonth();
                break;

            case StatisticTitles.SupportExpiredAsset:
                reportDataSet = lStatisticsDAO.SupportExpiredAsset();
                break;

            case StatisticTitles.SupportExpireTodayAsset:
                reportDataSet = lStatisticsDAO.SupportExpireTodayAsset();
                break;

            case StatisticTitles.SupportExpireThisWeekAsset:
                reportDataSet = lStatisticsDAO.SupportExpireThisWeekAsset();
                break;

            case StatisticTitles.SupportExpireThisMonthAsset:
                reportDataSet = lStatisticsDAO.SupportExpireThisMonthAsset();
                break;

            case "Compliant":
            case "Non-Compliant":
            case "Ignored":
            case "Not Defined":
                reportDataSet = lStatisticsDAO.StatisticsComplianceDrilldown(reportName);
                break;

            default:
                AssetDAO lAssetDAO        = new AssetDAO();
                string   lVersion         = (reportName.EndsWith(")")) ? reportName.Substring(reportName.LastIndexOf('(') + 2).TrimEnd(')') : "";
                string   lApplicationName = (lVersion == "") ? reportName : reportName.Substring(0, reportName.LastIndexOf(" ("));
                //reportDataSet = lAssetDAO.FindAssetByApplicationNameAndVersion(lApplicationName, lVersion, lAssetDAO.GetAllAssetIdsAsString());

                // CMD 8.4.2.3 - Why pass in all asset IDS???  A null string is better from what I can see
                reportDataSet = lAssetDAO.FindAssetByApplicationNameAndVersion(lApplicationName, lVersion, "");
                break;
            }

            return(reportDataSet);
        }
示例#19
0
 public StatisticsBO()
 {
     dll = new StatisticsDAO("statisticDB");
 }
示例#20
0
 public virtual JsonFlexiGridData QueryTime(SearchStatisticOnlineTime view)
 {
     dll = new StatisticsDAO("mainDB");
     return dll.QueryTime3(view);
 }
        private UltraChart CreateNewColumnChart(UltraChart lColumnChart)
        {
            try
            {
                lColumnChart.Dock      = DockStyle.Fill;
                lColumnChart.ChartType = Infragistics.UltraChart.Shared.Styles.ChartType.ColumnChart;

                lColumnChart.ColumnChart.SeriesSpacing = 0;
                lColumnChart.ColumnChart.NullHandling  = Infragistics.UltraChart.Shared.Styles.NullHandling.InterpolateSimple;

                Infragistics.UltraChart.Resources.Appearance.ChartTextAppearance chartTextAppearance = new Infragistics.UltraChart.Resources.Appearance.ChartTextAppearance();

                chartTextAppearance.ChartTextFont    = new System.Drawing.Font("Verdana", 8F);
                chartTextAppearance.Column           = 0;
                chartTextAppearance.ItemFormatString = "<DATA_VALUE:00.00>";
                chartTextAppearance.Row             = -2;
                chartTextAppearance.VerticalAlign   = StringAlignment.Center;
                chartTextAppearance.HorizontalAlign = StringAlignment.Near;
                lColumnChart.BarChart.ChartText.Add(chartTextAppearance);

                lColumnChart.Axis.Y.Labels.Font                         = new System.Drawing.Font("Verdana", 8F);
                lColumnChart.Axis.Y.Labels.FontColor                    = System.Drawing.Color.DimGray;
                lColumnChart.Axis.Y.Labels.HorizontalAlign              = System.Drawing.StringAlignment.Far;
                lColumnChart.Axis.Y.Labels.ItemFormatString             = "<DATA_VALUE:0.##>";
                lColumnChart.Axis.Y.Labels.Layout.Behavior              = Infragistics.UltraChart.Shared.Styles.AxisLabelLayoutBehaviors.Auto;
                lColumnChart.Axis.Y.Labels.Orientation                  = Infragistics.UltraChart.Shared.Styles.TextOrientation.Horizontal;
                lColumnChart.Axis.Y.Labels.SeriesLabels.Font            = new System.Drawing.Font("Verdana", 8F);
                lColumnChart.Axis.Y.Labels.SeriesLabels.FontColor       = System.Drawing.Color.DimGray;
                lColumnChart.Axis.Y.Labels.SeriesLabels.HorizontalAlign = System.Drawing.StringAlignment.Center;
                lColumnChart.Axis.Y.Labels.SeriesLabels.Layout.Behavior = Infragistics.UltraChart.Shared.Styles.AxisLabelLayoutBehaviors.Auto;
                lColumnChart.Axis.Y.Labels.SeriesLabels.Orientation     = Infragistics.UltraChart.Shared.Styles.TextOrientation.VerticalLeftFacing;
                lColumnChart.Axis.Y.Labels.SeriesLabels.VerticalAlign   = System.Drawing.StringAlignment.Center;
                lColumnChart.Axis.Y.Labels.VerticalAlign                = System.Drawing.StringAlignment.Center;
                lColumnChart.Axis.Y.LineThickness                       = 1;
                lColumnChart.Axis.Y.MajorGridLines.AlphaLevel           = ((byte)(255));
                lColumnChart.Axis.Y.MajorGridLines.Color                = System.Drawing.Color.Gainsboro;
                lColumnChart.Axis.Y.MajorGridLines.DrawStyle            = Infragistics.UltraChart.Shared.Styles.LineDrawStyle.Solid;
                lColumnChart.Axis.Y.MajorGridLines.Visible              = true;
                lColumnChart.Axis.Y.MinorGridLines.AlphaLevel           = ((byte)(200));
                lColumnChart.Axis.Y.MinorGridLines.Color                = System.Drawing.Color.LightGray;
                lColumnChart.Axis.Y.MinorGridLines.DrawStyle            = Infragistics.UltraChart.Shared.Styles.LineDrawStyle.Dot;
                lColumnChart.Axis.Y.MinorGridLines.Visible              = true;
                lColumnChart.Axis.Y.TickmarkInterval                    = 40;
                lColumnChart.Axis.Y.TickmarkStyle                       = Infragistics.UltraChart.Shared.Styles.AxisTickStyle.Smart;
                lColumnChart.Axis.Y.Visible           = true;
                lColumnChart.Axis.X.Margin.Near.Value = 0;
                lColumnChart.Axis.Y.Margin.Far.Value  = 2;

                lColumnChart.Axis.X.Labels.ItemFormatString = String.Empty;

                lColumnChart.Axis.X.Labels.Layout.Behavior = Infragistics.UltraChart.Shared.Styles.AxisLabelLayoutBehaviors.Auto;
                lColumnChart.Axis.Y.Labels.Layout.Behavior = Infragistics.UltraChart.Shared.Styles.AxisLabelLayoutBehaviors.Auto;

                // title
                lColumnChart.TitleBottom.Visible      = false;
                lColumnChart.TitleTop.Font            = new System.Drawing.Font("Verdana", 12.75F, ((System.Drawing.FontStyle)((System.Drawing.FontStyle.Regular))));
                lColumnChart.TitleTop.HorizontalAlign = System.Drawing.StringAlignment.Center;
                lColumnChart.TitleTop.Visible         = false;

                // colours
                lColumnChart.BackgroundImageLayout = System.Windows.Forms.ImageLayout.Center;
                lColumnChart.Border.Color          = System.Drawing.Color.FromArgb(((int)(((byte)(170)))), ((int)(((byte)(173)))), ((int)(((byte)(187)))));

                lColumnChart.ColorModel.AlphaLevel = ((byte)(200));
                lColumnChart.ColorModel.ColorBegin = System.Drawing.Color.Red;
                lColumnChart.ColorModel.ColorEnd   = System.Drawing.Color.Red;
                lColumnChart.ColorModel.ModelStyle = ColorModels.CustomLinear;
                //lColumnChart.ColorModel.Scaling = ColorScaling.None;

                Infragistics.UltraChart.Resources.Appearance.GradientEffect gradientEffect1 = new Infragistics.UltraChart.Resources.Appearance.GradientEffect();

                gradientEffect1.Coloring = Infragistics.UltraChart.Shared.Styles.GradientColoringStyle.Lighten;
                gradientEffect1.Style    = Infragistics.UltraChart.Shared.Styles.GradientStyle.BackwardDiagonal;
                lColumnChart.Effects.Effects.Add(gradientEffect1);

                lColumnChart.Data.UseRowLabelsColumn = false;

                // tooltips
                lColumnChart.Tooltips.Font                  = new System.Drawing.Font("Verdana", 8F);
                lColumnChart.Tooltips.FormatString          = " <SERIES_LABEL> (<DATA_VALUE>) ";
                lColumnChart.Tooltips.HighlightFillColor    = System.Drawing.Color.LightBlue;
                lColumnChart.Tooltips.HighlightOutlineColor = System.Drawing.Color.LightBlue;

                lColumnChart.Axis.X.Labels.SeriesLabels.Font      = new System.Drawing.Font("Verdana", 8F);
                lColumnChart.Axis.X.Labels.SeriesLabels.FontColor = System.Drawing.Color.DimGray;

                lColumnChart.InvalidDataReceived += new Infragistics.UltraChart.Shared.Events.ChartDataInvalidEventHandler(lChart_InvalidDataReceived);
                lColumnChart.ChartDrawItem       += new Infragistics.UltraChart.Shared.Events.ChartDrawItemEventHandler(lColumnChart_ChartDrawItem);
                lColumnChart.ChartDataClicked    += new Infragistics.UltraChart.Shared.Events.ChartDataClickedEventHandler(this.complianceChart_ChartDataClicked);

                DataTable reportData = new StatisticsDAO().StatisticsComplianceByType("", "");

                lColumnChart.Axis.Y.RangeType = Infragistics.UltraChart.Shared.Styles.AxisRangeType.Custom;

                double yMax = 0;

                foreach (DataRow row in reportData.Rows)
                {
                    double value = Math.Abs(Convert.ToDouble(row.ItemArray[1]));

                    if (value > yMax)
                    {
                        yMax = value;
                    }
                }

                lColumnChart.Axis.Y.RangeMax = yMax;
                lColumnChart.Axis.Y.RangeMin = 0;
                lColumnChart.DataSource      = reportData;
            }
            catch (Exception ex)
            {
                //logger.Error(ex.Message);
            }

            return(lColumnChart);
        }
        private UltraChart CreateNewStackColumnChart(string reportType)
        {
            UltraChart lStackColumnChart = new UltraChart();

            try
            {
                lStackColumnChart.Dock              = DockStyle.Fill;
                lStackColumnChart.ChartType         = ChartType.StackColumnChart;
                lStackColumnChart.Tooltips.Overflow = TooltipOverflow.ChartArea;

                lStackColumnChart.ColumnChart.SeriesSpacing = 1;

                Infragistics.UltraChart.Resources.Appearance.ChartTextAppearance chartTextAppearance = new Infragistics.UltraChart.Resources.Appearance.ChartTextAppearance();
                Infragistics.UltraChart.Resources.Appearance.StackAppearance     stackAppearance     = new Infragistics.UltraChart.Resources.Appearance.StackAppearance();

                chartTextAppearance.ChartTextFont    = new Font("Verdana", 8F);
                chartTextAppearance.Column           = 0;
                chartTextAppearance.ItemFormatString = "<DATA_VALUE:00.00>";
                chartTextAppearance.Row             = -2;
                chartTextAppearance.VerticalAlign   = StringAlignment.Center;
                chartTextAppearance.HorizontalAlign = StringAlignment.Near;
                lStackColumnChart.BarChart.ChartText.Add(chartTextAppearance);

                lStackColumnChart.Axis.BackColor = Color.White;

                lStackColumnChart.Axis.Y.Labels.Font                         = new Font("Verdana", 8F);
                lStackColumnChart.Axis.Y.Labels.FontColor                    = Color.DimGray;
                lStackColumnChart.Axis.Y.Labels.HorizontalAlign              = StringAlignment.Far;
                lStackColumnChart.Axis.Y.Labels.ItemFormatString             = "<DATA_VALUE:0.##>";
                lStackColumnChart.Axis.Y.Labels.Layout.Behavior              = AxisLabelLayoutBehaviors.Auto;
                lStackColumnChart.Axis.Y.Labels.Orientation                  = TextOrientation.Horizontal;
                lStackColumnChart.Axis.Y.Labels.SeriesLabels.Font            = new Font("Verdana", 8F);
                lStackColumnChart.Axis.Y.Labels.SeriesLabels.FontColor       = Color.DimGray;
                lStackColumnChart.Axis.Y.Labels.SeriesLabels.HorizontalAlign = StringAlignment.Center;
                lStackColumnChart.Axis.Y.Labels.SeriesLabels.Layout.Behavior = AxisLabelLayoutBehaviors.Auto;
                lStackColumnChart.Axis.Y.Labels.SeriesLabels.Orientation     = TextOrientation.VerticalLeftFacing;
                lStackColumnChart.Axis.Y.Labels.SeriesLabels.VerticalAlign   = StringAlignment.Center;
                lStackColumnChart.Axis.Y.Labels.VerticalAlign                = StringAlignment.Center;
                lStackColumnChart.Axis.Y.LineThickness                       = 1;
                lStackColumnChart.Axis.Y.MajorGridLines.AlphaLevel           = 255;
                lStackColumnChart.Axis.Y.MajorGridLines.Color                = Color.Gainsboro;
                lStackColumnChart.Axis.Y.MajorGridLines.DrawStyle            = LineDrawStyle.Solid;
                lStackColumnChart.Axis.Y.MajorGridLines.Visible              = true;
                lStackColumnChart.Axis.Y.MinorGridLines.AlphaLevel           = 200;
                lStackColumnChart.Axis.Y.MinorGridLines.Color                = Color.LightGray;
                lStackColumnChart.Axis.Y.MinorGridLines.DrawStyle            = LineDrawStyle.Dot;
                lStackColumnChart.Axis.Y.MinorGridLines.Visible              = true;
                lStackColumnChart.Axis.Y.TickmarkInterval                    = 40;
                lStackColumnChart.Axis.Y.TickmarkStyle                       = AxisTickStyle.Smart;
                lStackColumnChart.Axis.Y.Visible = true;

                //lStackColumnChart.Axis.X.Margin.Near.Value = 0.74626865671641784;
                lStackColumnChart.Axis.Y.Margin.Far.Value = 2;

                lStackColumnChart.Axis.X.Extent = 13;
                lStackColumnChart.Axis.Y.Extent = 30;

                lStackColumnChart.Axis.X.Labels.ItemFormatString = String.Empty;

                lStackColumnChart.Axis.X.Labels.SeriesLabels.Font      = new Font("Verdana", 8F);
                lStackColumnChart.Axis.X.Labels.SeriesLabels.FontColor = Color.DimGray;

                lStackColumnChart.Axis.X.Labels.Layout.Behavior = AxisLabelLayoutBehaviors.Auto;
                lStackColumnChart.Axis.Y.Labels.Layout.Behavior = AxisLabelLayoutBehaviors.Auto;

                // title
                lStackColumnChart.TitleBottom.Visible      = false;
                lStackColumnChart.TitleTop.Font            = new Font("Verdana", 12.75F, FontStyle.Regular);
                lStackColumnChart.TitleTop.HorizontalAlign = StringAlignment.Center;
                lStackColumnChart.TitleTop.Visible         = false;

                lStackColumnChart.Tooltips.Font                  = new Font("Calibri", 8.25F);
                lStackColumnChart.Tooltips.FormatString          = " <SERIES_LABEL>, <ITEM_LABEL>: <DATA_VALUE> ";
                lStackColumnChart.Tooltips.HighlightFillColor    = Color.LightBlue;
                lStackColumnChart.Tooltips.HighlightOutlineColor = Color.LightBlue;

                // colours
                lStackColumnChart.BackgroundImageLayout = ImageLayout.Center;
                lStackColumnChart.Border.Color          = Color.FromArgb(170, 173, 187);
                //lStackColumnChart.ColorModel.AlphaLevel = ((byte)(255));

                lStackColumnChart.ColorModel.AlphaLevel = 200;
                lStackColumnChart.ColorModel.ColorBegin = Color.Red;
                lStackColumnChart.ColorModel.ColorEnd   = Color.Red;
                lStackColumnChart.ColorModel.ModelStyle = ColorModels.CustomLinear;
                //lColumnChart.ColorModel.Scaling = ColorScaling.None;

                Infragistics.UltraChart.Resources.Appearance.GradientEffect gradientEffect1 = new Infragistics.UltraChart.Resources.Appearance.GradientEffect();

                gradientEffect1.Coloring = GradientColoringStyle.Lighten;
                gradientEffect1.Style    = GradientStyle.BackwardDiagonal;
                lStackColumnChart.Effects.Effects.Add(gradientEffect1);

                // use different colour depending on report type
                DataTable reportData;

                if (reportType == "Under-Licensed Applications")
                {
                    reportData = new StatisticsDAO().StatisticsUnderLicensedApplicationsForDashboard();
                    lStackColumnChart.ColorModel.ColorBegin = Color.FromArgb(211, 78, 78);
                }
                else
                {
                    reportData = new StatisticsDAO().StatisticsOverLicensedApplicationsForDashboard();
                    lStackColumnChart.ColorModel.ColorBegin = Color.FromArgb(151, 189, 100);
                }

                lStackColumnChart.ColorModel.ModelStyle = ColorModels.Office2007Style;
                lStackColumnChart.ColorModel.Scaling    = ColorScaling.Decreasing;

                lStackColumnChart.Data.UseRowLabelsColumn = false;
                lStackColumnChart.EmptyChartText          = "";
                lStackColumnChart.InvalidDataReceived    += lChart_InvalidDataReceived;
                lStackColumnChart.ChartDataClicked       += licenseChart_ChartDataClicked;

                lStackColumnChart.DataSource = reportData;
            }
            catch (Exception ex)
            {
                //logger.Error(ex.Message);
            }

            return(lStackColumnChart);
        }
示例#23
0
 public virtual JsonFlexiGridData QueryTime(SearchStatisticOnlineTime view)
 {
     dll = new StatisticsDAO("mainDB");
     return(dll.QueryTime3(view));
 }