public SpeakerBase GetSpeakerBase() { SpeakerBase res = new SpeakerBase(); res.ConferenceId = ConferenceId; res.UserId = UserId; res.Sort = Sort; res.Url = Url; res.Description = Description; res.DescriptionShort = DescriptionShort; res.Company = Company; res.CreatedByUserID = CreatedByUserID; res.CreatedOnDate = CreatedOnDate; res.LastModifiedByUserID = LastModifiedByUserID; res.LastModifiedOnDate = LastModifiedOnDate; return res; }
public SpeakerBase GetSpeakerBase() { SpeakerBase res = new SpeakerBase(); res.ConferenceId = ConferenceId; res.UserId = UserId; res.Sort = Sort; res.Url = Url; res.Description = Description; res.DescriptionShort = DescriptionShort; res.Company = Company; res.CreatedByUserID = CreatedByUserID; res.CreatedOnDate = CreatedOnDate; res.LastModifiedByUserID = LastModifiedByUserID; res.LastModifiedOnDate = LastModifiedOnDate; return(res); }
public void ReadSpeakerBase(SpeakerBase speaker) { if (speaker.ConferenceId > -1) { ConferenceId = speaker.ConferenceId; } if (speaker.UserId > -1) { UserId = speaker.UserId; } if (speaker.Sort > -1) { Sort = speaker.Sort; } if (!String.IsNullOrEmpty(speaker.Url)) { Url = speaker.Url; } if (!String.IsNullOrEmpty(speaker.Description)) { Description = speaker.Description; } if (!String.IsNullOrEmpty(speaker.DescriptionShort)) { DescriptionShort = speaker.DescriptionShort; } if (!String.IsNullOrEmpty(speaker.Company)) { Company = speaker.Company; } }
public void ReadSpeakerBase(SpeakerBase speaker) { if (speaker.ConferenceId > -1) ConferenceId = speaker.ConferenceId; if (speaker.UserId > -1) UserId = speaker.UserId; if (speaker.Sort > -1) Sort = speaker.Sort; if (!String.IsNullOrEmpty(speaker.Url)) Url = speaker.Url; if (!String.IsNullOrEmpty(speaker.Description)) Description = speaker.Description; if (!String.IsNullOrEmpty(speaker.DescriptionShort)) DescriptionShort = speaker.DescriptionShort; if (!String.IsNullOrEmpty(speaker.Company)) Company = speaker.Company; }
public ActionResult Edit(int conferenceId, int speakerId, SpeakerDTO speaker) { if (!ConferenceModuleContext.Security.CanManage) { if (User.UserID != speakerId) { ConferenceModuleContext.ThrowAccessViolation(); } } SpeakerBase recordToUpdate = null; var existingRecord = _repository.GetSpeaker(conferenceId, speakerId); var modeAdd = false; if (existingRecord == null) { recordToUpdate = new SpeakerBase() { ConferenceId = conferenceId, UserId = speakerId }; modeAdd = true; } else { recordToUpdate = existingRecord.GetSpeakerBase(); } recordToUpdate.Description = speaker.Description; recordToUpdate.DescriptionShort = speaker.DescriptionShort; recordToUpdate.Url = speaker.Url; recordToUpdate.Company = speaker.Company; if (modeAdd) { _repository.AddSpeaker(recordToUpdate, User.UserID); } else { _repository.UpdateSpeaker(recordToUpdate, User.UserID); } // Now the DNN side of things var dnnUser = DotNetNuke.Entities.Users.UserController.GetUserById(PortalSettings.PortalId, speakerId); if (dnnUser == null) { // create the user } dnnUser.FirstName = speaker.FirstName.Trim(); dnnUser.LastName = speaker.LastName.Trim(); dnnUser.DisplayName = speaker.DisplayName.Trim(); dnnUser.Email = speaker.Email.Trim(); // Handle the picture if (speaker.ProfilePic.filename != "") { IFileInfo file = null; var userFolder = FolderManager.Instance.GetUserFolder(dnnUser); var folderManager = FolderManager.Instance; file = FileManager.Instance.GetFile(userFolder, speaker.ProfilePic.filename); dnnUser.Profile.Photo = file.FileId.ToString(); if (file != null & speaker.ProfilePic.crop.points != null) { System.IO.MemoryStream sizedContent = null; using (var content = FileManager.Instance.GetFileContent(file)) { sizedContent = ImageUtils.CreateImage(content, speaker.ProfilePic.crop.points, file.Extension); } FileManager.Instance.AddFile(userFolder, file.FileName, sizedContent, true, false, file.ContentType); sizedContent.Dispose(); ImageUtils.CreateThumbnails(file.FileId); } } DotNetNuke.Entities.Users.UserController.UpdateUser(PortalSettings.PortalId, dnnUser); DotNetNuke.Entities.Profile.ProfileController.UpdateUserProfile(dnnUser); return ReturnRoute(speaker.ConferenceId, View("View", _repository.GetSpeaker(speaker.ConferenceId, speaker.UserId))); }