/// <summary> /// 是否存在该记录 /// </summary> public bool IsExistsByEPID(long EPID) { QueryExamPaper query = new QueryExamPaper(); query.EPID = EPID; DataTable dt = new DataTable(); int count = 0; dt = GetExamPaper(query, string.Empty, 1, 1, out count); if (count > 0) { return(true); } else { return(false); } }
/// <summary> /// 得到一个对象实体 /// </summary> public Entities.ExamPaper GetExamPaper(long EPID) { QueryExamPaper query = new QueryExamPaper(); query.EPID = EPID; DataTable dt = new DataTable(); int count = 0; dt = GetExamPaper(query, string.Empty, 1, 1, 0, out count); if (count > 0) { return(LoadSingleExamPaper(dt.Rows[0])); } else { return(null); } }
public void BindData() { QueryExamPaper query = new QueryExamPaper(); if (RequestKeywords != "") { query.Name = RequestKeywords; } if (RequestExamCategory != "") { query.ExamCategory = RequestExamCategory; } query.ExamPersonID = BLL.Util.GetLoginUserID(); DataTable dt = BLL.ExamPaper.Instance.GetExamPaperByExamList(query, " eiEndTime desc ", BLL.PageCommon.Instance.PageIndex, PageSize, out RecordCount); repeaterTableList.DataSource = dt; repeaterTableList.DataBind(); litPagerDown.Text = BLL.PageCommon.Instance.LinkStringByPost(BLL.Util.GetUrl(), GroupLength, RecordCount, PageSize, BLL.PageCommon.Instance.PageIndex, 1); int testOverCount; // 考试结束数目(已考) int noTestCount; // 考试正在进行中数目(未考) QueryExamPaper query_testOver = query; query_testOver.TestOverEndTime = "1"; DataTable dt_testOver = BLL.ExamPaper.Instance.GetExamPaperByExamList(query_testOver, "", BLL.PageCommon.Instance.PageIndex, PageSize, out testOverCount); //QueryExamPaper query_noTest = query; //query_noTest.TestOverEndTime = null; //query_noTest.NoTestEndTime = "1"; //DataTable dt_noTest = BLL.ExamPaper.Instance.GetExamPaperByExamList(query_noTest, "", BLL.PageCommon.Instance.PageIndex, PageSize, out noTestCount); noTestCount = RecordCount - testOverCount; hidTestOver.Value = testOverCount.ToString(); hidNoTest.Value = noTestCount.ToString(); }
public DataTable GetExamPaperByExamList(QueryExamPaper query, string order, int currentPage, int pageSize, out int totalCount) { return(Dal.ExamPaper.Instance.GetExamPaperByExamList(query, order, currentPage, pageSize, out totalCount)); }
/// <summary> /// 按照查询条件查询 /// </summary> /// <param name="query">查询条件</param> /// <param name="order">排序</param> /// <param name="currentPage">页号,-1不分页</param> /// <param name="pageSize">每页记录数</param> /// <param name="totalCount">总行数</param> /// <returns>集合</returns> public DataTable GetExamPaper(QueryExamPaper query, string order, int currentPage, int pageSize, out int totalCount) { return(Dal.ExamPaper.Instance.GetExamPaper(query, order, currentPage, pageSize, BLL.Util.GetLoginUserID(), out totalCount)); }
/// <summary> /// 按照查询条件查询 /// </summary> /// <param name="query">查询条件</param> /// <param name="order">排序</param> /// <param name="currentPage">页号,-1不分页</param> /// <param name="pageSize">每页记录数</param> /// <param name="totalCount">总行数</param> /// <returns>集合</returns> public DataTable GetExamPaper(QueryExamPaper query, string order, int currentPage, int pageSize, int loginUserID, out int totalCount) { string where = loginUserID > 0 ? Dal.UserGroupDataRigth.Instance.GetSqlRightstr("ExamPaper", "BGID", "CreaetUserID", loginUserID) : string.Empty; if (query.EPID != Constant.INT_INVALID_VALUE) { where += " AND EPID=" + query.EPID.ToString(); } if (query.Name != Constant.STRING_INVALID_VALUE) { where += " AND Name like '%" + StringHelper.SqlFilter(query.Name.ToString()) + "%'"; } if (query.ECID != Constant.INT_INVALID_VALUE && query.ECID != -1) { where += " AND ECID=" + query.ECID.ToString(); } if (query.ECIDStr != Constant.STRING_INVALID_VALUE) { where += " AND ECID in(" + Dal.Util.SqlFilterByInCondition(query.ECIDStr) + ") "; } if (query.CreateBeginTime != Constant.DATE_INVALID_VALUE) { where += " AND CreateTime >='" + StringHelper.SqlFilter(query.CreateBeginTime.ToString()) + "'"; } if (query.CreateEndTime != Constant.DATE_INVALID_VALUE) { where += " AND CreateTime <='" + StringHelper.SqlFilter(Convert.ToDateTime(query.CreateEndTime).AddDays(1).ToString()) + "'"; } if (query.Status != Constant.STRING_INVALID_VALUE) { where += " AND dbo.GetStatusByEPID(EPID,Status) in(" + Dal.Util.SqlFilterByInCondition(query.Status.ToString()) + ")"; } if (query.CreaetUserID != Constant.STRING_INVALID_VALUE) { where += " AND CreaetUserID in(" + Dal.Util.SqlFilterByInCondition(query.CreaetUserID.ToString()) + ")"; } if (query.BGID != Constant.INT_INVALID_VALUE) { where += " AND BGID=" + query.BGID.ToString(); } //添加数据权限 //string wherePlus = BLL.UserGroupDataRigth.Instance.GetSqlRightstr("KnowledgeLib", "BGID", "CreateUserID", BLL.Util.GetLoginUserID()) + " AND KnowledgeLib.Status!=5 "; DataSet ds; SqlParameter[] parameters = { new SqlParameter("@where", SqlDbType.NVarChar, 40000), new SqlParameter("@order", SqlDbType.NVarChar, 200), new SqlParameter("@pagesize", SqlDbType.Int, 4), new SqlParameter("@indexpage", SqlDbType.Int, 4), new SqlParameter("@totalRecorder", SqlDbType.Int, 4) }; parameters[0].Value = where; parameters[1].Value = order; parameters[2].Value = pageSize; parameters[3].Value = currentPage; parameters[4].Direction = ParameterDirection.Output; ds = SqlHelper.ExecuteDataset(CONNECTIONSTRINGS, CommandType.StoredProcedure, P_EXAMPAPER_SELECT, parameters); totalCount = (int)(parameters[4].Value); return(ds.Tables[0]); }
/// <summary> /// 按照查询条件查询(在线考试列表页使用 lxw) /// </summary> /// <param name="query">查询条件</param> /// <param name="order">排序</param> /// <param name="currentPage">页号,-1不分页</param> /// <param name="pageSize">每页记录数</param> /// <param name="totalCount">总行数</param> /// <returns>集合</returns> public DataTable GetExamPaperByExamList(QueryExamPaper query, string order, int currentPage, int pageSize, out int totalCount) { string where1 = string.Empty; where1 += " AND ei.ExamStartTime<='" + DateTime.Now + "'"; if (query.ExamPersonID != Constant.INT_INVALID_VALUE) { where1 += " AND ePerson.ExamPerSonID=" + query.ExamPersonID; } if (query.ExamCategory != Constant.STRING_INVALID_VALUE) { where1 += " AND ep.ECID IN (" + Dal.Util.SqlFilterByInCondition(query.ExamCategory) + ")"; } if (query.Name != Constant.STRING_INVALID_VALUE) { where1 += " AND ep.Name like '%" + StringHelper.SqlFilter(query.Name.ToString()) + "%'"; } if (query.TestOverEndTime != Constant.STRING_INVALID_VALUE) { where1 += " AND ei.ExamEndTime<'" + DateTime.Now + "'"; } //if (query.NoTestEndTime != Constant.STRING_INVALID_VALUE) //{ // where1 += " AND ei.ExamEndTime>='" + DateTime.Now + "'"; //} string where2 = string.Empty; where2 += " AND muei.MakeUpExamStartTime<='" + DateTime.Now + "'"; if (query.ExamPersonID != Constant.INT_INVALID_VALUE) { where2 += " AND ePerson.ExamPerSonID=" + query.ExamPersonID; } if (query.ExamCategory != Constant.STRING_INVALID_VALUE) { where2 += " AND ep.ECID IN (" + Dal.Util.SqlFilterByInCondition(query.ExamCategory) + ")"; } if (query.Name != Constant.STRING_INVALID_VALUE) { where2 += " AND ep.Name like '%" + StringHelper.SqlFilter(query.Name) + "%'"; } if (query.TestOverEndTime != Constant.STRING_INVALID_VALUE) { where2 += " AND muei.MakeUpExamEndTime<'" + DateTime.Now + "'"; } //if (query.NoTestEndTime != Constant.STRING_INVALID_VALUE) //{ // where2 += " AND muei.MakeUpExamEndTime>='" + DateTime.Now + "'"; //} DataSet ds; SqlParameter[] parameters = { new SqlParameter("@where1", SqlDbType.NVarChar, 40000), new SqlParameter("@where2", SqlDbType.NVarChar, 40000), new SqlParameter("@order", SqlDbType.NVarChar, 200), new SqlParameter("@pagesize", SqlDbType.Int, 4), new SqlParameter("@indexpage", SqlDbType.Int, 4), new SqlParameter("@totalRecorder", SqlDbType.Int, 4) }; parameters[0].Value = where1; parameters[1].Value = where2; parameters[2].Value = order; parameters[3].Value = pageSize; parameters[4].Value = currentPage; parameters[5].Direction = ParameterDirection.Output; ds = SqlHelper.ExecuteDataset(CONNECTIONSTRINGS, CommandType.StoredProcedure, "P_EXAMPAPER_SELECTByExamList", parameters); totalCount = (int)(parameters[5].Value); return(ds.Tables[0]); }