public ActionResult ResetPassword(string token)
        {
            //Created Model
            var model = new ResetPasswordViewModel();


            try
            {
                var decryptedToken = Security.Decrypt(token);
                var customerID     = decryptedToken.CustomerID;
                var date           = Convert.ToDateTime(decryptedToken.Date);
                var customer       = Exigo.GetCustomer((int)customerID);
                var dateExpiration = date.AddMinutes(30);

                if (DateTime.Now > dateExpiration)
                {
                    model.IsExpiredLink = true;
                }

                model.CustomerID   = customer.CustomerID;
                model.CustomerType = customer.CustomerTypeID;

                return(View(model));
            }
            catch (Exception e)
            {
                return(RedirectToAction("Login", "Authentication", new { error = "invalidtoken" }));
            }
        }
Beispiel #2
0
        public IList <IIndividualReward> GetActiveRewards(string siteType, int customerId)
        {
            var activeAwards = new List <IIndividualReward>();

            if (customerId <= 999)
            {
                return(activeAwards);                   //Don't want any rewards returning for corporarte accounts.
            }
            if (siteType == "backOffice")
            {
                var customer = Exigo.GetCustomer(customerId);

                var activeBOAwards = new List <IIndividualReward>
                {
                    ServicesModule.Instance.Kernel.Get <NewEbReward>(),
                    ServicesModule.Instance.Kernel.Get <RecruitingReward>(),
                    ServicesModule.Instance.Kernel.Get <ProductCreditReward>(),
                    ServicesModule.Instance.Kernel.Get <NewStyleAmbassadorHalfOffReward>(),
                    //ServicesModule.Instance.Kernel.Get<OngoingStyleAmbassadorHalfOffReward>(),
                    //ServicesModule.Instance.Kernel.Get<NewProductsLaunchReward>()
                };
                activeAwards.AddRange(activeBOAwards.Where(reward => reward.IsEligible(customer, siteType)));
                return(activeAwards);
            }
            // was being used for REP site...no longer needed for now. - Azam
            //var allRewards = AllRewards();
            //activeAwards.AddRange(allRewards.Where(reward => reward.IsEligible(customer, siteType)));

            return(activeAwards);
        }
Beispiel #3
0
        public void Initialize(int customerID)
        {
            //var upline = Exigo.OData().Customers
            //    .Where(c => c.CustomerID == customerID)
            //    .Select(c => new
            //    {
            //        c.EnrollerID,
            //        c.SponsorID
            //    }).FirstOrDefault();

            var upline = Exigo.GetCustomer(customerID);

            if (upline == null)
            {
                return;
            }

            if (upline.EnrollerID != null)
            {
                this.Enroller = Exigo.GetCustomer((int)upline.EnrollerID);
            }
            if (upline.SponsorID != null)
            {
                this.Sponsor = Exigo.GetCustomer((int)upline.SponsorID);
            }
        }
        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));
            }
        }
Beispiel #5
0
        public ActionResult Index()
        {
            var model = new BackofficeSubscriptionsViewModel();

            // Get the customer's subscriptions
            model.Subscriptions = Exigo.GetCustomerSubscriptions(CurrentCustomerID).ToList();


            // If we have any expired subscriptions, we need to calculate how much they are going to cost to catch them up today
            if (model.Subscriptions.Where(c => c.SubscriptionID == Subscriptions.BackofficeFeatures).FirstOrDefault() == null || model.Subscriptions.Where(c => c.SubscriptionID == Subscriptions.BackofficeFeatures).Any(s => s.IsExpired))
            {
                var customer = Exigo.GetCustomer(Identity.Current.CustomerID);
                if (customer.CreatedDate >= DateTimeExtensions.ToCST(DateTime.Now.AddMinutes(-30)) && customer.CustomerTypeID == CustomerTypes.Associate)
                {
                    var cookie = new HttpCookie(GlobalSettings.Backoffices.MonthlySubscriptionCookieName);
                    cookie.Value   = "true";
                    cookie.Expires = DateTime.Now.AddMinutes(15);
                    HttpContext.Response.Cookies.Add(cookie);

                    return(RedirectToAction("Index", "Dashboard"));
                }
                // Set up our request to get the order totals on the subscriptions that are required
                var request = new OrderCalculationRequest();

                // We pull the customer's addresses first, if there are none we calculate with the corp address
                var customerAddresses = Exigo.GetCustomerAddresses(CurrentCustomerID);
                var address           = (customerAddresses.Count() > 0 && customerAddresses.Where(c => c.IsComplete == true).Count() > 0) ? customerAddresses.Where(c => c.IsComplete == true).FirstOrDefault() : GlobalSettings.Company.Address;

                // Find which subscriptions are expired and add the appropriate items to those where needed
                var itemsToCalculate = new List <ShoppingCartItem>();


                itemsToCalculate.Add(new ShoppingCartItem {
                    ItemCode = GlobalSettings.Backoffices.MonthlySubscriptionItemCode, Quantity = 1
                });


                model.PaymentMethods = Exigo.GetCustomerPaymentMethods(new GetCustomerPaymentMethodsRequest
                {
                    CustomerID = CurrentCustomerID,
                    ExcludeIncompleteMethods = true,
                    ExcludeInvalidMethods    = true
                });
                request.Configuration = OrderConfiguration;
                request.Address       = address;
                request.Items         = itemsToCalculate;

                request.ShipMethodID = OrderConfiguration.DefaultShipMethodID;
                //82774 Ivan S. 11/24/2016
                //The Commissions page was displaying an OOPS error when clicking on it, because
                //we were not passing in the CustomerID, and it was generating a null exception
                //Therefore I added this line of code:
                request.CustomerID      = Identity.Current.CustomerID;
                model.OrderCalcResponse = Exigo.CalculateOrder(request);
            }

            return(View(model));
        }
