コード例 #1
0
ファイル: Program.cs プロジェクト: xuchuansheng/GenXSource
        private static void UploadPhoto(Member member, String photoCollectionID, String base64StringPhoto, String dateTime)
        {
            var byteImage = Convert.FromBase64String(base64StringPhoto);
            var longDateTime = Int64.Parse(dateTime);
            var takenDT = new DateTime(longDateTime);

            try
            {
                var img = data.Photo.ByteArrayToImage(byteImage);
            }
            catch
            {
                //throw new ArgumentException(Resources.Argument_InvalidBase64PhotoString);
            }


            var photoCollection = PhotoCollection.GetPhotoCollectionByWebPhotoCollectionID(photoCollectionID);

            if (photoCollection == null)
            {
                photoCollection = new PhotoCollection()
                {
                    DTCreated = DateTime.Now,
                    //Description = Resources.SnapUp_DefaultGalleryDescrpiption,
                    MemberID = member.MemberID,
                    //Name = Resources.SnapUp_DefaultGalleryName
                };
                photoCollection.Save();
            }

            data.Photo.ProcessMemberPhoto(member, photoCollection.PhotoCollectionID, byteImage, takenDT);
        }
コード例 #2
0
ファイル: Logic.cs プロジェクト: Shine6Z/GenXSource
        /// <summary>
        /// Starts a chat session by creating an inbox instance
        /// </summary>
        /// <param name="MemberID"></param>
        public static AjaxMember LoginToChatServer(string EmailAddress, string Password)
        {
            Next2Friends.Data.Member member = Login(EmailAddress, Password);

            AjaxMember m = new AjaxMember();

            m.WebMemberID  = member.WebMemberID;
            m.FirstName    = member.FirstName;
            m.LastName     = member.LastName;
            m.NickName     = member.NickName;
            m.Email        = member.Email;
            m.OnlineStatus = OnlineStatus.Online;

            ChatInbox inbox = GetInbox(m.WebMemberID);

            // if no existing instances exist then create one
            if (inbox == null)
            {
                //log the user in
                inbox            = new ChatInbox();
                inbox.MemberID   = member.MemberID;
                inbox.MemberInfo = m;
                ChatInboxList.Add(inbox);
            }
            else
            {
                inbox.MemberInfo = m;
            }

            return(m);
        }
コード例 #3
0
        public Int32 CreateUser(String emailAddress, String nickname, String password, Int32 gender /* 0 - Girl, 1 - Boy, 2 - Not saying */)
        {
            if (String.IsNullOrEmpty(emailAddress)
                || !RegexPatterns.TestEmailRegex(emailAddress))
                return -1; // emailAddress is not valid.
            if (!Member.IsEmailAddressAvailable(emailAddress))
                return -2; // emailAddress already registered.
            if (String.IsNullOrEmpty(nickname)
                || !RegexPatterns.TestNickname(nickname))
                return -3; // nickname invalid.
            if (!Member.IsNicknameAvailable(nickname))
                return -4; // nickname already registered.
            if (String.IsNullOrEmpty(password)
                || !RegexPatterns.TestPassword(password))
                return -5; // password minimum length is 7 characters.
            if (gender < 0 || gender > 2)
                return -6; // gender should be 0 - Girl, 1 - Boy, 2 - Not saying.

            var member = new Member()
            {
                AccountType = 0, /* Default */
                Email = emailAddress,
                NickName = nickname,
                FirstName = nickname,
                Password = password,
                Gender = gender,
                ISOCountry = "UNS", /* Unspecified */
                ProfilePhotoResourceFileID = 1, /* Default */
                WebMemberID = UniqueID.NewWebID(),
                CreatedDT = DateTime.Now
            };

            try
            {
                member.Save();
            }
            catch (Exception e)
            {
                Debug.WriteLine(e.Message);
                return -7;
            }

            try
            {
                MemberSetUp(member);
            }
            catch (Exception e)
            {
                Debug.WriteLine(e.Message);
                return -8;
            }

            return 0;
        }
コード例 #4
0
ファイル: Logic.cs プロジェクト: Shine6Z/GenXSource
        public static bool AddFriend(string WebMemberID, string TargetEmail)
        {
            ChatInbox inbox = GetInbox(WebMemberID);

            Next2Friends.Data.Member targetMember = Next2Friends.Data.Member.GetMemberByEmail(TargetEmail);
            if (targetMember == null)
            {
                return(false);
            }

            Next2Friends.Data.Friend f = new Next2Friends.Data.Friend();
            f.MemberID1 = inbox.MemberID;
            f.MemberID2 = targetMember.MemberID;
            f.Save();

            return(true);
        }
