Esempio n. 1
0
        public void GetResultsForComparison(CompareEvent @event)
        {
            View.Region = @event.Region;

            ComparisonRequest request = @event.ToRequest();
            var compareCommand = new CompareCommand(request);
            compareCommand.Execute(RestClient, c => Dispatcher.BeginInvoke(() => GetResultsForComparisonCallBack(c)));
        }
Esempio n. 2
0
        public void Compare()
        {
            EventHub.Publish(new PreCompareEvent());

            var compareEvent = new CompareEvent
                                   {
                                       ElectricityPlan = View.ElectricityUsageView.SelectedPlan,
                                       ElectricitySupplier = View.ElectricityUsageView.SelectedSupplier,
                                       GasPlan = View.GasUsageView.SelectedPlan,
                                       GasSupplier = View.GasUsageView.SelectedSupplier,
                                       ComparisonPaymentMethod = View.PaymentMethod,
                                       HasGas = View.HasGas,
                                       ElectricityPaymentMethod = View.ElectricityUsageView.PaymentMethod,
                                       GasPaymentMethod = View.GasUsageView.PaymentMethod,
                                       Postcode = View.Postcode,
                                       IsEconomy7 = View.HasEconomy7,
                                       Region = View.Region
                                   };

            if (View.ElectricityUsageView.IsInKwh)
            {
                compareEvent.ElectricityAnnualConsumptionKwh = View.ElectricityUsageView.CalculatedUsageInKwh;
            } else
            {
                compareEvent.ElectricityAnnualSpend = View.ElectricityUsageView.CalculatedAnnualSpend;
            }

            if (View.GasUsageView.IsInKwh)
            {
                compareEvent.GasAnnualConsumptionKwh = View.GasUsageView.CalculatedUsageInKwh;
            }
            else
            {
                compareEvent.GasAnnualSpend = View.GasUsageView.CalculatedAnnualSpend;
            }

            EventHub.Publish(compareEvent);
        }