public ActionResult CompanyPlatformLogOff() { FormsAuthentication.SignOut(); Session.Clear(); BreadCrumb.ClearState(); return(RedirectToAction("CompanyPlatformLogin", "Account")); }
public ActionResult CompanyPlatformLogin(AccountModel model) { //判断提交模型数据是否正确 if (!ModelState.IsValid) { return(View(model)); } string code = (string)Session["ValidateCode"]; if (model.CheckCode != code) { ModelState.AddModelError("CheckCode", "验证码不正确"); return(View(model)); } //根据用户名查找用户 ICompanyUserBLL companyUserBll = BLLFactory <ICompanyUserBLL> .GetBLL("CompanyUserBLL"); T_CompanyUser user = companyUserBll.GetEntity(u => u.UserName == model.UserName.Trim() && u.DelFlag == ConstantParam.DEL_FLAG_DEFAULT); //1.判断用户名是否正确 if (user == null) { ModelState.AddModelError("UserName", "用户名不存在"); return(View(model)); } //2.判断密码是否正确 string md5Str = PropertyUtils.GetMD5Str(model.Password); if (user.Password != md5Str) { ModelState.AddModelError("Password", "密码不正确"); return(View(model)); } //3.如果未设置角色 if (user.CompanyUserRoles.Count == 0) { ModelState.AddModelError("UserName", "该用户未设置角色,请联系管理员"); return(View(model)); } //4.获取用户对象信息(权限菜单,Action等)保存基本信息到session中 this.SetUserSessiong(user, companyUserBll); //5.判断是否拥有访问首页的权限 UserSessionModel session = (UserSessionModel)Session[ConstantParam.SESSION_USERINFO]; if (session.IsMgr == ConstantParam.USER_ROLE_DEFAULT && !session.ActionDic.ContainsKey("/CompanyPlatform/Index")) { ModelState.AddModelError("UserName", "该用户无访问权限,请联系管理员"); return(View(model)); } BreadCrumb.ClearState(); //5.跳转到 return(RedirectToAction("Index", "CompanyPlatform")); }
public ActionResult ShopPlatformLogin(AccountModel model) { //判断提交模型数据是否正确 if (!ModelState.IsValid) { return(View(model)); } string code = (string)Session["ValidateCode"]; if (model.CheckCode != code) { ModelState.AddModelError("CheckCode", "验证码不正确"); return(View(model)); } //根据用户名查找门店平台用户 IShopUserBLL shopUserBll = BLLFactory <IShopUserBLL> .GetBLL("ShopUserBLL"); T_ShopUser user = shopUserBll.GetEntity(u => u.UserName == model.UserName.Trim() && u.DelFlag == ConstantParam.DEL_FLAG_DEFAULT); //1.判断用户名是否正确 if (user == null) { ModelState.AddModelError("UserName", "用户名不存在"); return(View(model)); } //2.判断密码是否正确 string md5Str = PropertyUtils.GetMD5Str(model.Password); if (user.Password != md5Str) { ModelState.AddModelError("Password", "密码不正确"); return(View(model)); } //3.保存基本信息到session中 this.SetUserSessiong(user, shopUserBll); BreadCrumb.ClearState(); //4.跳转到 return(RedirectToAction("Index", "ShopPlatform")); }
/// <summary> /// 转到物业平台 /// </summary> /// <param name="id">小区ID</param> /// <returns></returns> public ActionResult GotoProperty(int id) { //获取session对象 UserSessionModel model = (UserSessionModel)Session[ConstantParam.SESSION_USERINFO]; //构造菜单业务对象 IMenuBLL menuBll = BLLFactory <IMenuBLL> .GetBLL("MenuBLL"); //获取菜单 var list = menuBll.GetList(m => m.MenuFlag == ConstantParam.MENU_LEFT && m.IsPlatform == ConstantParam.USER_TYPE_PROPERTY).Select(m => new MenuModel { MenuId = m.Id, MenuName = m.MenuName, MenuCode = m.MenuCode, MenuUrl = m.Href, MenuFlag = m.MenuFlag, MenuCss = m.IconClass, ParentId = m.ParentId, Order = m.Order, IsPlatform = m.IsPlatform }).ToList(); if (model.PropertyPlaceId == null) { //设置左边菜单 model.MenuList.AddRange(list); } //设置当前小区 model.PropertyPlaceId = id; //设置session信息 Session[ConstantParam.SESSION_USERINFO] = model; BreadCrumb.ClearState(); return(RedirectToAction("Index", "Property")); }