コード例 #1
0
        /// <summary>
        /// Instanciate a new balance day object and loads with base information
        /// </summary>
        private async void StartReportBalanceDayConfiguration()
        {
            if (balanceOfOperators == null)
            {
                currentOperatorFilter = oprAllOperators;
                currentHourFilter     = basicHourFilter;
                currentTimeFiltering  = TimeFilteringReport.QuartersAndTotals;
                // Generate a new Report Data Source
                if (rptDataSourceBalanceDay == null)
                {
                    rptDataSourceBalanceDay = new ReportDataSource();
                }
                rptDataSourceBalanceDay.Name = "dsBalanceToday";
                rptBalanceTotals.LocalReport.DataSources.Add(rptDataSourceBalanceDay);
                rptBalanceTotals.LocalReport.ReportEmbeddedResource = "UIBackoffice.Reports.RptBalanceTodayWithQuarters.rdlc";
                rptBalanceTotals.ShowBackButton             = false;
                rptBalanceTotals.ShowDocumentMapButton      = false;
                rptBalanceTotals.ShowPageNavigationControls = false;
                rptBalanceTotals.ShowRefreshButton          = false;
                rptBalanceTotals.ShowStopButton             = false;
                balanceOfOperators = new Logica.Balance();
                await balanceOfOperators.Generate(lstDetailedOperators.GetOperatorList());

                rptDataSourceBalanceDay.Value = balanceOfOperators.List;
                ActivateTimeFiltering();
                // Load initial information
                LoadReportInformation();
            }
        }
コード例 #2
0
 private void FillHourComboByOperator()
 {
     // Deactivate selection change event
     cboHourReportFiltering.SelectionChanged -= CboHourReportFiltering_SelectionChanged;
     if (currentOperatorFilter == oprAllOperators)
     {
         cboHourReportFiltering.ItemsSource = lstHourFilter;
     }
     else
     {
         // Gets current operator filtered
         OperatorReport opReportFiltered = cboOperatorReportFiltering.SelectedItem as OperatorReport;
         // Gets Operator Backoffice entity
         OperBackoffice operboFilter = lstDetailedOperators.First((opbo) => opbo.UserName == opReportFiltered.UserName);
         // Get Hour of start and end
         int opboStartHour = operboFilter.StartTime.Hour;
         int opboEndHour   = operboFilter.EndTime.Hour;
         // Loads combo of hours with operation time of seleceted operator
         cboHourReportFiltering.ItemsSource = lstHourFilter.Where((hrFlt) => (hrFlt.IntValue >= opboStartHour && hrFlt.IntValue < opboEndHour) || hrFlt.IntValue == basicHourFilter.IntValue).ToList();
     }
     // Change index of filter
     cboHourReportFiltering.SelectedItem = basicHourFilter;
     currentHourFilter = basicHourFilter;
     // Activate selectión changed event
     cboHourReportFiltering.SelectionChanged += CboHourReportFiltering_SelectionChanged;
 }
コード例 #3
0
        /// <summary>
        /// Controls report filtering by operators
        /// </summary>
        /// <param name="sender"></param>
        /// <param name="e"></param>
        private void CboOperatorReportFiltering_SelectionChanged(object sender, SelectionChangedEventArgs e)
        {
            OperatorReport selectedOperator = cboOperatorReportFiltering.SelectedItem as OperatorReport;

            if (selectedOperator != null)
            {
                SetReportFiltering(selectedOperator);
            }
        }
コード例 #4
0
 private void SetReportFiltering(OperatorReport prmOperatorToFilter)
 {
     // Stop timer checking
     StopTimerToCheckHourChange();
     if (currentOperatorFilter != prmOperatorToFilter)
     {
         // Save current operator in local Variable
         currentOperatorFilter = prmOperatorToFilter;
         // Set hour combo with user related times
         FillHourComboByOperator();
         // Load and refresh report
         LoadReportInformation();
     }
 }
コード例 #5
0
        /// <summary>
        /// Gets the reports.
        /// </summary>
        /// <param name="filter">The filter.</param>
        /// <returns></returns>
        public IEnumerable <OperatorReport> GetReports(ReportFilter filter)
        {
            var result = new List <OperatorReport>();

            //TODO: roll in ORM like EF or Dapper for Db access
            using (var conn =
                       new SqlConnection(
                           "Data Source=PHOENIX\\SQLEXPRESS;Initial Catalog=chat;User id=chat;Password=chat;") //TODO: move sensitive info like connection strings out
                   )
            {
                conn.Open();

                using (var sqlcomm =
                           new SqlCommand("dbo.OperatorProductivity ", conn))
                {
                    sqlcomm.CommandType = CommandType.StoredProcedure;

                    sqlcomm.Parameters.Add("@SelWeb", SqlDbType.VarChar).Value = filter.SelectedWebsite;
                    sqlcomm.Parameters.Add("@SelDev", SqlDbType.VarChar).Value = filter.SelectedDevice;
                    sqlcomm.Parameters.Add("@From", SqlDbType.DateTime).Value  = filter.SelectedFromDate;
                    sqlcomm.Parameters.Add("@To", SqlDbType.DateTime).Value    = filter.SelectedToDate;

                    using (var dr = sqlcomm.ExecuteReader())
                    {
                        while (dr.Read())
                        {
                            var opVM = new OperatorReport
                            {
                                Id                    = Convert.ToInt32(dr[0]),
                                Name                  = Convert.ToString(dr[1]),
                                ProactiveSent         = Convert.ToInt32(dr[2]),
                                ProactiveAnswered     = Convert.ToInt32(dr[3]),
                                ProactiveResponseRate = Convert.ToInt32(dr[4]),
                                ReactiveReceived      = Convert.ToInt32(dr[5]),
                                ReactiveAnswered      = Convert.ToInt32(dr[6]),
                                ReactiveResponseRate  = Convert.ToInt32(dr[7]),
                                TotalChatLength       = Convert.ToString(dr[8]),
                                AverageChatLength     = Convert.ToString(dr[9])
                            };

                            result.Add(opVM);
                        }
                    }
                }
            }

            return(result);
        }
コード例 #6
0
        /// <summary>
        /// Generates the row for child part detail.
        /// </summary>
        /// <param name="report">The report.</param>
        /// <returns></returns>
        private Row GenerateRowForChildPartDetail(OperatorReport report)
        {
            var tRow = new Row();

            tRow.Append(CreateCell(report.Id.ToString()));
            tRow.Append(CreateCell(report.Name));
            tRow.Append(CreateCell(report.ProactiveSent.ToString()));
            tRow.Append(CreateCell(report.ProactiveAnswered.ToString()));
            tRow.Append(CreateCell(report.ProactiveResponseRate.ToString()));
            tRow.Append(CreateCell(report.ReactiveReceived.ToString()));
            tRow.Append(CreateCell(report.ReactiveAnswered.ToString()));
            tRow.Append(CreateCell(report.ReactiveResponseRate.ToString()));
            tRow.Append(CreateCell(report.TotalChatLength ?? "-"));
            tRow.Append(CreateCell(report.AverageChatLength ?? "-"));

            return(tRow);
        }