public static void Login(Member member) { AjaxChatFriend owner = new AjaxChatFriend(); owner.CustomMessage = member.MemberProfile[0].TagLine; owner.Email = member.Email; owner.FirstName = member.FirstName; owner.LastName = member.LastName; owner.NickName = member.NickName; owner.OnlineStatus = OnlineStatus.Online; owner.OnlineStatusString = OnlineStatus.Online.ToString(); owner.WebMemberID = member.WebMemberID; owner.LastCommDt = DateTime.Now; ResourceFile PhotoRes = new ResourceFile(member.ProfilePhotoResourceFileID); owner.AvatorUrl = ParallelServer.Get(PhotoRes.FullyQualifiedURL) + PhotoRes.FullyQualifiedURL; ; AjaxChat c = new AjaxChat(owner); c = AddToChatData(member.WebMemberID, c); c.Owner.OnlineStatus = OnlineStatus.Online; c.Token = Next2Friends.Misc.UniqueID.NewWebID(); FillFriends(member); GetMessagesFromDB(member); }
public Bitmap GetPhoto() { if (Session["ImageStore"] != null && Session["Original"] != null) return (Bitmap)Session["ImageStore"]; if (Session["strWebMemberID"] != null) strWebMemberID = (string)(Session["strWebMemberID"]); string PhotoURL="1", LargePhotoURL; try { if (strWebMemberID != null) { Member ViewingMember = Member.GetMembersViaWebMemberIDWithFullJoin(strWebMemberID); ResourceFile PhotoRes = new ResourceFile(ViewingMember.ProfilePhotoResourceFileID); PhotoURL = OSRegistry.GetDiskUserDirectory() + PhotoRes.SavePath.Replace("pthmb", "pmed");//PhotoRes.Server + "|" + PhotoRes.Path+"|"+PhotoRes.StorageLocation + PhotoRes.FileName; Bitmap photoLarge = (Bitmap)Image.FromFile(PhotoURL); Session["Original"] = photoLarge; Session["ImageStore"] = photoLarge; if (Session["Original"] != null) return photoLarge; } } catch (Exception ex) { PhotoURL = ex.Message; } Bitmap pic = new Bitmap(defaultPicureSize.Width,defaultPicureSize.Height); Graphics g = Graphics.FromImage(pic); g.SmoothingMode = System.Drawing.Drawing2D.SmoothingMode.AntiAlias; g.FillRectangle(new SolidBrush(Color.White), 0, 0, defaultPicureSize.Width, defaultPicureSize.Height); g.DrawRectangle(new Pen(new SolidBrush(Color.Black)), 0, 0, defaultPicureSize.Width - 1, defaultPicureSize.Height - 1); // g.DrawString(PhotoURL, new Font("Courier New", 12), new SolidBrush(Color.Blue), 10, 40); return pic; }
public static string GetMiniProgileHTML(string WebMemberID, Member member) { Member MiniProfileMember = Member.GetMembersViaWebMemberIDWithFullJoin(WebMemberID); string MiniProfileHTML = string.Empty; int MutualFriendCount = Friend.GetMutualFriendCount(MiniProfileMember, member); try { if (MiniProfileMember != null) { StringBuilder sbHTML = new StringBuilder(); string[] Parameters = new string[7]; Parameters[0] = MiniProfileMember.NickName; ResourceFile PhotoRes = new ResourceFile(MiniProfileMember.ProfilePhotoResourceFileID); Parameters[1] = "http://www.next2friends.com/" + PhotoRes.FullyQualifiedURL; Parameters[2] = MiniProfileMember.FirstName + " " + MiniProfileMember.LastName; Parameters[3] = UserStatus.IsUserOnline(MiniProfileMember.WebMemberID) ? "<img class=\"online-offline\" src=\"/images/online.gif\" alt=\"Online\" /> Online now" : "<img class=\"online-offline\" src=\"/images/offline.gif\" alt=\"Offline\" /> Offline"; Parameters[4] = MiniProfileMember.AgeYears.ToString(); Parameters[5] = MiniProfileMember.WebMemberID; Parameters[6] = MutualFriendCount.ToString(); sbHTML.AppendFormat(@"<div class='popupActions'> <ul class='friend_actions' style='width:150px'> <li><a class='send_message' onmouseover='return true;' href='javascript:openMsg();'>Send Message</a></li> <li><a class='forward' onmouseover='return true;' href='/Inbox.aspx?f={5}'>Forward to a friend</a></li> <li><a class='forward' onmouseover='return true;' href='/users/{0}'>View full profile</a></li> </ul> </div> <div class='popupProfileContent'> <p class='profile_pic'> <img id='imgProfile' alt='Comosicus profile pic' src='{1}'/> </p> <dl> <dt>Name:</dt><dd><strong>{2}</strong></dd> <dt>Age:</dt><dd><strong>{4}</strong></dd> <dt>Friends:</dt><dd>{6} mutual friends</dd> </dl> <div class='clear'/> <div id='divMsg' style='display:none'> <p>Send message to {2}:</p> <p><textarea rows='3' style='width: 100%;'/></textarea></p> <p style='text-align:right;'><input type='button' class='form_btn2' value='cancel' onclick='closeMsg();'/><input type='button' class='form_btn2' value='send'/></p> </div> </div>", Parameters); MiniProfileHTML = sbHTML.ToString(); } } catch (Exception ex) { throw ex; } return MiniProfileHTML; }
public void FixProfilePhotos() { using (var dr = Member.GetAllMemberReader()) { while (dr.Read()) { var memberId = Convert.ToInt32(dr["MemberID"], CultureInfo.InvariantCulture); var profilePhotoId = Convert.ToInt32(dr["ProfilePhotoResourceFileID"], CultureInfo.InvariantCulture); if (profilePhotoId == _defaultPhotoResourceFileId) continue; var resourceFile = new ResourceFile(profilePhotoId); FixProfilePhoto(memberId, resourceFile.Path, resourceFile.FileName); } dr.Close(); } }
private void ExtractURLParams() { ViewingMember = ExtractPageParams.GetMember(this.Page, this.Context); // if no member name was givent then it is likely to be a video page if (ViewingMember == null) { // get the video and extact the member DefaultVideo = ExtractPageParams.GetVideo(this.Page, this.Context); ViewingMember = new Member(DefaultVideo.MemberID); } NumberOfComments = AjaxComment.GetNumberOfCommentByObjectID(ViewingMember.MemberID,(int)CommentType.Wall); NumberOfMemberSubscribers = SubscriptionMember.GetSubscriberCountByMemberID(ViewingMember.MemberID).ToString(); ViewingMemberProfile = ViewingMember.MemberProfile[0]; try { NumberOfVideos = ViewingMemberProfile.NumberOfVideos; NumberOfPhotos = ViewingMemberProfile.NumberOfPhotos; NumberOfFriends = FriendRequest.GetNumberOfFriends(ViewingMember.MemberID); } catch { } try { ResourceFile PhotoRes = new ResourceFile(ViewingMember.ProfilePhotoResourceFileID); PhotoURL = ParallelServer.Get(PhotoRes.FullyQualifiedURL) + PhotoRes.FullyQualifiedURL; LargePhotoURL = ParallelServer.Get("/pmed/" + PhotoRes.FileName) + @"user/" + ViewingMember.NickName + "/pmed/" + PhotoRes.FileName; } catch { } ViewingMemberProfile = ViewingMember.MemberProfile[0]; ViewingMemberProfile.NumberOfViews++; }
/// <summary> /// Takes an prepopulated IDataReader and creates an array of ResourceFiles /// </summary> public static List<ResourceFile> PopulateObject(IDataReader dr) { ColumnFieldList list = new ColumnFieldList(dr); List<ResourceFile> arr = new List<ResourceFile>(); ResourceFile obj; while (dr.Read()) { obj = new ResourceFile(); if (list.IsColumnPresent("ResourceFileID")) { obj._resourceFileID = (int)dr["ResourceFileID"]; } if (list.IsColumnPresent("WebResourceFileID")) { obj._webResourceFileID = (string)dr["WebResourceFileID"]; } if (list.IsColumnPresent("ResourceType")) { obj._resourceType = (int)dr["ResourceType"]; } if (list.IsColumnPresent("StorageLocation")) { obj._storageLocation = (int)dr["StorageLocation"]; } if (list.IsColumnPresent("Server")) { obj._server = (int)dr["Server"]; } if (list.IsColumnPresent("Path")) { obj._path = (string)dr["Path"]; } if (list.IsColumnPresent("FileName")) { obj._fileName = (string)dr["FileName"]; } if (list.IsColumnPresent("CreatedDT")) { obj._createdDT = (DateTime)dr["CreatedDT"]; } arr.Add(obj); } dr.Close(); return arr; }
public static void ProcessAAFPhoto(Member member, AskAFriend AAF, Image image, int IndexOrder) { string GlobalWebID = UniqueID.NewWebID(); string FileName = GlobalWebID + @".jpg"; AskAFriendPhoto photo = new AskAFriendPhoto(); photo.AskAFriendID = AAF.AskAFriendID; photo.IndexOrder = IndexOrder; //create the medium ResourceFile PhotoResourceFile = new ResourceFile(); PhotoResourceFile.WebResourceFileID = GlobalWebID; PhotoResourceFile.ResourceType = (int)ResourceFileType.AAFLarge; PhotoResourceFile.Path = member.NickName + "/" + "aaflrge" + "/"; PhotoResourceFile.FileName = FileName; PhotoResourceFile.Save(); System.Drawing.Image MediumImage = Photo.Resize480x480(image); Photo.SaveToDisk(MediumImage, PhotoResourceFile.SavePath); photo.PhotoResourceFileID = PhotoResourceFile.ResourceFileID; //create the thumbnail ResourceFile ThumbnailPhoto = new ResourceFile(); ThumbnailPhoto.WebResourceFileID = GlobalWebID; ThumbnailPhoto.ResourceType = (int)ResourceFileType.AAFThumbnail; ThumbnailPhoto.Path = member.NickName + "/" + "aafthmb" + "/"; ThumbnailPhoto.FileName = FileName; ThumbnailPhoto.Save(); System.Drawing.Image ThumbnailImage = Photo.ResizeTo124x91(MediumImage); Photo.SaveToDisk(ThumbnailImage, ThumbnailPhoto.SavePath); photo.Save(); if (IndexOrder == 1) { AAF.DefaultPhotoResourceFileID = ThumbnailPhoto.ResourceFileID; } AAF.Save(); }
/// <summary> /// Saves the video file to disk /// </summary> /// <returns></returns> public static void QueueVideoForEncoding(Video video, Stream FLVStream,string Extension, Member member, string VideoTitle) { if (VideoTitle.Length > 35) { VideoTitle = VideoTitle.Substring(0, 35); } string VideoFileName = UniqueID.NewWebID(); string VideoPreprocessedInputFile = OSRegistry.GetDiskUserDirectory() + member.NickName + @"\video\" + VideoFileName + "." + Extension; string VideoInputFile = member.NickName + @"\video\" + VideoFileName + "." + Extension; string VideoOutputFile = member.NickName + @"\video\" + VideoFileName + ".flv"; int Length = 256; Byte[] buffer = new Byte[256]; int bytesRead = FLVStream.Read(buffer, 0, Length); FileStream fs = new FileStream(VideoPreprocessedInputFile, FileMode.Create); // write the required bytes while (bytesRead > 0) { fs.Write(buffer, 0, bytesRead); bytesRead = FLVStream.Read(buffer, 0, Length); } FLVStream.Close(); fs.Flush(); fs.Close(); ResourceFile VideoResourceFile = new ResourceFile(); VideoResourceFile.WebResourceFileID = UniqueID.NewWebID(); VideoResourceFile.FileName = VideoFileName + ".flv"; VideoResourceFile.Path = @"/" + member.NickName + @"/video/"; VideoResourceFile.ResourceType = (int)ResourceFileType.Video; VideoResourceFile.Save(); string ThumbnailName = UniqueID.NewWebID() + ".jpg"; string ThumbnailSavePath = member.NickName + @"\vthmb\" + ThumbnailName; ResourceFile ThumbnailResourceFile = new ResourceFile(); ThumbnailResourceFile.WebResourceFileID = UniqueID.NewWebID(); ThumbnailResourceFile.FileName = ThumbnailName; ThumbnailResourceFile.Path = member.NickName + @"/vthmb/"; ThumbnailResourceFile.ResourceType = (int)ResourceFileType.VideoThumbnail; ThumbnailResourceFile.Save(); video.MemberID = member.MemberID; video.WebVideoID = UniqueID.NewWebID(); video.Category = 1; video.DTCreated = DateTime.Now; video.VideoResourceFileID = VideoResourceFile.ResourceFileID; video.ThumbnailResourceFileID = ThumbnailResourceFile.ResourceFileID; video.Status = (int)VideoStatus.EncoderQueue; video.Save(); // update the number of photos MemberProfile memberProfile = member.MemberProfile[0]; memberProfile.NumberOfVideos++; memberProfile.Save(); VideoEncoderQueue VideoEncode = new VideoEncoderQueue(); VideoEncode.VideoID = video.VideoID; VideoEncode.VideoInputFile = VideoInputFile; VideoEncode.VideoOutputFile = VideoOutputFile; VideoEncode.ThumbnailOutputFile = ThumbnailSavePath; VideoEncode.Status = (int)VideoEncoderStatus.Ready; VideoEncode.Save(); }
// <summary> /// Lawrence: This method appears to be obselete and was used as an interim solution for video encoder... /// </summary> /// <returns></returns> public static void ProxyProcessVideo(Stream FLVStream, Member member, string UNCPathToUserDirectory, string VideoTitle) { if (VideoTitle.Length > 35) { VideoTitle = VideoTitle.Substring(0, 35); } string VideoFileName = UniqueID.NewWebID() + ".flv"; string SavePath = UNCPathToUserDirectory + member.NickName + @"\video\" + VideoFileName; int Length = 256; Byte[] buffer = new Byte[256]; int bytesRead = FLVStream.Read(buffer, 0, Length); FileStream fs = new FileStream(SavePath, FileMode.Create); // write the required bytes while (bytesRead > 0) { fs.Write(buffer, 0, bytesRead); bytesRead = FLVStream.Read(buffer, 0, Length); } FLVStream.Close(); fs.Flush(); fs.Close(); ResourceFile VideoResourceFile = new ResourceFile(); VideoResourceFile.WebResourceFileID = UniqueID.NewWebID(); VideoResourceFile.FileName = VideoFileName; VideoResourceFile.Path = @"/" + member.NickName + @"/video/"; VideoResourceFile.ResourceType = (int)ResourceFileType.Video; VideoResourceFile.Save(); Process FFMpegProcess; FFMpegProcess = new System.Diagnostics.Process(); string ThumbnailName = UniqueID.NewWebID(); string ThumbnailSavePath = OSRegistry.GetDiskUserDirectory() + member.NickName + @"\vthmb\"; if (ThumbnailName.Length > 21) { ThumbnailName = ThumbnailName.Substring(0, 20); } string FullSavePath = ThumbnailSavePath + ThumbnailName; string arg = "-i " + SavePath + " -an -ss 00:00:07 -t 00:00:01 -r 1 -y -s 160x120 " + FullSavePath + "%d.jpg"; string cmd = @"c:\ffmpeg.exe"; FFMpegProcess = System.Diagnostics.Process.Start(cmd, arg); FFMpegProcess.WaitForExit(); FFMpegProcess.Close(); //ffmpeg must add a 1 to the end of the file ThumbnailName += "1.jpg"; ResourceFile ThumbnailResourceFile = new ResourceFile(); ThumbnailResourceFile.WebResourceFileID = UniqueID.NewWebID(); ThumbnailResourceFile.FileName = ThumbnailName; ThumbnailResourceFile.Path = member.NickName + @"/vthmb/"; ThumbnailResourceFile.ResourceType = (int)ResourceFileType.VideoThumbnail; ThumbnailResourceFile.Save(); Video video = new Video(); video.MemberID = member.MemberID; video.WebVideoID = UniqueID.NewWebID(); video.Title = VideoTitle; video.Description = "No Description"; video.DTCreated = DateTime.Now; video.VideoResourceFileID = VideoResourceFile.ResourceFileID; video.ThumbnailResourceFileID = ThumbnailResourceFile.ResourceFileID; video.Save(); // update the number of photos MemberProfile memberProfile = member.MemberProfile[0]; memberProfile.NumberOfVideos++; memberProfile.Save(); }
public int SendMessage(string Recipient, string MessageBody, string VMToken) { Member member = (Member)Session["Member"]; // determine if its an email or an n2f member // if not a member check the nickname field in the member table Member MemberRecipient = Member.GetMemberViaNicknameNoEx(Recipient); //member.HasBlockedMember(MemberRecipient); if (Recipient == string.Empty) { return (int)MessageSendResponse.BadAddress; } else if (MemberRecipient == null) { if (RegexPatterns.TestEmailRegex(Recipient)) { Message message = new Message(); ResourceFile VideoMessage = new ResourceFile(VMToken); ///*** TEMPORARY //if (VideoMessage.ResourceFileID == 0) //{ // // An external VM must have a video message. return an error message // return (int)MessageSendResponse.EmailMustHaveVideoMessage; //} //else //{ // // yes a video message was recorder // message.VideoMessageResourceFileID = VideoMessage.ResourceFileID; //} ///*** TEMPORARY message.WebMessageID = Next2Friends.Misc.UniqueID.NewWebID(); message.VideoMessageToken = VMToken; message.MemberIDFrom = member.MemberID; message.MemberIDTo = -1; message.Body = MessageBody; message.DTCreated = DateTime.Now; message.ExternalEmailTo = Recipient; message.PassKey = Next2Friends.Misc.UniqueID.NewWebID(); try { message.Save(); } catch(Exception ex) { ex = ex; } message.InReplyToID = message.MessageID; message.Save(); if (message.MessageID > 0) return (int)MessageSendResponse.Sent; else return (int)MessageSendResponse.UnexpectedError; // ResourceFile VideoMessage = new ResourceFile(VMToken); // Message emailMessage = new Message(); // emailMessage.MemberIDFrom = member.MemberID; // emailMessage.MemberIDTo = -1; // emailMessage.ExternalEmailTo = Recipient; // emailMessage.FromNickName = member.NickName; // emailMessage.PassKey = Next2Friends.Misc.UniqueID.NewWebID(); // emailMessage.WebMessageID = Next2Friends.Misc.UniqueID.NewWebID(); // emailMessage.Body = ""; // emailMessage.DTCreated = DateTime.Now; // if (VideoMessage.ResourceFileID != 0) // { // // yes a video message was recorder // emailMessage.VideoMessageResourceFileID = VideoMessage.ResourceFileID; // } // else // { // // An email must have a video message. return an error message // return (int)MessageSendResponse.EmailMustHaveVideoMessage; // } // emailMessage.Save(); // emailMessage.InReplyToID = emailMessage.MessageID; // emailMessage.Save(); // return (int)MessageSendResponse.Sent; //} } else { return (int)MessageSendResponse.BadAddress; } } else { Message message = new Message(); ResourceFile VideoMessage = new ResourceFile(VMToken); if (VideoMessage.ResourceFileID != 0) { // yes a video message was recorder message.VideoMessageResourceFileID = VideoMessage.ResourceFileID; } message.WebMessageID = Next2Friends.Misc.UniqueID.NewWebID(); message.VideoMessageToken = VMToken; message.MemberIDFrom = member.MemberID; message.MemberIDTo = MemberRecipient.MemberID; message.Body = MessageBody; message.DTCreated = DateTime.Now; message.Save(); message.InReplyToID = message.MessageID; message.Save(); if (message.MessageID > 0) return (int)MessageSendResponse.Sent; else return (int)MessageSendResponse.UnexpectedError; } }
/// <summary> /// Sets the thumbnail for a Video /// </summary> /// <param name="Thumbnail"></param> public void SetLiveThumbnail(Image Thumbnail) { Image Resized = Photo.ResizeTo124x91(Thumbnail); Member member = new Member(this.MemberID); ResourceFile thumbnailRes = new ResourceFile(); thumbnailRes.WebResourceFileID = Misc.UniqueID.NewWebID(); thumbnailRes.ResourceType = (int)ResourceFileType.VideoThumbnail; thumbnailRes.FileName = member.NickName + "/" + thumbnailRes.WebResourceFileID + ".jpg"; string ThumbnailSaveLocation = member.NickName + @"\vthmb\" + thumbnailRes.WebResourceFileID + ".jpg"; Photo.SaveToDisk(Resized, ThumbnailSaveLocation); thumbnailRes.Save(); //need to add this to the LiveBroadcast table this.ThumbnailResourceFileID = thumbnailRes.ResourceFileID; this.Save(); }
public static void ProcessProfilePhotoWithCrop(Member member, Image Original, Image Cropped) { string GlobalWebID = UniqueID.NewWebID(); string FileName = GlobalWebID + @".jpg"; //create the medium ResourceFile PhotoResourceFile = new ResourceFile(); PhotoResourceFile.WebResourceFileID = GlobalWebID; PhotoResourceFile.ResourceType = (int)ResourceFileType.PhotoLarge; PhotoResourceFile.Path = member.NickName + "/" + "pmed" + "/"; PhotoResourceFile.FileName = FileName; PhotoResourceFile.Save(); Photo.SaveToDisk(Original, PhotoResourceFile.SavePath); //create the thumbnail ResourceFile ThumbnailResourceFile = new ResourceFile(); ThumbnailResourceFile.WebResourceFileID = GlobalWebID; ThumbnailResourceFile.ResourceType = (int)ResourceFileType.PhotoThumbnail; ThumbnailResourceFile.Path = member.NickName + "/" + "pthmb" + "/"; ThumbnailResourceFile.FileName = FileName; ThumbnailResourceFile.Save(); Photo.SaveToDisk(Cropped, ThumbnailResourceFile.SavePath); member.DefaultPhoto = ThumbnailResourceFile; member.ProfilePhotoResourceFileID = ThumbnailResourceFile.ResourceFileID; member.Save(); }
/// <summary> /// </summary> /// <param name="member"></param> /// <param name="image"></param> public static void ProcessProfilePhoto(Member member, Image image) { string GlobalWebID = UniqueID.NewWebID(); string FileName = GlobalWebID + @".jpg"; //create the medium ResourceFile PhotoResourceFile = new ResourceFile(); PhotoResourceFile.WebResourceFileID = GlobalWebID; PhotoResourceFile.ResourceType = (int)ResourceFileType.PhotoLarge; PhotoResourceFile.Path = member.NickName + "/" + "pmed" + "/"; PhotoResourceFile.FileName = FileName; PhotoResourceFile.Save(); System.Drawing.Image MediumImage = Photo.Resize480x480(image); Photo.SaveToDisk(MediumImage, PhotoResourceFile.SavePath); //create the thumbnail ResourceFile ThumbnailResourceFile = new ResourceFile(); ThumbnailResourceFile.WebResourceFileID = GlobalWebID; ThumbnailResourceFile.ResourceType = (int)ResourceFileType.PhotoThumbnail; ThumbnailResourceFile.Path = member.NickName + "/" + "pthmb" + "/"; ThumbnailResourceFile.FileName = FileName; ThumbnailResourceFile.Save(); System.Drawing.Image ThumbnailImage = Photo.ResizeTo102x102(MediumImage); Photo.SaveToDisk(ThumbnailImage, ThumbnailResourceFile.SavePath); member.DefaultPhoto = ThumbnailResourceFile; member.ProfilePhotoResourceFileID = ThumbnailResourceFile.ResourceFileID; member.Save(); }
public static void ProcessProfilePhoto(Int32 memberId, String nickname, Image image) { if (String.IsNullOrEmpty(nickname)) throw new ArgumentNullException("nickname"); if (image == null) throw new ArgumentNullException("image"); var webId = UniqueID.NewWebID(); var fileName = String.Concat(webId, @".jpg"); /* Create medium image. */ var photoResourceFile = new ResourceFile() { WebResourceFileID = webId, ResourceType = (int)ResourceFileType.PhotoLarge, Path = String.Concat(nickname, "/pmed/"), FileName = fileName }; photoResourceFile.Save(); var mediumImage = Photo.Resize480x480(image); Photo.SaveToDisk(mediumImage, photoResourceFile.SavePath); /* Create thumbnail. */ var thumbnailResourceFile = new ResourceFile() { WebResourceFileID = webId, ResourceType = (int)ResourceFileType.PhotoThumbnail, Path = String.Concat(nickname, "/pthmb/"), FileName = fileName }; thumbnailResourceFile.Save(); var thumbnailImage = Photo.ResizeTo102x102(mediumImage); Photo.SaveToDisk(thumbnailImage, thumbnailResourceFile.SavePath); Member.UpdateProfilePhotoResourceFileId(memberId, thumbnailResourceFile.ResourceFileID); mediumImage.Dispose(); thumbnailImage.Dispose(); }
protected void Page_Load(object sender, EventArgs e) { AjaxPro.Utility.RegisterTypeForAjax(typeof(NSpotPage)); member = (Member)Session["Member"]; // set the default forwarding if the member is not logged in LoginUrl = @"signup.aspx?u=" + Request.Url.AbsoluteUri; SubscribeLink = LoginUrl; SendMessageLink = LoginUrl; BlockMemberLink = LoginUrl; AddToFriendsLink = LoginUrl; DefaultVoteUpLink = LoginUrl; DefaultVoteDownLink = LoginUrl; AddFavouritesLink = LoginUrl; string strWebNSpotID = Request.Params["n"]; // load the members photo string strMemberPhoto = Request.Params["np"]; if (strWebNSpotID != null) { ViewingNSpot = NSpot.GetNSpotByNSpotWebIDWithJoin(strWebNSpotID); PhotoURL = ViewingNSpot.PhotoResourceFile.FullyQualifiedURL; ProfileDefaultPageType = NSDefaultPageType.NSpot; DefaultNumberOfViews = (++ViewingNSpot.NumberOfViews).ToString(); ViewingNSpot.Save(); PermaLink = WebRoot + "nspot.aspx?m=" + strWebNSpotID; GenerateNSpotMemberLister(); } if (strMemberPhoto != null) { ResourceFile PhotoRes = new ResourceFile(ViewingNSpot.PhotoResourceFileID); LoadLargeNSpotPhoto = true; LargePhotoURL = @"user/" + ViewingNSpot.Member.NickName + "/nslrge/" + PhotoRes.FileName; } if (member != null) { IsLoggedIn = true; if (ViewingNSpot.MemberID == member.MemberID) { IsMyPage = true; } } GeneratePageComments(); //CreateEmbeddedLinks(); }
private void SetVariables() { string strWebMemberID = Request.Params["m"]; string strWebVideoID = Request.Params["v"]; string strPhotoID = Request.Params["p"]; string strLiveBroadcastID = Request.Params["l"]; if (strWebMemberID != null) { ViewingMember = Member.GetMembersViaWebMemberIDWithFullJoin(strWebMemberID); //ProfileDefaultPageType = DefaultPageType.Member; //ViewingMemberProfile = ViewingMember.MemberProfile[0]; //DefaultNumberOfViews = (++ViewingMemberProfile.NumberOfViews).ToString(); //ViewingMemberProfile.Save(); //PermaLink = WebRoot + "view.aspx?m=" + strWebMemberID; MemberSubscribers = GetSubscriberLister(); GenerateFriendLister(); } else if (strWebVideoID != null) { DefaultVideo = Video.GetVideoByWebVideoIDWithJoin(strWebVideoID); ViewingMember = new Member(DefaultVideo.MemberID); //ViewingMemberProfile = ViewingMember.MemberProfile[0]; //ProfileDefaultPageType = DefaultPageType.Video; //DefaultVideoURL = DefaultVideo.VideoResourceFile.FullyQualifiedURL; //DefaultMediaID = strWebVideoID; //DefaultVoteCount = DefaultVideo.TotalVoteScore.ToString(); //VideoURL = DefaultVideo.VideoResourceFile.FullyQualifiedURL; //DefaultNumberOfViews = (++DefaultVideo.NumberOfViews).ToString(); //DefaultVideo.Save(); //PermaLink = WebRoot + "view.aspx?v=" + strWebVideoID; //EmbedLink = @"<object width=""480"" height=""400""><param name=""movie"" value=""http://www.next2friends.com/flvplayer.swf""></param><param name=""wmode"" value=""transparent""></param><embed src=""http://www.next2friends.com/flvplayer.swf?file=" + VideoURL + @""" type=""application/x-shockwave-flash"" wmode=""transparent"" width=""480"" height=""400""></embed></object>"; //MainTitle = DefaultVideo.Title; //MainSubTitle = DefaultVideo.Description; if (IsLoggedIn) { //ReportAbuseLink = "ReportAbuse.aspx?r=" + strWebVideoID; } else { //ReportAbuseLink = @"signup.aspx?u=ReportAbuse.aspx?r=" + strWebVideoID + "&url=" + Request.Url.AbsoluteUri; } } else if (strPhotoID != null) { DefaultPhoto = Photo.GetPhotoByWebPhotoIDWithJoin(strPhotoID); //DefaultNumberOfViews = (++DefaultPhoto.NumberOfViews).ToString(); //DefaultPhoto.Save(); ViewingMember = new Member(DefaultPhoto.MemberID); //ViewingMemberProfile = ViewingMember.MemberProfile[0]; //ProfileDefaultPageType = DefaultPageType.Photo; //DefaultPhotoURL = ParallelServer.Get(DefaultPhoto.PhotoResourceFile.FullyQualifiedURL) + DefaultPhoto.PhotoResourceFile.FullyQualifiedURL; //DefaultMediaID = strPhotoID; //DefaultVoteCount = DefaultPhoto.TotalVoteScore.ToString(); //PermaLink = WebRoot + "view.aspx?p=" + strPhotoID; MainTitle = DefaultPhoto.Caption; //MainSubTitle = "From Gallery " + DefaultPhoto.; if (IsLoggedIn) { //ReportAbuseLink = "ReportAbuse.aspx?r=" + strPhotoID; } else { //ReportAbuseLink = @"signup.aspx?u=ReportAbuse.aspx?r=" + strPhotoID + "&url=" + Request.Url.AbsoluteUri; } } else if (strLiveBroadcastID != null) { VideoURL = strLiveBroadcastID; LiveBroadcast live = LiveBroadcast.GetLiveBroadcastByWebLiveBroadcastID(strLiveBroadcastID); ViewingMember = new Member(live.MemberID); //ViewingMemberProfile = ViewingMember.MemberProfile[0]; //ProfileDefaultPageType = DefaultPageType.LiveBroadcast; //PermaLink = ASP.global_asax.WebRoot + "view.aspx?v="+strWebVideoID; } else { throw new Exception("No WebID"); //ViewingMember = new Member(1); //ProfileDefaultPageType = DefaultPageType.Member; //PermaLink = ASP.global_asax.WebRoot + "view.aspx?v="+strWebVideoID; } NumberOfComments = AjaxComment.GetNumberOfMemberCommentByMemberID(ViewingMember.MemberID); ViewingMemberProfile = ViewingMember.MemberProfile[0]; try { NumberOfVideos = ViewingMemberProfile.NumberOfVideos; NumberOfPhotos = ViewingMemberProfile.NumberOfPhotos; NumberOfFriends = FriendRequest.GetNumberOfFriends(ViewingMember.MemberID); } catch { } try { ResourceFile PhotoRes = new ResourceFile(ViewingMember.ProfilePhotoResourceFileID); PhotoURL = ParallelServer.Get(PhotoRes.FullyQualifiedURL) + PhotoRes.FullyQualifiedURL; LargePhotoURL = ParallelServer.Get("/pmed/" + PhotoRes.FileName) + @"user/" + ViewingMember.NickName + "/pmed/" + PhotoRes.FileName; } catch { } ViewingMemberProfile = ViewingMember.MemberProfile[0]; ViewingMemberProfile.NumberOfViews++; }
protected void Page_Load(object sender, EventArgs e) { ResourceFile PhotoRes = new ResourceFile(ViewingMember.ProfilePhotoResourceFileID); PhotoURL = "http://www.next2friends.com/" + PhotoRes.FullyQualifiedURL; SetEmbedString(); }
protected void btnPhotoChange_Click(object sender, EventArgs e) { Member member = (Member)Session["Member"]; if (member != null) { if (filePhoto.HasFile) { System.Drawing.Image ProfilePhoto = Photo.ByteArrayToImage(filePhoto.FileBytes); Photo.ProcessProfilePhoto(member, ProfilePhoto); Session["Member"] = member; ResourceFile PhotoRes = new ResourceFile(member.ProfilePhotoResourceFileID); PhotoURL = PhotoRes.FullyQualifiedURL; } } }
public String GetProfilePhotoUrl(String nickname) { if (String.IsNullOrEmpty(nickname)) throw new ArgumentNullException("nickname"); var member = Member.GetMemberViaNickname(nickname); var profilePhotoURL = String.Empty; if (member != null) { var photoRes = new ResourceFile(member.ProfilePhotoResourceFileID); profilePhotoURL = "http://www.next2friends.com/" + photoRes.FullyQualifiedURL; } return profilePhotoURL; }
public static NSpot ProcessNSpotPhoto(Member member, NSpot nSpot, Image image) { Database db = DatabaseFactory.CreateDatabase(); DbConnection conn = db.CreateConnection(); DbTransaction Transaction = null; try { conn.Open(); Transaction = conn.BeginTransaction(); string GlobalWebID = UniqueID.NewWebID(); string FileName = GlobalWebID + @".jpg"; // create the large photo // just store the large image.. dont make a resource record System.Drawing.Image MainImage = Photo.Resize480x480(image); string Savepath = member.NickName + @"\" + "nslrge" + @"\" + FileName; Photo.SaveToDisk(MainImage, Savepath); //create the medium ResourceFile PhotoResourceFile = new ResourceFile(); PhotoResourceFile.CreatedDT = DateTime.Now; PhotoResourceFile.WebResourceFileID = GlobalWebID; PhotoResourceFile.ResourceType = (int)ResourceFileType.NspotPhoto; PhotoResourceFile.Path = member.NickName + "/" + "nsmed" + "/"; PhotoResourceFile.FileName = FileName; PhotoResourceFile.Save(db); System.Drawing.Image MediumImage = Photo.Resize190x130(MainImage); Photo.SaveToDisk(MediumImage, PhotoResourceFile.SavePath); //create the thumbnail ResourceFile ThumbnailResourceFile = new ResourceFile(); ThumbnailResourceFile.CreatedDT = DateTime.Now; ThumbnailResourceFile.WebResourceFileID = GlobalWebID; ThumbnailResourceFile.ResourceType = (int)ResourceFileType.NspotThumbnail; ThumbnailResourceFile.Path = member.NickName + "/" + "nsthmb" + "/"; ThumbnailResourceFile.FileName = FileName; ThumbnailResourceFile.Save(db); System.Drawing.Image ThumbnailImage = Photo.ResizeTo124x91(MediumImage); Photo.SaveToDisk(ThumbnailImage, ThumbnailResourceFile.SavePath); // attached the resource ids to the photos nSpot.ThumbnailResourceFileID = ThumbnailResourceFile.ResourceFileID; nSpot.PhotoResourceFileID = PhotoResourceFile.ResourceFileID; nSpot.Save(db); Transaction.Commit(); } catch (Exception ex) { Transaction.Rollback(); throw ex; } finally { conn.Close(); } return nSpot; }