public void Save()
        {
            using (CarrotCMSDataContext _db = CarrotCMSDataContext.Create()) {
                bool            bNew = false;
                carrot_UserData usr  = CompiledQueries.cqFindUserTblByID(_db, this.UserId);

                if (usr == null)
                {
                    usr         = new carrot_UserData();
                    usr.UserKey = this.UserKey;
                    usr.UserId  = Guid.NewGuid();
                    bNew        = true;
                }

                usr.UserNickName = this.UserNickName;
                usr.FirstName    = this.FirstName;
                usr.LastName     = this.LastName;
                usr.UserBio      = this.UserBio;

                if (bNew)
                {
                    _db.carrot_UserDatas.InsertOnSubmit(usr);
                }

                _db.SubmitChanges();

                this.UserId = usr.UserId;

                //grab fresh copy from DB
                vw_carrot_UserData rc = CompiledQueries.cqFindUserByID(_db, usr.UserId);
                LoadUserData(rc);
            }
        }
        internal UserProfile(membership_User mu, carrot_UserData ud)
        {
            if (mu != null) {
                this.Id = mu.Id;
                this.Email = mu.Email;
                this.EmailConfirmed = mu.EmailConfirmed;
                this.PasswordHash = mu.PasswordHash;
                this.SecurityStamp = mu.SecurityStamp;
                this.PhoneNumber = mu.PhoneNumber;
                this.PhoneNumberConfirmed = mu.PhoneNumberConfirmed;
                this.TwoFactorEnabled = mu.TwoFactorEnabled;
                this.LockoutEndDateUtc = mu.LockoutEndDateUtc;
                this.LockoutEnabled = mu.LockoutEnabled;
                this.AccessFailedCount = mu.AccessFailedCount;
                this.UserName = mu.UserName;

                this.UserId = Guid.Empty;
                this.UserKey = mu.Id;
            }

            if (ud != null) {
                this.UserId = ud.UserId;
                this.UserNickName = ud.UserNickName;
                this.FirstName = ud.FirstName;
                this.LastName = ud.LastName;
                this.UserBio = ud.UserBio;
                this.UserKey = ud.UserKey;
            } else {
                this.UserId = Guid.Empty;
                this.UserKey = String.Empty;
            }
        }
        public void Save()
        {
            using (CarrotCMSDataContext _db = CarrotCMSDataContext.GetDataContext()) {
                bool            bNew = false;
                carrot_UserData usr  = CompiledQueries.cqFindUserTblByID(_db, this.UserId);

                if (usr == null)
                {
                    usr        = new carrot_UserData();
                    usr.UserId = this.UserId;
                    bNew       = true;
                }

                usr.UserNickName = this.UserNickName;
                usr.FirstName    = this.FirstName;
                usr.LastName     = this.LastName;
                usr.UserBio      = this.UserBio;

                if (bNew)
                {
                    _db.carrot_UserDatas.InsertOnSubmit(usr);
                }

                _db.SubmitChanges();

                this.UserId = usr.UserId;
            }
        }
Exemple #4
0
        internal UserProfile(membership_User mu, carrot_UserData ud)
        {
            if (mu != null)
            {
                this.Id                   = mu.Id;
                this.Email                = mu.Email;
                this.EmailConfirmed       = mu.EmailConfirmed;
                this.PasswordHash         = mu.PasswordHash;
                this.SecurityStamp        = mu.SecurityStamp;
                this.PhoneNumber          = mu.PhoneNumber;
                this.PhoneNumberConfirmed = mu.PhoneNumberConfirmed;
                this.TwoFactorEnabled     = mu.TwoFactorEnabled;
                this.LockoutEndDateUtc    = mu.LockoutEndDateUtc;
                this.LockoutEnabled       = mu.LockoutEnabled;
                this.AccessFailedCount    = mu.AccessFailedCount;
                this.UserName             = mu.UserName;

                this.UserId  = Guid.Empty;
                this.UserKey = mu.Id;
            }

            if (ud != null)
            {
                this.UserId       = ud.UserId;
                this.UserNickName = ud.UserNickName;
                this.FirstName    = ud.FirstName;
                this.LastName     = ud.LastName;
                this.UserBio      = ud.UserBio;
                this.UserKey      = ud.UserKey;
            }
            else
            {
                this.UserId  = Guid.Empty;
                this.UserKey = String.Empty;
            }
        }
		public void Save() {
			using (CarrotCMSDataContext _db = CarrotCMSDataContext.Create()) {
				bool bNew = false;
				carrot_UserData usr = CompiledQueries.cqFindUserTblByID(_db, this.UserId);

				if (usr == null) {
					usr = new carrot_UserData();
					usr.UserKey = this.UserKey;
					usr.UserId = Guid.NewGuid();
					bNew = true;
				}

				usr.UserNickName = this.UserNickName;
				usr.FirstName = this.FirstName;
				usr.LastName = this.LastName;
				usr.UserBio = this.UserBio;

				if (bNew) {
					_db.carrot_UserDatas.InsertOnSubmit(usr);
				}

				_db.SubmitChanges();

				this.UserId = usr.UserId;

				//grab fresh copy from DB
				vw_carrot_UserData rc = CompiledQueries.cqFindUserByID(_db, usr.UserId);
				LoadUserData(rc);
			}
		}
        public void Save()
        {
            using (CarrotCMSDataContext _db = CarrotCMSDataContext.GetDataContext()) {
                bool bNew = false;
                carrot_UserData usr = CompiledQueries.cqFindUserTblByID(_db, this.UserId);

                if (usr == null) {
                    usr = new carrot_UserData();
                    usr.UserId = this.UserId;
                    bNew = true;
                }

                usr.UserNickName = this.UserNickName;
                usr.FirstName = this.FirstName;
                usr.LastName = this.LastName;
                usr.UserBio = this.UserBio;

                if (bNew) {
                    _db.carrot_UserDatas.InsertOnSubmit(usr);
                }

                _db.SubmitChanges();

                this.UserId = usr.UserId;
            }
        }