예제 #1
0
 /// <summary>
 /// 学院信息查询方法
 /// </summary>
 /// <param name="t">实体</param>
 /// <returns>PageBox 所有信息的实体</returns>
 public PageBox Query(DateTime?startDate, DateTime?endDate, int pageIndex = 1, int pageSize = 2, string CollegeName = "")
 {
     try
     {
         var pageCount = 0;
         var list      = sugar.Queryable <Colleges>();
         if (!string.IsNullOrWhiteSpace(startDate.ToString()))
         {
             list = list.Where(m => m.CollegeCreateDate >= startDate);
         }
         if (!string.IsNullOrWhiteSpace(endDate.ToString()))
         {
             list = list.Where(m => m.CollegeCreateDate <= endDate);
         }
         if (!string.IsNullOrWhiteSpace(CollegeName))
         {
             list = list.Where(m => m.CollegeName.Contains(CollegeName));
         }
         var     listResult = list.ToPageList(pageIndex, pageSize, ref pageCount);
         PageBox page       = new PageBox();
         page.PageIndex = pageIndex;
         page.PageCount = pageCount;
         page.Data      = listResult;
         return(page);
     }
     catch (Exception ex)
     {
         ErrorLog.WriteLog(ex);
         return(null);
     }
 }
예제 #2
0
        public string Query(DateTime?startDate, DateTime?endDate, string UserName, string RoleName, int pageIndex, int pageSize)
        {
            var list = iAdmin_Users_BLL.Query();

            if (!string.IsNullOrWhiteSpace(UserName))
            {
                list = list.Where(m => m.Admin_UserName.Contains(UserName)).ToList();
            }
            if (!string.IsNullOrWhiteSpace(RoleName))
            {
                list = list.Where(m => m.RoleNames.Contains(RoleName)).ToList();
            }
            if (!string.IsNullOrWhiteSpace(startDate.ToString()))
            {
                list = list.Where(m => m.CreateDate >= Convert.ToDateTime(startDate)).ToList();
            }
            if (!string.IsNullOrWhiteSpace(endDate.ToString()))
            {
                list = list.Where(m => m.CreateDate <= Convert.ToDateTime(endDate)).ToList();
            }
            PageBox page = new PageBox();

            page.PageIndex = pageIndex;
            page.PageCount = list.Count;
            page.Data      = list.Skip((pageIndex - 1) * pageSize).Take(pageSize);
            return(JsonConvert.SerializeObject(page));
        }
        /// <summary>
        /// 获取历史试卷
        /// </summary>
        /// <param name="startDate">开始时间</param>
        /// <param name="endDate">结束时间</param>
        /// <param name="pageIndex">首页</param>
        /// <param name="pageSize">每页显示条数</param>
        /// <returns>返回page</returns>
        public PageBox GetHistoricalPapers(int StudentId, DateTime?startDate, DateTime?endDate, int pageIndex = 1, int pageSize = 10)
        {
            try
            {
                //总页数
                var pageCount = 0;
                //五表联查
                var list = db.Queryable <HistoricalPapers, ExamQuestions, Scores, Students>((hp, eq, sc, st) => new object[] { JoinType.Inner, hp.ExamQuestionId == eq.ExamQuestionId, JoinType.Inner, hp.ScoreId == sc.ScoreId, JoinType.Inner, sc.StudentId == st.StudentId }).Select((hp, eq, sc, st) => new {
                    sc.ScoreNum,
                    st.StudentNum,
                    st.StudentName,
                    eq.ExamName,
                    hp.CreateDate,
                    hp.ExamQuestionId,
                    st.StudentId,
                    eq.ExamEndDate
                }).OrderBy(hp => hp.CreateDate, OrderByType.Desc).ToList();

                PageBox page = new PageBox
                {
                    PageIndex = pageIndex,
                    PageCount = pageCount,
                    Data      = list
                };
                return(page);
            }
            catch (Exception ex)
            {
                ErrorLog.WriteLog(ex);
                return(null);
            }
        }
        public PageBox Query(int pageIndex = 1, int pageSize = 3, string Name = "", int TId = 0, int SId = 0, int isUse = -1)
        {
            var list = bll.Query();

            if (!string.IsNullOrWhiteSpace(Name))
            {
                list = list.Where(m => m.Name.Contains(Name)).ToList();
            }
            if (TId != 0)
            {
                list = list.Where(m => m.TId.Equals(TId)).ToList();
            }
            if (SId != 0)
            {
                list = list.Where(m => m.SId.Equals(SId)).ToList();
            }
            if (isUse != -1)
            {
                list = list.Where(m => m.IsUse.Equals(isUse)).ToList();
            }
            PageBox page = new PageBox
            {
                PageIndex = pageIndex,
                PageCount = list.Count / pageSize + (list.Count % pageSize > 0 ? 1 : 0),
                Data      = list.Skip((pageIndex - 1) * pageSize).Take(pageSize)
            };

            return(page);
        }
        public PageBox Query(int pageIndex = 1, string UName = "", string GName = "", int GId = 0, int SId = 0)
        {
            var list = bll.Query();

            if (!string.IsNullOrWhiteSpace(UName))
            {
                list = list.Where(m => m.UName.Contains(UName)).ToList();
            }
            if (!string.IsNullOrWhiteSpace(GName))
            {
                list = list.Where(m => m.GName.Contains(GName)).ToList();
            }
            if (GId != 0)
            {
                list = list.Where(m => m.GId.Equals(GId)).ToList();
            }
            if (SId != 0)
            {
                list = list.Where(m => m.SId.Equals(SId)).ToList();
            }
            PageBox page = new PageBox
            {
                PageIndex = pageIndex,
                PageCount = list.Count / PAGESIZE + (list.Count % PAGESIZE > 0 ? 1 : 0),
                Data      = list.Skip((pageIndex - 1) * PAGESIZE).Take(PAGESIZE)
            };

            return(page);
        }
