コード例 #1
0
        public ActionResult GetUserListByRoleId()
        {
            GxSysUserBusiness sysUserBusiness = new GxSysUserBusiness();
            var roleId   = ConvertUtility.ToDecimal(Request["roleid"]);
            var list     = sysUserBusiness.FindAllUserByRoleId(roleId).ToList();
            var listData = list.Select(c => new EasyuiDropDown {
                Value = c.ID.ToString(), Text = c.USERNAME
            }).ToList();

            listData.Insert(0, new EasyuiDropDown {
                Value = "0", Text = "请选择"
            });
            return(Json(listData));
        }
コード例 #2
0
 public HttpResponseMessage Post([FromBody] PassPortParamter parameter)
 {
     try
     {
         GxSysUserBusiness gxSysUser = new GxSysUserBusiness();
         var entity = gxSysUser.FindGxSysUser().FirstOrDefault(t => t.USERID == parameter.UserId && t.USERPWD == parameter.Pwd);
         if (entity == null)
         {
             var loginResult = new DataResult <List <ViewUserModel> >();
             loginResult.ErrorCode = "404";
             loginResult.Result    = false;
             loginResult.Message   = "未找到当前登录用户信息";
             return(Request.CreateResponse(HttpStatusCode.OK, loginResult));
         }
         var dataResult = new DataResult <ViewUserModel>();
         if (entity.USERSTATUS != 10)
         {
             dataResult.ErrorCode = "500";
             dataResult.Result    = false;
             dataResult.Message   = "当前登录用户已禁止登陆";
         }
         else
         {
             dataResult.ErrorCode = "200";
             dataResult.Result    = true;
             dataResult.Message   = "当前登录用户登陆成功";
             ViewUserModel model = new ViewUserModel()
             {
                 UserId   = entity.USERID,
                 UserName = entity.USERNAME,
                 id       = entity.ID
             };
             dataResult.Data = model;
         }
         return(Request.CreateResponse(HttpStatusCode.OK, dataResult));
     }
     catch (Exception ex)
     {
         DataResult <string> dataResult = new DataResult <string>();
         dataResult.ErrorCode = "100101";
         dataResult.Result    = false;
         dataResult.Message   = "获取数据异常:" + (ex.InnerException == null ? ex.Message : ex.InnerException.Message);
         return(Request.CreateResponse(HttpStatusCode.OK, dataResult));
     }
 }
コード例 #3
0
        public ActionResult Login(FormCollection form)
        {
            string     loginName = form.Get("LoginName");
            string     loginPass = form.Get("loginPass");
            AjaxResult result    = null;

            if (string.IsNullOrEmpty(loginName))
            {
                result = AjaxResult.Error("用户名不能为空");
                return(Json(result));
            }
            if (string.IsNullOrEmpty(loginPass))
            {
                result = AjaxResult.Error("密码不能为空");
                return(Json(result));
            }
            GxSysUserBusiness gxSysUserBusiness = new GxSysUserBusiness();
            var entity = gxSysUserBusiness.FindGxSysUser(loginName, loginPass);

            result = AjaxResult.Error(entity.Message);
            return(Json(result));
        }