private void BindGrid() { int employeeID = Convert.ToInt32(PrjPub.StudentID); hfEmployeeID.Value = PrjPub.StudentID.ToString(); RandomExamStatisticBLL objBll = new RandomExamStatisticBLL(); IList <RailExam.Model.RandomExamStatistic> objList = objBll.GetErrorItemInfoByEmployeeID(employeeID, DateTime.Today, DateTime.Today); examsGrid.DataSource = objList; examsGrid.DataBind(); }
protected void btnSelect_Click(object sender, EventArgs e) { btnQuery.Enabled = false; int bookID = 0; int chapterID = 0; int typeID = 0; int examID = Convert.ToInt32(ViewState["ExamID"].ToString()); int employeeID = Convert.ToInt32(ViewState["EmployeeID"].ToString()); int orgID = 0; DateTime begin, end; try { begin = Convert.ToDateTime(ddlYearSmall.SelectedValue + "-" + ddlMonthSmall.SelectedValue + "-" + "01"); end = Convert.ToDateTime(ddlYearBig.SelectedValue + "-" + ddlMonthBig.SelectedValue + "-" + "01").AddMonths(1); hfBegin.Value = begin.ToShortDateString(); hfEnd.Value = end.ToShortDateString(); } catch { SessionSet.PageMessage = "日期选择不正确!"; return; } if (rbnBook.Checked) { if (HfBookId.Value == "") { SessionSet.PageMessage = "教材章节不能为空!"; return; } bookID = Convert.ToInt32(HfBookId.Value); chapterID = Convert.ToInt32(HfChapterId.Value); typeID = Convert.ToInt32(HfRangeType.Value); if (PrjPub.CurrentLoginUser.SuitRange == 1) { orgID = -1; } else { orgID = PrjPub.CurrentLoginUser.StationOrgID; } RandomExamStatisticBLL objBll = new RandomExamStatisticBLL(); IList <RailExam.Model.RandomExamStatistic> objList = objBll.GetErrorItemInfo(bookID, chapterID, typeID, examID == 0?-1:examID, begin, end, orgID); examsGrid.DataSource = objList; examsGrid.DataBind(); } else if (rbnExam.Checked) { if (ViewState["ExamID"].ToString() == "0") { SessionSet.PageMessage = "请选择考试!"; return; } bookID = Convert.ToInt32(HfBookId.Value); chapterID = Convert.ToInt32(HfChapterId.Value); typeID = Convert.ToInt32(HfRangeType.Value); if (PrjPub.CurrentLoginUser.SuitRange == 1) { orgID = -1; } else { orgID = PrjPub.CurrentLoginUser.StationOrgID; } RandomExamStatisticBLL objBll = new RandomExamStatisticBLL(); IList <RailExam.Model.RandomExamStatistic> objList = objBll.GetErrorItemInfo(bookID, chapterID, typeID, examID, begin, end, orgID); examsGrid.DataSource = objList; examsGrid.DataBind(); } else if (rbnEmployee.Checked) { if (employeeID == 0) { SessionSet.PageMessage = "请选择学员!"; return; } RandomExamStatisticBLL objBll = new RandomExamStatisticBLL(); IList <RailExam.Model.RandomExamStatistic> objList = objBll.GetErrorItemInfoByEmployeeID(employeeID, begin, end); examsGrid.DataSource = objList; examsGrid.DataBind(); } if (examsGrid.DataSource != null) { Session["dtExamStatistic"] = examsGrid.DataSource; hfIsRef.Value = "true"; } btnQuery.Enabled = true; }