상속: Connect.Conference.Core.Data.AuditableEntity
예제 #1
0
        public void ReadAttendeeBase(AttendeeBase attendee)
        {
            if (attendee.ConferenceId > -1)
            {
                ConferenceId = attendee.ConferenceId;
            }

            if (attendee.UserId > -1)
            {
                UserId = attendee.UserId;
            }

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

            ReceiveNotifications = attendee.ReceiveNotifications;

            if (!String.IsNullOrEmpty(attendee.Company))
            {
                Company = attendee.Company;
            }

            if (!String.IsNullOrEmpty(attendee.AttCode))
            {
                AttCode = attendee.AttCode;
            }

            if (!String.IsNullOrEmpty(attendee.NotificationToken))
            {
                NotificationToken = attendee.NotificationToken;
            }
        }
예제 #2
0
 public HttpResponseMessage ChangeStatus(int conferenceId, [FromBody]ChangeStatusDTO newStatus)
 {
     if (!ConferenceModuleContext.Security.CanManage)
     {
         if (newStatus.Status > 1)
         {
             return AccessViolation("Only management can increase your status this far");
         }
         if (newStatus.UserId != UserInfo.UserID)
         {
             return AccessViolation("Only management can change status for other users");
         }
     }
     var attendee = AttendeeRepository.Instance.GetAttendee(conferenceId, newStatus.UserId);
     if (attendee == null)
     {
         var a = new AttendeeBase() { ConferenceId = conferenceId, UserId = newStatus.UserId, ReceiveNotifications = true, Status = newStatus.Status };
         AttendeeRepository.Instance.AddAttendee(a, UserInfo.UserID);
         Connect.Conference.Core.Controllers.DnnRoleController.CheckAttendee(PortalSettings.PortalId, a);
         return Request.CreateResponse(HttpStatusCode.OK, AttendeeRepository.Instance.GetAttendee(conferenceId, a.UserId));
     }
     else if (newStatus.Status == -1)
     {
         AttendeeRepository.Instance.DeleteAttendee(conferenceId, newStatus.UserId);
         Connect.Conference.Core.Controllers.DnnRoleController.RemoveAttendee(PortalSettings.PortalId, conferenceId, newStatus.UserId);
         return Request.CreateResponse(HttpStatusCode.OK, "");
     }
     else
     {
         attendee.Status = newStatus.Status;
         AttendeeRepository.Instance.UpdateAttendee(attendee, UserInfo.UserID);
         Connect.Conference.Core.Controllers.DnnRoleController.CheckAttendee(PortalSettings.PortalId, attendee);
         return Request.CreateResponse(HttpStatusCode.OK, attendee);
     }
 }
예제 #3
0
       public AttendeeBase GetAttendeeBase()
       {
           AttendeeBase res = new AttendeeBase();
            res.ConferenceId = ConferenceId;
            res.UserId = UserId;
            res.Status = Status;
            res.ReceiveNotifications = ReceiveNotifications;
 res.CreatedByUserID = CreatedByUserID;
 res.CreatedOnDate = CreatedOnDate;
 res.LastModifiedByUserID = LastModifiedByUserID;
 res.LastModifiedOnDate = LastModifiedOnDate;
           return res;
       }
예제 #4
0
        public void ReadAttendeeBase(AttendeeBase attendee)
        {
            if (attendee.ConferenceId > -1)
                ConferenceId = attendee.ConferenceId;

            if (attendee.UserId > -1)
                UserId = attendee.UserId;

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

            ReceiveNotifications = attendee.ReceiveNotifications;

        }
예제 #5
0
        public AttendeeBase GetAttendeeBase()
        {
            AttendeeBase res = new AttendeeBase();

            res.ConferenceId         = ConferenceId;
            res.UserId               = UserId;
            res.Status               = Status;
            res.ReceiveNotifications = ReceiveNotifications;
            res.Company              = Company;
            res.CreatedByUserID      = CreatedByUserID;
            res.CreatedOnDate        = CreatedOnDate;
            res.LastModifiedByUserID = LastModifiedByUserID;
            res.LastModifiedOnDate   = LastModifiedOnDate;
            return(res);
        }
