/// <inheritdoc />
        public EventStatus UnlockEvent(string eventCode, int memberId, out EventPageModel eventPage)
        {
            eventPage = null;
            var eventPageWithCode = UmbracoContext.Current.PublishedContentRequest.PublishedContent
                                    .ToModel <BaseContentModel>().StartPage.Descendants <EventPageModel>()
                                    .SingleOrDefault(x => x.EventCode.Equals(eventCode, StringComparison.OrdinalIgnoreCase));

            if (eventPageWithCode != null)
            {
                eventPage = eventPageWithCode;

                if (IsEventUnlocked(eventPageWithCode.Id, memberId) == false)
                {
                    var eventEntity = new ClaremontEvent
                    {
                        EventId  = eventPageWithCode.Id,
                        MemberId = memberId
                    };

                    Database.Insert(eventEntity);
                }

                return(EventStatus.Unlocked);
            }

            return(EventStatus.WrongEventCode);
        }
Exemplo n.º 2
0
        public ActionResult Create()
        {
            // todo add permissions later
            //if (!_permissionService.Authorize(StandardPermissionProvider.ManageProducts))
            //    return AccessDeniedView();

            var model = new EventPageModel();

            return(View("~/Plugins/Widgets.mobSocial/Views/mobSocial/Admin/ManageEventPage/Create.cshtml", model));
        }
Exemplo n.º 3
0
        /// <inheritdoc />
        public void ScheduleSendNotifyEventStart(ISiteMember member, EventPageModel eventPageModel, EventActivityPageModel activityPageModel)
        {
            if (eventPageModel.StartDate.HasValue == false)
            {
                LogHelper.Info <DefaultMailer>($"The event {eventPageModel.Id} has no start date! aborting, scheduling mail.");
                return;
            }

            MailMessage email = mailerEngine.Create("NotifyEventStart", new NotifyEventStartEmailViewModel(activityPageModel, member, eventPageModel), member.Email, eventPageModel.Name);

            ScheduleMail(email, $"{member.Id}:SendNotifyEventStart:{eventPageModel.Id}", eventPageModel.StartDate.Value.AddDays(-1));
        }