コード例 #5
0
ファイル: Logic.cs プロジェクト: Shine6Z/GenXSource
        public static Next2Friends.Data.Member Login(string EmailAddress, string Password)
        {
            Next2Friends.Data.Member member = Next2Friends.Data.Member.MemberLogin(EmailAddress, Password);

            //Get new messages from DB and put them into the server memory
            try
            {
                List <AjaxChat> chatList = GetNewMessagesDB(member.WebMemberID);

                foreach (AjaxChat chat in chatList)
                {
                    Member otherMember = new Member(chat.OtherMemberID);
                    SendMessageLive(otherMember.WebMemberID, member.WebMemberID, otherMember.NickName, chat.Message, chat.ChatWebID);
                }
            }
            catch {}
            return(member);
        }
コード例 #6
0
ファイル: Logic.cs プロジェクト: xuchuansheng/GenXSource
        public static Next2Friends.Data.Member Login(string EmailAddress, string Password)
        {
            Next2Friends.Data.Member member = Next2Friends.Data.Member.MemberLogin(EmailAddress, Password);

            //Get new messages from DB and put them into the server memory
            try
            {
                List<AjaxChat> chatList = GetNewMessagesDB(member.WebMemberID);                

                foreach (AjaxChat chat in chatList)
                {
                    Member otherMember = new Member(chat.OtherMemberID);
                    SendMessageLive(otherMember.WebMemberID,member.WebMemberID, otherMember.NickName, chat.Message, chat.ChatWebID);
                }
            }
            catch{}
            return member;            
        }
コード例 #7
0
ファイル: Friend.cs プロジェクト: xuchuansheng/GenXSource
        public static List<Member> GetMutualFriends(Member Member1, Member Member2)
        {
            Database db = DatabaseFactory.CreateDatabase();

            DbCommand dbCommand = db.GetStoredProcCommand("[HG_GetMutualFriends]");
            db.AddInParameter(dbCommand, "MemberID1", DbType.Int32, Member1.MemberID);
            db.AddInParameter(dbCommand, "MemberID2", DbType.Int32, Member2.MemberID);

            List<Member> MutualFriends = new List<Member>();

            using (IDataReader dr = db.ExecuteReader(dbCommand))
            {
                MutualFriends = Member.PopulateObjectWithJoin(dr);
                dr.Close();
            }

            return MutualFriends;
        }
コード例 #8
0
ファイル: Nspot.cs プロジェクト: xuchuansheng/GenXSource
        public static List<NSpot> GetAllNSpotByMemberID(Member member)
        {
            Database db = DatabaseFactory.CreateDatabase();
            DbCommand dbCommand = db.GetStoredProcCommand("HG_GetAllNSpotByMemberIDWithJoin");
            db.AddInParameter(dbCommand, "MemberID", DbType.Int32, member.MemberID);

            List<NSpot> arr = null;

            //execute the stored procedure
            using (IDataReader dr = db.ExecuteReader(dbCommand))
            {
                arr = PopulateObjectWithJoin(dr);
                dr.Close();
            }

            // Create the object array from the datareader
            return arr;
        }
コード例 #9
0
ファイル: Friend.cs プロジェクト: xuchuansheng/GenXSource
        public static int GetMutualFriendCount(Member Member1, Member Member2)
        {
            Database db = DatabaseFactory.CreateDatabase();

            DbCommand dbCommand = db.GetStoredProcCommand("[HG_GetMutualFriendCount]");
            db.AddInParameter(dbCommand, "MemberID1", DbType.Int32, Member1.MemberID);
            db.AddInParameter(dbCommand, "MemberID2", DbType.Int32, Member2.MemberID);

            int MutualFriendCount = 0;

            using (IDataReader dr = db.ExecuteReader(dbCommand))
            {
                if (dr.Read())
                {
                    MutualFriendCount = dr.GetInt32(0);
                }
                dr.Close();
            }

            return MutualFriendCount;
        }
コード例 #10
0
        public static void CreateUserDirectories(Member member)
        {
            string root = OSRegistry.GetDiskUserDirectory() + member.NickName;

            Directory.CreateDirectory(root);
            Directory.CreateDirectory(root + @"\plrge");
            Directory.CreateDirectory(root + @"\pmed");
            Directory.CreateDirectory(root + @"\pthmb");

            Directory.CreateDirectory(root + @"\video");
            Directory.CreateDirectory(root + @"\vthmb");

            Directory.CreateDirectory(root + @"\aaflrge");
            Directory.CreateDirectory(root + @"\aafthmb");

            Directory.CreateDirectory(root + @"\nslrge");
            Directory.CreateDirectory(root + @"\nsmed");
            Directory.CreateDirectory(root + @"\nsthmb");

            Directory.CreateDirectory(root + @"\advrimg");
            Directory.CreateDirectory(root + @"\banner");
        }