Beispiel #6
0
        public bool BecameSABetweenMay17AndAug232015(int customerId)
        {
            var customer     = Exigo.GetCustomer(customerId);
            var dateBecameSa = customer.Date1 ?? DateTime.Now;
            var startDate    = new DateTime(2015, 5, 17);
            var endDate      = new DateTime(2015, 8, 23);

            return(dateBecameSa >= startDate && dateBecameSa <= endDate);
        }
        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 Notifications()
        {
            var model = new AccountNotificationsViewModel();

            var customer = Exigo.GetCustomer(Identity.Current.CustomerID);

            model.Email     = customer.Email;
            model.IsOptedIn = customer.IsOptedIn;

            return(View(model));
        }
        public JsonNetResult AddAnnualMembershipAutoOrder()
        {
            try
            {
                var customer = Exigo.GetCustomer(Identity.Current.CustomerID);

                var newDate = new DateTime(DateTime.Now.Year, customer.CreatedDate.Month, customer.CreatedDate.Day) <= DateTime.Now ? new DateTime(DateTime.Now.AddYears(1).Year, customer.CreatedDate.Month, customer.CreatedDate.Day) : new DateTime(DateTime.Now.Year, customer.CreatedDate.Month, customer.CreatedDate.Day);

                CreateAutoOrderRequest autoOrderRequest = new CreateAutoOrderRequest()
                {
                    Frequency    = FrequencyType.Yearly,
                    CustomerID   = customer.CustomerID,
                    StartDate    = newDate,
                    FirstName    = customer.FirstName,
                    LastName     = customer.LastName,
                    Address1     = customer.MainAddress.Address1,
                    City         = customer.MainAddress.City,
                    State        = customer.MainAddress.State,
                    Country      = customer.MainAddress.Country,
                    Zip          = customer.MainAddress.Zip,
                    CurrencyCode = CurrencyCodes.DollarsUS,
                    WarehouseID  = Warehouses.Default,
                    PriceType    = PriceTypes.Wholesale,
                    ShipMethodID = 8
                };
                OrderDetailRequest det = null;

                List <OrderDetailRequest> details = new List <OrderDetailRequest>();
                det = new OrderDetailRequest()
                {
                    ItemCode = "IAANNUALRENEWAL",
                    Quantity = 1,
                };
                details.Add(det);
                autoOrderRequest.Details = details.ToArray();

                Exigo.WebService().CreateAutoOrder(autoOrderRequest);

                return(new JsonNetResult(new
                {
                    success = true,
                    action = "AddAnnualMembershipAutoOrder"
                }));
            }
            catch (Exception ex)
            {
                return(new JsonNetResult(new
                {
                    success = false,
                    message = ex.Message
                }));
            }
        }
Beispiel #10
0
        //This will get the total amount of days the customer has been a Style Ambassador
        public int GetTotalSaDays(int customerId)
        {
            if (BecameSABetweenMay17AndAug232015(customerId))
            {
                return(0);
            }
            var customer     = Exigo.GetCustomer(customerId);
            var dateBecameSa = customer.Date1 ?? DateTime.Now;
            var diff         = (DateTime.Now.Date - dateBecameSa.Date);

            return(diff.Days);
        }
Beispiel #11
0
 public ActionResult SetEnroller()
 {
     if (PropertyBag.Customer.Enroller == null && Identity.Owner.CustomerID != GlobalSettings.ReplicatedSites.DefaultAccountID)
     {
         var enrollerInfo = Exigo.GetCustomer(Identity.Owner.CustomerID);
         PropertyBag.Customer.Enroller = enrollerInfo;
         Exigo.PropertyBags.Update(PropertyBag);
     }
     else if (Identity.Owner.CustomerID == GlobalSettings.ReplicatedSites.DefaultAccountID)
     {
         return(EnrollmentConfiguration());
     }
     return(Checkout());
 }
        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));
            }
        }
