Exemplo n.º 1
0
        /// <summary>
        /// 验证登录信息
        /// </summary>
        /// <param name="query"></param>
        /// <param name="rm"></param>
        /// <returns></returns>
        public bool CheckLoginInfo(SysUsrMstrQuery query, ref ReturnMsg rm)
        {
            if (string.IsNullOrEmpty(query.USR_NAME))
            {
                rm.msg = "请输入用户名";
                return(false);
            }
            if (string.IsNullOrEmpty(query.USR_PWD))
            {
                rm.msg = "请输入密码";
                return(false);
            }
            if (string.IsNullOrEmpty(query.code))
            {
                rm.msg = "请输入验证码";
                return(false);
            }
            var vch = new CaptchaHelper();

            if (!vch.VerifyCode(query.cookie, query.code))
            {
                rm.msg = "验证码错误";
                return(false);
            }
            return(true);
        }
Exemplo n.º 2
0
 public ActionResult GetSysUsrPageList(SysUsrMstrQuery query)
 {
     try
     {
         var result = _sysUsrMstrRepository.GetSysUsrPageList(query);
         return(Page(result.Data, result.Page));
     }
     catch (Exception ex)
     {
         return(Fail(ex.Message));
     }
 }
Exemplo n.º 3
0
        /// <summary>
        /// web登录验证
        /// </summary>
        /// <param name="query"></param>
        /// <returns></returns>
        public ReturnMsg Login(SysUsrMstrQuery query)
        {
            var rm = new ReturnMsg();

            try
            {
                query.USR_NAME.Trim();
                query.USR_PWD.Trim();
                var isCheck = CheckLoginInfo(query, ref rm);
                if (!isCheck)
                {
                    rm.code      = 28600;
                    rm.IsSuccess = false;
                    return(rm);
                }
                query.USR_PWD = Encrypt.Md5Hash(query.USR_PWD);
                var userInfo = _sysUsrMstrRepository.FirstOrDefault(c => c.USR_NAME == query.USR_NAME && c.USR_PWD == query.USR_PWD && c.USR_STATUS == 1 && c.DEL_FLAG == 1);
                if (userInfo != null && userInfo.Id > 0)
                {
                    var tree = _sysNavTreeRepository.GetSysUsrMstrNavTree(userInfo.Id);
                    var dic  = new Dictionary <string, object>();
                    dic.Add("UserInfo", userInfo);
                    dic.Add("NavTree", tree);

                    rm.code      = 28000;
                    rm.IsSuccess = true;
                    rm.msg       = "登录成功";
                    rm.result    = JsonConvert.SerializeObject(dic);

                    return(rm);
                }
                else
                {
                    rm.code      = 28600;
                    rm.IsSuccess = false;
                    rm.msg       = "用户名或密码错误";
                    return(rm);
                }
            }
            catch (Exception ex)
            {
                rm.code      = 28600;
                rm.IsSuccess = false;
                rm.msg       = ex.Message;
                return(rm);
            }
        }
Exemplo n.º 4
0
        public ActionResult Login(SysUsrMstrQuery query)
        {
            try
            {
                var result = _sysUsrMstrService.Login(query);
                if (!result.IsSuccess)
                {
                    return(Fail(result.msg));
                }

                return(Success(result.msg, result.result));
            }
            catch (Exception ex)
            {
                return(Fail(ex.Message));
            }
        }
Exemplo n.º 5
0
        /// <summary>
        /// 获取用户分页列表
        /// </summary>
        /// <param name="query"></param>
        /// <returns></returns>
        public PagerList <dynamic> GetSysUsrPageList(SysUsrMstrQuery query)
        {
            var perssion = _permissionHelper.GetCondition(AbpSession.USR_TYPE, AbpSession.USR_SCOPE, "usr.ORG_NO", AbpSession.ORG_NO, AbpSession.BG_NO);

            return(_sqlQuery.Select(@"
                    usr.USR_ID,
                    usr.USR_AVATAR_PATH,
                    usr.USR_NAME,
                    usr.USR_REAL_NAME,
                    usr.USR_EMAIL,
                    usr.UDF1 WeiXin,
                  (
		           CASE usr.USR_STATUS
		           WHEN 1 THEN
			           '启用'
		           ELSE
			           '禁用'
		           END
	                    ) AS USR_STATUS,
                    usr.USR_DESC,
                    dept.DEPT_NAME,
                    duty.DUTY_NAME,
                    bu.BU_SHORT_NAME,
                    usr.CREATE_DATE")
                   .Filter("usr.USR_NAME", query.USR_NAME, Operator.Contains)
                   .Filter("usr.USR_REAL_NAME", query.USR_REAL_NAME, Operator.Contains)
                   .Filter("usr.USR_TYPE", query.USR_TYPE)
                   .Filter("duty.DUTY_NAME", query.DUTY_NAME, Operator.Contains)
                   .Filter("usr.DEL_FLAG", "1")
                   .And("USR_TYPE!='0'")
                   .And(perssion)
                   .OrderBy("usr.CREATE_DATE desc")
                   .GetPageList <dynamic>(@"SYS_USR_MSTR usr
                LEFT JOIN MDM_BU_MSTR bu ON usr.ORG_NO=bu.BU_NO
                LEFT JOIN MDM_DEPT_MSTR dept ON usr.DEPT_ID=dept.DEPT_ID
                LEFT JOIN MDM_DUTY_MSTR duty ON usr.DUTY_ID=duty.DUTY_ID", Context.Database.GetDbConnection(), query));
        }