public ActionResult Edit(SessionBase session)
 {
     var previousRecord = _repository.GetSession(session.ConferenceId, session.SessionId);
     if (previousRecord == null)
     {
         _repository.AddSession(ref session, User.UserID);
     }
     else
     {
         session.CreatedOnDate = previousRecord.CreatedOnDate;
         session.CreatedByUserID = previousRecord.CreatedByUserID;
         _repository.UpdateSession(session, User.UserID);
     }
     HandleTags(session);
     return ReturnRoute(session.ConferenceId, View("View", _repository.GetSession(session.ConferenceId, session.SessionId)));
 }
Beispiel #2
0
        public void ReadSessionBase(SessionBase session)
        {
            if (session.SessionId > -1)
                SessionId = session.SessionId;

            if (session.ConferenceId > -1)
                ConferenceId = session.ConferenceId;

            if (session.LocationId > -1)
                LocationId = session.LocationId;

            if (!String.IsNullOrEmpty(session.Level))
                Level = session.Level;

            if (session.Sort > -1)
                Sort = session.Sort;

            if (session.Capacity > -1)
                Capacity = session.Capacity;

            if (session.SlotId > -1)
                SlotId = session.SlotId;

            if (!String.IsNullOrEmpty(session.Title))
                Title = session.Title;

            if (!String.IsNullOrEmpty(session.SubTitle))
                SubTitle = session.SubTitle;

            if (!String.IsNullOrEmpty(session.Description))
                Description = session.Description;

            if (session.Status > -1)
                Status = session.Status;

            IsPlenary = session.IsPlenary;

            if (session.DayNr > -1)
                DayNr = session.DayNr;

            if (!String.IsNullOrEmpty(session.Notes))
                Notes = session.Notes;

            if (session.TrackId > -1)
                TrackId = session.TrackId;

        }
Beispiel #3
0
 public SessionBase GetSessionBase()
 {
     SessionBase res = new SessionBase();
     res.SessionId = SessionId;
     res.ConferenceId = ConferenceId;
     res.LocationId = LocationId;
     res.Level = Level;
     res.Sort = Sort;
     res.Capacity = Capacity;
     res.SlotId = SlotId;
     res.Title = Title;
     res.SubTitle = SubTitle;
     res.Description = Description;
     res.Status = Status;
     res.IsPlenary = IsPlenary;
     res.DayNr = DayNr;
      res.Notes = Notes;
      res.TrackId = TrackId;
     res.CreatedByUserID = CreatedByUserID;
     res.CreatedOnDate = CreatedOnDate;
     res.LastModifiedByUserID = LastModifiedByUserID;
     res.LastModifiedOnDate = LastModifiedOnDate;
     return res;
 }
 private void HandleTags(SessionBase session)
 {
     if (session.EditTags != null)
     {
         IEnumerable<Tag> tags = Newtonsoft.Json.JsonConvert.DeserializeObject<IEnumerable<Tag>>(session.EditTags);
         var tagsToAdd = new List<TagBase>();
         foreach (Tag tag in tags)
         {
             var tagToAdd = tag.GetTagBase();
             if (tag.TagId < 0)
             {
                 tagToAdd.TagName = tagToAdd.TagName.Substring(0, 1).ToUpper() + tagToAdd.TagName.Substring(1);
                 tagToAdd.ConferenceId = session.ConferenceId;
                 TagRepository.Instance.AddTag(ref tagToAdd, User.UserID);
             }
             if (tagsToAdd.SingleOrDefault(t => t.TagId == tagToAdd.TagId) == null)
             {
                 tagsToAdd.Add(tagToAdd);
             }
         }
         SessionTagRepository.Instance.SetSessionTags(session.SessionId, tagsToAdd.Select(t => t.TagId).ToList());
     }
 }
 public ActionResult Submit(SessionBase session)
 {
     var recordToUpdate = (_repository.GetSession(session.ConferenceId, session.SessionId) ?? new Session() { ConferenceId = session.ConferenceId }).GetSessionBase();
     recordToUpdate.Title = session.Title;
     recordToUpdate.SubTitle = session.SubTitle;
     recordToUpdate.Description = session.Description;
     recordToUpdate.Notes = session.Notes;
     recordToUpdate.Level = session.Level;
     recordToUpdate.Capacity = session.Capacity;
     if (recordToUpdate.SessionId == -1)
     {
         _repository.AddSession(ref recordToUpdate, User.UserID);
     }
     else
     {
         _repository.UpdateSession(recordToUpdate, User.UserID);
     }
     if (SessionSpeakerRepository.Instance.GetSessionSpeakersBySession(recordToUpdate.SessionId).Count() == 0)
     {
         if (SpeakerRepository.Instance.GetSpeaker(session.ConferenceId, User.UserID) == null)
         {
             SpeakerRepository.Instance.AddSpeaker(new Connect.Conference.Core.Models.Speakers.SpeakerBase() { ConferenceId = session.ConferenceId, UserId = User.UserID, Sort = 999 }, User.UserID);
         }
         SessionSpeakerRepository.Instance.AddSessionSpeaker(new Connect.Conference.Core.Models.SessionSpeakers.SessionSpeakerBase() { SessionId = recordToUpdate.SessionId, SpeakerId = User.UserID, Sort = 0 }, User.UserID);
         Connect.Conference.Core.Controllers.DnnRoleController.CheckSpeaker(PortalSettings.PortalId, session.ConferenceId, User.UserID);
     }
     HandleTags(session);
     return RedirectToDefaultRoute();
 }
Beispiel #6
0
        public void ReadSessionBase(SessionBase session)
        {
            if (session.SessionId > -1)
            {
                SessionId = session.SessionId;
            }

            if (session.ConferenceId > -1)
            {
                ConferenceId = session.ConferenceId;
            }

            if (session.LocationId > -1)
            {
                LocationId = session.LocationId;
            }

            if (!String.IsNullOrEmpty(session.Level))
            {
                Level = session.Level;
            }

            if (session.Sort > -1)
            {
                Sort = session.Sort;
            }

            if (session.Capacity > -1)
            {
                Capacity = session.Capacity;
            }

            if (session.SlotId > -1)
            {
                SlotId = session.SlotId;
            }

            if (!String.IsNullOrEmpty(session.Title))
            {
                Title = session.Title;
            }

            if (!String.IsNullOrEmpty(session.SubTitle))
            {
                SubTitle = session.SubTitle;
            }

            if (!String.IsNullOrEmpty(session.Description))
            {
                Description = session.Description;
            }

            if (session.Status > -1)
            {
                Status = session.Status;
            }

            IsPlenary = session.IsPlenary;

            if (session.DayNr > -1)
            {
                DayNr = session.DayNr;
            }

            if (!String.IsNullOrEmpty(session.Notes))
            {
                Notes = session.Notes;
            }

            if (session.TrackId > -1)
            {
                TrackId = session.TrackId;
            }
        }