Beispiel #13
0
        public ActionResult EnrollmentConfiguration(EnrollmentConfigurationViewModel enroller = null)
        {
            if (Request.HttpMethod == "GET")
            {
                var model = new EnrollmentConfigurationViewModel();
                model.MarketSelectList = GlobalSettings.Markets.AvailableMarkets.Select(c => new SelectListItem
                {
                    Text     = c.Description,
                    Value    = c.Name.ToString(),
                    Selected = (c.CookieValue == "CA")
                }).ToList();
                model.MarketName = Utilities.GetCurrentMarket().Name;

                model.EnrollerID = Identity.Owner.CustomerID;

                return(View(model));
            }
            else
            {
                // set the customer's addresses to the country selected
                var countryCode = GlobalSettings.Markets.AvailableMarkets.Where(c => c.Name == enroller.MarketName).FirstOrDefault().CookieValue;
                PropertyBag.Customer.MainAddress.Country    = countryCode;
                PropertyBag.Customer.MailingAddress.Country = countryCode;
                PropertyBag.ShippingAddress.Country         = countryCode;
                PropertyBag.SelectedMarket = enroller.MarketName;
                PropertyBag.EnrollerID     = enroller.EnrollerID;

                // Set the enroller information
                var enrollerInfo = new Customer();
                if (PropertyBag.EnrollerID == Identity.Owner.CustomerID)
                {
                    enrollerInfo.CustomerID   = Identity.Owner.CustomerID;
                    enrollerInfo.FirstName    = Identity.Owner.FirstName;
                    enrollerInfo.LastName     = Identity.Owner.LastName;
                    enrollerInfo.Email        = Identity.Owner.Email;
                    enrollerInfo.PrimaryPhone = Identity.Owner.Phone;
                }
                else
                {
                    enrollerInfo = Exigo.GetCustomer(enroller.EnrollerID);
                }

                PropertyBag.Customer.Enroller = enrollerInfo;

                //Exigo.GetCustomer(enroller.EnrollerID);
                Exigo.PropertyBags.Update(PropertyBag);
                return(RedirectToAction("Checkout"));
            }
        }
        public ActionResult PopoverSummary(int id)
        {
            var model = new ProfileViewModel();

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

            model.Customer = Exigo.GetCustomer(id);

            if (Request.IsAjaxRequest())
            {
                return(PartialView("Partials/_ProfilePopover", model));
            }
            else
            {
                return(View(model));
            }
        }
Beispiel #15
0
        public static KeyValuePair <bool, List <string> > IdentityCheck(int customerID)
        {
            var nullList = new List <string>();

            var cust = Exigo.GetCustomer(customerID);


            if (cust.MainAddress == null || string.IsNullOrEmpty(cust.MainAddress.Country))
            {
                nullList.Add("Main Country");
            }


            if (nullList.Count() <= 0)
            {
                return(new KeyValuePair <bool, List <string> >(true, nullList));
            }
            else
            {
                return(new KeyValuePair <bool, List <string> >(false, nullList));
            }
        }
Beispiel #16
0
        private static BookingReward CreateBookingReward(int customerId, int partyId, int bookingsRewardOwnerId)
        {
            var bookingReward = new BookingReward();

            if (partyId == 0)
            {
                return(bookingReward);
            }
            //Get Party Details of Party that we earned booking rewards from.
            var party        = Exigo.GetCustomer(partyId);
            var customerSite = Exigo.GetCustomerSite(partyId);
            //Get Point Account Value Earned for Booking Rewards - CustomerPointAccounts - PointAccountID 3
            var bookingsRewardsCash = Exigo.GetCustomerPointAccount(partyId, PointAccounts.BookingsRewardsCash);

            bookingReward.PartyName          = party.FirstName;
            bookingReward.WebAlias           = customerSite.WebAlias;
            bookingReward.BookingRewardOwner = bookingsRewardOwnerId;
            bookingReward.CustomerID         = party.CustomerID; //This will be the Field 3, Field 4, Field 5, Field 6 from the ExtendedDetails
            bookingReward.Balance            = (bookingsRewardsCash != null) ? bookingsRewardsCash.Balance : 0;
            bookingReward.PointAccountID     = PointAccounts.BookingsRewardsCash;
            return(bookingReward);
        }
Beispiel #17
0
        public void Initialize(int customerID)
        {
            dynamic upline = null;


            using (var context = Exigo.Sql())
            {
                try
                {
                    upline = context.Query(@"
                        Select c.EnrollerID,
                            c.CustomerID
                        From Customers c
                        Where c.CustomerID = @customerid
", new
                    {
                        customerid = customerID
                    }).FirstOrDefault();
                }
                catch (Exception e)
                {
                    return;
                }
            }
            if (upline == null)
            {
                return;
            }

            if (upline.EnrollerID != null)
            {
                this.Enroller = Exigo.GetCustomer((int)upline.EnrollerID);
            }
            if (upline.SponsorID != null)
            {
                this.Sponsor = Exigo.GetCustomer((int)upline.SponsorID);
            }
        }