예제 #6
0
 public static void CheckAttendee(int portalId, AttendeeBase attendee)
 {
     var conference = ConferenceRepository.Instance.GetConference(portalId, attendee.ConferenceId);
     if (conference.AttendeeRole > 0)
     {
         if (attendee.Status >= (int)AttendeeStatus.Confirmed)
         {
             EnsureUserRole(portalId, attendee.UserId, conference.AttendeeRole);
         }
         else
         {
             DenyUserRole(portalId, attendee.UserId, conference.AttendeeRole);
         }
     }
 }
예제 #7
0
        public void ReadAttendeeBase(AttendeeBase attendee)
        {
            if (attendee.ConferenceId > -1)
                ConferenceId = attendee.ConferenceId;

            if (attendee.UserId > -1)
                UserId = attendee.UserId;

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

            ReceiveNotifications = attendee.ReceiveNotifications;

            if (!String.IsNullOrEmpty(attendee.Company))
                Company = attendee.Company;

            if (!String.IsNullOrEmpty(attendee.AttCode))
                AttCode = attendee.AttCode;
        }
예제 #8
0
 public ActionResult Edit(int conferenceId, int attendeeId, AttendeeDTO attendee)
 {
     if (!ConferenceModuleContext.Security.CanManage)
     {
         if (User.UserID != attendeeId)
         {
             ConferenceModuleContext.ThrowAccessViolation();
         }
     }
     AttendeeBase recordToUpdate = null;
     var existingRecord = _repository.GetAttendee(conferenceId, attendeeId);
     var modeAdd = false;
     if (existingRecord == null)
     {
         recordToUpdate = new AttendeeBase() { ConferenceId = conferenceId, UserId = attendeeId };
         modeAdd = true;
     }
     else
     {
         recordToUpdate = existingRecord.GetAttendeeBase();
     }
     recordToUpdate.ReceiveNotifications = attendee.ReceiveNotifications;
     recordToUpdate.Company = attendee.Company;
     if (modeAdd)
     {
         _repository.AddAttendee(recordToUpdate, User.UserID);
     }
     else
     {
         _repository.UpdateAttendee(recordToUpdate, User.UserID);
     }
     // Now the DNN side of things
     var dnnUser = DotNetNuke.Entities.Users.UserController.GetUserById(PortalSettings.PortalId, attendeeId);
     if (dnnUser == null)
     {
         // create the user
         dnnUser = new UserInfo() { PortalID = PortalSettings.PortalId, Username = attendee.Email, Email = attendee.Email, FirstName = attendee.FirstName, LastName = attendee.LastName, DisplayName = attendee.DisplayName };
         UserController.CreateUser(ref dnnUser);
     }
     dnnUser.FirstName = attendee.FirstName.Trim();
     dnnUser.LastName = attendee.LastName.Trim();
     dnnUser.DisplayName = attendee.DisplayName.Trim();
     dnnUser.Email = attendee.Email.Trim();
     // Handle the picture
     if (attendee.ProfilePic.filename != "")
     {
         IFileInfo file = null;
         var userFolder = FolderManager.Instance.GetUserFolder(dnnUser);
         var folderManager = FolderManager.Instance;
         file = FileManager.Instance.GetFile(userFolder, attendee.ProfilePic.filename);
         dnnUser.Profile.Photo = file.FileId.ToString();
         if (file != null & attendee.ProfilePic.crop.points != null)
         {
             System.IO.MemoryStream sizedContent = null;
             using (var content = FileManager.Instance.GetFileContent(file))
             {
                 sizedContent = ImageUtils.CreateImage(content, attendee.ProfilePic.crop.points, attendee.ProfilePic.crop.zoom, 200, file.Extension);
             }
             FileManager.Instance.AddFile(userFolder, file.FileName, sizedContent, true, false, file.ContentType);
             sizedContent.Dispose();
             ImageUtils.CreateThumbnails(file.FileId);
         }
     }
     if (!string.IsNullOrEmpty(attendee.Company))
     {
         dnnUser.Profile.SetProfileProperty("Company", attendee.Company);
     }
     UserController.UpdateUser(PortalSettings.PortalId, dnnUser);
     DotNetNuke.Entities.Profile.ProfileController.UpdateUserProfile(dnnUser);
     return ReturnRoute(attendee.ConferenceId, View("View", _repository.GetAttendee(attendee.ConferenceId, attendee.UserId)));
 }