コード例 #11
0
ファイル: Member.cs プロジェクト: xuchuansheng/GenXSource
        public static string GetGalleryID(Member member, DefaultGalleryType GalleryType)
        {
            Database db = DatabaseFactory.CreateDatabase();
            DbCommand dbCommand = db.GetStoredProcCommand("HG_GetGalleryID");
            db.AddInParameter(dbCommand, "MemberID", DbType.Int32, member.MemberID);
            //db.AddInParameter(dbCommand, "GalleryType", DbType.String, GalleryType);

            string WebGalleryID = string.Empty;

            //execute the stored procedure
            using (IDataReader dr = db.ExecuteReader(dbCommand))
            {
                if (dr.Read())
                {
                    WebGalleryID = (string)dr[0];
                }

                dr.Close();
            }

            return WebGalleryID;
        }
コード例 #12
0
        /// <summary>
        /// Check if a Member has voted for an AskAFriend or not
        /// </summary>
        /// <param name="member">The Member Object</param>
        /// <param name="AAF">The AskAFriend object</param>
        /// <returns>True if the member has voted otherwise false</returns>
        public static bool HasntYetVoted(Member member, AskAFriend AAF)
        {
            Database db = DatabaseFactory.CreateDatabase();
            DbCommand dbCommand = db.GetStoredProcCommand("HG_HasntYetVoted");
            db.AddInParameter(dbCommand, "MemberID", DbType.Int32, member.MemberID);
            db.AddInParameter(dbCommand, "AskAFriendID", DbType.Int32, AAF.AskAFriendID);

            bool HasVoted = false;

            //execute the stored procedure
            using (IDataReader dr = db.ExecuteReader(dbCommand))
            {
                if (dr.Read())
                {
                    HasVoted = (bool)dr["HasVoted"];
  
                }

                dr.Close();
            }

            return !HasVoted;
        }
コード例 #13
0
ファイル: Member.cs プロジェクト: xuchuansheng/GenXSource
        /// <summary>
        /// Is this Member blocked
        /// </summary>
        public bool HasBlockedMember(Member member)
        {
            Database db = DatabaseFactory.CreateDatabase();
            DbCommand dbCommand = db.GetStoredProcCommand("HG_HasBlockedMember");
            db.AddInParameter(dbCommand, "MemberID", DbType.Int32, this.MemberID);
            db.AddInParameter(dbCommand, "IsBlockedMemberID", DbType.Int32, member.MemberID);

            bool IsBlocked = false;

            //execute the stored procedure
            using (IDataReader dr = db.ExecuteReader(dbCommand))
            {

                if (dr.Read())
                {
                    IsBlocked = (bool)dr[0];
                }

                dr.Close();
            }


            return IsBlocked;

        }
コード例 #14
0
        private void UploadPhoto(Member member, String photoCollectionID, String base64StringPhoto, String dateTime, Boolean SnappedFromMobile)
        {
            var byteImage = Convert.FromBase64String(base64StringPhoto);
            var longDateTime = Int64.Parse(dateTime);
            var takenDT = new DateTime(longDateTime);

            Image img = null;

            try
            {
                img = data.Photo.ByteArrayToImage(byteImage);
            }
            catch
            {
                throw new ArgumentException(Resources.Argument_InvalidBase64PhotoString);
            }

            var photoCollection = PhotoCollection.GetPhotoCollectionByWebPhotoCollectionID(photoCollectionID);

            if (photoCollection == null)
            {
                photoCollection = new PhotoCollection()
                {
                    DTCreated = DateTime.Now,
                    Description = Resources.SnapUp_DefaultGalleryDescrpiption,
                    MemberID = member.MemberID,
                    Name = Resources.SnapUp_DefaultGalleryName
                };
                photoCollection.Save();
            }

            if (member.ProfilePhotoResourceFileID == 1 && !data.Photo.MemberHasAnyPhotos(member.MemberID))
                data.Photo.ProcessProfilePhoto(member, img);

            data.Photo.ProcessMemberPhoto(member, photoCollection.PhotoCollectionID, byteImage, takenDT, SnappedFromMobile);
            NotifyPhotoUploaded(member, photoCollection);
        }