Exemplo n.º 4
0
        public ActionResult Create(EventPageModel model, bool continueEditing)
        {
            //if (!_permissionService.Authorize(StandardPermissionProvider.ManageProducts))
            //    return AccessDeniedView();

            if (ModelState.IsValid)
            {
                var entity = new EventPage()
                {
                    Name                  = model.Name,
                    LocationName          = model.LocationName,
                    LocationAddress1      = model.LocationAddress1,
                    LocationAddress2      = model.LocationAddress2,
                    LocationCity          = model.City,
                    LocationState         = model.LocationState,
                    LocationZipPostalCode = model.ZipPostalCode,
                    LocationPhone         = model.Phone,
                    LocationWebsite       = model.Website,
                    LocationEmail         = model.Email,
                    LocationCountry       = model.LocationCountry,
                    StartDate             = model.StartDate,
                    EndDate               = model.EndDate,
                    Description           = model.Description,
                    MetaKeywords          = model.MetaKeywords,
                    MetaDescription       = model.MetaDescription,
                    DateCreated           = DateTime.Now,
                    DateUpdated           = DateTime.Now,
                };

                //search engine name
                model.SeName = SeoExtensions.GetSeName(entity, _workContext.WorkingLanguage.Id);

                // todo: add event hosts
                _eventPageService.Insert(entity);

                //save hotels
                //SaveEventHotels(product, ParseProductTags(model.ProductTags));

                //activity log
                //_customerActivityService.InsertActivity("AddNewProduct", _localizationService.GetResource("ActivityLog.AddNewProduct"), product.Name);
                _customerActivityService.InsertActivity("AddNewEventPage", _localizationService.GetResource("ActivityLog.AddNewEventPage"), entity.Name);


                SuccessNotification(_localizationService.GetResource("Admin.MobSocial.EventPage.Added"));

                return(continueEditing ? RedirectToAction("Edit", new { id = entity.Id }) : RedirectToAction("List"));
            }

            return(View("~/Plugins/Widgets.mobSocial/Views/mobSocial/Admin/ManageEventPage/Create.cshtml", model));
        }
        /// <summary>
        /// An action returning a page showing an event
        /// </summary>
        /// <param name="id">The id of the event to show</param>
        /// <returns>If user is in the event: Returns a page containing information about the event</returns>
        public ActionResult Page(int id)
        {
            //Find the event and makes sure you are in it (dont show if the user isnt invited/owns the event)
            int?           infoID    = this.UserId();
            MeetupModel    model     = new MeetupModel();
            EventPageModel viewModel = new EventPageModel();

            viewModel.Event = model.Events.SingleOrDefault(e => e.Id == id && (e.Invites.Any(i => i.UserId == infoID) || e.HostUserId == infoID));
            if (viewModel.Event is null)
            {
                return(RedirectToAction("Index", "Home"));
            }

            //Check if the user owns the event
            viewModel.UserID = infoID.Value;
            if (viewModel.Event.HostUserId == infoID)
            {
                viewModel.EventOwner = true;
            }

            //Creates the list of all users invited to the event
            viewModel.Invited      = viewModel.Event.Invites.Any(i => i.UserId == infoID);
            viewModel.InvitedUsers = viewModel.Event.GetUsers().ToList();

            //Creates the list of all seances/meetings with this user
            List <Seance> seances = viewModel.Event.Seances.ToList();

            viewModel.Meetings = new List <Meeting>();
            foreach (Seance seance in seances)
            {
                Meeting meeting = seance.Meetings.SingleOrDefault(m => m.MeetingContainsUser(infoID.Value));
                if (!(meeting is null))
                {
                    viewModel.Meetings.Add(meeting);
                }
            }

            //Gets a list of the user's wishes for the event
            viewModel.UserWishes = new List <Wish>();
            User user = model.Users.SingleOrDefault(u => u.Id == viewModel.UserID);

            viewModel.UserWishes = user.Wishes.Where(w => w.EventId == viewModel.Event.Id).ToList();

            return(View(viewModel));
        }
Exemplo n.º 6
0
        public ActionResult Edit(int id)
        {
            //todo: add later
            //if (!_permissionService.Authorize(MobSocialPermissionProvider.ManageEventPages))
            //    return AccessDeniedView();

            var item = _eventPageService.GetById(id);

            if (item == null) //Not found
            {
                return(RedirectToAction("List"));
            }


            var model = new EventPageModel()
            {
                Id              = item.Id,
                Name            = item.Name,
                SeName          = SeoExtensions.GetSeName(item, _workContext.WorkingLanguage.Id),
                LocationName    = item.LocationName,
                Address1        = item.LocationAddress1,
                Address2        = item.LocationAddress2,
                City            = item.LocationCity,
                LocationState   = item.LocationState,
                ZipPostalCode   = item.LocationZipPostalCode,
                LocationCountry = item.LocationCountry,
                Phone           = item.LocationPhone,
                Website         = item.LocationWebsite,
                Email           = item.LocationEmail,
                StartDate       = item.StartDate,
                EndDate         = item.EndDate,
                Description     = item.Description,
                DateCreated     = item.DateCreated,
                DateUpdated     = item.DateUpdated,
                MetaDescription = item.MetaDescription,
                MetaKeywords    = item.MetaKeywords,
            };

            return(View("~/Plugins/Widgets.mobSocial/Views/mobSocial/Admin/ManageEventPage/Edit.cshtml", model));
        }
