public void InsertFishermanUser(FishermanUser fishermanUser)
 {
     if ((fishermanUser.EntityState != EntityState.Detached))
     {
         this.ObjectContext.ObjectStateManager.ChangeObjectState(fishermanUser, EntityState.Added);
     }
     else
     {
         this.ObjectContext.FishermanUsers.AddObject(fishermanUser);
     }
 }
 public void DeleteFishermanUser(FishermanUser fishermanUser)
 {
     if ((fishermanUser.EntityState != EntityState.Detached))
     {
         this.ObjectContext.ObjectStateManager.ChangeObjectState(fishermanUser, EntityState.Deleted);
     }
     else
     {
         this.ObjectContext.FishermanUsers.Attach(fishermanUser);
         this.ObjectContext.FishermanUsers.DeleteObject(fishermanUser);
     }
 }
        public void OnUserLoaded(object sender, EventArgs e)
        {
            LoadOperation lop = sender as LoadOperation;
            if (lop.Error != null)
            {
                throw lop.Error;
            }

            FishermanUser currentUser = lop.Entities.FirstOrDefault() as FishermanUser;
            this.User = currentUser;
        }
 /// <summary>
 /// Create a new FishermanUser object.
 /// </summary>
 /// <param name="fishermanUserId">Initial value of the FishermanUserId property.</param>
 public static FishermanUser CreateFishermanUser(global::System.Int32 fishermanUserId)
 {
     FishermanUser fishermanUser = new FishermanUser();
     fishermanUser.FishermanUserId = fishermanUserId;
     return fishermanUser;
 }
 /// <summary>
 /// Deprecated Method for adding a new object to the FishermanUsers EntitySet. Consider using the .Add method of the associated ObjectSet&lt;T&gt; property instead.
 /// </summary>
 public void AddToFishermanUsers(FishermanUser fishermanUser)
 {
     base.AddObject("FishermanUsers", fishermanUser);
 }
 private bool FilterUser(FishermanUser entity)
 {
     return (entity.FishermanUserId == this.UserId);
 }
 public void UpdateFishermanUser(FishermanUser currentFishermanUser)
 {
     this.ObjectContext.FishermanUsers.AttachAsModified(currentFishermanUser, this.ChangeSet.GetOriginal(currentFishermanUser));
 }
 public UpdatedFishermanUserMessage(FishermanUser fishermanUser)
 {
     this.FishermanUser = fishermanUser;
 }
 public LaunchNewFishermanUserMessage(FishermanUser fishermanUser)
 {
     this.FishermanUser = fishermanUser;
 }
 public void Save(FishermanUser fishermanUser, Action<System.ServiceModel.DomainServices.Client.SubmitOperation> submitCallback, object state)
 {
     submitCallback(null);
 }
 public void Save(FishermanUser fishermanUser, Action<SubmitOperation> submitCallback, object state)
 {
     Context.FishermanUsers.Add(fishermanUser);
     if (Context.HasChanges)
     {
         Context.SubmitChanges(submitCallback, state);
     }
 }
        public CreateUserStatus CreateUser(RegistrationData user,
            [Required(ErrorMessageResourceName = "ValidationErrorRequiredField", ErrorMessageResourceType = typeof(ValidationErrorResources))]
            [RegularExpression("^.*[^a-zA-Z0-9].*$", ErrorMessageResourceName = "ValidationErrorBadPasswordStrength", ErrorMessageResourceType = typeof(ValidationErrorResources))]
            [StringLength(50, MinimumLength = 7, ErrorMessageResourceName = "ValidationErrorBadPasswordLength", ErrorMessageResourceType = typeof(ValidationErrorResources))]
            string password)
        {
            if (user == null)
            {
                throw new ArgumentNullException("user");
            }

            // Run this BEFORE creating the user to make sure roles are enabled and the default role is available.
            //
            // If there is a problem with the role manager, it is better to fail now than to fail after the user is created.
            if (!Roles.RoleExists(UserRegistrationService.DefaultRole))
            {
                Roles.CreateRole(UserRegistrationService.DefaultRole);
            }

            // NOTE: ASP.NET by default uses SQL Server Express to create the user database.
            // CreateUser will fail if you do not have SQL Server Express installed.
            MembershipCreateStatus createStatus;
            Membership.CreateUser(user.UserName, password, user.Email, user.Question, user.Answer, true, null, out createStatus);

            if (createStatus != MembershipCreateStatus.Success)
            {
                return UserRegistrationService.ConvertStatus(createStatus);
            }

            // Assign the user to the default role.
            // This will fail if role management is disabled.
            Roles.AddUserToRole(user.UserName, UserRegistrationService.DefaultRole);

            // Set the friendly name (profile setting).
            // This will fail if the web.config is configured incorrectly.
            ProfileBase profile = ProfileBase.Create(user.UserName, true);
            profile.SetPropertyValue("FriendlyName", user.FriendlyName);
            profile.Save();

            //register the fishermanUser
            FishingPointEntities context = new FishingPointEntities();
            FishermanUser newFishermanUser = new FishermanUser();
            newFishermanUser.Username = user.UserName;
            newFishermanUser.Name = user.FriendlyName;
            context.FishermanUsers.AddObject(newFishermanUser);
            context.SaveChanges();

            return CreateUserStatus.Success;
        }