コード例 #15
0
 private void NotifyPhotoUploaded(Member member, PhotoCollection photoCollection)
 {
     System.Diagnostics.Debug.Assert(member != null, "member != null");
     var memberAccount = MemberAccount.GetMemberAccountByMemberID(member.MemberID);
     if (MemberAccount.IsTwitterReady(memberAccount))
     {
         if (TwitterService.CanPost(MemberAccountActivity.GetLastActivity(member.MemberID, 1 /* Twitter */, 2 /* PhotoGallery */)))
         {
             TwitterService.NotifyPhotoUploaded(memberAccount.Username, memberAccount.Password, member.WebMemberID, photoCollection.WebPhotoCollectionID);
             MemberAccountActivity.SetLastActivity(member.MemberID, 1 /* Twitter */, 2 /* PhotoGallery */);
         }
     }
 }
コード例 #16
0
        /// <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();

        }
コード例 #17
0
        /// <summary>
        /// Lawrence: added this for the 1st release of social. This method needs to be refactored into data dll.
        /// </summary>
        /// <param name="member"></param>
        /// <param name="ObjectID"></param>
        /// <param name="contentType"></param>
        private static void ContentViewed(Member member, int ObjectID, CommentType contentType)
        {
            if (member != null)
            {
                try
                {
                    DateTime dtNow = DateTime.Now;

                    ContentView contentView = new ContentView();
                    contentView.DTCreated = DateTime.Now;
                    contentView.MemberID = member.MemberID;
                    contentView.ObjectID = ObjectID;
                    contentView.ObjectType = (int)contentType;

                    contentView.SaveWithCheck();
                }
                catch { }
            }
        }
コード例 #18
0
        private static void CreateUserDirectories(Member member)
        {
            var root = OSRegistry.GetDiskUserDirectory() + member.NickName;

            Directory.CreateDirectory(root);
            Directory.CreateDirectory(String.Concat(root, @"\plrge"));
            Directory.CreateDirectory(String.Concat(root, @"\pmed"));
            Directory.CreateDirectory(String.Concat(root, @"\pthmb"));

            Directory.CreateDirectory(String.Concat(root, @"\video"));
            Directory.CreateDirectory(String.Concat(root, @"\vthmb"));

            Directory.CreateDirectory(String.Concat(root, @"\aaflrge"));
            Directory.CreateDirectory(String.Concat(root, @"\aafthmb"));

            Directory.CreateDirectory(String.Concat(root, @"\nslrge"));
            Directory.CreateDirectory(String.Concat(root, @"\nsmed"));
            Directory.CreateDirectory(String.Concat(root, @"\nsthmb"));
        }
コード例 #19
0
ファイル: Photo.cs プロジェクト: xuchuansheng/GenXSource
        /// <summary>
        /// Saves the photo file to disk
        /// </summary>
        /// <returns></returns>
        public static bool SaveMemberXML(string XML, Member member)
        {
            string SavePath = OSRegistry.GetDiskUserDirectory() + member.NickName + @"\" + "gallery.xml";

            try
            {
                StreamWriter writer = new StreamWriter(SavePath, false);
                writer.Write(XML);
                writer.Flush();
                writer.Close();
            }
            catch (Exception)
            {
                throw new IOException(String.Format(Properties.Resources.IO_WriteFileErrorToSavePath, SavePath));
            }

            return true;
        }
コード例 #20
0
ファイル: Photo.cs プロジェクト: xuchuansheng/GenXSource
        /// <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();
        }
コード例 #21
0
ファイル: Friend.cs プロジェクト: xuchuansheng/GenXSource
        public static void UnFriend(Member Member, Member friend)
        {
            Database db = DatabaseFactory.CreateDatabase();
            DbCommand dbCommand = db.GetStoredProcCommand("HG_UnFriend");
            db.AddInParameter(dbCommand, "MemberID", DbType.Int32, Member.MemberID);
            db.AddInParameter(dbCommand, "FriendMemberID", DbType.Int32, friend.MemberID);

            try
            {
                db.ExecuteNonQuery(dbCommand);
            }
            catch(Exception ex)
            {
                throw ex;
            }

        }
