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

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

            // AJAX requests
            else
            {
                // Real-time commissions
                if (runid == 0)
                {
                    model.Commissions = ExigoDAL.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>()
                    {
                        ExigoDAL.GetCustomerHistoricalCommission(Identity.Current.CustomerID, runid)
                    };
                    return(PartialView("_HistoricalCommissionDetail", model));
                }
            }
        }