예제 #1
0
        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();
        }
예제 #2
0
        /// <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();
        }
예제 #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
    protected void btnSignup2_Click(object sender, EventArgs e)
    {
        bool SignUpOkay = true;

        if (txtFirstName.Text.Trim() == string.Empty)
        {
            SignUpOkay = false;
            errTxtFirstName.Text = "<span class='formerror_msg'>No first name</span>";
        }
        else
        {
            errTxtFirstName.Text = string.Empty;
        }

        if (txtLastName.Text.Trim() == string.Empty)
        {
            SignUpOkay = false;
            errTxtLastName.Text = "<span class='formerror_msg'>No last name</span>";
        }
        else
        {
            errTxtLastName.Text = string.Empty;
        }

        if (txtPassword.Text == string.Empty)
        {
            SignUpOkay = false;
            errTxtPassword.Text = "<span class='formerror_msg'>No password</span>";
        }
        else if (txtPassword.Text != txtConfirm.Text)
        {
            SignUpOkay = false;
            errTxtPassword.Text = "<span class='formerror_msg'>Passwords do no match</span>";
        }
        else if (!RegexPatterns.TestPassword(txtPassword.Text))
        {
            SignUpOkay = false;
            errTxtPassword.Text = "minimum length 7 characters";
        }
        else
        {
            errTxtPassword.Text = string.Empty;
        }

        if (!cbTOS.Checked)
        {
            SignUpOkay = false;
            errChbTOS.Text = "<span class='formerror_msg'>You must agree to the tos</span>";
        }
        else
        {
            errChbTOS.Text = string.Empty;
        }

        if (SignUpOkay)
        {
            NewMember = (Member)Session["Member"];

            CurrentStage = MobileSignupStage.Complete;

            Database db = DatabaseFactory.CreateDatabase();
            DbConnection conn = db.CreateConnection();
            DbTransaction Transaction = null;

            try
            {
                conn.Open();
                Transaction = conn.BeginTransaction();

                NewMember.FirstName = txtFirstName.Text;
                NewMember.LastName = txtLastName.Text;


                NewMember.AccountType = 0;
                NewMember.Password = txtPassword.Text;

                NewMember.ProfilePhotoResourceFileID = 1;
                NewMember.WebMemberID = Next2Friends.Misc.UniqueID.NewWebID();
                NewMember.CreatedDT = DateTime.Now;
                NewMember.Save(db);

                // Ceate the business Account
                //if (rbBusiness.Checked)
                //{
                //    Business business = new Business();
                //    business.MemberID = NewMember.MemberID;
                //    business.CompanyName = txtCompanyName.Text;
                //    business.IndustrySector = drpIndustrySector.SelectedValue;
                //    business.YearFounded = Int32.Parse(drpYearFounded.SelectedValue);
                //    business.CompanySize = drpCompanySize.Text;
                //    business.IndustrySector = drpIndustrySector.SelectedValue;
                //    business.Save(db);

                //    IMSPlan imsPlan = new IMSPlan();
                //    imsPlan.BusinessID = business.BusinessID;
                //    imsPlan.Save(db);
                //}


                //ResourceFile.CreateUserDirectories(NewMember);
                TEMPCreateUserDirectories(NewMember);

                PhotoCollection DefaultGallery = new PhotoCollection();
                DefaultGallery.WebPhotoCollectionID = Next2Friends.Misc.UniqueID.NewWebID();
                DefaultGallery.MemberID = NewMember.MemberID;
                DefaultGallery.DTCreated = DateTime.Now;
                DefaultGallery.Name = NewMember.NickName + "'s Gallery";
                DefaultGallery.Description = "My First Gallery!";
                DefaultGallery.Save(db);

                // create a new member profile for the meber
                Next2Friends.Data.MemberProfile profile = new Next2Friends.Data.MemberProfile();
                profile.MemberID = NewMember.MemberID;
                profile.DTLastUpdated = DateTime.Now;
                profile.DefaultPhotoCollectionID = DefaultGallery.PhotoCollectionID;
                profile.Save(db);

                Message message = new Message();
                message.Body = "Welcome to Next2Friends";
                message.WebMessageID = Next2Friends.Misc.UniqueID.NewWebID();
                message.MemberIDFrom = 31;
                message.MemberIDTo = NewMember.MemberID;
                message.DTCreated = DateTime.Now;
                message.Save(db);
                message.InReplyToID = message.MessageID;
                message.Save(db);

                // create the default settings for the member
                MemberSettings settings = new MemberSettings();

                settings.NotifyNewPhotoComment = true;
                settings.NotifyNewProfileComment = true;
                settings.NotifyNewVideoComment = true;
                settings.NotifyOnAAFComment = true;
                settings.NotifyOnFriendRequest = true;
                settings.NotifyOnNewMessage = true;
                settings.NotifyOnNewsLetter = true;
                settings.NotifyOnSubscriberEvent = true;

                settings.MemberID = NewMember.MemberID;
                settings.Save(db);

                MatchProfile matchProfile = new MatchProfile();
                matchProfile.MemberID = NewMember.MemberID;
                matchProfile.Save(db);

                Device Device = new Device();
                Device.MemberID = NewMember.MemberID;
                Device.PrivateEncryptionKey = Next2Friends.Misc.UniqueID.NewEncryptionKey();
                Device.CreatedDT = DateTime.Now;
                Device.DeviceTagID = Guid.NewGuid().ToString();
                Device.Save(db);

                OnlineNow now = new OnlineNow();
                now.MemberID = NewMember.MemberID;
                now.DTOnline = DateTime.Now;
                now.Save(db);

                Session["Member"] = NewMember;
                Transaction.Commit();

                Utility.AddToLoggedIn();


            }
            catch (Exception ex)
            {
                Transaction.Rollback();
                throw ex;
            }
            finally
            {
                conn.Close();
            }
        }
        else
        {
            CurrentStage = MobileSignupStage.Stage2;
        }
    }
예제 #5
0
    public LocationResponse SaveLocation(string SearchText, bool IsID)
    {
        LocationResponse Response = new LocationResponse();

        member = (Member)Session["Member"];

        if (member == null)
        {
            Utility.RememberMeLogin();
        }

        if (member != null)
        {
            if (IsID)
            {
                int IPLocationID = Int32.Parse(SearchText);
                IPLocation loc = new IPLocation(IPLocationID);
                member.IPLocationID = loc.IPLocationID;
                Response.LocationText = loc.city;
                member.Save();
                Response.ResponseType = 1;
            }
            else
            {
                List<IPLocation> IPLocationList = IPLocation.SearchLocation(SearchText);
                Response.LocationList = new List<LocationItem>();

                for (int i = 0; i < IPLocationList.Count; i++)
                {
                    LocationItem locationItem = new LocationItem();
                    locationItem.Lcid = IPLocationList[i].IPLocationID.ToString();
                    locationItem.Text = Server.HtmlEncode(LocationResponse.GetFullLocationName(IPLocationList[i]));
                    Response.LocationList.Add(locationItem);
                }

                

                if (Response.LocationList.Count == 0)
                {
                    Response.ResponseType = 0;
                }
                else if (Response.LocationList.Count == 1)
                {
                    Response.ResponseType = 1;
                    Response.LocationText = Server.HtmlEncode(IPLocationList[0].city);
                }
                else if (Response.LocationList.Count > 1)
                {
                    Response.ResponseType = 2;
                }
            }
        }

        return Response;
    }
예제 #6
0
        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();
        }
예제 #7
0
        /// <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();
        }