Beispiel #18
0
        // For Soft Launch
        public ActionResult VerifyEnrollerSponsor(string input, bool isEnroller, int EnrollerID = 0)
        {
            if (input.IsNullOrEmpty())
            {
                return(new JsonNetResult(new
                {
                    success = true,
                    valid = false
                }));
            }
            // Check both login name and customer id even if int change how its in sql based on whether or not it can parse. Need to find out about what happens if login name = customerid.
            var     whereclause                 = "";
            int     customerid                  = 0;
            var     EnrollerString              = "";
            dynamic User                        = null;
            var     checkForWebAliasString      = (!GlobalSettings.Globalization.HideForLive) ? "and cs.WebAlias != '' and cs.WebAlias IS NOT NULL" : "";
            var     checkForWebAliasTableString = (!GlobalSettings.Globalization.HideForLive) ? "left join CustomerSites cs on cs.CustomerID = c.CustomerID" : "";

            if (int.TryParse(input, out customerid))
            {
                whereclause = "AND c.CustomerID = " + customerid;
            }
            else
            {
                whereclause = "AND c.LoginName = '" + input + "'";
            }
            if (isEnroller)
            {
                using (var context = Exigo.Sql())
                {
                    User = context.Query(@" " + EnrollerString + @"

                    Select  c.CustomerID
                    from Customers c " + checkForWebAliasTableString + @" 
                    Where c.CustomerID > 5 and c.CustomerStatusID in @customerstatuses " + checkForWebAliasString + @" and c.CustomerTypeID = @customertype " + whereclause + @"
            ", new
                    {
                        customerstatuses = CustomerStatusTypes.ActiveStatusTypes.ToList(),
                        customertype     = (int)CustomerTypes.Associate
                    }).FirstOrDefault();
                }
            }

            else
            {
                using (var context = Exigo.Sql())
                {
                    User = context.Query(@"

                    Select  c.CustomerID, c.FirstName, c.LastName, c.Company from Customers c
                    inner join UniLevelDownline ud
                    on c.CustomerID = ud.CustomerID
                    " + checkForWebAliasTableString + @" 
                    Where ud.DownlineCustomerID = @id  and c.CustomerID > 5 and c.CustomerStatusID in @customerstatuses  " + checkForWebAliasString + @" and c.CustomerTypeID = @customertype " + whereclause + @"
            ", new
                    {
                        id = EnrollerID,
                        customerstatuses = CustomerStatusTypes.ActiveStatusTypes.ToList(),
                        customertype     = (int)CustomerTypes.Associate
                    }).FirstOrDefault();
                }
            }
            if (User != null)
            {
                try
                {
                    var customer     = Exigo.GetCustomer(User.CustomerID);
                    var detailsModel = new CustomerDetailsViewModel();
                    detailsModel.Customer = customer;
                    var customerdetailshtml = "";
                    customerdetailshtml = this.RenderPartialViewToString("../Enrollment/_CustomerDetails", detailsModel);

                    var successhtml = this.RenderPartialViewToString("../Enrollment/_EnrollerResult", detailsModel.Customer);

                    return(new JsonNetResult(new
                    {
                        success = true,
                        valid = true,
                        html = customerdetailshtml,
                        successhtml = successhtml,
                        customerid = detailsModel.Customer.CustomerID
                    }));
                }
                catch (Exception ex)
                {
                    var failhtml = this.RenderPartialViewToString("../Enrollment/_EnrollerFail", 0);
                    return(new JsonNetResult(new
                    {
                        success = true,
                        valid = false,
                        html = failhtml
                    }));
                }
            }
            else
            {
                try
                {
                    var failhtml = this.RenderPartialViewToString("../Enrollment/_EnrollerFail", 0);
                    return(new JsonNetResult(new
                    {
                        success = true,
                        valid = false,
                        html = failhtml
                    }));
                }
                catch (Exception e)
                {
                    Console.Write(e);
                    return(new JsonNetResult(new
                    {
                        success = true,
                        valid = false
                    }));
                }
            }
        }
