예제 #1
0
        public JsonResult GetDepartmentListForCurrentUser()
        {
            ResponseResult result = new ResponseResult();

            int userId = WebApi.Common.HelpOp.UserOp.GetUserId(this.User);

            if (userId <= 0)
            {
                result.Code = ResponseResultMessageDefine.ParaError;
                result.Errors.Add(ResponseResultMessageDefine.OpLostMessage);
            }
            else
            {
                WXQ.BusinessCore.systemmanage.DepartmentOp op = new WXQ.BusinessCore.systemmanage.DepartmentOp();


                ListResult <WXQ.Enties.Department> rv = op.GetDepartmentListByUserId(userId, 1, 200);

                if (rv == null)
                {
                    result.Code = ResponseResultMessageDefine.OpLost;
                    result.Errors.Add(ResponseResultMessageDefine.OpLostMessage);
                }
                else
                {
                    result.Data = rv;
                }
            }

            return(Json(result));
        }
예제 #2
0
        public JsonResult GetDepartmentListByUserId([FromForm]  WXQ.InOutPutEntites.Input.SystemManage.Department.GetDepartmentListByUserIdInput model)
        {
            ResponseResult result = new ResponseResult();

            GetDepartmentListByUserIdInputModelValidation validator = new GetDepartmentListByUserIdInputModelValidation();
            ValidationResult vr = validator.Validate(model);

            if (!vr.IsValid)
            {
                result.Code   = ResponseResultMessageDefine.ParaError;
                result.Errors = vr.Errors.Select(e => e.ErrorMessage).ToList();
            }
            else
            {
                WXQ.BusinessCore.systemmanage.DepartmentOp op = new WXQ.BusinessCore.systemmanage.DepartmentOp();


                SqlSugar.PageModel pagemodel          = TypeAdapter.Adapt <WXQ.InOutPutEntites.Input.PageInput, SqlSugar.PageModel>(model.Page);
                ListResult <WXQ.Enties.Department> rv = op.GetDepartmentListByUserId(model.UserId, model.Page.PageIndex, model.Page.PageSize);

                if (rv == null)
                {
                    result.Code = ResponseResultMessageDefine.OpLost;
                    result.Errors.Add(ResponseResultMessageDefine.OpLostMessage);
                }
                else
                {
                    result.Data = rv;
                }
            }

            return(Json(result));
        }