public JsonNetResult GetCurrentCommissions() { var customerID = Identity.Current.CustomerID; try { var currentCommissions = Cache.Get("Dashboard_CurrentCommissionsCard_{0}".FormatWith(customerID), TimeSpan.FromMinutes(WidgetCacheTimeout), () => ExigoDAL.GetCustomerRealTimeCommissions(new GetCustomerRealTimeCommissionsRequest { CustomerID = customerID, GetPeriodVolumes = false }).ToList() ); var html = this.RenderPartialViewToString("Cards/CurrentCommissions", currentCommissions); return(new JsonNetResult(new { success = true, html })); } catch (Exception ex) { return(new JsonNetResult(new { success = false, message = ex.Message })); } }
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)); } } }