Exemplo n.º 1
0
        public FindEventsDialog(
            IServiceProvider serviceProvider)
            : base(nameof(FindEventsDialog), serviceProvider)
        {
            var findEvents = new WaterfallStep[]
            {
                GetLocationAsync,
                FindEventsAsync
            };

            _eventbriteService = new EventbriteService(Settings);

            AddDialog(new WaterfallDialog(nameof(FindEventsDialog), findEvents));
            AddDialog(new TextPrompt(DialogIds.LocationPrompt, ValidateLocationPromptAsync));
        }
Exemplo n.º 2
0
        public void SetUp()
        {
            this._converterService = new ModelConverterService();
            IEventService eventService = new EventbriteService();
            var           location     = Cities.Amberg.GetLocation();

            this._events =
                eventService.GetEvents(location.Item1, location.Item2, new EventDateRange {
                Description = "Weekend"
            }).Result
                .ToArray();


            var fileName = "SQliteDatabaseTest.db3";
            var path     = Path.Combine(Path.GetTempPath(), fileName);

            Console.WriteLine(path);
            if (File.Exists(path))
            {
                File.Delete(path);
            }

            this._connection = new SQLiteConnection(new SQLite.Net.Platform.Win32.SQLitePlatformWin32(), path, SQLiteOpenFlags.ReadWrite | SQLiteOpenFlags.Create | SQLiteOpenFlags.SharedCache);
            this._connection.CreateTable <MobileCategory>();
            this._connection.CreateTable <MobileUser>();
            this._connection.CreateTable <MobileEvent>();


            this._dummyUser = new MobileUser
            {
                Guid                        = "max.urvent",
                Gender                      = 0,
                EMail                       = "*****@*****.**",
                Birthday                    = DateTime.Now,
                AccessToken                 = "token",
                AccessTokenReceived         = DateTime.Now,
                AttractedTo                 = 1,
                EventDateRange              = 0,
                ExcludedCategories          = new List <MobileCategory>(),
                FacebookAccessToken         = "fbToken",
                FacebookAccessTokenReceived = DateTime.Now,
                MaxDistance                 = 20,
                Longitude                   = 0,
                Latitude                    = 0,
                LastLogin                   = DateTime.Now,
                UserEvents                  = new List <MobileEvent>()
            };
        }
        public async Task <ActionResult> Index(int eventbriteOrderNo, int dddEventId, string clientToken)
        {
            try
            {
                UserInfo registeredUser = null;
                var      userService    = new UserService();

                var user = userService.GetUserByEventbriteOrder(dddEventId, eventbriteOrderNo);

                if (user == null)
                {
                    var eventMgr           = new EventsService();
                    var eventInfo          = eventMgr.GetServerEventData(dddEventId);
                    var eventbriteService  = new EventbriteService(eventInfo.EventbriteToken);
                    var eventbriteUserInfo = await eventbriteService.GetUserRegistrationInfo(eventbriteOrderNo, eventInfo.EventbriteEventId);

                    var newToken = Guid.NewGuid().ToString();
                    userService.AddUser(dddEventId, eventbriteOrderNo, eventbriteUserInfo.firstName, eventbriteUserInfo.lastName, newToken, clientToken);
                    registeredUser = new UserInfo
                    {
                        firstName = eventbriteUserInfo.firstName,
                        lastName  = eventbriteUserInfo.lastName,
                        token     = newToken
                    };
                }
                else
                {
                    registeredUser = new UserInfo
                    {
                        firstName = user.FirstName,
                        lastName  = user.LastName,
                        token     = user.RowKey
                    };
                }

                var eventScoreService = new EventScoreService(registeredUser.token, dddEventId, user.FirstName + "_" + user.LastName);
                registeredUser.eventScore = eventScoreService.GetCurrentEventScore();

                return(new JsonNetResult(registeredUser));
            }
            catch (Exception)
            {
                throw new InvalidDataException("Failed to get user");
            }
        }
Exemplo n.º 4
0
        public FindEventsDialog(
            BotSettings settings,
            BotServices services,
            ResponseManager responseManager,
            ConversationState conversationState,
            UserState userState,
            IBotTelemetryClient telemetryClient)
            : base(nameof(FindEventsDialog), settings, services, responseManager, conversationState, userState, telemetryClient)
        {
            var findEvents = new WaterfallStep[]
            {
                GetLocation,
                FindEvents
            };

            _eventbriteService = new EventbriteService(settings);

            AddDialog(new WaterfallDialog(nameof(FindEventsDialog), findEvents));
            AddDialog(new TextPrompt(DialogIds.LocationPrompt, ValidateLocationPrompt));
        }
        private async Task DownloadDataAsync()
        {
            var eventbriteService = new EventbriteService();

            EventbriteEvents = await eventbriteService.GetEventsAsync("Milwaukee");
        }