コード例 #1
0
ファイル: StudentData.cs プロジェクト: IOT001/IOT1.0-me
        /// <summary>
        /// 分页获取学生列表
        /// </summary>
        /// <param name="search"></param>
        /// <returns></returns>
        public static PagedList <vw_Students> GetStudentList(StudentListSearchModel search)
        {
            string table = string.Empty, fields = string.Empty, orderby = string.Empty, where = string.Empty; //定义结构

            fields  = @"  * ";                                                                                //输出字段
            table   = @" vw_Students ";                                                                       //表或者视图
            orderby = "ID desc";                                                                              //排序信息
            StringBuilder sb = new StringBuilder();                                                           //构建where条件

            sb.Append(" 1=1 ");
            if (!string.IsNullOrWhiteSpace(search.Name))//姓名
            {
                sb.AppendFormat(" and (Name like '%{0}%' or  BindPhone like '%{0}%' )", search.Name);
            }
            //if (search.CreateTime_end != null && search.CreateTime_start !=null)//时间
            //    sb.AppendFormat(" and CreateTime between '{0}'  and  '{1}'", search.CreateTime_start,search.CreateTime_end);

            if (!string.IsNullOrWhiteSpace(search.CreateTime_start))//开班时间
            {
                sb.AppendFormat(" and CreateTime > = '{0}' ", search.CreateTime_start);
            }
            if (!string.IsNullOrWhiteSpace(search.CreateTime_end))//结束时间
            {
                sb.AppendFormat(" and CreateTime <= '{0}' ", search.CreateTime_end);
            }


            if (!string.IsNullOrWhiteSpace(search.ComCode))//校区
            {
                sb.AppendFormat(" and [ComCode] = '{0}' ", search.ComCode);
            }


            if (!string.IsNullOrWhiteSpace(search.StudentDicItemID))//学员状态
            {
                sb.AppendFormat(" and  StateID = '{0}' ", search.StudentDicItemID);
            }

            where = sb.ToString();
            int allcount = 0;
            var list     = CommonPage <vw_Students> .GetPageList(
                out allcount, table, fields : fields, where : where.Trim(),
                orderby : orderby, pageindex : search.CurrentPage, pagesize : search.PageSize, connect : DBKeys.PRX);

            return(new PagedList <vw_Students>(list, search.CurrentPage, search.PageSize, allcount));
        }
コード例 #2
0
ファイル: StudentController.cs プロジェクト: IOT001/IOT1.0-me
        //
        // GET: /ButtonList/
        /// <summary>
        /// 列表查询
        /// </summary>
        /// <param name="search"></param>
        /// <returns></returns>
        public ActionResult Student(StudentListSearchModel search)
        {
            StudentListViewModel model = new StudentListViewModel();                                                           //页面模型

            model.search             = search;                                                                                 //页面的搜索模型
            model.search.PageSize    = 15;                                                                                     //每页显示
            model.search.CurrentPage = Convert.ToInt32(Request["pageindex"]) <= 0 ? 1 : Convert.ToInt32(Request["pageindex"]); //当前页

            //下拉项
            List <CommonEntity> SourceIL = CommonData.GetDictionaryList(2);//1是字典类型值,仅供测试参考

            model.SourceIL = CommonData.Instance.GetBropDownListData(SourceIL);


            //学员状态下拉项
            List <CommonEntity> StudentSourceIL = CommonData.GetDictionaryList(3);//1是字典类型值,仅供测试参考

            model.StudentSourceIL = CommonData.Instance.GetBropDownListData(StudentSourceIL);



            //分校下拉项
            List <CommonEntity> ComCodeIL = CommonData.Get_SYS_Company_COMP_Code(UserSession.comcode);//分校

            model.ComCodeIL        = CommonData.Instance.GetBropDownListData_Choice(ComCodeIL);
            model.search.ComCodeIL = CommonData.Instance.GetBropDownListData_Choice(ComCodeIL);



            if (UserSession.comcode != null && UserSession.comcode != "1")
            {
                search.ComCode = UserSession.comcode;//默认查询当前分校的人员
            }

            model.Studentlist = StudentData.GetStudentList(search); //填充页面模型数据
            return(View(model));                                    //返回页面模型
        }