Beispiel #19
0
        public Event GetEventDetails(int eventId)
        {
            Customer eventCustomer = Exigo.GetCustomerByIDandType(eventId, CustomerTypes.Party);

            //using (var context = Exigo.Sql())
            //{
            //    var sql = string.Format("exec GetCustomerByIDandType {0}, {1}", eventId, CustomerTypes.Party);
            //    eventCustomer = context.Query<Customer>(sql).FirstOrDefault();
            //}

            //if (null == eventCustomer)
            //{
            //    throw new ApplicationException("The provided event ID does not exist.");
            //}

            var eventCustomerSiteResponse = Exigo.GetCustomerSite(eventId);

            var eventCustomerEx = Exigo.GetCustomerExtendedDetails(eventId, (int)CustomerExtendedGroup.PartyDetails).FirstOrDefault();

            var creator           = new Customer();
            int creatorCustomerId = 0;

            if (int.TryParse(eventCustomerEx.Field5, out creatorCustomerId))
            {
                creator          = Exigo.GetCustomerByIDandType(creatorCustomerId, CustomerTypes.IndependentStyleAmbassador);
                creator.WebAlias = Exigo.GetCustomerWebAlias(creator.CustomerID);
            }

            var host           = new Customer();
            int hostCustomerId = 0;

            if (int.TryParse(eventCustomerEx.Field6, out hostCustomerId))
            {
                host = Exigo.GetCustomer(hostCustomerId);
            }

            // Retrieve the party sales total
            var salesTotal = GetPointAccountBalance(eventId, PointAccounts.PartySalesTotal);

            // Retieve the Host' rewards point accounts
            var pointAccounts = GetHostRewardPointAccounts(eventId);

            //var bookingRewards = GetBookingRewards();

            //int bookingRewardsOwnerId = 0;
            //int.TryParse(eventCustomerEx.Field7, out bookingRewardsOwnerId);

            // Create Missing Host Specials
            //CreateMissngHostSpecials(eventCustomerEx);


            var @event = new Event()
            {
                Id                 = eventCustomer.CustomerID,
                Name               = eventCustomer.FirstName,
                Location           = eventCustomer.MainAddress,
                Creator            = creator,
                Host               = host,
                TotalSales         = salesTotal,
                EventPointAccounts = null != pointAccounts?pointAccounts.ToArray() : null,
                                         //EventBookingRewards = bookingRewards,
                                         //BookingRewardsOwnerId = bookingRewardsOwnerId,
                                         WebAlias      = eventCustomerSiteResponse.WebAlias,
                                         StartDate     = Convert.ToDateTime(eventCustomerEx.Field1),
                                         ActualDate    = Convert.ToDateTime(eventCustomerEx.Field2),
                                         EventStatus   = eventCustomer.CustomerStatusID == 0 ? "Close" : Convert.ToDateTime(eventCustomerEx.Field4) < DateTime.Now ? "Close" : "Open",
                                         CloseDate     = Convert.ToDateTime(eventCustomerEx.Field3),
                                         LockoutDate   = Convert.ToDateTime(eventCustomerEx.Field4),
                                         DeletedEvents = eventCustomer.CustomerStatusID == 0?true:false,
                                         //HostSpecialReward = (HostSpecialDiscount)eventCustomerEx,
            };

            if ((@event.LockoutDate - @event.CloseDate).TotalDays <= 2.00)
            {
                @event.LockoutDate = @event.CloseDate.AddDays(7);
            }
            return(@event);
        }
        public ActionResult ManageAutoOrder(int id)
        {
            var viewModel           = new ManageAutoOrderViewModel();
            var customerID          = Identity.Customer.CustomerID;
            var customer            = Exigo.GetCustomer(customerID);
            var autoOrder           = Exigo.GetCustomerAutoOrders(customerID, id).FirstOrDefault();
            var market              = GlobalSettings.Markets.AvailableMarkets.Where(c => c.Countries.Contains(Identity.Customer.Country)).FirstOrDefault();
            var configuration       = market.GetConfiguration().AutoOrders;
            var isExistingAutoOrder = id != 0;

            if (isExistingAutoOrder)
            {
                viewModel.AutoOrder           = autoOrder;
                viewModel.AutoOrder.StartDate = Exigo.GetNextAvailableAutoOrderStartDate(viewModel.AutoOrder.NextRunDate ?? DateTime.Now);

                // Fill in any blanks in the recipient
                viewModel.AutoOrder.ShippingAddress.FirstName  = GlobalUtilities.Coalesce(viewModel.AutoOrder.ShippingAddress.FirstName, customer.FirstName);
                viewModel.AutoOrder.ShippingAddress.MiddleName = GlobalUtilities.Coalesce(viewModel.AutoOrder.ShippingAddress.MiddleName, customer.MiddleName);
                viewModel.AutoOrder.ShippingAddress.LastName   = GlobalUtilities.Coalesce(viewModel.AutoOrder.ShippingAddress.LastName, customer.LastName);
                viewModel.AutoOrder.ShippingAddress.Company    = GlobalUtilities.Coalesce(viewModel.AutoOrder.ShippingAddress.Company, customer.Company);
                viewModel.AutoOrder.ShippingAddress.Email      = GlobalUtilities.Coalesce(viewModel.AutoOrder.ShippingAddress.Email, customer.Email);
                viewModel.AutoOrder.ShippingAddress.Phone      = GlobalUtilities.Coalesce(viewModel.AutoOrder.ShippingAddress.Phone, customer.PrimaryPhone, customer.SecondaryPhone, customer.MobilePhone);
            }
            else
            {
                var customerShippingAddress = customer.ShippingAddresses.Where(a => a.IsComplete && a.Country == Identity.Customer.Country).FirstOrDefault();

                viewModel.AutoOrder = new AutoOrder()
                {
                    FrequencyTypeID        = FrequencyTypes.Monthly,
                    CurrencyCode           = configuration.CurrencyCode,
                    AutoOrderPaymentTypeID = AutoOrderPaymentTypes.PrimaryCreditCardOnFile,
                    StartDate       = Exigo.GetNextAvailableAutoOrderStartDate(DateTime.Now),
                    ShippingAddress = (customerShippingAddress != null) ? customerShippingAddress : new ShippingAddress()
                    {
                        Country = Identity.Customer.Country
                    },
                    ShipMethodID = configuration.DefaultShipMethodID
                };

                viewModel.AutoOrder.ShippingAddress.Phone = GlobalUtilities.Coalesce(viewModel.AutoOrder.ShippingAddress.Phone, customer.PrimaryPhone, customer.SecondaryPhone, customer.MobilePhone);
                viewModel.UsePointAccount = false;
            }

            // Get Available Ship Methods, if we are managing an existing auto order
            if (isExistingAutoOrder)
            {
                var calculateOrderResponse = Exigo.CalculateOrder(new OrderCalculationRequest
                {
                    Address           = viewModel.AutoOrder.ShippingAddress,
                    ShipMethodID      = viewModel.AutoOrder.ShipMethodID,
                    ReturnShipMethods = true,
                    Configuration     = Identity.Customer.Market.Configuration.AutoOrders,
                    CustomerID        = Identity.Customer.CustomerID,
                    Items             = viewModel.AutoOrder.Details.Select(i => new ShoppingCartItem {
                        ItemCode = i.ItemCode, Quantity = i.Quantity
                    })
                });
                viewModel.AvailableShipMethods = calculateOrderResponse.ShipMethods.ToList();
            }
            else
            {
                // Give the View a default ship method for display only
                viewModel.AvailableShipMethods = new List <ShipMethod> {
                    new ShipMethod {
                        Price = 0, Selected = true, ShipMethodDescription = "---", ShipMethodID = 0
                    }
                };
            }

            InflateManageAutoOrderViewModel(customerID, market, configuration, ref viewModel);

            return(View(viewModel));
        }
        public ActionResult ManageAutoOrder(int id, ManageAutoOrderViewModel viewModel)
        {
            var customerID          = Identity.Customer.CustomerID;
            var apiRequests         = new List <ApiRequest>();
            var customer            = Exigo.GetCustomer(customerID);
            var market              = GlobalSettings.Markets.AvailableMarkets.Where(c => c.Countries.Contains(Identity.Customer.Country)).FirstOrDefault();
            var configuration       = market.GetConfiguration().AutoOrders;
            var warehouseID         = configuration.WarehouseID;
            var isExistingAutoOrder = id != 0;
            var paymentMethods      = Exigo.GetCustomerPaymentMethods(new GetCustomerPaymentMethodsRequest()
            {
                CustomerID = Identity.Customer.CustomerID, ExcludeIncompleteMethods = true
            });



            // Remove all items that have no quantity.
            viewModel.AutoOrder.Details = viewModel.AutoOrder.Details.Where(d => d.Quantity > 0).ToList();
            if (!viewModel.AutoOrder.Details.Any())
            {
                ModelState.AddModelError("Result", "Please select at least one product for your Auto Order.");
            }



            if (ModelState.Keys.Contains("Result"))
            {
                InflateManageAutoOrderViewModel(customerID, market, configuration, ref viewModel);

                return(View(viewModel));
            }

            // Save New Credit Card
            var isUsingNewCard = viewModel.AutoOrder.AutoOrderPaymentTypeID == 0;
            var hasPrimaryCard = paymentMethods.Where(v => v.IsComplete).Count() > 0;

            if (isUsingNewCard)
            {
                var saveCCRequest = new SetAccountCreditCardTokenRequest(viewModel.NewCreditCard);

                // If there is one or more available payment type, save the card in the secondary card slot
                if (hasPrimaryCard)
                {
                    saveCCRequest.CreditCardAccountType        = AccountCreditCardType.Secondary;
                    viewModel.AutoOrder.AutoOrderPaymentTypeID = AutoOrderPaymentTypes.SecondaryCreditCardOnFile;
                }
                else
                {
                    viewModel.AutoOrder.AutoOrderPaymentTypeID = AutoOrderPaymentTypes.PrimaryCreditCardOnFile;
                }
                saveCCRequest.CustomerID = customerID;
                apiRequests.Add(saveCCRequest);
            }


            // Prepare the auto order
            var autoOrder = viewModel.AutoOrder;
            var createAutoOrderRequest = new CreateAutoOrderRequest(autoOrder)
            {
                PriceType   = configuration.PriceTypeID,
                WarehouseID = warehouseID,
                Notes       = !string.IsNullOrEmpty(autoOrder.Notes)
                                ? autoOrder.Notes
                                : string.Format("Created with the API Auto-Delivery manager at \"{0}\" on {1:u} at IP {2} using {3} {4} ({5}).",
                                                Request.Url.AbsoluteUri,
                                                DateTime.Now.ToUniversalTime(),
                                                GlobalUtilities.GetClientIP(),
                                                HttpContext.Request.Browser.Browser,
                                                HttpContext.Request.Browser.Version,
                                                HttpContext.Request.Browser.Platform),
                CustomerID = customerID
            };

            apiRequests.Add(createAutoOrderRequest);

            try
            {
                // Process the transaction
                var transaction = new TransactionalRequest {
                    TransactionRequests = apiRequests.ToArray()
                };
                var response = Exigo.WebService().ProcessTransaction(transaction);

                return(RedirectToAction("AutoOrderList", new { success = "1" }));
            }
            catch (Exception ex)
            {
                ModelState.AddModelError("Result", "We were unable to save your Auto-Delivery: " + ex.Message);

                InflateManageAutoOrderViewModel(customerID, market, configuration, ref viewModel);

                return(View(viewModel));
            }
        }