Exemplo n.º 7
0
        public ActionResult Index(int?id, int?page)
        {
            if (!_customerSettings.AllowViewingProfiles)
            {
                return(RedirectToRoute("HomePage"));
            }

            var entityId = 0;

            if (id.HasValue)
            {
                entityId = id.Value;
            }

            var entity = _eventPageService.GetById(entityId);

            if (entity == null)
            {
                return(RedirectToRoute("HomePage"));
            }

            var model = new EventPageModel()
            {
                Id               = entity.Id,
                Name             = entity.Name,
                LocationName     = entity.LocationName,
                LocationAddress1 = entity.LocationAddress1,
                LocationAddress2 = entity.LocationAddress2,
                LocationCity     = entity.LocationCity,
                LocationState    = entity.LocationState,
                ZipPostalCode    = entity.LocationZipPostalCode,
                LocationCountry  = entity.LocationCountry,
                Phone            = entity.LocationPhone,
                Email            = entity.LocationEmail,
                Website          = entity.LocationWebsite,
                StartDate        = entity.StartDate,
                EndDate          = entity.EndDate,
                Description      = entity.Description,
                MetaKeywords     = entity.MetaKeywords,
                MetaDescription  = entity.MetaDescription,
                DateCreated      = entity.DateCreated,
                DateUpdated      = entity.DateUpdated,
            };

            // Event Page Hotels
            foreach (var hotel in entity.Hotels)
            {
                model.Hotels.Add(new EventPageHotelModel
                {
                    Id                    = hotel.Id,
                    Name                  = hotel.Name,
                    Title                 = hotel.Title,
                    Address1              = hotel.Address1,
                    Address2              = hotel.Address2,
                    City                  = hotel.City,
                    State                 = hotel.State,
                    ZipPostalCode         = hotel.ZipPostalCode,
                    Country               = hotel.Country,
                    PhoneNumber           = hotel.PhoneNumber,
                    AdditionalInformation = hotel.AdditionalInformation
                });
            }

            // Event Page Pictures
            foreach (var picture in entity.Pictures)
            {
                model.Pictures.Add(new PictureModel
                {
                    Id           = picture.Id,
                    EntityId     = entity.Id,
                    PictureId    = picture.PictureId,
                    DisplayOrder = picture.DisplayOrder,
                    DateCreated  = picture.DateCreated,
                    DateUpdated  = picture.DateUpdated,
                    PictureUrl   = _pictureService.GetPictureUrl(picture.PictureId, 200),
                });
            }


            if (entity.Pictures.Count > 0)
            {
                model.MainPictureUrl   = model.Pictures.First().PictureUrl;
                model.FullSizeImageUrl = _pictureService.GetPictureUrl(model.Pictures.First().PictureId);
            }
            else
            {
                model.MainPictureUrl   = _pictureService.GetDefaultPictureUrl(200);
                model.FullSizeImageUrl = _pictureService.GetDefaultPictureUrl();
            }

            return(View("~/Plugins/Widgets.mobSocial/Views/mobSocial/EventPage/Index.cshtml", model));
        }
Exemplo n.º 8
0
        public ActionResult Index()
        {
            EventPageModel model = PopulateEventPageModel.PopulateEvents();

            return(View(model));
        }
Exemplo n.º 9
0
 public void RemoveScheduleNotifyEventStart(ISiteMember member, EventPageModel eventPageModel)
 {
     jobManager.RemoveJob($"{member.Id}:SendNotifyEventStart:{eventPageModel.Id}", true);
 }
Exemplo n.º 10
0
        /// <inheritdoc />
        public void SendNotifyEventApplied(ISiteMember member, EventPageModel eventPageModel)
        {
            MailMessage email = mailerEngine.Create("NotifyEventAppliedEmail", new NotifyEventEmailViewModel(member, eventPageModel), member.Email, eventPageModel.Name);

            EnqueueMail(email);
        }
