public ActionResult CalendarIndex()
        {
            CalendarIndexViewModel model = new CalendarIndexViewModel();

            model.Calendar = new Infrastructure.ViewModels.Calendar.CalendarViewModel(Infrastructure.Types.Calendar.DefaultView.Month)
            {
                CalendarName = "Appointments"
            };
            model.Calendar.Categories = new List <CategoryViewModel>();


            var meetingCategory = new CategoryViewModel("Meetings with JobSeeker", "DisplayForm")
            {
                Description = new Infrastructure.ViewModels.ContentViewModel().AddText("This category is for something...."),
                Area        = "Example",
                Color       = Infrastructure.Types.ColourType.Blue,
                IconType    = Infrastructure.Types.IconType.User
            };

            meetingCategory.Items = meetingCategoryEventsList;
            model.Calendar.Categories.Add(meetingCategory);

            var eventCategory = new CategoryViewModel("Event", "DisplayFormEvent")
            {
                Description      = new Infrastructure.ViewModels.ContentViewModel().AddText("This is description of category."),
                Area             = "Example",
                DragResizeAction = "UpdateEventTimes",
                Color            = Infrastructure.Types.ColourType.Green,
                IconType         = Infrastructure.Types.IconType.CalendarO
            };

            eventCategory.Items = eventsCategoryList;
            model.Calendar.Categories.Add(eventCategory);

            var qAndaCategory = new CategoryViewModel("Q and A", "DisplayFormQA")
            {
                Description = new Infrastructure.ViewModels.ContentViewModel().AddText("Q & A"),
                Area        = "Example",
                Color       = Infrastructure.Types.ColourType.Orange,
                IconType    = Infrastructure.Types.IconType.Question
            };

            qAndaCategory.Items = qAndaCategoryList;
            model.Calendar.Categories.Add(qAndaCategory);

            return(View(model));
        }
예제 #2
0
        public async Task <ActionResult> SearchResult(CalendarIndexViewModel data)
        {
            if (data.queries == null)
            {
                CalendarIndexViewModel model = new CalendarIndexViewModel();

                return(View("SearchResult", model));
            }
            else
            {
                var postTask = await client.PostAsJsonAsync("/api/Calendar/Search", data);

                var UserResult = await postTask.Content.ReadAsAsync <CalendarSearchViewModel>();

                return(Json(UserResult, JsonRequestBehavior.AllowGet));
            }
        }
예제 #3
0
        public async Task <ActionResult> View(long?cal_id)
        {
            if (cal_id != null)
            {
                CalendarUpdateViewModel model = new CalendarUpdateViewModel();
                var postTask = await client.GetAsync("/api/Calendar/View/?cal_id=" + cal_id);

                model = await postTask.Content.ReadAsAsync <CalendarUpdateViewModel>();

                if (model != null)
                {
                    return(View("View", model));
                }
                else
                {
                    CalendarIndexViewModel data = new CalendarIndexViewModel();
                    ViewBag.Error = "No Activity Found !";
                    return(View("Index", data));
                }
            }
            return(new HttpStatusCodeResult(HttpStatusCode.BadRequest));
        }
예제 #4
0
        public ActionResult Index()
        {
            CalendarIndexViewModel model = new CalendarIndexViewModel();

            return(View("Index", model));
        }
예제 #5
0
        public ActionResult Index()
        {
            var model = new CalendarIndexViewModel();

            return(View(model));
        }