Beispiel #22
0
        ////Not being used anymore...just here for reference
        //public void CreateCustomerRecruitingRewards(int customerId)
        //{

        //    var api = Exigo.WebService();
        //    var reward = new RecruitingRewardDiscount();

        //    //Set start and expiry dates.
        //    var startDate = DateTime.Now;
        //    reward.CompletionDate = startDate.AddDays(60);

        //    //customerId = 1022;
        //    const int extendedGroupId = (int)CustomerExtendedGroup.RecruitingRewards;

        //    //Get Discount amount and check validity.
        //    reward.RewardAmount = Convert.ToDecimal(GetRecruitingReward(customerId));
        //    if (reward.DiscountAmount <= 0) return;

        //    //Check if the reward has already been added for the customer
        //    var customerEx = Exigo.GetCustomerExtendedDetails(customerId, extendedGroupId).Where(x => Convert.ToDateTime(x.Field2) == reward.CompletionDate);
        //    if (customerEx.Any()) return;

        //    var response = api.CreateCustomerExtended(new CreateCustomerExtendedRequest()
        //    {
        //        CustomerID = customerId,
        //        ExtendedGroupID = extendedGroupId,
        //        Field1 = reward.ItemCode, //Item Code
        //        Field2 = reward.CompletionDate.ToString(CultureInfo.InvariantCulture), //Completion Date
        //        Field4 = Convert.ToString(reward.RewardAmount, CultureInfo.InvariantCulture), //RewardAmount
        //        Field3 = 0.ToString(CultureInfo.InvariantCulture) //Redeemed

        //    });
        //}

        ////Also not being use at this time.
        //public decimal GetRecruitingReward(int customerId)
        //{

        //    var request = new GetPointAccountRequest()
        //    {
        //        CustomerID = customerId,
        //        PointAccountID = PointAccounts.RecruitingRewards
        //    };
        //    var rewardAmount = Exigo.GetRecruitingReward(request);

        //    return rewardAmount;
        //}

        //public IList<RecruitingRewardDiscount> GetCustomerRecruitingRewardDiscounts(int customerId)
        //{
        //    var details = Exigo.GetCustomerExtendedDetails(customerId, (int)CustomerExtendedGroup.RecruitingRewards /* Recruiting Rewards Extended Group ID */);

        //    var recruitingReward = (from d in details
        //                            select new RecruitingRewardDiscount()
        //                    {
        //                        CustomerExtendedDetailId = d.CustomerExtendedDetailID,
        //                        CompletionDate = DateTime.Parse(d.Field2),
        //                        ItemCode = d.Field1,
        //                        HasBeenRedeemed = (d.Field3 == "1"),
        //                        RewardAmount = Convert.ToDecimal(d.Field4)
        //                    }
        //     );

        //    return recruitingReward.ToList();

        //}

        #endregion Recruiting-Reward

        #region Enrollee-Reward

        //public void CreateCustomerEnrolleeRewards(int customerId)
        //{

        //    var api = Exigo.WebService();
        //    var reward = new EnrolleeRewardDiscount();

        //    //Set start and expiry dates.
        //    var startDate = DateTime.Now;
        //    reward.CompletionDate = startDate.AddDays(60);

        //    //customerId = 1022;
        //    const int extendedGroupId = (int)CustomerExtendedGroup.EnrolleeRewards;

        //    //Get Discount amount and check validity.
        //    reward.RewardAmount = Convert.ToDecimal(GetEnrolleeReward(customerId));
        //    if (reward.DiscountAmount <= 0) return;

        //    //Check if the reward has already been added for the customer
        //    var customerEx = Exigo.GetCustomerExtendedDetails(customerId, extendedGroupId).Where(x => Convert.ToDateTime(x.Field2) == reward.CompletionDate);
        //    if (customerEx.Any()) return;

        //    var response = api.CreateCustomerExtended(new CreateCustomerExtendedRequest()
        //    {
        //        CustomerID = customerId,
        //        ExtendedGroupID = extendedGroupId,
        //        Field1 = reward.CompletionDate.ToString(CultureInfo.InvariantCulture), //Completion Date
        //        Field2 = Convert.ToString(reward.RewardAmount), //RewardAmount
        //        Field3 = 0.ToString(CultureInfo.InvariantCulture) //Redeemed

        //    });
        //}

        //public decimal GetEnrolleeReward(int customerId)
        //{

        //    var request = new GetPointAccountRequest()
        //    {
        //        CustomerID = customerId,
        //        PointAccountID = PointAccounts.EnrolleeRewards
        //    };
        //    var rewardAmount = Exigo.GetEnrolleeReward(request);

        //    return rewardAmount;
        //}

        //public IList<EnrolleeRewardDiscount> GetCustomerEnrolleeRewardDiscounts(int customerId)
        //{
        //    var details = Exigo.GetCustomerExtendedDetails(customerId, (int)CustomerExtendedGroup.EnrolleeRewards /* Recruiting Rewards Extended Group ID */);

        //    var enrolleeReward = (from d in details
        //                          select new EnrolleeRewardDiscount()
        //                            {
        //                                CustomerExtendedDetailId = d.CustomerExtendedDetailID,
        //                                CompletionDate = DateTime.Parse(d.Field2),
        //                                ItemCode = d.Field3,
        //                                HasBeenRedeemed = (d.Field5 == "1")
        //                            }
        //     );

        //    return enrolleeReward.ToList();

        //}

        #endregion Enrollee-Reward


        public int CreateRewardsAutoOrder(string itemCode, int customerId, int ExtendedGroupID, int phase)
        {
            ShoppingCart.Items.Clear();
            try
            {
                Api = Exigo.WebService();

                CustomerExtendedDetails customerEx = Exigo.GetCustomerExtendedDetails(customerId, ExtendedGroupID).FirstOrDefault(x => x.Field3 == itemCode && x.Field1 == phase.ToString());
                if (customerEx != null)
                {
                    return(0);
                }
                var customer = Exigo.GetCustomer(customerId);
                // Start creating the API requests
                var details = new List <ApiRequest>();
                // Create the order request, if applicable
                ShoppingCartItem cartItem = ShoppingCartItem.Create();

                cartItem.ItemCode          = itemCode;
                cartItem.Quantity          = 1;
                cartItem.PriceEachOverride = 0;
                cartItem.PriceTypeID       = PriceTypes.Wholesale;
                cartItem.Type = ShoppingCartItemType.Order;

                ShoppingCart.Items.Add(cartItem);
                if (string.IsNullOrEmpty(itemCode))
                {
                    _log.TraceEvent(TraceEventType.Warning, 1, "IRewardService.CreateBonusKickerAutoOrder( String, int ): Entering method and ShoppingCart.Items is {0}.", (ShoppingCart.Items == null) ? "null" : "empty");
                    _nlog.Warn("IRewardService.CreateBonusKickerAutoOrder( String, int ): Entering method and ShoppingCart.Items is {0}.", (ShoppingCart.Items == null) ? "null" : "empty");
                }
                else
                {
                    _log.TraceEvent(TraceEventType.Information, 1, "IRewardService.CreateBonusKickerAutoOrder( String, int ): Entering method and ShoppingCart.Items is {0}.", ShoppingCart.Items.Count);
                    _nlog.Info("IOrderService.PlaceOrder( Shop, String ): Entering method with {0} products.", ShoppingCart.Items.Count);
                }
                // Create the autoorder request, if applicable
                var autoOrderRequest = new CreateOrderRequest(
                    AutoOrderConfiguration,
                    (int)ShipMethods.Standard,
                    string.Empty,
                    ShoppingCart.Items,
                    new ShippingAddress
                {
                    Address1    = string.IsNullOrEmpty(customer.MainAddress.Address1) ? customer.MailingAddress.Address1 : customer.MainAddress.Address1,
                    Address2    = string.IsNullOrEmpty(customer.MainAddress.Address2) ? customer.MailingAddress.Address2 : customer.MainAddress.Address2,
                    AddressType = AddressType.Mailing,
                    City        = string.IsNullOrEmpty(customer.MainAddress.City) ? customer.MailingAddress.City : customer.MainAddress.City,
                    Country     = string.IsNullOrEmpty(customer.MainAddress.Country) ? customer.MailingAddress.Country : customer.MainAddress.Country,
                    CustomerID  = customer.CustomerID,
                    Email       = customer.Email,
                    LastName    = customer.LastName,
                    FirstName   = customer.FirstName,
                    Phone       = customer.MobilePhone,
                    State       = string.IsNullOrEmpty(customer.MainAddress.State) ? customer.MailingAddress.State : customer.MainAddress.State,
                    Zip         = string.IsNullOrEmpty(customer.MainAddress.Zip) ? customer.MailingAddress.Zip : customer.MainAddress.Zip,
                },
                    shippingOverride: 0,
                    taxOverride: 0);

                autoOrderRequest.TaxRateOverride        = 0M;
                autoOrderRequest.ShippingAmountOverride = 0M;
                autoOrderRequest.CustomerID             = customerId;
                autoOrderRequest.Other15 = "1";

                details.Add(autoOrderRequest);

                // Process the transaction
                var transactionRequest = new TransactionalRequest {
                    TransactionRequests = details.ToArray()
                };
                var transactionResponse = Exigo.WebService().ProcessTransaction(transactionRequest);
                if (transactionResponse == null)
                {
                    _log.TraceEvent(TraceEventType.Error, 1, "There was no CreateOrderResponse.");
                }
                else
                {
                    _log.TraceEvent(TraceEventType.Information, 1, "ProcessTransaction.Result.TransactionKey = {0}", transactionResponse.Result.TransactionKey);
                    _log.TraceEvent(TraceEventType.Information, 1, "ProcessTransaction.Result.Reponse = {0}", transactionResponse.Result.Status);

                    if ((transactionResponse.Result.Errors != null) && (transactionResponse.Result.Errors.Length > 0))
                    {
                        _log.TraceEvent(TraceEventType.Error, 1, "ProcessTransaction.Result.Errors.Length = {0}", transactionResponse.Result.Errors.Length);
                        for (int i = 0; i < transactionResponse.Result.Errors.Length; i++)
                        {
                            _log.TraceEvent(TraceEventType.Error, 1, "ProcessTransaction.Result.Errors[{0}] = {1}", i, transactionResponse.Result.Errors[i]);
                        }
                    }
                }
                var newOrderId = 0;

                //process the response
                if (transactionResponse.Result.Status == ResultStatus.Success)
                {
                    foreach (var orderResponse in transactionResponse.TransactionResponses.OfType <CreateOrderResponse>())
                    {
                        newOrderId = orderResponse.OrderID;

                        var request = Api.CreateCustomerExtended(new CreateCustomerExtendedRequest()
                        {
                            CustomerID      = customer.CustomerID,
                            ExtendedGroupID = ExtendedGroupID,
                            Field1          = phase.ToString(),                         // phase # for bonus kicker or module for training
                            Field2          = DateTime.Now.ToString(CultureInfo.InvariantCulture),
                            Field3          = itemCode,                                 //ItemCode
                            Field4          = 100.ToString(),                           //Discount Percent
                            Field5          = 1.ToString(CultureInfo.InvariantCulture), //Redeemed
                            Field6          = newOrderId.ToString()                     // orderid
                        });
                    }

                    var updateOrder = Api.ChangeOrderStatus(new ChangeOrderStatusRequest()
                    {
                        OrderID     = newOrderId,
                        OrderStatus = OrderStatusType.Accepted
                    });
                }
                return(newOrderId);
            }
            catch (Exception ex)
            {
                return(0);
            }
        }
        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));
        }
Beispiel #24
0
        public int AuthenticateCustomer(int customerid)
        {
            Customer customer = Exigo.GetCustomer(customerid);

            return(customer.CustomerID);
        }