TECHNOLOGIES
FORUMS
JOBS
BOOKS
EVENTS
INTERVIEWS
Live
MORE
LEARN
Training
CAREER
MEMBERS
VIDEOS
NEWS
BLOGS
Sign Up
Login
No unread comment.
View All Comments
No unread message.
View All Messages
No unread notification.
View All Notifications
Answers
Post
An Article
A Blog
A News
A Video
An EBook
An Interview Question
Ask Question
Forums
Monthly Leaders
Forum guidelines
shailesh basawar
NA
17
2.9k
give me discription
Mar 7 2014 6:20 AM
#region Data Mamber
VisitingThereEntities
context = null;
#endregion
#region
Cont'r
public
RpUser
(
)
{
context
= new VisitingThereEntities
(
);
}
#endregion
#region Clean Session Manager
/// <summary>
/// clean session manager after click change password
/// and fore to re-login into the system.
/// </summary>
/// <param name="obj"></param>
public void Logout()
{
SessionManager.userClearSession();
//SessionManager.clearSession();
SessionManager.userid = 0;
SessionManager.userEmail = null;
SessionManager.userName = null;
SessionManager.userType = null;
}
#endregion
#region Set Session Manager
/// <summary>
/// set session Manager details after login.
/// </summary>
private void SetSessionManager(User obj)
{
SessionManager.userid = obj.UserId;
SessionManager.userEmail = obj.EmailId;
SessionManager.userName = obj.FirstName;
SessionManager.userType = obj.Type;
}
#endregion
#region Login
public UserViewModel Login(string emailId, string password)
{
var obj = context.Users.FirstOrDefault(u => u.EmailId == emailId && u.Password == password);
if (obj != null)
{
//UserViewModel data = new UserViewModel()
UserViewModel data = new UserViewModel()
{
EmailId = obj.EmailId,
FirstName = obj.FirstName,
LastName = obj.LastName,
password = obj.Password,
UserId = obj.UserId,
Type = obj.Type
};
SetSessionManager(obj);
return data;
}
else return null;
}
public UserViewModel UserAdd(UserViewModel obj)
{
User con = new User();
//con.UserName = obj.UserName;
con.FirstName = obj.FirstName;
con.LastName = obj.LastName;
//con.Type = obj.Type;
con.EmailId = obj.EmailId;
con.Password = obj.password;
con.NewPassword = obj.NewPassword;
con.ConformPassword = obj.confirmPassword;
con.AgeId = obj.AgeId;
con.Type = obj.Type;
context.Users.AddObject(con);
context.SaveChanges();
obj.FirstName = con.FirstName;
obj.LastName = con.LastName;
obj.EmailId = con.EmailId;
obj.password = con.Password;
return obj;
}
#endregion
Reply
Answers (
0
)
ASP.NET.MVC
table row count problem