예제 #6
0
        public PageBox GetTargetDetails(string TargetName, string IndexLevelId, string targettypename, string BlocName, string DutyMan, int pageindex = 1)
        {
            PageBox pageBox           = new PageBox();
            var     targetDetailslist = targetDetailsServices.GetTargetDetails();

            if (!string.IsNullOrEmpty(TargetName))
            {
                targetDetailslist = targetDetailslist.Where(r => r.TargetName.Contains(TargetName)).ToList();
            }
            if (!string.IsNullOrEmpty(IndexLevelId))
            {
                targetDetailslist = targetDetailslist.Where(r => r.IndexLevelId == IndexLevelId).ToList();
            }
            if (!string.IsNullOrEmpty(targettypename))
            {
                targetDetailslist = targetDetailslist.Where(r => r.targettypename == targettypename).ToList();
            }
            if (!string.IsNullOrEmpty(BlocName))
            {
                targetDetailslist = targetDetailslist.Where(r => r.BlocName.Contains(BlocName)).ToList();
            }
            if (!string.IsNullOrEmpty(DutyMan))
            {
                targetDetailslist = targetDetailslist.Where(r => r.DutyMan.Contains(DutyMan)).ToList();
            }
            pageBox.PageIndex = pageindex;
            pageBox.PageSize  = 5;
            pageBox.PageCount = targetDetailslist.Count / pageBox.PageSize + (targetDetailslist.Count % pageBox.PageSize == 0 ? 0 : 1);
            pageBox.Data      = targetDetailslist.Skip((pageBox.PageIndex - 1) * pageBox.PageSize).Take(pageBox.PageSize).ToList();
            return(pageBox);
        }