コード例 #22
0
        /// <summary>
        /// Creates a FriendRequest from an imported contact
        /// </summary>
        /// <param name="NewMember"></param>
        /// <param name="ContactImportID"></param>
        public static void CreateFriendRequestsFromImport(Member NewMember, int ContactImportID)
        {

            Database db = DatabaseFactory.CreateDatabase();
            DbCommand dbCommand = db.GetStoredProcCommand("HG_CreateFriendRequestsFromImport");

            db.AddInParameter(dbCommand, "NewMemberID", DbType.Int32, NewMember.MemberID);
            db.AddInParameter(dbCommand, "ContactImportID", DbType.Int32, ContactImportID);
            db.AddInParameter(dbCommand, "Email", DbType.String, NewMember.Email);

            try
            {
                db.ExecuteNonQuery(dbCommand);
            }
            catch (Exception ex)
            {

            }
        }
コード例 #23
0
ファイル: Referral.cs プロジェクト: xuchuansheng/GenXSource
        /// <summary>
        /// once the user has signed up, this methods determines if the user is a referal and updates the Referral table
        /// </summary>
        /// <param name="context"></param>
        /// <param name="MemberID"></param>
        public static string  GetEmailReferrer(HttpContext context)
        {
            try
            {
                Referral Refer = (Referral)context.Session["Referral"];

                if (Refer != null)
                {
                    ContactImport contactImport = new ContactImport(Refer.ContactImportID);

                    if (contactImport != null)
                    {
                        Member ReferrerMember = new Member(contactImport.ImporterMemberID);

                        return ReferrerMember.Email;
                    }

                }
            }
            catch { }

            return string.Empty;
        }
コード例 #24
0
ファイル: Video.cs プロジェクト: xuchuansheng/GenXSource
        // <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();

        }
コード例 #25
0
ファイル: Video.cs プロジェクト: xuchuansheng/GenXSource
        /// <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();

        }
コード例 #26
0
ファイル: Member.cs プロジェクト: xuchuansheng/GenXSource
        /// <summary>
        /// Takes an prepopulated IDataReader and creates an array of Members
        /// </summary>
        public static List<Member> PopulateMemberWithJoin(IDataReader dr)
        {
            ColumnFieldList list = new ColumnFieldList(dr);

            List<Member> arr = new List<Member>();

            Member obj;

            while (dr.Read())
            {
                obj = new Member();
                obj._memberID = (int)dr["MemberID"];
                obj._webMemberID = (string)dr["WebMemberID"];
                obj._adminStatusID = (int)dr["AdminStatusID"];
                obj._nickName = (string)dr["NickName"];
                obj._channelID = (int)dr["ChannelID"];
                obj._password = (string)dr["Password"];
                obj._email = (string)dr["Email"];
                obj._gender = (int)dr["Gender"];
                obj._firstName = (string)dr["FirstName"];
                obj._lastName = (string)dr["LastName"];
                obj._profilePhotoResourceFileID = (int)dr["ProfilePhotoResourceFileID"];
                obj._dOB = (DateTime)dr["DOB"];
                obj._iSOCountry = (string)dr["ISOCountry"];
                if (list.IsColumnPresent("ISOCode")) { obj.ISOCode = (string)dr["ISOCode"]; }
                obj._zipPostcode = (string)dr["ZipPostcode"];
                obj._createdDT = (DateTime)dr["CreatedDT"];

                //obj._accountType = (int)dr["AccountType"];
                if (list.IsColumnPresent("AccountType")) { obj._accountType = (int)dr["AccountType"]; }

                if (list.IsColumnPresent("DTOnline")) { obj.LastOnline = (DateTime)dr["DTOnline"]; }
                if (list.IsColumnPresent("IsFriend")) { obj.IsFriend = (bool)dr["IsFriend"]; }

                obj.DefaultPhoto = new ResourceFile();
                if (list.IsColumnPresent("DefaultPhotoResourceFileID")) { obj.DefaultPhoto.ResourceFileID = (int)dr["DefaultPhotoResourceFileID"]; }
                if (list.IsColumnPresent("DefaultPhotoWebResourceFileID")) { obj.DefaultPhoto.WebResourceFileID = (string)dr["DefaultPhotoWebResourceFileID"]; }
                if (list.IsColumnPresent("DefaultPhotoResourceType")) { obj.DefaultPhoto.ResourceType = (int)dr["DefaultPhotoResourceType"]; }
                if (list.IsColumnPresent("DefaultPhotoStorageLocation")) { obj.DefaultPhoto.StorageLocation = (int)dr["DefaultPhotoStorageLocation"]; }
                if (list.IsColumnPresent("DefaultPhotoServer")) { obj.DefaultPhoto.Server = (int)dr["DefaultPhotoServer"]; }
                if (list.IsColumnPresent("DefaultPhotoPath")) { obj.DefaultPhoto.Path = (string)dr["DefaultPhotoPath"]; }
                if (list.IsColumnPresent("DefaultPhotoFileName")) { obj.DefaultPhoto.FileName = (string)dr["DefaultPhotoFileName"]; }
                if (list.IsColumnPresent("DefaultPhotoCreatedDT")) { obj.DefaultPhoto.CreatedDT = (DateTime)dr["DefaultPhotoCreatedDT"]; }


                if (list.IsColumnPresent("DeviceID"))
                {
                    obj.device = new List<Device>();
                    obj.device.Add(new Device());
                }
                if (list.IsColumnPresent("DeviceID")) { obj.device[0].DeviceID = (int)dr["DeviceID"]; }
                if (list.IsColumnPresent("DeviceTagID")) { obj.device[0].DeviceTagID = (string)dr["DeviceTagID"]; }
                if (list.IsColumnPresent("DeviceMemberID")) { obj.device[0].MemberID = (int)dr["DeviceMemberID"]; }
                if (list.IsColumnPresent("DevicePrivateEncryptionKey")) { obj.device[0].PrivateEncryptionKey = (string)dr["DevicePrivateEncryptionKey"]; }
                if (list.IsColumnPresent("DeviceCreatedDT")) { obj.device[0].CreatedDT = (DateTime)dr["DeviceCreatedDT"]; }

                arr.Add(obj);
            }

            dr.Close();

            return arr;
        }
