Ejemplo n.º 1
0
        public async Task <IActionResult> Post(Guid id, [FromBody] DateRange occurs)
        {
            var command = new ScheduleMeeting(id, occurs);
            await _commandBus.Send(command);

            return(Ok());
        }
Ejemplo n.º 2
0
        public ActionResult ScheduleMeeting(int sessionID = 0)
        {

            var profile = Dc.TutorProfiles.FirstOrDefault(a => a.UserID == currentUser.UserId);
            if (profile != null)
            {
                ViewBag.Rate = profile.Rate;
            }
            var m = new ScheduleMeeting();
            if (sessionID > 0)
            {
                m = Dc.ScheduleMeetings.Include("Attendees").FirstOrDefault(a => a.SessionID == sessionID);
            }
            else
            {
                m.StartTime = DateTime.UtcNow.GetLocalTime(currentUser.TimeZone);
                m.EndTime = DateTime.UtcNow.AddMinutes(45).GetLocalTime(currentUser.TimeZone);
                m.EndDateBy = DateTime.UtcNow.AddMonths(1);
                m.HostUserID = currentUser.UserId;
                //todo: find users default timezone
                m.TimeZone = currentUser.TimeZone;
            }


            return View(m);
        }
        public async Task <Unit> Handle(ScheduleMeeting request, CancellationToken cancellationToken)
        {
            var meeting = await repository.Find(request.MeetingId, cancellationToken);

            meeting.Schedule(request.Occurs);

            await repository.Update(meeting, cancellationToken);

            return(Unit.Value);
        }
Ejemplo n.º 4
0
        public async Task <Unit> Handle(ScheduleMeeting request, CancellationToken cancellationToken)
        {
            var meeting = await repository.Find(request.MeetingId, cancellationToken)
                          ?? throw AggregateNotFoundException.For <Meeting>(request.MeetingId);

            meeting.Schedule(request.Occurs);

            await repository.Update(meeting, cancellationToken);

            return(Unit.Value);
        }
Ejemplo n.º 5
0
        public object CreateMeeting(MeetingBooking e)
        {
            try
            {
                if (e.MeetingId != null)
                {
                    ScheduleMeeting em = new ScheduleMeeting();
                    em.FirstName = e.FirstName;

                    em.LastName = e.LastName;

                    em.Purpose = e.Purpose;

                    em.Description = e.Description;

                    em.MeetingDtm = e.MeetingDtm.Value.ToUniversalTime();

                    em.Country = e.Country;

                    DB.ScheduleMeetings.Add(em);

                    DB.SaveChanges();

                    return(new Response
                    {
                        Status = "Success",
                        Message = "Data save Successfully"
                    });
                }

                else

                {
                    var obj = DB.ScheduleMeetings.Where(x => x.MeetingId == e.MeetingId).ToList().FirstOrDefault();

                    if (obj.MeetingId != null)

                    {
                        obj.FirstName = e.FirstName;

                        obj.LastName = e.LastName;

                        obj.Purpose = e.Purpose;

                        obj.Description = e.Description;

                        obj.MeetingDtm = e.MeetingDtm;

                        DB.SaveChanges();

                        return(new Response
                        {
                            Status = "Updated",
                            Message = "Updated Successfully"
                        });
                    }
                }
            }
            catch (Exception ex)
            {
                Console.Write(ex.Message);
            }
            return(new Response
            {
                Status = "Error",
                Message = "Data not insert"
            });
        }
Ejemplo n.º 6
0
        public ActionResult SaveMeeting(ScheduleMeeting m)
        {


            if (ModelState.IsValid)
            {
                try
                {


                    //Time Sessions
                    //TimeSpan Start, End = new TimeSpan();
                    //Start = m.StartTime.TimeOfDay;
                    //End = m.EndTime.TimeOfDay;
                    m.StartTime = m.StartTime.GetFromLocalTime(m.TimeZone);
                    m.EndTime = m.EndTime.GetFromLocalTime(m.TimeZone);

                    //TimeZone
                    if (m.SessionID > 0)
                    {
                        Dc.ScheduleMeetings.Attach(m);
                        Dc.Entry(m).State = System.Data.Entity.EntityState.Modified;
                        Dc.SaveChanges();
                    }
                    else
                    {
                        m.HostUserID = currentUser.UserId;
                        m.Active = "Y";
                        m.Date = m.StartTime.Date;
                        //meeting link
                        string meetingID = Membership.GeneratePassword(10, 2);

                        m.MeetingLink = "https://www.groupworld.net/room/3437/" + meetingID + "?show_timer=true&timer_two_users=true";

                        //Radio button logic
                        //You MUST get ALL the values for Recurr
                        if (m.Recurr == true)
                        {
                            //Monthly
                            if (m.Frequency == 3)
                            {
                                //m.RepeatFrequency
                            }
                        }
                        else // sets the following to defaults
                        {
                            m.Frequency = 0; m.RepeatDaily = 0; m.RepeatWeekly = 0; m.RepeatMonthly = 0; m.Sunday = false; m.Monday = false; m.Tuesday = false;
                            m.Wednesday = false; m.Thursday = false; m.Friday = false; m.Saturday = false; m.RepeatMonthRadio1 = false;
                            m.RepeatMonthRadio2 = false; m.Radio2List1 = 0; m.Radio2List2 = 0; m.EndDateBy = DateTime.UtcNow; m.EndDateAfter = 0; m.Subject = "";
                        }


                        Dc.ScheduleMeetings.Add(m);
                        Dc.SaveChanges();
                        var schedule = new Schedule()
                        {
                            SessionID = m.SessionID,
                            UserID = currentUser.UserId
                        };
                        Dc.Schedules.Add(schedule);
                        Dc.SaveChanges();
                        // needs to input into the schedule table because thats the table that is populating
                        // the schedule
                        //
                        //redirects user to different action"                    
                        //This needs to change (Either Success view or take user to "Add to Calendar Page/Review Meeting Page"

                        // jquery is preventing any kind of action
                        // return RedirectToAction("Schedule", "User", new { ID = currentUser.UserId });//redirects user to different action"                    
                    }

                }
                catch (System.Data.Entity.Validation.DbEntityValidationException ex)
                {
                    Exception raise = ex;
                    foreach (var validationErrors in ex.EntityValidationErrors)
                    {
                        foreach (var validationError in validationErrors.ValidationErrors)
                        {
                            string message = string.Format("{0}:{1}",
                                validationErrors.Entry.Entity.ToString(),
                                validationError.ErrorMessage);
                            // raise a new exception nesting  
                            // the current instance as InnerException  
                            raise = new InvalidOperationException(message, raise);
                        }
                    }
                }

                m.Attendees = Dc.Attendees.Where(a => a.SessionID == m.SessionID).ToList();
            }
            //m.EndDateBy = new DateTime();
            //m.EndDateAfter = new DateTime();

            // Validation failed and returning current fields.
            return PartialView("ScheduleMeeting", m);

        }