예제 #7
0
 /// <summary>
 /// 获取权限信息
 /// </summary>
 /// <param name="permissionName">权限名称</param>
 /// <param name="pageIndex">当前页</param>
 /// <param name="pageSize">每页几条</param>
 /// <returns>返回分页类</returns>
 public PageBox Query(string permissionName, int pageIndex = 1, int pageSize = 3)
 {
     try
     {
         //总页数
         var pageCount = 0;
         var list      = db.Queryable <Permissions>();
         //根据权限名称查询
         if (!string.IsNullOrWhiteSpace(permissionName))
         {
             list = list.Where(m => m.PermissionName.Contains(permissionName));
         }
         //分页
         var     listUser = list.ToPageList(pageIndex, pageSize, ref pageCount);
         PageBox page     = new PageBox();
         page.PageIndex = pageIndex;
         page.PageCount = pageCount;
         page.Data      = listUser;
         return(page);
     }
     catch (Exception ex)
     {
         ErrorLog.WriteLog(ex);
         return(null);
     }
 }
        public string Query(DateTime?startDate, DateTime?endDate, string novelsName = "", int typeIdOne = 0, int typeIdTwo = 0, int pageIndex = 1, int pageSize = 5)
        {
            var list = iNovels_BLL.Query();

            if (!string.IsNullOrWhiteSpace(novelsName))
            {
                list = list.Where(m => m.NovelName.Contains(novelsName)).ToList();
            }
            if (!string.IsNullOrWhiteSpace(startDate.ToString()))
            {
                list = list.Where(m => m.CreateDate >= Convert.ToDateTime(startDate)).ToList();
            }
            if (!string.IsNullOrWhiteSpace(endDate.ToString()))
            {
                list = list.Where(m => m.CreateDate <= Convert.ToDateTime(endDate)).ToList();
            }
            if (typeIdOne != 0)
            {
                list = list.Where(m => m.TypeIdOne.Equals(typeIdOne)).ToList();
            }
            if (typeIdTwo != 0)
            {
                list = list.Where(m => m.TypeIdTwo.Equals(typeIdTwo)).ToList();
            }
            PageBox page = new PageBox();

            page.PageIndex = pageIndex;
            page.PageCount = list.Count;
            page.Data      = list.Skip((pageIndex - 1) * pageSize).Take(pageSize);
            return(JsonConvert.SerializeObject(page));
        }
예제 #9
0
        public PageBox GetPermission(int Page = 1)
        {
            List <Permission> tPermissionList = t_Permission.GetPermissions();
            PageBox           pagebox         = new PageBox();

            pagebox.PageIndex = Page;
            pagebox.PageCount = tPermissionList.Count / PAGESIZE + (tPermissionList.Count % PAGESIZE == 0 ? 0 : 1);
            pagebox.Data      = tPermissionList.Skip((Page - 1) * PAGESIZE).Take(PAGESIZE);
            return(pagebox);
        }
예제 #10
0
파일: PageBoxTest.cs 프로젝트: Cricle/Anf
        public void GivenDisposableValue_SetDoNotDispose_DisposeIt_MustBeDisposed()
        {
            var res = new DispoableObject();
            var box = new PageBox <object>();

            box.DoNotDispose = true;
            box.Resource     = res;
            box.Dispose();
            Assert.IsFalse(res.IsDisposed);
        }
예제 #11
0
        public PageBox GetSubfamilie(int page = 1)
        {
            var     subfamilyList = subfamilyServices.GetSubfamilie();
            PageBox pageBox       = new PageBox();

            pageBox.PageIndex = page;
            pageBox.PageSize  = PAGESIZE;
            pageBox.PageCount = subfamilyList.Count / PAGESIZE + (subfamilyList.Count % PAGESIZE == 0 ? 0 : 1);
            pageBox.Data      = subfamilyList.Skip((page - 1) * PAGESIZE).Take(PAGESIZE);
            return(pageBox);
        }
예제 #12
0
        public PageBox GetHosts(int page = 1)
        {
            var     hostList = hostServices.GetHosts();
            PageBox pageBox  = new PageBox();

            pageBox.PageIndex = page;
            pageBox.PageSize  = PAGESIZE;
            pageBox.PageCount = hostList.Count / PAGESIZE + (hostList.Count % PAGESIZE == 0 ? 0 : 1);
            pageBox.Data      = hostList.Skip((page - 1) * PAGESIZE).Take(PAGESIZE);
            return(pageBox);
        }
예제 #13
0
        public PageBox GetFood(int id, int Page = 1)
        {
            List <Food> foodlist = Food.GetFood(id);
            PageBox     pagebox  = new PageBox();

            pagebox.PageIndex = Page;
            pagebox.PageCount = foodlist.Count / PAGESIZE + (foodlist.Count % PAGESIZE == 0 ? 0 : 1);
            pagebox.Data      = foodlist.Skip((Page - 1) * PAGESIZE).Take(PAGESIZE);

            return(pagebox);
        }