コード例 #27
0
        private static data.Comment CreateComment(WebComment comment, Member member)
        {
            var inReplyToCommentID = comment.InReplyToCommentID;
            var inReplyToComment = inReplyToCommentID == 0 ? null : data.Comment.GetComment(inReplyToCommentID);

            var result = new data.Comment()
            {
                ObjectID = comment.ObjectID,
                MemberIDFrom = member.MemberID,
                Text = HttpUtility.HtmlEncode(comment.Text),
                DTCreated = DateTime.Now,
                IsDeleted = false,
                CommentType = comment.CommentType,
                WebCommentID = UniqueID.NewWebID(),
                Path = inReplyToComment == null ? "/" : String.Format("/{0}/", inReplyToComment.InReplyToCommentID),
                SentFromMobile = 1
            };
            result.Save();

            result.ThreadNo = inReplyToComment == null ? result.CommentID : inReplyToComment.ThreadNo;
            result.InReplyToCommentID = inReplyToCommentID == 0 ? result.CommentID : inReplyToCommentID;
            result.Save();

            try
            {
                IncrementCommentCount((CommentType)comment.CommentType, comment.ObjectID);
            }
            catch { }

            return result;
        }
コード例 #28
0
        /// <summary>
        /// Takes an prepopulated IDataReader and creates an array of Members
        /// </summary>
        public static List<Member> PopulateObject(IDataReader dr)
        {
            ColumnFieldList list = new ColumnFieldList(dr);

            List<Member> arr = new List<Member>();

            Member obj;

            while (dr.Read())
            {
                obj = new Member();
                if (list.IsColumnPresent("MemberID")) { obj._memberID = (int)dr["MemberID"]; }
                if (list.IsColumnPresent("WebMemberID")) { obj._webMemberID = (string)dr["WebMemberID"]; }
                if (list.IsColumnPresent("AdminStatusID")) { obj._adminStatusID = (int)dr["AdminStatusID"]; }
                if (list.IsColumnPresent("NickName")) { obj._nickName = (string)dr["NickName"]; }
                if (list.IsColumnPresent("ChannelID")) { obj._channelID = (int)dr["ChannelID"]; }
                if (list.IsColumnPresent("Password")) { obj._password = (string)dr["Password"]; }
                if (list.IsColumnPresent("Email")) { obj._email = (string)dr["Email"]; }
                if (list.IsColumnPresent("Gender")) { obj._gender = (int)dr["Gender"]; }
                if (list.IsColumnPresent("FirstName")) { obj._firstName = (string)dr["FirstName"]; }
                if (list.IsColumnPresent("LastName")) { obj._lastName = (string)dr["LastName"]; }
                if (list.IsColumnPresent("ProfilePhotoResourceFileID")) { obj._profilePhotoResourceFileID = (int)dr["ProfilePhotoResourceFileID"]; }
                if (list.IsColumnPresent("DOB")) { obj._dOB = (DateTime)dr["DOB"]; }
                if (list.IsColumnPresent("ISOCountry")) { obj._iSOCountry = (string)dr["ISOCountry"]; }
                if (list.IsColumnPresent("AccountType")) { obj._accountType = (int)dr["AccountType"]; }
                if (list.IsColumnPresent("ZipPostcode")) { obj._zipPostcode = (string)dr["ZipPostcode"]; }
                if (list.IsColumnPresent("PhoneNumber")) { obj._phoneNumber = (string)dr["PhoneNumber"]; }
                if (list.IsColumnPresent("MobilePhoneID")) { obj._mobilePhoneID = (int)dr["MobilePhoneID"]; }
                if (list.IsColumnPresent("IPLocationID")) { obj._iPLocationID = (int)dr["IPLocationID"]; }
                if (list.IsColumnPresent("CreatedDT")) { obj._createdDT = (DateTime)dr["CreatedDT"]; }

                arr.Add(obj);
            }

            dr.Close();

            return arr;
        }
