Beispiel #1
0
        public JsonNetResult GetRankQualificationsDashboard(int rankID = 0)
        {
            try
            {
                var response = RankQualificationService.GetCustomerRankQualifications(new GetCustomerRankQualificationsRequest
                {
                    CustomerID   = Identity.Current.CustomerID,
                    PeriodTypeID = PeriodTypes.Default,
                    RankID       = rankID
                });

                var html = (!response.IsUnavailable) ? this.RenderPartialViewToString("_RankQualificationDetailDashboard", response) : "";

                return(new JsonNetResult(new
                {
                    result = response,
                    html = html
                }));
            }
            catch (Exception ex)
            {
                return(new JsonNetResult(new
                {
                    success = false,
                    message = ex.Message
                }));
            }
        }
Beispiel #2
0
        public ActionResult RankAdvancement(int id)
        {
            var currentPeriod = ExigoDAL.GetCurrentPeriod(PeriodTypes.Default);

            int result;

            using (var context = ExigoDAL.Sql())
            {
                result = context.Query <int>(@"
                    SELECT 
                        ISNULL(pv.PaidRankID, 1)	
                    FROM
	                    PeriodVolumes pv		                            
                    WHERE pv.CustomerID = @customerid
	                    AND pv.PeriodTypeID = @periodtypeid
	                    AND pv.PeriodID = @periodid
                ", new
                {
                    customerid   = id,
                    periodtypeid = currentPeriod.PeriodTypeID,
                    periodid     = currentPeriod.PeriodID
                }).FirstOrDefault();
            }

            var paidRankID = 1;

            if (result > 0)
            {
                paidRankID = result;
            }

            var ranks = RankService.GetRanks().ToList();

            if (ranks.Last().RankID != paidRankID)
            {
                paidRankID = ranks.OrderBy(c => c.RankID).Where(c => c.RankID > paidRankID).FirstOrDefault().RankID;
            }

            var model = RankQualificationService.GetCustomerRankQualifications(new GetCustomerRankQualificationsRequest
            {
                CustomerID   = id,
                PeriodTypeID = PeriodTypes.Default,
                RankID       = paidRankID
            });

            return(PartialView("Partials/RankAdvancement", model));
        }
        public ActionResult GetRankAdvancementCard(int rankid)
        {
            var ranks      = RankService.GetRanks().ToList();
            var customerID = Identity.Current.CustomerID;

            GetCustomerRankQualificationsResponse model = null;

            // Check to ensure that the rank we are checking is not the last rank.
            // If so, return a null. Our view will take care of nulls specially.
            if (ranks.Last().RankID != rankid)
            {
                var nextRankID = ranks.OrderBy(c => c.RankID).Where(c => c.RankID > rankid).FirstOrDefault().RankID;
                model = RankQualificationService.GetCustomerRankQualifications(new GetCustomerRankQualificationsRequest
                {
                    CustomerID   = Identity.Current.CustomerID,
                    PeriodTypeID = PeriodTypes.Default,
                    RankID       = nextRankID
                });
            }

            return(PartialView("Cards/RankAdvancement", model));
        }