Example #1
0
        private IState InitializeStates()
        {
            var toBeContinued = new ToBeContinuedState();

            var dialogOptions = new List <IState>()
            {
                new DialogOptionState("Option 1 was chosen"),
                new DialogOptionState("Option 2 was chosen"),
                new DialogOptionState("Option 3 was chosen")
            };

            dialogOptions.ForEach(x => x.AddState(StandardCommands.ToBeContinued, toBeContinued));

            var dialogState = new DialogState();

            dialogState.AddState(StandardCommands.DialogOptionOne, dialogOptions[0]);
            dialogState.AddState(StandardCommands.DialogOptionTwo, dialogOptions[1]);
            dialogState.AddState(StandardCommands.DialogOptionThree, dialogOptions[2]);

            var meetingState = new MeetingState();

            meetingState.AddState(StandardCommands.OpenDialog, dialogState);
            meetingState.AddState(StandardCommands.AnotherOption, new SomeState());

            var startState = new StartState();

            startState.AddState(StandardCommands.MeetCharacter, meetingState);

            return(startState);
        }
Example #2
0
        public async Task <IActionResult> Edit(int id, [Bind("Id,Name")] MeetingState meetingState)
        {
            if (id != meetingState.Id)
            {
                return(NotFound());
            }

            if (ModelState.IsValid)
            {
                try
                {
                    _context.Update(meetingState);
                    await _context.SaveChangesAsync();
                }
                catch (DbUpdateConcurrencyException)
                {
                    if (!MeetingStateExists(meetingState.Id))
                    {
                        return(NotFound());
                    }
                    else
                    {
                        throw;
                    }
                }
                return(RedirectToAction(nameof(Index)));
            }
            return(View(meetingState));
        }
Example #3
0
 public override void Load(MeetingDocument document)
 {
     id          = new Id(document.Id);
     version     = new Version(document.Version);
     meetingDate = new MeetingDate(document.MeetingDate);
     speaker     = new Id(document.Speaker);
     state       = document.State;
     tickets     = new Tickets(document.Tickets);
     venue       = new Id(document.Venue);
 }
Example #4
0
 public MeetingDocument(Id meetingId, MeetingDate meeting, Id venue, Id speaker, IEnumerable<MeetingDocumentTickets> tickets, MeetingState state, Version version)
 {
     Id = (Guid) meetingId; 
     Venue = venue ?? Guid.Empty;
     MeetingDate = (DateTime) meeting;
     Speaker = speaker ?? Guid.Empty;
     State = MeetingState.Live;
     Tickets = tickets.ToList();
     Version = (int) version;
 }
Example #5
0
 public bool UpdateMeeting(int id, MeetingState state, string email = null)
 {
     using (var db = new VMSDbEntities())
     {
         Random randomGenerator = new Random();
         var    otp             = state == MeetingState.Acknowledged ? randomGenerator.Next(100000, 999999) : -1;
         db.spUpdateMeeting(id, (int)state, email ?? string.Empty, otp);
     }
     return(true);
 }
Example #6
0
        public async Task <IActionResult> Create([Bind("Id,Name")] MeetingState meetingState)
        {
            if (ModelState.IsValid)
            {
                _context.Add(meetingState);
                await _context.SaveChangesAsync();

                return(RedirectToAction(nameof(Index)));
            }
            return(View(meetingState));
        }
Example #7
0
        public async Task <List <Meeting> > ListMeetings(string userId, MeetingState state)
        {
            var token      = GetToken();
            var listResult = await ZoomApiBaseUrl
                             .AppendPathSegments("users", userId, "meetings")
                             .SetQueryParams(new { page_size = 50, type = state.ToString().ToLower() })
                             .WithOAuthBearerToken(token)
                             .GetJsonAsync <ListMeetingsResult>();

            return(listResult.Meetings.ToList());
        }
Example #8
0
        async Task RegisterFormDialogResumedAsync(IDialogContext context, IAwaitable <RegisterForm> result)
        {
            var         mtgState = new MeetingState();
            MeetingData mtgData  = await mtgState.GetAsync(context.Activity) ?? new MeetingData();

            RegisterForm form = await result;

            mtgData.UserDBID      = form.UserID;
            mtgData.UserChannelID = context.Activity.From.Id;

            MtgData = mtgData;
            //await mtgState.UpdateAsync(context.Activity, mtgData);

            context.Wait(MessageReceivedAsync);
        }
Example #9
0
        async Task RegisterDialogResumedAsync(IDialogContext context, IAwaitable <Registration> result)
        {
            Registration registration = await result;

            IActivity activity = context.Activity;

            var         mtgState = new MeetingState();
            MeetingData mtgData  = await mtgState.GetAsync(activity) ?? new MeetingData();

            using (var ctx = new MeetingContext())
            {
                User user =
                    await
                        (from usr in ctx.Users
                        where usr.UserID == mtgData.UserDBID ||
                        usr.Email == registration.Email
                        select usr)
                    .SingleOrDefaultAsync();

                if (user == null)
                {
                    user = new User
                    {
                        Email = registration.Name,
                        Name  = registration.Email
                    };
                    ctx.Users.Add(user);
                }
                else
                {
                    user.Name  = registration.Name;
                    user.Email = registration.Email;
                }

                await ctx.SaveChangesAsync();
            }

            await context.PostAsync("Registration succeeded!");

            context.Wait(MessageReceivedAsync);
        }
Example #10
0
 public void OpenForRegistration()
 {
     state = MeetingState.Live;
 }
Example #11
0
 public MeetingDocument(Id meetingId, MeetingDate meeting, Id venue, Id speaker, IEnumerable <MeetingDocumentTickets> tickets, MeetingState state, Version version)
 {
     Id          = (Guid)meetingId;
     Venue       = venue ?? Guid.Empty;
     MeetingDate = (DateTime)meeting;
     Speaker     = speaker ?? Guid.Empty;
     State       = MeetingState.Live;
     Tickets     = tickets.ToList();
     Version     = (int)version;
 }