コード例 #29
0
ファイル: Photo.cs プロジェクト: xuchuansheng/GenXSource
        public static string MemberXMLGallery(int MemberID)
        {
            Member member = new Member(MemberID);

            string ThumbPath = "user/" + member.NickName + "/" + "pthmb/";
            string LargePath = "user/" + member.NickName + "/" + "plrge/";

            List<PhotoCollection> collections = member.PhotoCollection;

            StringBuilder sb = new StringBuilder();

            sb.Append(@"<?xml version=""1.0"" encoding=""UTF-8""?>");
            sb.Append(@"<gallery>");

            for (int i = 0; i < collections.Count; i++)
            {
                Photo[] photos = Photo.GetPhotoByPhotoCollectionIDWithJoin(collections[i].PhotoCollectionID);

                if (photos.Length > 0)
                {
                    object[] AlbumParameters = new object[6];
                    AlbumParameters[0] = collections[i].WebPhotoCollectionID;
                    AlbumParameters[1] = ParallelServer.Get(photos[0].ThumbnailResourceFile.FullyQualifiedURL) + photos[0].ThumbnailResourceFile.FullyQualifiedURL;
                    AlbumParameters[2] = ParallelServer.Get(LargePath) + LargePath;
                    AlbumParameters[3] = ParallelServer.Get(ThumbPath) + ThumbPath;
                    AlbumParameters[4] = collections[i].Name;
                    AlbumParameters[5] = collections[i].Description;
                    //AlbumParameters[6] = collections[i].Description;



                    //gallery title
                    sb.AppendFormat(@"  <album id=""{0}"" title=""{4}"" tn=""{1}"" lgPath=""{2}"" tnPath=""{3}"" description=""{5}"" >", AlbumParameters);

                    for (int j = 0; j < photos.Length; j++)
                    {
                        object[] PhotoParameters = new object[2];
                        PhotoParameters[0] = photos[j].PhotoResourceFile.FileName;
                        PhotoParameters[1] = string.Empty;

                        sb.AppendFormat(@"      <img src=""{0}"" caption=""{1}"" />", PhotoParameters);
                    }

                    sb.Append(@"    </album>");
                }
            }

            sb.Append(@"</gallery>");

            return sb.ToString();
        }
コード例 #30
0
        private static void MemberSetUp(Member member)
        {
            CreateUserDirectories(member);

            var defaultGallery = new PhotoCollection()
            {
                WebPhotoCollectionID = UniqueID.NewWebID(),
                MemberID = member.MemberID,
                DTCreated = DateTime.Now,
                Name = member.NickName + "'s Gallery",
                Description = "My First Gallery!"
            };
            defaultGallery.Save();

            string StatusText = "New to next2Friends!";

            /* Create a new member profile for the member. */
            var profile = new MemberProfile()
            {
                MemberID = member.MemberID,
                DTLastUpdated = DateTime.Now,
                DefaultPhotoCollectionID = defaultGallery.PhotoCollectionID,
                TagLine = StatusText
            };
            profile.Save();

            MemberStatusText.UpdateStatusText(member.MemberID, StatusText);

            var message = new Message()
            {
                Body = "Welcome to Next2Friends",
                WebMessageID = UniqueID.NewWebID(),
                MemberIDFrom = 31,
                MemberIDTo = member.MemberID,
                DTCreated = DateTime.Now
            };
            message.Save();
            message.InReplyToID = message.MessageID;
            message.Save();

            /* Create the default settings for the member. */
            var settings = new MemberSettings()
            {
                NotifyNewPhotoComment = true,
                NotifyNewProfileComment = true,
                NotifyNewVideoComment = true,
                NotifyOnAAFComment = true,
                NotifyOnFriendRequest = true,
                NotifyOnNewMessage = true,
                NotifyOnNewsLetter = true,
                NotifyOnSubscriberEvent = true,
                MemberID = member.MemberID
            };
            settings.Save();

            var matchProfile = new MatchProfile()
            {
                MemberID = member.MemberID
            };
            matchProfile.Save();

            var device = new Device()
            {
                MemberID = member.MemberID,
                PrivateEncryptionKey = UniqueID.NewEncryptionKey(),
                CreatedDT = DateTime.Now,
                DeviceTagID = Guid.NewGuid().ToString()
            };
            device.Save();

            // Lawrence: Added block to register default friends and profile views
            try
            {
                // Add Lawrence as Auto Friend
                Friend.AddFriend(1, member.MemberID);
                // Add Anthony as Auto Friend
                Friend.AddFriend(3, member.MemberID);
                // Add Hans as Auto Friend
                Friend.AddFriend(24, member.MemberID);
                // Add Becca as Auto Friend
                Friend.AddFriend(30, member.MemberID);

                ContentViewed(new Member(1), member.MemberID, CommentType.Member);
                ContentViewed(new Member(3), member.MemberID, CommentType.Member);
                ContentViewed(new Member(24), member.MemberID, CommentType.Member);
                ContentViewed(new Member(30), member.MemberID, CommentType.Member);
            }
            catch { }

            SetOnlineNow(member.MemberID);
        }
