public DataTablesResponse ListDataTablesAjax(DataTablesRequest dtRequest)
        {
            DataTablesResponse dtResponse;
            Int32  recordsTotal, recordsFiltered;
            String whereSql, orderColumn;
            List <ExaminationPaper> ms;


            dtResponse = new DataTablesResponse();

            dtResponse.draw = dtRequest.Draw;

            recordsTotal            = olsEni.ExaminationPapers.Count();
            dtResponse.recordsTotal = recordsTotal;


            //TODO:指定筛选条件
            whereSql = "";
            foreach (var col in dtRequest.Columns)
            {
                if ("" != col.Name)
                {
                    whereSql += col.Name + "||";
                }
            }

            //TODO:指定排序列
            orderColumn = dtRequest.Columns[dtRequest.OrderColumn].Name;

            ms =
                olsEni
                .ExaminationPapers
                .OrderBy(model => model.EP_Id)
                .Where(model =>
                       model.EP_UserName.Contains(dtRequest.SearchValue) &&
                       model.EP_Status != (Byte)Status.Delete)
                .ToList();

            recordsFiltered            = ms.Count();
            dtResponse.recordsFiltered = recordsFiltered;

            if (-1 != dtRequest.Length)
            {
                ms =
                    ms
                    .Skip(dtRequest.Start).Take(dtRequest.Length)
                    .ToList();
            }

            dtResponse.data = ms;

            return(dtResponse);
        }
        public DataTablesResponse ListUserDataTablesAjax(DataTablesRequest dtRequest, Int32 eptId)
        {
            DataTablesResponse dtResponse;
            Int32 recordsTotal, recordsFiltered;

            Object[] modelData;
            List <VMExaminationTaskUserStatistic> ms;

            modelData       = GetUserStatistics(dtRequest, eptId);
            ms              = (List <VMExaminationTaskUserStatistic>)modelData[0];
            recordsTotal    = (Int32)modelData[1];
            recordsFiltered = (Int32)modelData[2];

            dtResponse                 = new DataTablesResponse();
            dtResponse.draw            = dtRequest.Draw;
            dtResponse.recordsTotal    = recordsTotal;
            dtResponse.recordsFiltered = recordsFiltered;
            dtResponse.data            = ms;

            return(dtResponse);
        }
示例#3
0
        public DataTablesResponse GetList(List <SqlParameter> sps, String statusFieldName, String[] exceptFields)
        {
            DataTablesResponse dtResponse;
            Int32 recordsTotal, recordsFiltered;

            Object[] modelData;
            List <T> ms;

            modelData       = GetModels(sps, statusFieldName, exceptFields);
            ms              = (List <T>)modelData[0];
            recordsTotal    = (Int32)modelData[1];
            recordsFiltered = (Int32)modelData[2];

            dtResponse                 = new DataTablesResponse();
            dtResponse.draw            = dtRequest.Draw;
            dtResponse.recordsTotal    = recordsTotal;
            dtResponse.recordsFiltered = recordsFiltered;
            dtResponse.data            = ms;

            return(dtResponse);
        }
