/// <summary> /// Add notification for user on Session /// </summary> /// <param name="session">Contain Session object as parameter.</param> /// <returns>Returns a boolean value as add session notification is added successfully or not.</returns> internal bool AddSessionNotification(Session session) { var notification = new Notification { Description = "New Session Added", Link = string.Format(SessionLink, session.Id), TypeOfNotification = session.IsNeW ? NotificationType.NewSessionNotification : NotificationType.SessionUpdatedNotification, AddedBy = session.Presenter.UserId, Title = session.IsNeW ? "New Session Added" : "Session Details Updated", AddedOn = DateTime.Now, AddedTo = session.Attendee }; new MailerBl().AddSessionMail(notification, session); return(AddNotification(notification, session.SessionAttendees.Where(x => x.UserId != session.Presenter.UserId) .Select(x => x.UserId) .ToList())); }
public bool UpdateSessionAssets(Session session, bool isVideo) { if (session.Id <= 0) { return(false); } DAL.EntityFramework.Session coreSession = UnitOfWork.SessionRepository .GetSessionWithAttendeesTrackable(session.Id); if (!isVideo) { coreSession.SlideName = session.SlideName; } else { coreSession.VideoFileName = session.VideoFileName; } return(UnitOfWork.Commit() > 0); }
/// <summary> /// method to Add or edit session details /// </summary> /// <param name="objSession">instance of session Object</param> /// <returns>boolean resutt of event's success</returns> public bool UpdateSessionsDetails(Session objSession, User currentUser) { if (objSession.Id <= 0) { return(false); } try { DAL.EntityFramework.Session coreSession = UnitOfWork.SessionRepository .GetSessionWithAttendeesTrackable(objSession.Id); coreSession.SessionDate = objSession.Date; coreSession.Description = objSession.Description; coreSession.Title = objSession.Title; coreSession.SlideName = objSession.SlideName; coreSession.VideoFileName = objSession.VideoFileName; coreSession.UserSessionMappings.Where(x => objSession.SessionAttendees.All(y => y.UserId != x.UserId)) .ToList() .ForEach(trainee => coreSession.UserSessionMappings.Remove(trainee)); objSession.SessionAttendees.Where(x => coreSession.UserSessionMappings.All(y => y.UserId != x.UserId)) .ToList() .ForEach(trainee => coreSession.UserSessionMappings.Add(new UserSessionMapping { AddedBy = currentUser.UserId, AddedOn = DateTime.Now, UserId = trainee.UserId })); objSession.Presenter = currentUser; return(UnitOfWork.Commit() > 0 && (new NotificationBl().AddSessionNotification(objSession))); } catch (Exception ex) { LogUtility.ErrorRoutine(ex); return(false); } }
/// <summary> /// method to Add or edit session details /// </summary> /// <param name="objSession">instance of session Object</param> /// <param name="currentUser">instance of Current User</param> /// <returns>boolean resutt of event's success</returns> public SessionVm AddNewSession(Session objSession, User currentUser) { objSession.IsNeW = (objSession.Id == 0); objSession.Presenter = currentUser; DAL.EntityFramework.Session coreSession = SessionConverter.ConvertToCore(objSession); foreach (var trainee in objSession.SessionAttendees) { coreSession.UserSessionMappings.Add(new UserSessionMapping { AddedBy = currentUser.UserId, AddedOn = DateTime.Now, UserId = trainee.UserId }); } UnitOfWork.SessionRepository.Add(coreSession); UnitOfWork.Commit(); objSession.Id = coreSession.SessionId; new NotificationBl().AddSessionNotification(objSession); return(GetSessionOnFilter(1, (int)Common.Enumeration.SessionType.All, coreSession.SessionId, "", currentUser)); }