Exemplo n.º 1
0
 private void setMaxTotalValues(PaymentReportViewModel viewModel) {
     IDictionary<string, PaymentReportViewModel.LocationMax> deps = new Dictionary<string, PaymentReportViewModel.LocationMax>();
     IDictionary<string, PaymentReportViewModel.LocationMax> dests = new Dictionary<string, PaymentReportViewModel.LocationMax>();
     PaymentReportData lastReport = viewModel.ReportData.Last();
     viewModel.MaxBookings = lastReport.TotalBookings;
     viewModel.MaxSales = lastReport.TotalSales;
     foreach (var v in lastReport.Departures) {
         PaymentReportViewModel.LocationMax locMax = new PaymentReportViewModel.LocationMax();
         locMax.MaxTotal = v.Value;
         deps.Add(v.Key, locMax);
     }
     foreach (var v in lastReport.Destinations) {
         PaymentReportViewModel.LocationMax locMax = new PaymentReportViewModel.LocationMax();
         locMax.MaxTotal = v.Value;
         dests.Add(v.Key, locMax);
     }
     viewModel.DepartureMax = deps;
     viewModel.DestinationMax = dests;
 }
Exemplo n.º 2
0
        //
        // GET: /Report/?Page=..

        public ActionResult Index([Optional, DefaultParameterValue("1")]string Page) {
            int pageSize = ConfigUtil.GetInt("ListPageSize");
            int pageStart = Util.GetPageStart(Page, pageSize);
            PaymentReportViewModel viewModel = new PaymentReportViewModel();
			using(IFinanceDao dao = DaoFactory.Instance.GetFinanceDao()) {
				PaymentReportPage prp = dao.GetReportPage(User.Identity.Name, pageStart, pageSize);
                
                List<PaymentReportData> reportData = new List<PaymentReportData>();
                if (prp.ReportsAsXml != null && prp.ReportsAsXml.Count > 0) {
                    foreach (string s in prp.ReportsAsXml) {
                        reportData.Add(PaymentReportData.FromXML(s));
                    }
                    viewModel.ReportData = reportData.ToArray();
                    setMaxTotalValues(viewModel);
                    setMaxDeltaValues(viewModel);
                }
                viewModel.Page = prp;
            }
            return View(viewModel);
        }
Exemplo n.º 3
0
 private void setMaxDeltaValues(PaymentReportViewModel viewModel) {
     PaymentReportData prev = null;
     foreach (var rd in viewModel.ReportData) {
         if (prev != null) {
             int deltaBookings = rd.TotalBookings - prev.TotalBookings;
             decimal deltaSales = rd.TotalSales - prev.TotalSales;
             foreach (var v in rd.Departures) {
                 int delta = v.Value;
                 if (prev.Departures.ContainsKey(v.Key)) {
                     delta = v.Value - prev.Departures[v.Key];
                 }
             }
             foreach (var v in rd.Destinations) {
                 int delta = v.Value;
                 if (prev.Destinations.ContainsKey(v.Key)) {
                     delta = v.Value - prev.Destinations[v.Key];
                 }
             }
         }
         prev = rd;
     }
 }