示例#1
0
        /// <summary>
        /// Prcoess the incoming report data event message, and creates and shows an instance of the report popup window with the appropriate chart.
        /// It uses the service locator to get an instance of the report popup window.
        /// </summary>
        /// <param name="eventPayLoad"> the GreeksByCategoryReportEventPayLoad event sent by the ReportDataManagerImpl.</param>
        /// <exception cref="ArgumentNullException"> thrown if the eventpayload parameter is null.</exception>
        private void HandleGreeksByCategoryReportEvent(GreeksByCategoryReportEventPayLoad eventPayLoad)
        {
            if (eventPayLoad == null)
            {
                throw new ArgumentNullException("eventPayLoad");
            }

            if (eventPayLoad.GreeksByCategory.Count == 0)
            {
                MessageBox.Show("No greek data returned for the selected criteria!", "No Report Data To Display",
                                MessageBoxButton.OK, MessageBoxImage.Information);

                return;
            }

            var reportViewModel = new GeneratedReportViewModel
            {
                ReportTitle = "Graph Of Greeks By " + eventPayLoad.Category + " :",
                ReportType  = eventPayLoad.ReportType,
            };

            foreach (var greeksBelongingToACatgeory in eventPayLoad.GreeksByCategory)
            {
                var listOfCategorizedgreeks = greeksBelongingToACatgeory.Value.ToList();
                listOfCategorizedgreeks.Sort(new StringKeyComparer());
                reportViewModel.AddSeries(greeksBelongingToACatgeory.Key, listOfCategorizedgreeks);
            }

            var reportWindow = ServiceLocator.Current.GetInstance <IWindowPopup>(WindowPopupNames.REPORT_WINDOW_POPUP);

            reportWindow.ShowWindow(reportViewModel);
        }
示例#2
0
        /// <summary>
        /// Requests the greeks per category report data from the web services back-end and sends this data along with other parameter information
        /// to the report generation viewmodel by publishing an GreeksByCategoryReportEvent through the event aggregator.
        /// </summary>
        /// <param name="reportType"> the type of report - bar chart, pie chart, etc.</param>
        /// <param name="categoryType"> the category by which the RFQs will be grouped - this is passed onto the web service.</param>
        /// <param name="greeksToBeIncluded"> the set of greeks to be included in the report</param>
        /// <param name="maturityDateFrom"> the maturity date from which the RFQ's greeks will be included.</param>
        /// <param name="maturityDateTo"> the maturity date up until which the RFQ's greeks will be included.</param>
        /// <param name="minimumGreek">the minimum greek value that will be excluded from the report data.</param>
        /// <exception cref="ArgumentException"> thrown if reportType parameter is null or empty.</exception>
        /// <exception cref="ArgumentException"> thrown if categoryType parameter is null or empty.</exception>
        /// <exception cref="ArgumentException"> thrown if maturityDateFrom or maturityDateTo parameter is null.</exception>
        /// <exception cref="ArgumentException"> thrown if greeksTobeIncluded parameter is null or empty</exception>
        public void CompileGreeksByCategoryReport(string reportType, string categoryType, ISet <string> greeksToBeIncluded,
                                                  DateTime maturityDateFrom, DateTime maturityDateTo, double minimumGreek)
        {
            if (String.IsNullOrEmpty(reportType))
            {
                throw new ArgumentException("reportType");
            }

            if (String.IsNullOrEmpty(categoryType))
            {
                throw new ArgumentException("categoryType");
            }

            if (maturityDateFrom == null)
            {
                throw new ArgumentException("maturityDateFrom");
            }

            if (maturityDateTo == null)
            {
                throw new ArgumentException("maturityDateTo");
            }

            if (greeksToBeIncluded == null)
            {
                throw new ArgumentException("greeksToBeIncluded");
            }

            if (greeksToBeIncluded.Count == 0)
            {
                throw new ArgumentException("greeksToBeIncluded");
            }

            try
            {
                var eventPayLoad = new GreeksByCategoryReportEventPayLoad
                {
                    ReportType         = reportType,
                    Category           = categoryType,
                    MaturityDateFrom   = maturityDateFrom,
                    MaturityDateTo     = maturityDateTo,
                    MinimumGreek       = minimumGreek,
                    GreeksToBeIncluded = greeksToBeIncluded
                };

                if (!configManager.IsStandAlone)
                {
                    var result = reportingContollerProxy.getGreeksByCategory(categoryType, maturityDateFrom, maturityDateTo, minimumGreek);
                    if (result != null)
                    {
                        foreach (var greekTotal in result)
                        {
                            if (greeksToBeIncluded.Contains(GreeksEnum.DELTA.ToString()))
                            {
                                eventPayLoad.AddGreek(greekTotal.categoryValue, GreeksEnum.DELTA, greekTotal.delta);
                            }
                            if (greeksToBeIncluded.Contains(GreeksEnum.GAMMA.ToString()))
                            {
                                eventPayLoad.AddGreek(greekTotal.categoryValue, GreeksEnum.GAMMA, greekTotal.gamma);
                            }
                            if (greeksToBeIncluded.Contains(GreeksEnum.THETA.ToString()))
                            {
                                eventPayLoad.AddGreek(greekTotal.categoryValue, GreeksEnum.VEGA, greekTotal.vega);
                            }
                            if (greeksToBeIncluded.Contains(GreeksEnum.VEGA.ToString()))
                            {
                                eventPayLoad.AddGreek(greekTotal.categoryValue, GreeksEnum.THETA, greekTotal.theta);
                            }
                            if (greeksToBeIncluded.Contains(GreeksEnum.RHO.ToString()))
                            {
                                eventPayLoad.AddGreek(greekTotal.categoryValue, GreeksEnum.RHO, greekTotal.rho);
                            }
                        }
                    }
                }

                eventAggregator.GetEvent <GreeksByCategoryReportEvent>().Publish(eventPayLoad);
            }
            catch (FaultException fe)
            {
                if (log.IsErrorEnabled)
                {
                    log.Error("Exception thrown while compile report data for greeks by category: " + categoryType +
                              ": " + fe);
                }
            }
            catch (EndpointNotFoundException epnfe)
            {
                if (log.IsErrorEnabled)
                {
                    log.Error("Exception thrown while compile report data for greeks by category: " + categoryType +
                              ": " + epnfe);
                }
            }
            catch (NullReferenceException nre)
            {
                if (log.IsErrorEnabled)
                {
                    log.Error("Exception thrown while compile report data for greeks by category: " + categoryType + ": " + nre);
                }
            }
        }