Exemple #1
0
 /// <summary>
 ///     用户登录
 /// </summary>
 /// <param name="model">登录模型信息</param>
 /// <returns>业务操作结果</returns>
 public OperationResult Login(LoginModel model)
 {
     Validator.ValidateObject(model, new ValidationContext(model));
     LoginInfo2 loginInfo = new LoginInfo2
     {
         Access = model.Account,
         Password = model.Password,  
     };
     OperationResult result = base.Login(loginInfo);
     if (result.ResultType == OperationResultType.Success)
     {
         
         User user = (User)result.AppendData;
         List<UserGroup> usergroups =user.UserGroups.ToList();
         List<Res> reses = new List<Res>();
         List<Mdl> mdls = new List<Mdl>();
         foreach (var a in usergroups)
         {
             reses.AddRange(a.Ress);
             mdls.AddRange(a.Mdls);
         }
         if (reses.SingleOrDefault(r=>r.RESCODE==model.ResCode)==null)
         {
             result.ResultType = OperationResultType.Error;
             result.Message = "用户没有该资源的权限";
         }
         result.AppendData = mdls;                    
     }
     return result;
 }
Exemple #2
0
 public OperationResult Login(LoginInfo2 loginInfo)
 {
     PublicHelper.CheckArgument(loginInfo, "loginInfo");
     User user = UserRepository.Entities.SingleOrDefault(m=>m.usercode==loginInfo.Access);
     if (user == null)
     {
         return new OperationResult(OperationResultType.QueryNull, "指定账号的用户不存在。");
     }
     if (user.userpwd != loginInfo.Password)
     {
         return new OperationResult(OperationResultType.Warning, "登录密码不正确。");
     }
     //登录LOG
     //LoginLog loginLog = new LoginLog { IpAddress = loginInfo.IpAddress, Member = member };
     //LoginLogRepository.Insert(loginLog);
     return new OperationResult(OperationResultType.Success, "登录成功。", user);
 }
Exemple #3
0
 private static void Method14()
 {
     LoginInfo2 logoninfo=new LoginInfo2();
     logoninfo.Access="65128044";
     logoninfo.Password="******";
     Console.WriteLine(_container.GetExportedValue<IUserFormService>().Login(logoninfo).Message);
 }