예제 #6
0
        public ActionResult Index()
        {
            var ctx       = new BlogDbContext();
            var viewmodel = new CalendarIndexViewModel();

            viewmodel.ProfilesToMeetings = ctx.ProfilesToMeetings.ToList();
            viewmodel.Meetings           = ctx.Meetings.Where(x => x.EveryoneAnswered == true && x.MeetingDateTime != null).OrderBy(x => x.MeetingDateTime).ToList();
            var user = User.Identity.GetUserId();

            ViewBag.people = ctx.Profiles.Where(x => x.ProfileID != user).ToList();

            var InviteIDs = ctx.Invites.Where(x => x.ProfileID == user && x.Accepted == false).ToList();

            ViewBag.inviteInformation = new List <InviteModel>();

            foreach (var invite in InviteIDs)
            {
                var DateIds = new List <int>();
                DateIds = ctx.MeetingDateOptionsToInvite.Where(x => x.InviteID == invite.InviteID).Select(x => x.MeetingDateOptionID).ToList();

                var dateDetails = new List <DateTime>();

                foreach (var dateid in DateIds)
                {
                    dateDetails.Add(ctx.MeetingOptions.Where(x => x.OptionID == dateid).Select(x => x.Date).Single());
                }

                string meetingName = ctx.Invites.Where(x => x.InviteID == invite.InviteID).Select(x => x.MeetingName).Single();
                var    meetingId   = ctx.Invites.Where(x => x.InviteID == invite.InviteID).Single();

                var meetingCreator = ctx.Meetings.FirstOrDefault(x => x.MeetingID == meetingId.MeetingID);

                var creatorFirstname = ctx.Profiles.Where(x => x.ProfileID == meetingCreator.ProfileId).Select(x => x.Forename).Single();
                var creatorSurname   = ctx.Profiles.Where(x => x.ProfileID == meetingCreator.ProfileId).Select(x => x.Surname).Single();

                var creatorName = creatorFirstname + " " + creatorSurname;

                var inviteTemplate = new InviteModel()
                {
                    MeetingID       = invite.MeetingID,
                    MeetingName     = invite.MeetingName,
                    Creator         = creatorName,
                    DateSuggestion1 = dateDetails[0],
                    DateSuggestion2 = dateDetails[1],
                    InviteId        = invite.InviteID
                };

                ViewBag.inviteInformation.Add(inviteTemplate);
            }

            var meetingInformation = ctx.Meetings.Where(x => x.ProfileId == user && x.EveryoneAnswered == true && x.MeetingDateTime == null).ToList();

            ViewBag.meetingInfo = new List <MeetingTemplate>();

            foreach (var meeting in meetingInformation)
            {
                var invited   = ctx.ProfilesToMeetings.Where(x => x.MeetingID == meeting.MeetingID).Select(x => x.Profile).ToList();
                var meetingID = meeting.MeetingID;

                var dates = (from dateNames in ctx.MeetingOptions
                             join dateIDs in ctx.MeetingDateOptionsToInvite
                             on dateNames.OptionID equals dateIDs.MeetingDateOptionID
                             join invites in ctx.Invites
                             on dateIDs.InviteID equals invites.InviteID
                             where invites.MeetingID == meetingID
                             select dateNames.Date).ToList();

                if (dates.Count > 0)
                {
                    var date1 = dates[0];
                    var date2 = dates[1];

                    var date1Amount = ctx.Invites.Where(x => x.MeetingID == meeting.MeetingID && x.ChosenDate == date1).ToList();
                    var date2Amount = ctx.Invites.Where(x => x.MeetingID == meeting.MeetingID && x.ChosenDate == date2).ToList();

                    var meetingTemplate = new MeetingTemplate()
                    {
                        MeetingName  = meeting.Name,
                        Participants = invited,
                        MeetingID    = meeting.MeetingID,
                        Date1        = dates[0],
                        Date2        = dates[1],
                        Date1Voters  = date1Amount.Count,
                        Date2Voters  = date2Amount.Count,
                    };

                    ViewBag.meetingInfo.Add(meetingTemplate);
                }
                else
                {
                    var meetingTemplate = new MeetingTemplate()
                    {
                        MeetingName = meeting.Name,
                    };
                    ViewBag.meetingInfo.Add(meetingTemplate);
                }
            }

            return(View(viewmodel));
        }