Exemplo n.º 11
0
        public ActionResult Edit(EventPageModel model, bool continueEditing)
        {
            //todo: add later
            //if (!_permissionService.Authorize(MobSocialPermissionProvider.ManageEventPages))
            //    return AccessDeniedView();

            var item = _eventPageService.GetById(model.Id);

            if (item == null)
            {
                //No product found with the specified id
                return(RedirectToAction("List"));
            }

            if (ModelState.IsValid)
            {
                item.Name                  = model.Name;
                item.LocationName          = model.LocationName;
                item.LocationAddress1      = model.Address1;
                item.LocationAddress2      = model.Address2;
                item.LocationCity          = model.City;
                item.LocationState         = model.LocationState;
                item.LocationZipPostalCode = model.ZipPostalCode;
                item.LocationCountry       = model.LocationCountry;
                item.LocationPhone         = model.Phone;
                item.LocationWebsite       = model.Website;
                item.LocationEmail         = model.Email;
                item.StartDate             = model.StartDate;
                item.EndDate               = model.EndDate;
                item.Description           = model.Description;
                item.MetaKeywords          = model.MetaKeywords;
                item.MetaDescription       = model.MetaDescription;

                item.DateUpdated = DateTime.Now;


                _eventPageService.Update(item);

                //search engine name
                model.SeName = SeoExtensions.GetSeName(item, _workContext.WorkingLanguage.Id);

                _urlRecordService.SaveSlug(item, model.SeName, _workContext.WorkingLanguage.Id);

                //picture seo names
                //UpdatePictureSeoNames(product);

                SuccessNotification(_localizationService.GetResource("Admin.MobSocial.EventPage.Updated"));

                if (continueEditing)
                {
                    //selected tab
                    SaveSelectedTabIndex();

                    return(RedirectToAction("Edit", new { id = item.Id }));
                }
                else
                {
                    return(RedirectToAction("List"));
                }
            }

            return(View("~/Plugins/Widgets.mobSocial/Views/mobSocial/Admin/ManageEventPage/Edit.cshtml", model));
        }
Exemplo n.º 12
0
 public NotifyEventEmailViewModel(ISiteMember member, EventPageModel eventPageModel)
 {
     Member = member;
     Event  = eventPageModel;
 }
Exemplo n.º 13
0
        public ActionResult Create(Guid id)
        {
            EventPageModel model = PopulateEventPageModel.PopulateEventDetails(id);

            return(View(model));
        }
Exemplo n.º 14
0
        public static EventPageModel PopulateEventDetails(Guid eventId)
        {
            EventPageModel eventPageModel = new EventPageModel();

            eventPageModel.eventList = new List <EventModel>();
            eventPageModel.bloburl   = ConfigurationManager.AppSettings["BlobUrl"] + ConfigurationManager.AppSettings["PhotoContainer"];

            var eventHeader = new EventModel();
            var eventItem   = new EventItem();


            var allEvents = Event.GetEventByEventId(eventId);

            Guid oldEvent = new Guid();

            foreach (var item in allEvents)
            {
                //Map Header Details
                if (item.EventId != oldEvent)
                {
                    oldEvent = item.EventId;

                    eventHeader = new EventModel();
                    var venueData = Event.GetVenueByVenueId(item.VenueId.GetValueOrDefault());

                    eventHeader.EventId       = item.EventId;
                    eventHeader.ASPNetUsersId = item.ASPNetUsersId;
                    eventHeader.Title         = item.Title;
                    eventHeader.Description   = item.EventDescription;
                    eventHeader.FullName      = item.FullName;
                    eventHeader.StartDate     = item.StartDate ?? DateTime.Now.AddYears(-500);
                    eventHeader.EndDate       = item.EndDate ?? DateTime.Now.AddYears(-500);
                    eventHeader.Image         = item.EventImage;

                    eventHeader.venue = new Venue();

                    if (item.VenueId != null)
                    {
                        eventHeader.venue.VenueName               = venueData.FirstOrDefault().VenueName;
                        eventHeader.venue.VenueAddress            = new Address();
                        eventHeader.venue.VenueAddress.AddressId  = venueData.FirstOrDefault().AddressId;
                        eventHeader.venue.VenueAddress.City       = venueData.FirstOrDefault().City;
                        eventHeader.venue.VenueAddress.Country    = venueData.FirstOrDefault().Country;
                        eventHeader.venue.VenueAddress.PostalCode = venueData.FirstOrDefault().PostalCode;
                        eventHeader.venue.VenueAddress.State      = venueData.FirstOrDefault().State;
                        eventHeader.venue.VenueAddress.Street1    = venueData.FirstOrDefault().Street1;
                        eventHeader.venue.VenueAddress.Street2    = venueData.FirstOrDefault().Street2;
                    }

                    eventHeader.EventItems = new List <EventItem>();
                    eventPageModel.eventList.Add(eventHeader);
                }

                //Map Item Details
                eventItem                 = new EventItem();
                eventItem.ItemId          = item.ItemId.GetValueOrDefault();
                eventItem.ItemDescription = item.ItemDescription;
                eventItem.ItemName        = item.ItemName;
                eventItem.Price           = item.Price;
                eventItem.SponsoredAmount = item.SponsoredAmount;
                eventItem.ItemIsPublic    = item.ItemIsPublic;

                eventHeader.EventItems.Add(eventItem);
            }

            return(eventPageModel);
        }
 public NotifyEventStartEmailViewModel(EventActivityPageModel activityPageModel, ISiteMember member, EventPageModel eventPageModel) : base(member, eventPageModel)
 {
     ActivityPageModel = activityPageModel;
 }
