protected void btnUpdateAccountStatus_Click(object sender, EventArgs e) { BLL.Member member = new BLL.Member(); MembershipUser user = Membership.GetUser(MemberUserName); if (user != null) { member.GetMemberByUserId(new Guid(user.ProviderUserKey.ToString())); if (drpAccountStatus.SelectedValue != member.s_RowStatusID) { member.RowStatusID = Convert.ToByte(drpAccountStatus.SelectedValue); member.Save(); } } }
protected void btnChangeQuestion_Click(object sender, EventArgs e) { MembershipUser user = Membership.GetUser(MemberUserName); if (user != null) { BLL.Member member = new BLL.Member(); member.GetMemberByUserId(new Guid(user.ProviderUserKey.ToString())); if (user.ChangePasswordQuestionAndAnswer(user.GetPassword(member.Answer), drpQuestions.SelectedValue, txtQuestionAnswer.Text)) { member.Answer = txtQuestionAnswer.Text; member.Save(); BindAccountInfo(); } } }
public bool RegisterMember(string userName, string password, string email, string question, string questionAnswer, out MembershipCreateStatus createStatus) { MembershipUser objUser = Membership.CreateUser(userName, password, email, question, questionAnswer, true, out createStatus); if (createStatus == MembershipCreateStatus.Success) { BLL.Member member = new BLL.Member(); member.AddNew(); member.Answer = questionAnswer; member.UserID = new Guid(objUser.ProviderUserKey.ToString()); member.Name = objUser.UserName; member.IsOnLine = true; member.Status = 1; member.Save(); return true; } return false; }
protected void btnUpdateUserName_Click(object sender, EventArgs e) { TextBox txtNewUserName = (TextBox)dtlAccountInfo.FindControl("txtUsername"); BLL.Member member = new BLL.Member(); if (member.GetMemberByUserName(MemberUserName)) { member.Name = txtNewUserName.Text; } BLL.MembershipBLL membership = new BLL.MembershipBLL(); string msg; if (membership.ChangeUsername(MemberUserName, txtNewUserName.Text, Membership.ApplicationName, out msg)) { member.Save(); Response.Redirect(Request.Url.AbsolutePath + "?search=" + txtNewUserName.Text); } else { txtNewUserName.Text = MemberUserName; lblErrorMessage.Text = msg; } }
protected void uiGridViewMembers_RowCommand(object sender, GridViewCommandEventArgs e) { int memberid = Convert.ToInt32(e.CommandArgument.ToString()); if (e.CommandName == "DeleteMember") { BLL.Member mem = new BLL.Member(); mem.LoadByPrimaryKey(memberid); mem.MarkAsDeleted(); string name = mem.UserName; mem.Save(); Membership.DeleteUser(name); BindMembers(); } else if (e.CommandName == "DeleteTypes") { BLL.MemberType types = new BLL.MemberType(); types.Where.MemberID.Value = memberid; types.Where.MemberID.Operator = MyGeneration.dOOdads.WhereParameter.Operand.Equal; types.Query.Load(); for (int i = 0; i < types.RowCount; i++) { types.MarkAsDeleted(); types.MoveNext(); } types.Save(); } else if (e.CommandName == "DeleteProfileLike") { BLL.ProfileLike Ilike = new BLL.ProfileLike(); BLL.ProfileLike Iliked = new BLL.ProfileLike(); Ilike.Where.MemberID.Value = memberid; Ilike.Where.MemberID.Operator = MyGeneration.dOOdads.WhereParameter.Operand.Equal; Ilike.Query.Load(); Iliked.Where.ProfileMemberID.Value = memberid; Iliked.Where.ProfileMemberID.Operator = MyGeneration.dOOdads.WhereParameter.Operand.Equal; Iliked.Query.Load(); for (int i = 0; i < Ilike.RowCount; i++) { Ilike.MarkAsDeleted(); Ilike.MoveNext(); } for (int i = 0; i < Iliked.RowCount; i++) { Iliked.MarkAsDeleted(); Iliked.MoveNext(); } Ilike.Save(); Iliked.Save(); } else if (e.CommandName == "DeleteMsgFolder") { BLL.MessageFolder msgs = new BLL.MessageFolder(); msgs.Where.MemberID.Value = memberid; msgs.Where.MemberID.Operator = MyGeneration.dOOdads.WhereParameter.Operand.Equal; msgs.Query.Load(); for (int i = 0; i < msgs.RowCount; i++) { msgs.MarkAsDeleted(); msgs.MoveNext(); } msgs.Save(); } else if (e.CommandName == "DeleteSettings") { BLL.MemberSetting settings = new BLL.MemberSetting(); settings.Where.MemberID.Value = memberid; settings.Where.MemberID.Operator = MyGeneration.dOOdads.WhereParameter.Operand.Equal; settings.Query.Load(); for (int i = 0; i < settings.RowCount; i++) { settings.MarkAsDeleted(); settings.MoveNext(); } settings.Save(); } else if (e.CommandName == "DeletePics") { BLL.MemberPic pics = new BLL.MemberPic(); pics.Where.MemberID.Value = memberid; pics.Where.MemberID.Operator = MyGeneration.dOOdads.WhereParameter.Operand.Equal; pics.Query.Load(); for (int i = 0; i < pics.RowCount; i++) { pics.MarkAsDeleted(); pics.MoveNext(); } pics.Save(); } else if (e.CommandName == "DeleteMessages") { BLL.Message msgs = new BLL.Message(); msgs.Where.SenderID.Value = memberid; msgs.Where.SenderID.Operator = MyGeneration.dOOdads.WhereParameter.Operand.Equal; msgs.Query.Load(); for (int i = 0; i < msgs.RowCount; i++) { msgs.MarkAsDeleted(); msgs.MoveNext(); } msgs.Save(); } else if (e.CommandName == "DeleteLog") { BLL.MemberLog msgs = new BLL.MemberLog(); msgs.Where.MemberID.Value = memberid; msgs.Where.MemberID.Operator = MyGeneration.dOOdads.WhereParameter.Operand.Equal; msgs.Query.Load(); for (int i = 0; i < msgs.RowCount; i++) { msgs.MarkAsDeleted(); msgs.MoveNext(); } msgs.Save(); BLL.MemberLog related = new BLL.MemberLog(); related.Where.RelatedMemberID.Value = memberid; related.Where.RelatedMemberID.Operator = MyGeneration.dOOdads.WhereParameter.Operand.Equal; related.Query.Load(); for (int i = 0; i < related.RowCount; i++) { related.MarkAsDeleted(); related.MoveNext(); } related.Save(); } else if (e.CommandName == "DeleteGifts") { BLL.MemberGift gifts = new BLL.MemberGift(); gifts.Where.MemberID.Value = memberid; gifts.Where.MemberID.Operator = MyGeneration.dOOdads.WhereParameter.Operand.Equal; gifts.Query.Load(); for (int i = 0; i < gifts.RowCount; i++) { gifts.MarkAsDeleted(); gifts.MoveNext(); } gifts.Save(); BLL.MemberGift giftsm = new BLL.MemberGift(); giftsm.Where.SenderID.Value = memberid; giftsm.Where.SenderID.Operator = MyGeneration.dOOdads.WhereParameter.Operand.Equal; giftsm.Query.Load(); for (int i = 0; i < giftsm.RowCount; i++) { giftsm.MarkAsDeleted(); giftsm.MoveNext(); } giftsm.Save(); } else if (e.CommandName == "DeleteFriends") { BLL.MemberFriend friend = new BLL.MemberFriend(); friend.Where.MemberID.Value = memberid; friend.Where.MemberID.Operator = MyGeneration.dOOdads.WhereParameter.Operand.Equal; friend.Query.Load(); for (int i = 0; i < friend.RowCount; i++) { friend.MarkAsDeleted(); friend.MoveNext(); } friend.Save(); BLL.MemberFriend mem = new BLL.MemberFriend(); mem.Where.MemberFriendID.Value = memberid; mem.Where.MemberFriendID.Operator = MyGeneration.dOOdads.WhereParameter.Operand.Equal; mem.Query.Load(); for (int i = 0; i < mem.RowCount; i++) { mem.MarkAsDeleted(); mem.MoveNext(); } mem.Save(); } }