예제 #14
0
        public PageBox GetPermissions(int PageIndex = 1)
        {
            PageBox           pageBox  = new PageBox();
            List <Permission> mainlist = permissionServices.GetPermissions();

            pageBox.PageIndex = PageIndex;
            pageBox.PageSize  = PAGESIZE;
            pageBox.PageCount = mainlist.Count / PAGESIZE + (mainlist.Count % PAGESIZE == 0 ? 0 : 1);
            pageBox.Data      = mainlist.Skip((PageIndex - 1) * PAGESIZE).Take(PAGESIZE);
            return(pageBox);
        }
예제 #15
0
        public PageBox GetLocaTions(FactoryEnum locastate, string isdelete, string currentpage, string companyname, string locanumber, string factoryname1, string factoryname2)
        {
            if (currentpage == null)
            {
                currentpage = "1";
            }

            var rolelist = localionServices.GetLocations();

            if (locastate != 0)
            {
                rolelist = rolelist.Where(n => n.LocaState.Equals(locastate)).ToList();
            }
            if (isdelete != null)
            {
                if (isdelete == "true")
                {
                    isdelete = "1";
                }
                else
                {
                    isdelete = "0";
                }
                rolelist = rolelist.Where(n => n.IsDelete.Equals(Convert.ToInt32(isdelete))).ToList();
            }
            if (companyname != null)
            {
                rolelist = rolelist.Where(n => n.CompanyName.Contains(companyname)).ToList();
            }
            if (locanumber != null)
            {
                rolelist = rolelist.Where(n => n.LocaNumber.Contains(locanumber)).ToList();
            }
            if (factoryname1 != null)
            {
                rolelist = rolelist.Where(n => n.FactoryName1.Contains(factoryname1)).ToList();
            }
            if (factoryname2 != null)
            {
                rolelist = rolelist.Where(n => n.FactoryName2.Contains(factoryname2)).ToList();
            }

            int totlepage = rolelist.Count / 3 + (rolelist.Count % 3 == 0 ? 0 : 1);

            rolelist = rolelist.Skip((int.Parse(currentpage) - 1) * 3).Take(3).ToList();
            PageBox pagebox = new PageBox();

            pagebox.PageIndex = int.Parse(currentpage);
            pagebox.PageCount = totlepage;
            pagebox.Data      = rolelist;

            return(pagebox);
        }
예제 #16
0
        public PageBox GetTargetDetailsByStatuId(int stateid = 0, int pageindex = 1)
        {
            PageBox pageBox           = new PageBox();
            var     targetDetailslist = targetDetailsServices.GetTargetDetails();

            targetDetailslist = targetDetailslist.Where(r => r.StatusId == stateid).ToList();
            pageBox.PageIndex = pageindex;
            pageBox.PageSize  = 5;
            pageBox.PageCount = targetDetailslist.Count / pageBox.PageSize + (targetDetailslist.Count % pageBox.PageSize == 0 ? 0 : 1);
            pageBox.Data      = targetDetailslist.Skip((pageBox.PageIndex - 1) * pageBox.PageSize).Take(pageBox.PageSize).ToList();
            return(pageBox);
        }
