コード例 #1
0
        public Expression <Func <Except_Info_Employ, bool> > GetByModelWhere(ExceptEmploySearchViewModel exceptEmploySearchViewModel)
        {
            var predicate = WhereExtension.True <Except_Info_Employ>();//初始化where表达式SchoolName

            //姓
            if (!exceptEmploySearchViewModel.SchoolCode.Equals(""))
            {
                predicate = predicate.And(p => p.facultystaff_Info.SchoolCode.Contains(exceptEmploySearchViewModel.SchoolCode));
            }
            if (!exceptEmploySearchViewModel.DepartCode.Equals(""))
            {
                predicate = predicate.And(p => p.facultystaff_Info.DepartCode.Contains(exceptEmploySearchViewModel.DepartCode));
            }
            if (!exceptEmploySearchViewModel.StaffCode.Equals(""))
            {
                predicate = predicate.And(p => p.facultystaff_Info.StaffCode.Contains(exceptEmploySearchViewModel.StaffCode));
            }
            if (!exceptEmploySearchViewModel.CreateDate.Equals(""))
            {
                predicate = predicate.And(p => p.CreateDate.ToString().Contains(exceptEmploySearchViewModel.CreateDate));
            }
            if (!exceptEmploySearchViewModel.Name.Equals(""))
            {
                predicate = predicate.And(p => p.Name.Contains(exceptEmploySearchViewModel.Name));
            }
            if (!exceptEmploySearchViewModel.Temperature.Equals(""))
            {
                predicate = predicate.And(p => p.Temperature.Contains(exceptEmploySearchViewModel.Temperature));
            }
            return(predicate);
        }
コード例 #2
0
        public List <ExceptEmploySearchMiddle> searchExceptEmployService(ExceptEmploySearchViewModel exceptEmploySearchViewModel)
        {
            List <Except_Info_Employ> searchinfo = exceptEmployRepository.searchEmployinfo(exceptEmploySearchViewModel);
            var result = _IMapper.Map <List <Except_Info_Employ>, List <ExceptEmploySearchMiddle> >(searchinfo);

            return(result);
        }
コード例 #3
0
        public List <Except_Info_Employ> searchEmployinfo(ExceptEmploySearchViewModel exceptEmploySearchViewModel)
        {
            var preciate = GetByModelWhere(exceptEmploySearchViewModel);
            List <Except_Info_Employ> Except_Info_Employs = new List <Except_Info_Employ>();

            if (exceptEmploySearchViewModel.RoleID == "sys")
            {
                var tempresult = DbSet.Where(preciate).Include(a => a.facultystaff_Info).Include(m => m.UserFiles_Info).ToList();
                Except_Info_Employs.AddRange(tempresult);
            }
            else
            {
                //先找到这个人所负责的所有班级
                var searchResult = Db.StaffStation_Relate
                                   .Where(a => a.facultystaff_InfoId == exceptEmploySearchViewModel.userKey)
                                   .Include(a => a.Station_Info).ToList();


                for (int i = 0; i < searchResult.Count(); i++)//通过班级code查询
                {
                    if (searchResult[i].Station_Info.StaffCode.Equals(""))
                    {
                        continue;
                    }
                    var tempresult = DbSet.Where(a => a.facultystaff_Info.StaffCode == searchResult[i].Station_Info.StaffCode)
                                     .Where(preciate).Include(a => a.facultystaff_Info).Include(m => m.UserFiles_Info).ToList();
                    Except_Info_Employs.AddRange(tempresult);
                }
            }
            return(Except_Info_Employs.OrderByDescending(a => a.CreateDate).ToList());
        }
コード例 #4
0
        public ActionResult <ExceptEmploySearchResModel> ExceptEmplySearch(ExceptEmploySearchViewModel exceptEmploySearchViewModel)
        {
            ExceptEmploySearchResModel exceptEmploySearchResModel = new ExceptEmploySearchResModel();
            var result = exceptEmployService.searchExceptEmployService(exceptEmploySearchViewModel);

            exceptEmploySearchResModel.IsSuccess = true;
            exceptEmploySearchResModel.exceptEmploySearchMiddles  = result;
            exceptEmploySearchResModel.baseViewModel.Message      = "查询成功";
            exceptEmploySearchResModel.baseViewModel.ResponseCode = 200;
            return(Ok(exceptEmploySearchResModel));
        }