I am developing a project (using a three-tier approach) in which I use LINQ TO SQL ... I want to update the user ...
but I ran into some problem. it does not give me any error, but also does not update detailed user information
here is the sequence of programs;
in UpdateProfile.aspx
String currentUser = Session["BMUser"].ToString();
String displayName = txtDisplayName.Text;
String username = currentUser;
String emailAddress = txtEmailAddress.Text;
String secretQuestion = txtSecretQuestion.Text;
String secretAnswer = txtSecretAnswer.Text;
if (UserManager.UpdateProfile(username, displayName, emailAddress, secretQuestion, secretAnswer))
{
lblStatus.Text = "Profile Updated";
}
else
lblStatus.Text = "Unable to Update Profile";
UserManager - class BLL
public class UserManager
{
public static bool UpdateProfile(String username, String displayName, String emailAddress, String secretQuestion, String secretAnswer)
{
BM_User user = UserCatalog.GetUserByName(username);
if (user != null)
{
user.DisplayName = displayName;
user.EmailAddress = emailAddress;
user.SecretQuestion = secretQuestion;
user.SecretAnswer = secretAnswer;
if (UserManagerDAO.UpdateUser(user, false))
{
return true;
}
else
return false;
}
else
return false;
}
}
and finally UserManagerDAO
public class UserManagerDAO
{
public static bool UpdateUser(BM_User user, bool changeLoginDateTime)
{
BugManDataContext db = new BugManDataContext();
if (changeLoginDateTime == true)
user.LastLoginDate = DateTime.Now;
db.SubmitChanges();
return true;
}
}
after that, when I receive the item from this updated user. this shows me the previous details. means it is not updating user details with new ...
kindly solve this problem
source
share