예제 #17
0
        /// <summary>
        /// 查询
        /// </summary>
        /// <param name="startDate">开始时间</param>
        /// <param name="endDate">结束时间</param>
        /// <param name="className">班级名称</param>
        /// <param name="collegeId">学院</param>
        /// <param name="mjorId">专业</param>
        /// <param name="stageId">阶段</param>
        /// <param name="pageIndex">当前页</param>
        /// <param name="pageSize">每页几条</param>
        /// <returns>返回班级信息</returns>
        public PageBox Query(DateTime?startDate, DateTime?endDate, string className, int collegeId, int mjorId, int stageId, int pageIndex = 1, int pageSize = 3)
        {
            try
            {
                //总页数
                var pageCount = 0;
                //四表联查
                var list = db.Queryable <Classes, Colleges, Stages, Majors>((us, co, st, ma) => new object[] { JoinType.Inner, us.CollegeId == co.CollegeId, JoinType.Inner, us.StageId == st.StageId, JoinType.Inner, us.MajorId == ma.MajorId }).Select((us, co, st, ma) => new { us.ClassId, us.ClassName, us.StageId, us.MajorId, us.CreateDate, us.CollegeId, co.CollegeName, st.StageName, ma.MajorName });

                //查询开始时间
                if (!string.IsNullOrWhiteSpace(startDate.ToString()))
                {
                    list = list.Where(us => us.CreateDate >= startDate);
                }
                //查询结束时间
                if (!string.IsNullOrWhiteSpace(endDate.ToString()))
                {
                    list = list.Where(us => us.CreateDate <= endDate);
                }
                //用户查询
                if (!string.IsNullOrWhiteSpace(className))
                {
                    list = list.Where(us => us.ClassName.Contains(className));
                }
                //学院查询
                if (collegeId != 0)
                {
                    list = list.Where(us => us.CollegeId.Equals(collegeId));
                }
                //专业查询
                if (mjorId != 0)
                {
                    list = list.Where(us => us.MajorId.Equals(mjorId));
                }
                //阶段查询
                if (stageId != 0)
                {
                    list = list.Where(us => us.StageId.Equals(stageId));
                }
                var     listUser = list.ToPageList(pageIndex, pageSize, ref pageCount);
                PageBox page     = new PageBox();
                page.PageIndex = pageIndex;
                page.PageCount = pageCount;
                page.Data      = listUser;
                return(page);
            }
            catch (Exception ex)
            {
                ErrorLog.WriteLog(ex);
                return(null);
            }
        }
예제 #18
0
 /// <summary>
 /// 学生信息查询方法
 /// </summary>
 /// <param name="t">实体</param>
 /// <returns>PageBox 所有信息的实体</returns>
 public PageBox Query(DateTime?startDate, DateTime?endDate, int pageIndex = 1, int pageSize = 2, string StudentName = "", int collegeId = 0, int mjorId = 0, int stageId = 0, int classId = 0)
 {
     try
     {
         var pageCount = 0;
         //五表联查
         var list = sugar.Queryable <Students, Classes, Colleges, Stages, Majors>((s, cl, co, st, ma) => new object[] { JoinType.Inner, s.ClassId == cl.ClassId, JoinType.Inner, s.CollegeId == co.CollegeId, JoinType.Inner, s.StageId == st.StageId, JoinType.Inner, s.MajorId == ma.MajorId }).Select((s, cl, co, st, ma) => new { s.StudentId, s.StudentNum, s.StudentName, s.StudentIdCard, s.CreateDate, s.CreateUserId, s.StudentPwd, cl.ClassName, co.CollegeName, st.StageName, ma.MajorName, s.CollegeId, s.MajorId, s.StageId, s.ClassId });
         if (!string.IsNullOrWhiteSpace(startDate.ToString()))
         {
             list = list.Where(s => s.CreateDate >= startDate);
         }
         if (!string.IsNullOrWhiteSpace(endDate.ToString()))
         {
             list = list.Where(s => s.CreateDate <= endDate);
         }
         if (!string.IsNullOrWhiteSpace(StudentName))
         {
             list = list.Where(s => s.StudentName.Contains(StudentName));
         }
         //学院查询
         if (collegeId != 0)
         {
             list = list.Where(s => s.CollegeId.Equals(collegeId));
         }
         //专业查询
         if (mjorId != 0)
         {
             list = list.Where(s => s.MajorId.Equals(mjorId));
         }
         //阶段查询
         if (stageId != 0)
         {
             list = list.Where(s => s.StageId.Equals(stageId));
         }
         //班级查询
         if (classId != 0)
         {
             list = list.Where(s => s.ClassId.Equals(classId));
         }
         var     listResult = list.ToPageList(pageIndex, pageSize, ref pageCount);
         PageBox page       = new PageBox();
         page.PageIndex = pageIndex;
         page.PageCount = pageCount;
         page.Data      = listResult;
         return(page);
     }
     catch (Exception ex)
     {
         ErrorLog.WriteLog(ex);
         return(null);
     }
 }
