public ActionResult PopoverSummary(int id)
        {
            var model = new ProfileViewModel();

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

            model.Customer = Exigo.GetCustomer(id);

            if (model.Customer.RankID == 0)
            {
                var volumes = Exigo.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));
            }
        }
示例#2
0
        public void Initialize(int customerID)
        {
            var weeklyVolumes = Exigo.GetCustomerVolumes(new GetCustomerVolumesRequest
            {
                CustomerID   = customerID,
                PeriodTypeID = PeriodTypes.Weekly
            });

            this.WeeklyVolumes = weeklyVolumes;
        }
        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)
            {
                id = Identity.Current.CustomerID;
            }

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

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

            if (model.Customer.EnrollerID > 0)
            {
                model.Customer.Enroller = Exigo.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 = Exigo.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 = Exigo.IsCustomerInEnrollerDownline(Identity.Current.CustomerID, model.Customer.CustomerID);
            }

            if (Request.IsAjaxRequest())
            {
                return(PartialView("Partials/_Profile", model));
            }
            else
            {
                return(View(model));
            }
        }
        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;
            }

            model.Customer       = Exigo.GetCustomer(id);
            model.RecentActivity = Exigo.GetCustomerRecentActivity(new GetCustomerRecentActivityRequest
            {
                CustomerID = id
            });
            model.Volumes = Exigo.GetCustomerVolumes(new GetCustomerVolumesRequest
            {
                CustomerID   = id,
                PeriodTypeID = PeriodTypes.Default
            });



            if (Request.IsAjaxRequest())
            {
                try
                {
                    var customerTypeHtml = model.Customer.CustomerType.CustomerTypeDescription + " Details";
                    var html             = this.RenderPartialViewToString("Partials/_Profile", model);
                    return(new JsonNetResult(new
                    {
                        success = true,
                        html = html,
                        customertypehtml = customerTypeHtml
                    }));
                }
                catch (Exception e)
                {
                    return(new JsonNetResult(new
                    {
                        success = false,
                        message = e.Message
                    }));
                }
            }
            else
            {
                return(View(model));
            }
        }
        public ActionResult Rank()
        {
            var model = new RankViewModel();

            model.Ranks = Exigo.GetRanks().OrderBy(c => c.RankID);

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

            model.CurrentRank = Exigo.GetCustomerVolumes(new GetCustomerVolumesRequest
            {
                CustomerID   = Identity.Current.CustomerID,
                PeriodTypeID = currentperiod.PeriodTypeID,
                PeriodID     = currentperiod.PeriodID
            }).PayableAsRank;

            return(View(model));
        }
示例#6
0
        public ActionResult Rank()
        {
            var model = new RankViewModel();

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

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

            //Get the current rank from the current paid as rank from the current commission period
            model.CurrentRank = Exigo.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));
        }
示例#7
0
        //This will get the EB Volumes
        public VolumeCollection GetEbRewardVolumes(int customerId)
        {
            // Get the volumes used for the customers sales amounts for the appropriate months
            var volumes = Exigo.GetCustomerVolumes(new GetCustomerVolumesRequest
            {
                CustomerID   = customerId,
                PeriodTypeID = PeriodTypes.Monthly,
                VolumeIDs    = new[] { 16, 17, 18, 22 },
            });

            //For Testing
            //var volumes = new VolumeCollection
            //{
            //    Volume16 = 1501,
            //    Volume17 = 1500,
            //    Volume18 = 1600,
            //    Volume22 = 4601
            //};

            return(volumes);
        }
