Beispiel #1
0
        public ActionResult CommissionDetail(int runid, int periodid)
        {
            var model = new CommissionDetailViewModel();

            // View Requests
            if (!Request.IsAjaxRequest())
            {
                model.CommissionPeriods = Exigo.GetCommissionPeriodList(Identity.Current.CustomerID, true);
                return(View("CommissionDetail", model));
            }

            // AJAX requests
            else
            {
                // Real-time commissions
                if (runid == 0)
                {
                    model.Commissions = Exigo.GetCustomerRealTimeCommissions(new GetCustomerRealTimeCommissionsRequest
                    {
                        CustomerID       = Identity.Current.CustomerID,
                        GetPeriodVolumes = true
                    });

                    // Check Period ID
                    if (periodid > 0)
                    {
                        model.PeriodID    = periodid;
                        model.Commissions = model.Commissions.Where(c => c.Period.PeriodID == periodid);
                    }

                    return(PartialView("_RealTimeCommissionDetail", model));
                }

                // Historical Commissions
                else
                {
                    model.Commissions = new List <ICommission>()
                    {
                        Exigo.GetCustomerHistoricalCommission(Identity.Current.CustomerID, runid)
                    };
                    return(PartialView("_HistoricalCommissionDetail", model));
                }
            }
        }
        public ActionResult CommissionDetail(int runid)
        {
            var model = new CommissionDetailViewModel();

            // View Requests
            if (!Request.IsAjaxRequest())
            {
                model.CommissionPeriods = Exigo.GetCommissionPeriodList(Identity.Current.CustomerID);
                return(View("CommissionDetail", model));
            }

            // AJAX requests
            else
            {
                // Real-time commissions
                if (runid == 0)
                {
                    model.Commissions = Exigo.GetCustomerRealTimeCommissions(new GetCustomerRealTimeCommissionsRequest
                    {
                        CustomerID = Identity.Current.CustomerID,
                        VolumeIDs  = new[] { 1, 2, 3, 4, 16 }
                    });
                    return(PartialView("_RealTimeCommissionDetail", model));
                }

                // Historical Commissions
                else
                {
                    model.Commissions = new List <ICommission>()
                    {
                        Exigo.GetCustomerHistoricalCommission(Identity.Current.CustomerID, runid)
                    };
                    return(PartialView("_HistoricalCommissionDetail", model));
                }
            }
        }