示例#4
0
        public DataTablesResponse GetList()
        {
            DataTablesResponse dtResponse;
            Int32 recordsTotal, recordsFiltered;

            Object[] modelData;
            List <T> ms;

            modelData       = GetModels(dtRequest);
            ms              = (List <T>)modelData[0];
            recordsTotal    = (Int32)modelData[1];
            recordsFiltered = (Int32)modelData[2];

            dtResponse                 = new DataTablesResponse();
            dtResponse.draw            = dtRequest.Draw;
            dtResponse.recordsTotal    = recordsTotal;
            dtResponse.recordsFiltered = recordsFiltered;
            dtResponse.data            = ms;

            return(dtResponse);
        }
        public DataTablesResponse ListUserDataTablesAjax(DataTablesRequest dtRequest, Int32 eptId)
        {
            DataTablesResponse dtResponse;
            Int32 recordsTotal, recordsFiltered;
            Object[] modelData;
            List<VMExaminationTaskUserStatistic> ms;

            modelData = GetUserStatistics(dtRequest, eptId);
            ms = (List<VMExaminationTaskUserStatistic>)modelData[0];
            recordsTotal = (Int32)modelData[1];
            recordsFiltered = (Int32)modelData[2];

            dtResponse = new DataTablesResponse();
            dtResponse.draw = dtRequest.Draw;
            dtResponse.recordsTotal = recordsTotal;
            dtResponse.recordsFiltered = recordsFiltered;
            dtResponse.data = ms;

            return dtResponse;
        }
        public DataTablesResponse ListDataTablesAjax(DataTablesRequest dtRequest)
        {
            DataTablesResponse dtResponse;
            Int32 recordsTotal, recordsFiltered;
            String whereSql, orderColumn;
            List<ExaminationPaper> ms;

            dtResponse = new DataTablesResponse();

            dtResponse.draw = dtRequest.Draw;

            recordsTotal = olsEni.ExaminationPapers.Count();
            dtResponse.recordsTotal = recordsTotal;

            //TODO:指定筛选条件
            whereSql = "";
            foreach (var col in dtRequest.Columns)
            {

                if ("" != col.Name)
                {

                    whereSql += col.Name + "||";
                }
            }

            //TODO:指定排序列
            orderColumn = dtRequest.Columns[dtRequest.OrderColumn].Name;

            ms =
                olsEni
                .ExaminationPapers
                .OrderBy(model => model.EP_Id)
                .Where(model =>
                    model.EP_UserName.Contains(dtRequest.SearchValue)
                    && model.EP_Status != (Byte)Status.Delete)
                .ToList();

            recordsFiltered = ms.Count();
            dtResponse.recordsFiltered = recordsFiltered;

            if (-1 != dtRequest.Length)
            {
                ms =
                    ms
                    .Skip(dtRequest.Start).Take(dtRequest.Length)
                    .ToList();
            }

            dtResponse.data = ms;

            return dtResponse;
        }
        public DataTablesResponse ListDataTablesAjax(DataTablesRequest dtRequest, Int32 uId, Byte type, Byte paperTemplateStatus)
        {
            DataTablesResponse dtResponse;
            Int32 recordsTotal, recordsFiltered;
            String orderColumn;
            Object[] modelData;

            dtResponse = new DataTablesResponse();

            dtResponse.draw = dtRequest.Draw;

            recordsTotal = olsEni.ExaminationPaperTemplates.Count();
            dtResponse.recordsTotal = recordsTotal;

            orderColumn = dtRequest.Columns[dtRequest.OrderColumn].Name;

            modelData = GetModels(dtRequest, uId, type, paperTemplateStatus);

            recordsFiltered = (Int32)modelData[0];
            dtResponse.recordsFiltered = recordsFiltered;

            dtResponse.data = (List<ExaminationPaperTemplate>)modelData[1];

            return dtResponse;
        }
        public DataTablesResponse ListDataTablesAjax(DataTablesRequest dtRequest, Int32 etId)
        {
            DataTablesResponse dtResponse;
            Int32 recordsTotal, recordsFiltered;
            String whereSql, orderColumn;
            List<ExaminationPaperTemplate> ms;
            ExaminationTask et;

            // 获取练习模板列表数据
            et = olsEni.ExaminationTasks.Single(m => m.ET_Id == etId);

            if (et.ET_Type == (Byte)ExaminationTaskType.Exercise)
            {
                return ListDataTablesAjaxStudent(etId, dtRequest, (Byte)ExaminationTaskType.Exercise, 2 /* 2:已考完 */);
            }

            dtResponse = new DataTablesResponse();

            dtResponse.draw = dtRequest.Draw;

            recordsTotal = olsEni.ExaminationPaperTemplates.Count();
            dtResponse.recordsTotal = recordsTotal;

            //TODO:指定筛选条件
            whereSql = "";
            foreach (var col in dtRequest.Columns)
            {

                if ("" != col.Name)
                {

                    whereSql += col.Name + "||";
                }
            }

            //TODO:指定排序列
            orderColumn = dtRequest.Columns[dtRequest.OrderColumn].Name;

            ms =
                olsEni
                .ExaminationPaperTemplates
                .OrderBy(model => model.EPT_Id)
                .Where(model =>
                    model.EPT_Status != (Byte)Status.Delete
                    && model.ET_Id == etId)
                .ToList();

            recordsFiltered = ms.Count();
            dtResponse.recordsFiltered = recordsFiltered;

            if (-1 != dtRequest.Length)
            {
                ms =
                    ms
                    .Skip(dtRequest.Start).Take(dtRequest.Length)
                    .ToList();
            }

            foreach (var m1 in ms)
            {
                m1.ET_Name = olsEni.ExaminationTasks.Single(m => m.ET_Id == m1.ET_Id).ET_Name;
            }

            dtResponse.data = ms;

            return dtResponse;
        }
        public DataTablesResponse ListDataTablesAjax(DataTablesRequest dtRequest, Int32 etId)
        {
            DataTablesResponse dtResponse;
            Int32  recordsTotal, recordsFiltered;
            String whereSql, orderColumn;
            List <ExaminationPaperTemplate> ms;
            ExaminationTask et;

            // 获取练习模板列表数据
            et = olsEni.ExaminationTasks.Single(m => m.ET_Id == etId);

            if (et.ET_Type == (Byte)ExaminationTaskType.Exercise)
            {
                return(ListDataTablesAjaxStudent(etId, dtRequest, (Byte)ExaminationTaskType.Exercise, 2 /* 2:已考完 */));
            }

            dtResponse = new DataTablesResponse();

            dtResponse.draw = dtRequest.Draw;

            recordsTotal            = olsEni.ExaminationPaperTemplates.Count();
            dtResponse.recordsTotal = recordsTotal;


            //TODO:指定筛选条件
            whereSql = "";
            foreach (var col in dtRequest.Columns)
            {
                if ("" != col.Name)
                {
                    whereSql += col.Name + "||";
                }
            }

            //TODO:指定排序列
            orderColumn = dtRequest.Columns[dtRequest.OrderColumn].Name;

            ms =
                olsEni
                .ExaminationPaperTemplates
                .OrderBy(model => model.EPT_Id)
                .Where(model =>
                       model.EPT_Status != (Byte)Status.Delete &&
                       model.ET_Id == etId)
                .ToList();

            recordsFiltered            = ms.Count();
            dtResponse.recordsFiltered = recordsFiltered;

            if (-1 != dtRequest.Length)
            {
                ms =
                    ms
                    .Skip(dtRequest.Start).Take(dtRequest.Length)
                    .ToList();
            }

            foreach (var m1 in ms)
            {
                m1.ET_Name = olsEni.ExaminationTasks.Single(m => m.ET_Id == m1.ET_Id).ET_Name;
            }

            dtResponse.data = ms;

            return(dtResponse);
        }