예제 #19
0
        /// <summary>
        /// 查询试题
        /// </summary>
        /// <param name="startDate">开始时间</param>
        /// <param name="endDate">结束时间</param>
        /// <param name="pageIndex">当前页</param>
        /// <param name="pageSize">每页显示几条</param>
        /// <param name="questionsName">题干</param>
        /// <param name="collegeId">学院</param>
        /// <param name="mjorId">专业</param>
        /// <param name="stageId">阶段</param>
        /// <returns>返回分页类</returns>
        public PageBox Query(DateTime?startDate, DateTime?endDate, int pageIndex = 1, int pageSize = 2, string questionsName = "", int collegeId = 0, int mjorId = 0, int stageId = 0)
        {
            try
            {
                //总页数
                var pageCount = 0;
                //四表联查
                var list = db.Queryable <Questions, Colleges, Stages, Majors>((qu, co, st, ma) => new object[] { JoinType.Inner, qu.CollegeId == co.CollegeId, JoinType.Inner, qu.StageId == st.StageId, JoinType.Inner, qu.MajorId == ma.MajorId }).Select((qu, co, st, ma) => new { qu.QuestionId, qu.QuestionNum, qu.QuestionTitle, qu.OptionA, qu.OptionB, qu.OptionC, qu.OptionD, qu.Answer, qu.CollegeId, qu.CreateDate, qu.MajorId, qu.StageId, qu.TypeId, co.CollegeName, st.StageName, ma.MajorName });

                //查询开始时间
                if (!string.IsNullOrWhiteSpace(startDate.ToString()))
                {
                    list = list.Where(qu => qu.CreateDate >= startDate);
                }
                //查询结束时间
                if (!string.IsNullOrWhiteSpace(endDate.ToString()))
                {
                    list = list.Where(qu => qu.CreateDate <= endDate);
                }
                //用户查询
                if (!string.IsNullOrWhiteSpace(questionsName))
                {
                    list = list.Where(qu => qu.QuestionTitle.Contains(questionsName));
                }
                //学院查询
                if (collegeId != 0)
                {
                    list = list.Where(qu => qu.CollegeId.Equals(collegeId));
                }
                //专业查询
                if (mjorId != 0)
                {
                    list = list.Where(qu => qu.MajorId.Equals(mjorId));
                }
                //阶段查询
                if (stageId != 0)
                {
                    list = list.Where(qu => qu.StageId.Equals(stageId));
                }
                var     listUser = list.ToPageList(pageIndex, pageSize, ref pageCount);
                PageBox page     = new PageBox();
                page.PageIndex = pageIndex;
                page.PageCount = pageCount;
                page.Data      = listUser;
                return(page);
            }
            catch (Exception ex)
            {
                ErrorLog.WriteLog(ex);
                return(null);
            }
        }
예제 #20
0
파일: PageBoxTest.cs 프로젝트: Cricle/Anf
        public void GivenAnyPropertyValue_GetMustEqualGiven()
        {
            var page     = new ComicPage();
            var resource = new object();
            var box      = new PageBox <object>();

            box.DoNotDispose = true;
            box.Page         = page;
            box.Resource     = resource;
            Assert.IsTrue(box.DoNotDispose);
            Assert.AreEqual(page, box.Page);
            Assert.AreEqual(resource, box.Resource);
        }
        public string Query(string volumeName, int pageIndex, int pageSize)
        {
            var list = iVolumes_BLL.Query();

            if (!string.IsNullOrWhiteSpace(volumeName))
            {
                list = list.Where(m => m.VolumeName.Contains(volumeName)).ToList();
            }
            PageBox page = new PageBox();

            page.PageIndex = pageIndex;
            page.PageCount = list.Count;
            page.Data      = list.Skip((pageIndex - 1) * pageSize).Take(pageSize);
            return(JsonConvert.SerializeObject(page));
        }
        public PageBox GetMaintenanceOrders(string UnitOrPump, int PageIndex = 1)
        {
            if (UnitOrPump == null)
            {
                UnitOrPump = "";
            }

            PageBox pageBox = new PageBox();
            List <MaintenanceOrderNotMap> mainlist = maintenanceOrderServices.GetMaintenanceOrders(UnitOrPump);

            pageBox.PageIndex = PageIndex;
            pageBox.PageSize  = PAGESIZE;
            pageBox.PageCount = mainlist.Count / PAGESIZE + (mainlist.Count % PAGESIZE == 0 ? 0 : 1);
            pageBox.Data      = mainlist.Skip((PageIndex - 1) * PAGESIZE).Take(PAGESIZE);
            return(pageBox);
        }
        public JsonResult GetSpecialties(string SpecialtyName, int Page = 1)
        {
            List <Specialty> specialties = SpecialtyServices.GetSpecialties().ToList();
            PageBox          pageBox     = new PageBox();

            if (!string.IsNullOrWhiteSpace(SpecialtyName))
            {
                specialties = specialties.Where(r => r.SpecialtyName.Contains(SpecialtyName)).ToList();
            }
            pageBox.CurrentPage = Page;
            pageBox.TotlePage   = (specialties.Count / PAGECOUNT) + (specialties.Count % PAGECOUNT == 0 ? 0 : 1);
            pageBox.Data        = specialties.Skip((Page - 1) * PAGECOUNT).Take(PAGECOUNT);

            //return pageBox;
            return(Json(pageBox, JsonRequestBehavior.AllowGet));
        }
