Exemplo n.º 1
0
        public static bool IsLoginNameAvailable(string loginname, int customerID = 0)
        {
            // Ensure that the login name entered actually has a value
            if (loginname.IsNullOrEmpty())
            {
                return(false);
            }

            if (customerID > 0)
            {
                // Get the current login name to see if it matches what we passed. If so, it's still valid.
                var currentLoginName = Exigo.GetCustomer(customerID).LoginName;
                if (loginname.Equals(currentLoginName, StringComparison.InvariantCultureIgnoreCase))
                {
                    return(true);
                }
            }

            var apiCustomer = Exigo.WebService().GetCustomers(new GetCustomersRequest()
            {
                LoginName = loginname
            }).Customers.FirstOrDefault();

            return(apiCustomer == null);
        }
Exemplo n.º 2
0
        public static bool IsLoginNameAvailable(int customerID, string loginname)
        {
            // Get the current login name to see if it matches what we passed. If so, it's still valid.
            var currentLoginName = Exigo.GetCustomer(customerID).LoginName;

            if (loginname.Equals(currentLoginName, StringComparison.InvariantCultureIgnoreCase))
            {
                return(true);
            }


            // Validate the login name
            return(Exigo.WebService().Validate(new IsLoginNameAvailableValidateRequest
            {
                LoginName = loginname
            }).IsValid);
        }
Exemplo n.º 3
0
        public static void CreateDefaultCalendarSubscriptions(int customerID)
        {
            // Get their enroller ID
            //var context = Exigo.OData();
            //var enroller = context.Customers
            //    .Where(c => c.CustomerID == customerID)
            //    .Select(c => new
            //    {
            //        c.EnrollerID
            //    })
            //    .FirstOrDefault();
            var enroller = Exigo.GetCustomer(customerID);

            // If this person does not have an enroller, stop here.
            if (enroller == null || enroller.EnrollerID == null)
            {
                return;
            }

            // Get the enroller's default calendar
            var enrollerID = (int)enroller.EnrollerID;
            var calendars  = GetCalendars(new GetCalendarsRequest
            {
                CustomerID = enrollerID,
                IncludeCalendarSubscriptions = false
            });

            // If they do not have a calendar, create them one
            var calendar = new Calendar();

            if (calendars.Count() == 0)
            {
                calendar = CreateDefaultCalendar(enrollerID);
            }
            else
            {
                calendar = calendars
                           .Where(c => c.CalendarTypeID == 1)
                           .OrderBy(c => c.CreatedDate)
                           .FirstOrDefault();
            }


            // Subscribe to the enroller's calendar
            SubscribeToCustomerCalendar(customerID, calendar.CalendarID);
        }
Exemplo n.º 4
0
        public static bool InEBPeriod(int customerId)
        {
            //ExigoCustomer exigoCustomer = Exigo.OData().Customers.Where(c => (c.CustomerID == ambassadorId)).FirstOrDefault();
            Customer exigoCustomer = Exigo.GetCustomer(customerId);

            if (exigoCustomer == null)
            {
                return(false);
            }

            if (!exigoCustomer.Date1.HasValue)
            {
                return(false);
            }

            DateTime ambassadorStartDate = exigoCustomer.Date1.Value;

            bool isFirst100Days = IsFirst100DaysOfBecomingSa(DateTime.Now, ambassadorStartDate);

            return(isFirst100Days);
        }
Exemplo n.º 5
0
        public static bool IsLoginNameAvailable(string loginname, int customerID = 0)
        {
            if (customerID > 0)
            {
                // Get the current login name to see if it matches what we passed. If so, it's still valid.
                var currentLoginName = Exigo.GetCustomer(customerID).LoginName;
                if (loginname.Equals(currentLoginName, StringComparison.InvariantCultureIgnoreCase))
                {
                    return(true);
                }
            }

            // Validate the login name
            // cannot use SQL due to delay in update to replicated database
            var apiCustomer = Exigo.WebService().GetCustomers(new GetCustomersRequest()
            {
                LoginName = loginname
            }).Customers.FirstOrDefault();

            return(apiCustomer == null);
        }