コード例 #1
0
 public PageModel <TeacherQuestion> GetListAsync(int pageIndex, int pageSize, string name, EnumAccept accept)
 {
     return(_teacherQuestionRepository.GetListAsync(pageIndex, pageSize, name, accept));
 }
コード例 #2
0
        public PageModel <MajorApply> GetListAsync(int pageIndex, int pageSize, string name, EnumAccept accept)
        {
            using (var conn = DapperFactory.GetConnection())
            {
                #region generate condition
                string where = "where 1=1 ";
                if (!string.IsNullOrEmpty(name))
                {
                    where += string.Format(" and m.Name like '%{0}%'", name);
                }
                if (accept != EnumAccept.All)
                {
                    where += string.Format(" and h.IsAccept = {0}", (int)accept);
                }
                #endregion

                string countSql = string.Format("select count(1) from [MajorApply] as h left join [Major] m on m.Id = h.MajorId {0};", where);
                int    total    = conn.ExecuteScalar <int>(countSql);
                if (total == 0)
                {
                    return(new PageModel <MajorApply>());
                }

                string sql  = string.Format(@"select * from ( select h.*, m.Name as MajorName, m.NameEn as MajorNameEn, 
                    ROW_NUMBER() over (Order by h.Id desc) as RowNumber from [MajorApply] as h 
                    left join [Major] m on m.Id = h.MajorId {0} ) as b
                    where RowNumber between {1} and {2};", where, ((pageIndex - 1) * pageSize) + 1, pageIndex * pageSize);
                var    list = conn.Query <MajorApply>(sql);

                return(new PageModel <MajorApply>
                {
                    Total = total,
                    Data = list != null?list.ToList() : null
                });
            }
        }
コード例 #3
0
 public PageModel <ProgramApply> GetListAsync(int pageIndex, int pageSize, string programName, EnumAccept accept)
 {
     return(_programApplyRepository.GetListAsync(pageIndex, pageSize, programName, accept));
 }
コード例 #4
0
 public PageModel <CourseOrder> GetListAsync(int pageIndex, int pageSize, string courseName, EnumAccept accept)
 {
     return(_courseOrderRepository.GetListAsync(pageIndex, pageSize, courseName, accept));
 }
コード例 #5
0
 public PageModel <SchoolApply> GetListAsync(int pageIndex, int pageSize, string schoolName, EnumAccept accept)
 {
     return(_schoolApplyRepository.GetListAsync(pageIndex, pageSize, schoolName, accept));
 }
コード例 #6
0
 public PageModel <CompanyApply> GetListAsync(int pageIndex, int pageSize, string name, EnumAccept accept)
 {
     return(_companyApplyRepository.GetListAsync(pageIndex, pageSize, name, accept));
 }
コード例 #7
0
 public PageModel <WorksComment> GetListAsync(int pageIndex, int pageSize, string name, EnumAccept accept)
 {
     return(_worksCommentRepository.GetListAsync(pageIndex, pageSize, name, accept));
 }