예제 #24
0
        public PageBox Query(int pageIndex = 1, int UId = 0)
        {
            var list = bll.Query();

            if (UId != 0)
            {
                list = list.Where(m => m.UId.Equals(UId)).ToList();
            }
            PageBox page = new PageBox
            {
                PageIndex = pageIndex,
                PageCount = list.Count / PAGESIZE + (list.Count % PAGESIZE > 0 ? 1 : 0),
                Data      = list.Skip((pageIndex - 1) * PAGESIZE).Take(PAGESIZE)
            };

            return(page);
        }
        public PageBox Query(int pageIndex = 1, string StoresName = "")
        {
            var list = bll.Query();

            if (!string.IsNullOrWhiteSpace(StoresName))
            {
                list = list.Where(m => m.StoresName.Contains(StoresName)).ToList();
            }
            PageBox page = new PageBox
            {
                PageIndex = pageIndex,
                PageCount = list.Count / PAGESIZE + (list.Count % PAGESIZE > 0 ? 1 : 0),
                Data      = list.Skip((pageIndex - 1) * PAGESIZE).Take(PAGESIZE)
            };

            return(page);
        }
예제 #26
0
 /// <summary>
 /// 查看待考信息
 /// </summary>
 /// <param name="collegeId"></param>
 /// <param name="majorId"></param>
 /// <param name="stageId"></param>
 /// <returns></returns>
 public PageBox GetExamQuestions(DateTime?strartDate, DateTime?endDate, int collegeId = 0, int majorId = 0, int stageId = 0, int pageIndex = 1, int pageSize = 3)
 {
     try
     {
         var pageCount = 0;
         var list      = sugar.Queryable <ExamQuestions, Colleges, Stages, Majors>((qu, co, st, ma) => new object[] { JoinType.Inner, qu.CollegeId == co.CollegeId, JoinType.Inner, qu.StageId == st.StageId, JoinType.Inner, qu.MajorId == ma.MajorId }).Select((qu, co, st, ma) => new { qu.CollegeId, qu.CreateDate, qu.ExamEndDate, qu.ExamName, qu.ExamQuestionId, qu.ExamStartDate, qu.MajorId, qu.QuestionIds, qu.StageId, qu.State, co.CollegeName, st.StageName, ma.MajorName }).OrderBy(qu => qu.CreateDate, OrderByType.Desc);
         //var listresult = list.Where(ex => ex.CollegeId.Equals(collegeId) && ex.MajorId.Equals(collegeId) && ex.StageId.Equals(collegeId));
         //查询开始时间
         if (!string.IsNullOrWhiteSpace(strartDate.ToString()))
         {
             list = list.Where(qu => qu.CreateDate >= strartDate);
         }
         //查询结束时间
         if (!string.IsNullOrWhiteSpace(endDate.ToString()))
         {
             list = list.Where(qu => qu.CreateDate <= endDate);
         }
         //学院查询
         if (collegeId != 0)
         {
             list = list.Where(qu => qu.CollegeId.Equals(collegeId));
         }
         //专业查询
         if (majorId != 0)
         {
             list = list.Where(qu => qu.MajorId.Equals(majorId));
         }
         //阶段查询
         if (stageId != 0)
         {
             list = list.Where(qu => qu.StageId.Equals(stageId));
         }
         var     listExamQuestions = list.ToPageList(pageIndex, pageSize, ref pageCount);
         PageBox page = new PageBox();
         page.PageIndex = pageIndex;
         page.PageCount = pageCount;
         page.Data      = listExamQuestions;
         return(page);
     }
     catch (Exception ex)
     {
         ErrorLog.WriteLog(ex);
         return(null);
     }
 }