示例#8
0
        // 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),
                                        () =>
                                        Exigo.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
                }));
            }
        }
        public ActionResult Index()
        {
            var model      = new DashboardViewModel();
            var tasks      = new List <Task>();
            var customerID = Identity.Current.CustomerID;

            if (!GlobalSettings.Globalization.HideForLive)
            {
                tasks.Add(Task.Factory.StartNew(() =>
                {
                    try
                    {
                        model.RecentOrders = Exigo.GetCustomerOrders(new GetCustomerOrdersRequest
                        {
                            CustomerID          = customerID,
                            IncludeOrderDetails = false,
                            Page     = 1,
                            RowCount = 4
                        }).ToList();
                    }
                    catch (Exception ex) { }
                }));
            }
            // Get the volumes
            tasks.Add(Task.Factory.StartNew(() =>
            {
                try
                {
                    model.Volumes = Exigo.GetCustomerVolumes(new GetCustomerVolumesRequest
                    {
                        CustomerID   = customerID,
                        PeriodTypeID = PeriodTypes.Default,
                        VolumeIDs    = new[] { 1, 2, 4, 16, 50, 51, 52, 53, 54, 55, 56, 57, 58, 59, 91 }
                    });
                }
                catch (Exception ex) { }
            }));

            // Get the current commissions
            tasks.Add(Task.Factory.StartNew(() =>
            {
                try
                {
                    model.CurrentCommissions = Exigo.GetCustomerRealTimeCommissions(new GetCustomerRealTimeCommissionsRequest
                    {
                        CustomerID = customerID
                    }).ToList();
                }
                catch (Exception) { }
            }));

            // Get the customer's recent organization activity
            tasks.Add(Task.Factory.StartNew(() =>
            {
                try
                {
                    model.RecentActivities = Exigo.GetCustomerRecentActivity(new GetCustomerRecentActivityRequest
                    {
                        CustomerID = customerID,
                        Page       = 1,
                        RowCount   = 50
                    }).ToList();
                }
                catch (Exception ex) { }
            }));


            // Get the newest distributors
            tasks.Add(Task.Factory.StartNew(() =>
            {
                try
                {
                    model.NewestDistributors = Exigo.GetNewestDistributors(new GetNewestDistributorsRequest
                    {
                        CustomerID = customerID,
                        RowCount   = 12,
                        MaxLevel   = 99999
                    }).Where(c => c.CustomerID != customerID).ToList();
                }
                catch (Exception ex) { }
            }));


            // Perform all tasks
            Task.WaitAll(tasks.ToArray());
            tasks.Clear();

            return(View(model));
        }
        public ActionResult Index()
        {
            var model    = new AccountOverviewViewModel();
            var customer = Exigo.GetCustomer(Identity.Current.CustomerID);

            model.Enroller = customer.Enroller;
            model.Sponsor  = customer.Sponsor;
            var website = Exigo.GetCustomerSite(Identity.Current.CustomerID);
            var socialNetworksResponse = Exigo.WebService().GetCustomerSocialNetworks(new GetCustomerSocialNetworksRequest()
            {
                CustomerID = Identity.Current.CustomerID
            });

            // Social NetWorks
            foreach (var network in socialNetworksResponse.CustomerSocialNetwork)
            {
                switch (network.SocialNetworkID)
                {
                case (int)SocialNetworks.Facebook: model.FacebookUrl = network.Url; break;

                case (int)SocialNetworks.Twitter: model.TwitterUrl = network.Url; break;

                case (int)SocialNetworks.YouTube: model.YouTubeUrl = network.Url; break;

                case (int)SocialNetworks.Blog: model.BlogUrl = network.Url; break;
                }
            }


            //Basic Info
            model.CustomerID  = customer.CustomerID;
            model.FirstName   = customer.FirstName;
            model.LastName    = customer.LastName;
            model.Email       = customer.Email;
            model.WebAlias    = website.WebAlias;
            model.LoginName   = customer.LoginName;
            model.LanguageID  = customer.LanguageID;
            model.CreatedDate = customer.CreatedDate;


            // Team Placement
            var currentPeriod    = Exigo.GetCurrentPeriod(PeriodTypes.Default);
            var placementOptions = new List <SelectListItem>();
            var volumes          = Exigo.GetCustomerVolumes(new GetCustomerVolumesRequest()
            {
                CustomerID   = Identity.Current.CustomerID,
                PeriodID     = currentPeriod.PeriodID,
                PeriodTypeID = PeriodTypes.Default
            });
            var canSeeTeamOne   = (volumes.Volume50 > 0);
            var canSeeTeamTwo   = (volumes.Volume51 > 0);
            var canSeeTeamThree = (volumes.Volume52 > 0);
            var canSeeTeamFour  = (volumes.Volume53 > 0);
            var canSeeTeamFive  = (volumes.Volume54 > 0);

            model.TeamPlacementPreferenceID = customer.Field1;

            // Only show available teams. If none available, default to team one
            if (canSeeTeamOne || (canSeeTeamOne == false && canSeeTeamTwo == false && canSeeTeamThree == false && canSeeTeamFour == false && canSeeTeamFive == false))
            {
                placementOptions.Add(new SelectListItem {
                    Text = Resources.Common.Team + " 1", Value = "1"
                });
            }
            if (canSeeTeamTwo)
            {
                placementOptions.Add(new SelectListItem {
                    Text = Resources.Common.Team + " 2", Value = "2"
                });
            }
            if (canSeeTeamThree)
            {
                placementOptions.Add(new SelectListItem {
                    Text = Resources.Common.Team + " 3", Value = "3"
                });
            }
            if (canSeeTeamFour)
            {
                placementOptions.Add(new SelectListItem {
                    Text = Resources.Common.Team + " 4", Value = "4"
                });
            }
            if (canSeeTeamFive)
            {
                placementOptions.Add(new SelectListItem {
                    Text = Resources.Common.Team + " 5", Value = "5"
                });
            }
            model.TeamPlacementPreferenceOptions = placementOptions;

            // Set the description for the user's team to be displayed
            if (model.TeamPlacementPreferenceID != "")
            {
                model.TeamPlacementPreference = Resources.Common.Team + " " + model.TeamPlacementPreferenceID;
            }
            // If somehow the customer does not have a value in thier Field1, default the description to the first available option
            else
            {
                var firstAvailableTeamNumber = placementOptions.OrderBy(c => c.Value).FirstOrDefault().Value;
                model.TeamPlacementPreference = Resources.Common.Team + " " + firstAvailableTeamNumber;
            }


            // Tax ID - Added try catch around this because it fails from time to time and kills the entire page - Mike M.
            try
            {
                var request = new Common.Api.ExigoWebService.GetCustomReportRequest();
                request.ReportID   = 3;
                request.Parameters = new List <ParameterRequest>
                {
                    new ParameterRequest {
                        ParameterName = "CustomerID", Value = Identity.Current.CustomerID
                    }
                }.ToArray();
                var taxIDResponse = Exigo.WebService().GetCustomReport(request);
                var taxId         = taxIDResponse.ReportData.Tables[0].Rows[0][0].ToString();
                model.TaxIDIsSet  = (taxId != "");
                model.MaskedTaxID = taxId;
            }
            catch (Exception ex)
            {
            }

            // Contact
            model.PrimaryPhone   = customer.PrimaryPhone;
            model.SecondaryPhone = customer.SecondaryPhone;
            model.MobilePhone    = customer.MobilePhone;
            model.Fax            = customer.Fax;
            model.Addresses      = customer.Addresses;


            // Customer Site
            model.CustomerSite.FirstName      = website.FirstName;
            model.CustomerSite.LastName       = website.LastName;
            model.CustomerSite.Email          = website.Email;
            model.CustomerSite.PrimaryPhone   = website.PrimaryPhone;
            model.CustomerSite.SecondaryPhone = website.SecondaryPhone;
            model.CustomerSite.Fax            = website.Fax;

            model.CustomerSite.Notes1 = website.Notes1;
            model.CustomerSite.Notes2 = website.Notes2;
            model.CustomerSite.Notes3 = website.Notes3;
            model.CustomerSite.Notes4 = website.Notes4;

            model.CustomerSite.Address.Address1 = website.Address.Address1;
            model.CustomerSite.Address.Address2 = website.Address.Address2;
            model.CustomerSite.Address.Country  = website.Address.Country;
            model.CustomerSite.Address.City     = website.Address.City;
            model.CustomerSite.Address.State    = website.Address.State;
            model.CustomerSite.Address.Zip      = website.Address.Zip;


            // Opt in
            model.IsOptedIn = customer.IsOptedIn;

            // Annual Membership
            model.Membership = Exigo.GetCustomerAutoOrders(new GetCustomerAutoOrdersRequest
            {
                CustomerID                = Identity.Current.CustomerID,
                IncludeDetails            = true,
                IncludePaymentMethods     = true,
                IncludeInactiveAutoOrders = true
            }).Where(v => v.Details.Any(d => d.ItemCode == "IAANNUALRENEWAL")).FirstOrDefault();

            model.ActiveMembership = model.Membership != null ? "Scheduled" + @model.Membership.NextRunDate : "No Renewal Scheduled";

            // Get the available languages
            model.Languages = Exigo.GetLanguages();


            return(View(model));
        }