Exemple #1
0
        public ActionResult PopoverSummary(int id)
        {
            var model = new ProfileViewModel();

            if (id == 0)
            {
                id = Identity.Current.CustomerID;
            }

            model.Customer = Customers.GetCustomer(id);

            if (model.Customer.RankID == 0)
            {
                var volumes = ExigoDAL.GetCustomerVolumes(new GetCustomerVolumesRequest
                {
                    CustomerID   = id,
                    PeriodTypeID = PeriodTypes.Default
                });

                model.Customer.RankID = volumes.PayableAsRank.RankID;
            }

            if (Request.IsAjaxRequest())
            {
                return(PartialView("Partials/_ProfilePopover", model));
            }
            else
            {
                return(View(model));
            }
        }
Exemple #2
0
        public void Initialize(int customerID)
        {
            var weeklyVolumes = ExigoDAL.GetCustomerVolumes(new GetCustomerVolumesRequest
            {
                CustomerID   = customerID,
                PeriodTypeID = PeriodTypes.Weekly
            });

            this.WeeklyVolumes = weeklyVolumes;
        }
Exemple #3
0
        public ActionResult Index(string token)
        {
            var model = new ProfileViewModel();
            var id    = Convert.ToInt32(Security.Decrypt(token, Identity.Current.CustomerID));

            if (id == 0 || (id != Identity.Current.CustomerID && !ExigoDAL.IsCustomerInlDownline(Identity.Current.CustomerID, id)))
            {
                id = Identity.Current.CustomerID;
            }

            model.Customer = Customers.GetCustomer(id);
            model.Volumes  = ExigoDAL.GetCustomerVolumes(new GetCustomerVolumesRequest
            {
                CustomerID   = id,
                PeriodTypeID = PeriodTypes.Default
            });

            if (model.Volumes == null)
            {
                model.Volumes = new VolumeCollection();
            }

            if (model.Customer.EnrollerID > 0)
            {
                model.Customer.Enroller = Customers.GetCustomer(Convert.ToInt32(model.Customer.EnrollerID));

                if (model.Customer.EnrollerID == model.Customer.SponsorID)
                {
                    model.Customer.Sponsor = model.Customer.Enroller;
                }
            }
            if (model.Customer.SponsorID > 0 && model.Customer.SponsorID != model.Customer.EnrollerID)
            {
                model.Customer.Sponsor = Customers.GetCustomer(Convert.ToInt32(model.Customer.SponsorID));
            }

            if (model.Customer.RankID == 0)
            {
                model.Customer.RankID = model.Volumes.PayableAsRank.RankID;
            }

            if (model.Customer.EnrollerID != Identity.Current.CustomerID && model.Customer.CustomerID != Identity.Current.CustomerID)
            {
                model.IsInEnrollerTree = ExigoDAL.IsCustomerInEnrollerDownline(Identity.Current.CustomerID, model.Customer.CustomerID);
            }

            if (Request.IsAjaxRequest())
            {
                return(PartialView("Partials/_Profile", model));
            }
            else
            {
                return(View(model));
            }
        }
Exemple #4
0
        public ActionResult Rank()
        {
            var model = new RankViewModel();

            //Pull in all the ranks
            model.Ranks = RankService.GetRanks().OrderBy(c => c.RankID);

            var currentperiod = ExigoDAL.GetCurrentPeriod(PeriodTypes.Default);

            //Get the current rank from the current paid as rank from the current commission period
            model.CurrentRank = ExigoDAL.GetCustomerVolumes(new GetCustomerVolumesRequest
            {
                CustomerID   = Identity.Current.CustomerID,
                PeriodTypeID = currentperiod.PeriodTypeID,
                PeriodID     = currentperiod.PeriodID
            }).PayableAsRank;

            //Get the next rank so we can jump to the next qualification
            model.NextRank = model.Ranks.OrderBy(c => c.RankID).Where(c => c.RankID > model.CurrentRank.RankID).FirstOrDefault();
            return(View(model));
        }
        // This method also get the "currentRankID" that is passed in the call to GetRankAdvancementCard
        public JsonNetResult GetVolumes()
        {
            var customerID = Identity.Current.CustomerID;

            try
            {
                var volumes = Cache.Get("Dashboard_VolumesCard_{0}".FormatWith(customerID),
                                        TimeSpan.FromMinutes(WidgetCacheTimeout),
                                        () =>
                                        ExigoDAL.GetCustomerVolumes(new GetCustomerVolumesRequest
                {
                    CustomerID   = customerID,
                    PeriodTypeID = PeriodTypes.Default
                })
                                        );

                // Get the Current Rank that is used for the Rank Advancement call
                var currentRankID = (volumes != null) ? volumes.PayableAsRank.RankID : 0;

                var html = this.RenderPartialViewToString("Cards/Volumes", volumes);

                return(new JsonNetResult(new
                {
                    success = true,
                    currentRankID,
                    html
                }));
            }
            catch (Exception ex)
            {
                return(new JsonNetResult(new
                {
                    success = false,
                    message = ex.Message
                }));
            }
        }