예제 #27
0
        public PageBox GetUnit(string AreaNumber, string UnitNumbers, int PageIndex = 1)
        {
            PageBox pageBox  = new PageBox();
            var     unitList = unitServices.GetHost();

            if (AreaNumber != null && AreaNumber != "")
            {
                unitList = unitList.Where(n => n.AreaName.Equals(AreaNumber)).ToList();
            }
            if (UnitNumbers != null && UnitNumbers != "")
            {
                unitList = unitList.Where(n => n.UnitNumber.Contains(UnitNumbers)).ToList();
            }
            pageBox.PageIndex = PageIndex;
            pageBox.PageSize  = PAGESIZE;
            pageBox.PageCount = unitList.Count / PAGESIZE + (unitList.Count % PAGESIZE == 0 ? 0 : 1);
            pageBox.Data      = unitList.Skip((PageIndex - 1) * PAGESIZE).Take(PAGESIZE);
            return(pageBox);
        }
예제 #28
0
        public string Query(string SearchType, int pageIndex, int pageSize, string Values, DateTime?startDate, DateTime?endDate)
        {
            var list       = iUsers_BLL.Query();
            var searchType = SearchType;
            var values     = Values;

            switch (searchType)
            {
            case "1":
                list = list.Where(m => m.UserName.Contains(values)).ToList();
                break;

            case "2":
                list = list.Where(m => m.Phone.Contains(values)).ToList();
                break;

            case "3":
                list = list.Where(m => m.Email.Contains(values)).ToList();
                break;

            case "4":
                list = list.Where(m => m.QQ.Contains(values)).ToList();
                break;

            default:
                list = list.ToList();
                break;
            }
            if (!string.IsNullOrWhiteSpace(startDate.ToString()))
            {
                list = list.Where(m => m.CreateDate >= Convert.ToDateTime(startDate)).ToList();
            }
            if (!string.IsNullOrWhiteSpace(endDate.ToString()))
            {
                list = list.Where(m => m.CreateDate <= Convert.ToDateTime(endDate)).ToList();
            }
            PageBox page = new PageBox();

            page.PageIndex = pageIndex;
            page.PageCount = list.Count;
            page.Data      = list.Skip((pageIndex - 1) * pageSize).Take(pageSize);
            return(JsonConvert.SerializeObject(page));
        }
예제 #29
0
        public PageBox GetPumps(string AreaNumber, string PumpNumber, int PageIndex = 1)
        {
            PageBox pageBox  = new PageBox();
            var     pumpList = pumpServices.GetPumps();

            if (AreaNumber != null && AreaNumber != "")
            {
                pumpList = pumpList.Where(n => n.AreaName.Equals(AreaNumber)).ToList();
            }
            if (PumpNumber != null && PumpNumber != "")
            {
                pumpList = pumpList.Where(n => n.PumpNumber.Contains(PumpNumber)).ToList();
            }
            pageBox.PageIndex = PageIndex;
            pageBox.PageSize  = PAGESIZE;
            pageBox.PageCount = pumpList.Count / PAGESIZE + (pumpList.Count % PAGESIZE == 0 ? 0 : 1);
            pageBox.Data      = pumpList.Skip((PageIndex - 1) * PAGESIZE).Take(PAGESIZE);
            return(pageBox);
        }
        public string Query(DateTime?startDate, DateTime?endDate, int pageIndex = 1, int pageSize = 5)
        {
            var list = iContracts_BLL.Query();

            if (!string.IsNullOrWhiteSpace(startDate.ToString()))
            {
                list = list.Where(m => m.CreateDate >= Convert.ToDateTime(startDate)).ToList();
            }
            if (!string.IsNullOrWhiteSpace(endDate.ToString()))
            {
                list = list.Where(m => m.CreateDate <= Convert.ToDateTime(endDate)).ToList();
            }
            PageBox page = new PageBox();

            page.PageIndex = pageIndex;
            page.PageCount = list.Count;
            page.Data      = list.Skip((pageIndex - 1) * pageSize).Take(pageSize);
            return(JsonConvert.SerializeObject(page));
        }