Exemplo n.º 1
0
        public JsonNetResult GetRankQualifications(int rankID = 0)
        {
            try
            {
                var response = Exigo.GetCustomerRankQualifications(new GetCustomerRankQualificationsRequest
                {
                    CustomerID   = Identity.Current.CustomerID,
                    PeriodTypeID = PeriodTypes.Default,
                    RankID       = rankID
                });

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

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

            int result;

            using (var context = Exigo.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 = Exigo.GetRanks().ToList();

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

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

            return(PartialView("Partials/RankAdvancement", model));
        }
Exemplo n.º 3
0
        public ActionResult GetRankAdvancementCard(int rankid)
        {
            var ranks      = Exigo.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 = Exigo.GetCustomerRankQualifications(new GetCustomerRankQualificationsRequest
                {
                    CustomerID   = Identity.Current.CustomerID,
                    PeriodTypeID = PeriodTypes.Default,
                    RankID       = nextRankID
                });
            }

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