public async Task <ActionResult> GetPageListJson(DetailsListParam param, Pagination pagination)
        {
            OperatorInfo operatorInfo = await Operator.Instance.Current();

            if (!operatorInfo.RoleIds.Contains(GlobalContext.SystemConfig.RoleId))//不是超级管理员
            {
                param.SysDepartmentId = operatorInfo.DepartmentId;
            }

            StudentInfoListParam stuaram = new StudentInfoListParam();

            param.SysDepartmentId = operatorInfo.DepartmentId;
            TData <List <StudentInfoEntity> > stuobj = await studentInfoBLL.GetList(stuaram);

            TData <List <DetailsEntity> > obj = await detailsBLL.GetPageList(param, pagination);

            TData <List <DetailsInfo> > infos = new TData <List <DetailsInfo> >();

            if (stuobj.Tag == 1 && stuobj.Result.Any() && obj.Tag == 1 && obj.Result.Any())
            {
                infos.Result     = obj.Result.MapToMany <DetailsEntity, DetailsInfo>();
                infos.Tag        = 1;
                infos.TotalCount = obj.TotalCount;
                foreach (var model in infos.Result)
                {
                    model.StudentName = stuobj.Result.Where(x => x.Code == model.StudentCode).FirstOrDefault().Name;
                }
                return(Json(infos));
            }
            return(Json(obj));
        }
Esempio n. 2
0
        private Expression <Func <StudentInfoEntity, bool> > ListFilter(StudentInfoListParam param)
        {
            var expression = LinqExtensions.True <StudentInfoEntity>();

            expression = expression.And(t => t.BaseIsDelete == 0);
            if (param != null)
            {
                if (!string.IsNullOrEmpty(param.Name))
                {
                    expression = expression.And(t => t.Name.Contains(param.Name));
                }
                if (!string.IsNullOrEmpty(param.Class))
                {
                    expression = expression.And(t => t.Class.Contains(param.Class));
                }
                if (param.Status > -1)
                {
                    expression = expression.And(t => t.Status == param.Status);
                }
                if (!param.SysDepartmentId.IsNullOrZero())
                {
                    expression = expression.And(t => t.SysDepartmentId == param.SysDepartmentId);
                }
            }
            return(expression);
        }
Esempio n. 3
0
        public async Task <List <StudentInfoEntity> > GetPageList(StudentInfoListParam param, Pagination pagination)
        {
            var expression = ListFilter(param);
            var list       = await this.BaseRepository().FindList(expression, pagination);

            return(list.ToList());
        }
        public async Task <TData <List <StudentInfoEntity> > > GetPageList(StudentInfoListParam param, Pagination pagination)
        {
            TData <List <StudentInfoEntity> > obj = new TData <List <StudentInfoEntity> >();

            obj.Result = await studentInfoService.GetPageList(param, pagination);

            obj.TotalCount = pagination.TotalCount;
            obj.Tag        = 1;
            return(obj);
        }
        public async Task <TData <List <StudentInfoEntity> > > GetList(StudentInfoListParam param)
        {
            TData <List <StudentInfoEntity> > obj = new TData <List <StudentInfoEntity> >();

            obj.Result = await studentInfoService.GetList(param);

            obj.TotalCount = obj.Result.Count;
            obj.Tag        = 1;
            return(obj);
        }
Esempio n. 6
0
        public async Task <ActionResult> GetPageListJson(StudentInfoListParam param, Pagination pagination)
        {
            OperatorInfo operatorInfo = await Operator.Instance.Current();

            if (!operatorInfo.RoleIds.Contains(GlobalContext.SystemConfig.RoleId))//不是超级管理员
            {
                param.SysDepartmentId = operatorInfo.DepartmentId;
            }
            TData <List <StudentInfoEntity> > obj = await studentInfoBLL.GetPageList(param, pagination);

            return(Json(obj));
        }
        public async Task <ActionResult> SaveFormJson(DetailsEntity entity)
        {
            OperatorInfo operatorInfo = await Operator.Instance.Current();

            entity.SysDepartmentId   = operatorInfo.DepartmentId;
            entity.SysDepartmentName = operatorInfo.DepartmentName;

            TData <string> obj      = new TData <string>();
            var            codelist = entity.StudentCode.Split(',');

            if (codelist.Contains("0"))//选择全部学生
            {
                StudentInfoListParam param = new StudentInfoListParam();
                param.SysDepartmentId = operatorInfo.DepartmentId;
                TData <List <StudentInfoEntity> > stuobj = await studentInfoBLL.GetList(param);

                if (stuobj.Tag == 1 && stuobj.Result.Any())
                {
                    foreach (var stumodel in stuobj.Result)//多选学生添加
                    {
                        entity.StudentCode = stumodel.Code;
                        entity.Id          = 0;
                        entity.Status      = 1;
                        obj = await detailsBLL.SaveForm(entity);
                    }
                }
            }
            else if (codelist.Count() > 1)
            {
                foreach (var code in codelist)//多选学生添加
                {
                    entity.StudentCode = code;
                    entity.Id          = 0;
                    entity.Status      = 1;
                    obj = await detailsBLL.SaveForm(entity);
                }
            }
            else
            {
                entity.Status = 1;
                obj           = await detailsBLL.SaveForm(entity);
            }
            return(Json(obj));
        }
Esempio n. 8
0
        public async Task <ActionResult> GetListJsonCom(StudentInfoListParam param)
        {
            OperatorInfo operatorInfo = await Operator.Instance.Current();

            if (!operatorInfo.RoleIds.Contains(GlobalContext.SystemConfig.RoleId))//不是超级管理员
            {
                param.SysDepartmentId = operatorInfo.DepartmentId;
            }
            TData <List <StudentInfoEntity> > obj = await studentInfoBLL.GetList(param);

            if (obj.Tag == 1 && obj.Result.Count > 0)
            {
                StudentInfoEntity info = new StudentInfoEntity();
                info.Code = "0";
                info.Name = "选择全部学生";
                obj.Result.Insert(0, info);
            }

            return(Json(obj));
        }