Exemplo n.º 16
0
        public ActionResult Index(int? id, int? page)
        {
            if (!_customerSettings.AllowViewingProfiles)
            {
                return RedirectToRoute("HomePage");
            }

            var entityId = 0;
            if (id.HasValue)
            {
                entityId = id.Value;
            }

            var entity = _eventPageService.GetById(entityId);
            if (entity == null)
            {
                return RedirectToRoute("HomePage");
            }

            var model = new EventPageModel()
            {
                Id = entity.Id,
                Name = entity.Name,
                LocationName = entity.LocationName,
                LocationAddress1 = entity.LocationAddress1,
                LocationAddress2 = entity.LocationAddress2,
                LocationCity = entity.LocationCity,
                LocationState = entity.LocationState,
                ZipPostalCode = entity.LocationZipPostalCode,
                LocationCountry = entity.LocationCountry,
                Phone = entity.LocationPhone,
                Email = entity.LocationEmail,
                Website = entity.LocationWebsite,
                StartDate = entity.StartDate,
                EndDate = entity.EndDate,
                Description = entity.Description,
                MetaKeywords = entity.MetaKeywords,
                MetaDescription = entity.MetaDescription,
                DateCreated = entity.DateCreated,
                DateUpdated = entity.DateUpdated,
            };

            // Event Page Hotels
            foreach(var hotel in entity.Hotels)
            {
                model.Hotels.Add(new EventPageHotelModel
                {
                    Id = hotel.Id,
                    Name = hotel.Name,
                    Title = hotel.Title,
                    Address1 = hotel.Address1,
                    Address2 = hotel.Address2,
                    City = hotel.City,
                    State = hotel.State,
                    ZipPostalCode = hotel.ZipPostalCode,
                    Country = hotel.Country,
                    PhoneNumber = hotel.PhoneNumber,
                    AdditionalInformation = hotel.AdditionalInformation
                });
            }

            // Event Page Pictures
            foreach(var picture in entity.Pictures)
            {
                model.Pictures.Add(new PictureModel
                {
                    Id = picture.Id,
                    EntityId = entity.Id,
                    PictureId = picture.PictureId,
                    DisplayOrder = picture.DisplayOrder,
                    DateCreated = picture.DateCreated,
                    DateUpdated = picture.DateUpdated,
                    PictureUrl = _pictureService.GetPictureUrl(picture.PictureId, 200),
                });
            }

            if (entity.Pictures.Count > 0)
            {
                model.MainPictureUrl = model.Pictures.First().PictureUrl;
                model.FullSizeImageUrl = _pictureService.GetPictureUrl(model.Pictures.First().PictureId);
            }
            else
            {
                model.MainPictureUrl = _pictureService.GetDefaultPictureUrl(200);
                model.FullSizeImageUrl = _pictureService.GetDefaultPictureUrl();
            }

            return View("~/Plugins/Widgets.mobSocial/Views/mobSocial/EventPage/Index.cshtml", model);
        }