public ActionResult Login(Models.UserInfo admin) { string name = admin.LoginName; string password = admin.LoginPwd; Models.UserInfo tAdmin = new UserManager().Login(admin); //tAdmin不为空 if (tAdmin != null) { if (tAdmin.LoginPwd != password) { ViewBag.LoginFailed = "登录失败:登录密码错误"; return(View("Index")); } //保存记录 ViewBag.adminName = tAdmin; Session["AdminName"] = tAdmin.NickName; FormsAuthentication.SetAuthCookie(admin.NickName, false); return(RedirectToRoute("Admin_default", new { controller = "Home", action = "Index" })); } //tAdmin为空,用户不存在 ViewBag.LoginFailed = "登录失败:用户不存在"; return(View("Index")); }
public ActionResult GetUserByLoginName(Models.UserInfo user) { List <Models.UserInfo> userList = new UserManager().GetUserByLoginName(user.LoginName); ViewBag.userList = userList; return(View("User")); }
/// <summary> /// 查询 登录方法 /// </summary> /// <param name="uifo"></param> /// <returns></returns> public Models.UserInfo GetUserInfoWhere(Models.UserInfo uifo) { //using 执行完之后立即销毁 var uifSvc = new DAL.UserInfoService(); //return uifSvc.GetLogin(s =>(string.IsNullOrEmpty(s.UserEmail=email) && s.UserPassword == pwd)); var loginEntity = uifSvc.GetLogin(uifo); return(loginEntity); }
public LoginResult Login(UserInfo user, bool ifAdmin) { var validResult = Model.ValidFor(user); if (validResult.State == false) { return new LoginResult { Message = validResult.ErrorMessage }; } // 通知其它fast会话有新成员登录 foreach (var session in this.OtherSessions) { session.InvokeApi("LoginNotify", user.Account); } // 标记会话已登录成功 this.CurrentContext.Session.Tag.Set("Logined", true); return new LoginResult { State = true }; }
public int Register(Models.UserInfo info) { int result = 0; using (var db = new Expense_ManagerEntities()) { user_info DALInfo = new user_info(); DALInfo.firstname = info.firstname; DALInfo.lastname = info.lastname; DALInfo.email = info.email; DALInfo.password = info.password; DALInfo.confirm_password = info.confirm_password; DALInfo.profile_pic_path = info.profile_pic_path; db.user_info.Add(DALInfo); db.SaveChanges(); result = 1; } return(result); }
public ActionResult AddUser(Models.UserInfo user) { DateTime dt = DateTime.Now; user.UserId = new Common().getGUID(); user.CreateTime = dt; user.ModifyTime = dt; user.Enable = 1; user.UserRank = 1; RegisterType addRet = new UserManager().AddUser(user); ViewBag.userExist = false; if (addRet == RegisterType.用户已存在)//用户已经存在 { ViewBag.userExist = true; } return(RedirectToRoute("Admin_route2", new { controller = "Home", action = "Users" })); }
public ActionResult ModifyPwd(Models.UserInfo user) { UserManager manage = new UserManager(); string OriginPwd = Request.Params["OriginLoginPwd"].ToString(); DateTime dt = DateTime.Now; user.ModifyTime = dt; int ret = new UserManager().ModifyUser(user, OriginPwd); if (ret > 0) { //修改成功 } else { //修改失败 } return(RedirectToRoute("Admin_route2", new { controller = "Home", action = "Users" })); }
public Models.UserInfo FetchUserInfo(Models.Login info) { Models.UserInfo BALinfo = new Models.UserInfo(); using (var db = new Expense_ManagerEntities()) { bool isvalid = db.user_info.Any(x => x.email == info.email && x.password == info.password); if (isvalid) { DAL.user_info DALinfo = db.user_info.Where(x => x.email == info.email && x.password == info.password).FirstOrDefault(); BALinfo.id = DALinfo.id; BALinfo.firstname = DALinfo.firstname; BALinfo.lastname = DALinfo.lastname; BALinfo.email = DALinfo.email; BALinfo.password = DALinfo.password; BALinfo.confirm_password = DALinfo.confirm_password; BALinfo.month_start_date = DALinfo.month_start_date; BALinfo.profile_pic_path = DALinfo.profile_pic_path; //var userdetail2 = from s in db.user_info where s.email == info.email && s.password == info.password select s; } } return(BALinfo); }
/// <summary> /// 登录服务器 /// </summary> /// <param name="user">用户信息</param> /// <param name="ifAdmin">是否为管理员</param> /// <returns></returns> public Task<LoginResult> Login(UserInfo user, Boolean ifAdmin) { return this.InvokeApi<LoginResult>("Login", user, ifAdmin); }
public ActionResult UpdateLocation(double lat, double lng) { if (Session[SessionKeys.User] != null) { var userInfo = (UserInfo) Session[SessionKeys.User]; userInfo.Location = PointFactory.Create(lat, lng); } else { var userInfo = new UserInfo { IsAdmin = false, IsAuthenticated = false, Location = PointFactory.Create(lat, lng) }; Session[SessionKeys.User] = userInfo; } return new HttpStatusCodeResult(HttpStatusCode.OK); }