Esempio n. 1
0
        private void RefreshTimeReport()
        {
            tbFromDate.Text = _fromDate.ToShortDateString();
            tbToDate.Text   = _toDate.ToShortDateString();

            var bw = new BackgroundWorker();

            bw.RunWorkerCompleted +=
                (sender, args) =>
                ((TimeReportViewModel)this.DataContext).LoadTimeReport(Reporting.BuildTimeReport(_fromDate,
                                                                                                 _toDate, SortOrder.DateOldestToNewest));
            bw.RunWorkerAsync();
        }
Esempio n. 2
0
        /// <summary>
        /// Sends the service report.
        /// </summary>
        private void SendServiceReport()
        {
            var      from = new DateTime(DateTime.Today.Year, DateTime.Today.Month, 1).AddMonths(-1);
            DateTime tod  = new DateTime(from.Year, from.Month, 1).AddMonths(1).AddDays(-1);

            string body = string.Format(StringResources.MainPage_Report_Header, from);

            TimeData[] entries = Reporting.BuildTimeReport(from, tod, SortOrder.DateOldestToNewest);

            int tTime = 0;
            int tMags = 0;
            int tBks  = 0;
            int tBros = 0;
            int tRv   = 0;
            int tBs   = 0;
            int tTs   = 0;

            foreach (TimeData e in entries)
            {
                tTime += e.Minutes;
                tMags += e.Magazines;
                tBks  += e.Books;
                tBros += e.Brochures;
                tRv   += e.ReturnVisits;
                tBs   += e.BibleStudies;
                tTs   += e.Tracts;
            }

            body += string.Format(StringResources.MainPage_Report_Hours, ((double)tTime / 60.0));
            var x = RBCTimeDataInterface.GetMonthRBCTimeTotal(from);

            body += x > 0 ? string.Format(StringResources.MainPage_Report_AuxHours, ((double)x / 60.0)) : string.Empty;
            body += tMags > 0 ? string.Format(StringResources.MainPage_Report_Mags, tMags) : string.Empty;
            body += tBks > 0 ? string.Format(StringResources.MainPage_Report_Books, tBks) : string.Empty;
            body += tBros > 0 ? string.Format(StringResources.MainPage_Report_Brochures, tBros) : string.Empty;
            body += tTs > 0 ? string.Format(StringResources.MainPage_Report_Tracts, tTs) : string.Empty;
            body += tRv > 0 ? string.Format(StringResources.MainPage_Report_RVs, tRv) : string.Empty;
            body += tBs > 0 ? string.Format(StringResources.MainPage_Report_BibleStudies, tBs) : string.Empty;


            Reporting.SendReport(body);
        }