コード例 #31
0
ファイル: Photo.cs プロジェクト: xuchuansheng/GenXSource
        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();
        }
コード例 #32
0
ファイル: Photo.cs プロジェクト: xuchuansheng/GenXSource
        public static string ProcessMemberPhoto(Member member, int PhotoCollectionID, Image image, DateTime TakenDT, bool SnappedFromMobile)
        {
            string GlobalWebID = UniqueID.NewWebID();
            string FileName = GlobalWebID + @".jpg";

            Bitmap bmp = (Bitmap)image;

            try
            {
                EXIFextractor exif = new EXIFextractor(ref bmp, string.Empty);

                if (exif.DTTaken.Year != 1900)
                {
                    TakenDT = exif.DTTaken;
                }

            }
            catch { }


            Photo photo = new Photo();
            photo.Active = true;
            photo.Mobile = SnappedFromMobile;
            photo.MemberID = member.MemberID;
            photo.WebPhotoID = GlobalWebID;
            photo.PhotoCollectionID = PhotoCollectionID;
            photo.TakenDT = TakenDT;
            photo.CreatedDT = DateTime.Now;

            // create the large photo
            // just store the large image.. dont make a resource record
            System.Drawing.Image MainImage = Photo.ResizeTo800x600(image);
            string Savepath = member.NickName + @"\" + "plrge" + @"\" + FileName;
            Photo.SaveToDiskNoCompression(MainImage, Savepath);

            //create the medium
            photo.PhotoResourceFile = new ResourceFile();
            photo.PhotoResourceFile.WebResourceFileID = GlobalWebID;
            photo.PhotoResourceFile.ResourceType = (int)ResourceFileType.PhotoLarge;
            photo.PhotoResourceFile.Path = member.NickName + "/" + "pmed" + "/";
            photo.PhotoResourceFile.FileName = FileName;
            photo.PhotoResourceFile.Save();
            System.Drawing.Image MediumImage = Photo.Resize480x480(MainImage);
            Photo.SaveToDisk(MediumImage, photo.PhotoResourceFile.SavePath);

            //create the thumbnail
            photo.ThumbnailResourceFile = new ResourceFile();
            photo.ThumbnailResourceFile.WebResourceFileID = GlobalWebID;
            photo.ThumbnailResourceFile.ResourceType = (int)ResourceFileType.PhotoThumbnail;
            photo.ThumbnailResourceFile.Path = member.NickName + "/" + "pthmb" + "/";
            photo.ThumbnailResourceFile.FileName = FileName;
            photo.ThumbnailResourceFile.Save();


            System.Drawing.Image ThumbnailImage = Photo.ScaledCropTo121x91(MediumImage);


            Photo.SaveToDisk(ThumbnailImage, photo.ThumbnailResourceFile.SavePath);

            // attached the resource ids to the photos
            photo.ThumbnailResourceFileID = photo.ThumbnailResourceFile.ResourceFileID;
            photo.PhotoResourceFileID = photo.PhotoResourceFile.ResourceFileID;

            photo.Save();

            // update the number of photos
            MemberProfile memberProfile = member.MemberProfile[0];
            memberProfile.NumberOfPhotos++;
            memberProfile.Save();

            return photo.WebPhotoID;
        }
コード例 #33
0
 protected void Page_Load(object sender, EventArgs e)
 {
     member = (Member)Session["Member"];
 }