Esempio n. 1
0
        protected void btnOK_Click(object sender, EventArgs e)
        {
            try
            {
                btnOK.Visible = false;
                RandomExamBLL             objBll        = new RandomExamBLL();
                RailExam.Model.RandomExam objRandomExam = objBll.GetExam(Convert.ToInt32(Request.QueryString.Get("examID")));
                //if (objRandomExam.HasTrainClass)
                //{
                //    SessionSet.PageMessage = "²»Äܸ´ÖÆÐÂÔöÅàѵ°à¿¼ÊÔ£¡";
                //    return;
                //}

                if (objRandomExam.IsReset)
                {
                    SessionSet.PageMessage = "²»Äܸ´ÖÆÐÂÔö²¹¿¼¿¼ÊÔ£¡";
                    return;
                }

                if (ViewState["ExamName"].ToString() == txtName.Text.Trim())
                {
                    SessionSet.PageMessage = "¿¼ÊÔÃû³Æ²»ÄÜÓëÔ­¿¼ÊÔÃû³ÆÖظ´£¡";
                    return;
                }

                objBll.AddCopyRandomExam(Convert.ToInt32(Request.QueryString.Get("examID")), txtName.Text);
                Response.Write("<script>top.returnValue='true';top.close();</script>");
            }
            catch
            {
                SessionSet.PageMessage = "¸´ÖÆʧ°Ü£¡";
                btnOK.Visible          = true;
            }
        }
        public void FillContent()
        {
            RandomExamBLL objbll = new RandomExamBLL();

            RailExam.Model.RandomExam obj = objbll.GetExam(Convert.ToInt32(ViewState["ExamID"]));
            int year = obj.BeginTime.Year;

            string strSql = "select * from Random_Exam_Item_" + year + " where Random_Exam_Item_ID=" +
                            ViewState["RandomExamItemID"];
            OracleAccess db = new OracleAccess();
            DataSet      ds = db.RunSqlDataSet(strSql);

            if (ds.Tables[0].Rows.Count > 0)
            {
                Response.Write(ds.Tables[0].Rows[0]["Content"].ToString());
            }
        }
Esempio n. 3
0
        protected void Page_Load(object sender, EventArgs e)
        {
            if (!IsPostBack)
            {
                if (PrjPub.HasEditRight("成绩查询"))
                {
                    HfUpdateRight.Value = "True";
                }
                else
                {
                    HfUpdateRight.Value = "False";
                }

                if (PrjPub.HasDeleteRight("新增考试") && PrjPub.IsServerCenter && PrjPub.CurrentLoginUser.IsAdmin && PrjPub.CurrentLoginUser.UseType == 0)
                {
                    hfDeleteRight.Value = "True";
                }
                else
                {
                    hfDeleteRight.Value = "False";
                }

                //如果是访问路局则只要是有成绩查询权限的用户均可以访问成绩查询页面
                if (PrjPub.IsServerCenter)
                {
                    hfIsAdmin.Value = "True";
                }
                //如果是访问路局则非本站段的用户不能访问成绩查询页面
                else
                {
                    hfOrgID.Value = ConfigurationManager.AppSettings["StationID"].ToString();
                    if ((PrjPub.CurrentLoginUser.StationOrgID.ToString() == hfOrgID.Value) || PrjPub.CurrentLoginUser.UseType == 0)
                    {
                        hfIsAdmin.Value = "True";
                    }
                    else
                    {
                        hfIsAdmin.Value = "False";
                    }
                }

                dateStartDateTime.DateValue = DateTime.Today.Year + "-" + DateTime.Today.Month + "-01";
                dateEndDateTime.DateValue   = DateTime.Today.ToString("yyyy-MM-dd");

                if (!string.IsNullOrEmpty(Request.QueryString.Get("begin")))
                {
                    dateStartDateTime.DateValue = Request.QueryString.Get("begin");
                }

                if (!string.IsNullOrEmpty(Request.QueryString.Get("end")))
                {
                    dateEndDateTime.DateValue = Request.QueryString.Get("end");
                }

                hfIsServer.Value = PrjPub.IsServerCenter.ToString();
                //hfHasTwoServer.Value = PrjPub.HasTwoServer().ToString();
                //hfIsMainServer.Value = PrjPub.IsMainServer().ToString();

                if (Request.QueryString.Get("Orgid") != "1" && !string.IsNullOrEmpty(Request.QueryString.Get("Orgid")))
                {
                    BindGrid();
                }
            }

            string strDeleteID = Request.Form.Get("DeleteID");

            if (!string.IsNullOrEmpty(strDeleteID))
            {
                RandomExamBLL             examBLL = new RandomExamBLL();
                RailExam.Model.RandomExam obj     = examBLL.GetExam(Convert.ToInt32(strDeleteID));

                if (obj.HasTrainClass)
                {
                    SessionSet.PageMessage = "不能删除有培训班的考试!";
                    BindGrid();
                    return;
                }

                examBLL.DeleteExam(int.Parse(strDeleteID));
                BindGrid();
            }
        }
        protected void Page_Load(object sender, EventArgs e)
        {
            if (!IsPostBack)
            {
                ViewState["RandomExamItemID"] = Request.QueryString.Get("RandomExamItemID");
                ViewState["BookID"]           = Request.QueryString.Get("BookID");
                ViewState["ChapterID"]        = Request.QueryString.Get("ChapterID");
                ViewState["RangeType"]        = Request.QueryString.Get("RangeType");
                ViewState["Begin"]            = Request.QueryString.Get("BeginDate");
                ViewState["End"]        = Request.QueryString.Get("EndDate");
                ViewState["ExamID"]     = Request.QueryString.Get("ExamID");
                ViewState["EmployeeID"] = Request.QueryString.Get("EmployeeID");

                RandomExamBLL             objbll        = new RandomExamBLL();
                RailExam.Model.RandomExam objRandomExam = objbll.GetExam(Convert.ToInt32(ViewState["ExamID"]));
                int year = objRandomExam.BeginTime.Year;

                string strSql = "select a.*,GetBookChapterName(Chapter_ID) ChapterName from Random_Exam_Item_" + year + @" a
                            where Random_Exam_Item_ID=" +
                                ViewState["RandomExamItemID"];
                OracleAccess db = new OracleAccess();
                DataSet      ds = db.RunSqlDataSet(strSql);
                if (ds.Tables[0].Rows.Count > 0)
                {
                    lblBookChapter.Text = ds.Tables[0].Rows[0]["ChapterName"].ToString();
                }

                int itemID     = Convert.ToInt32(ViewState["RandomExamItemID"].ToString());
                int bookID     = Convert.ToInt32(ViewState["BookID"].ToString());
                int chapterID  = Convert.ToInt32(ViewState["ChapterID"].ToString());
                int typeID     = Convert.ToInt32(ViewState["RangeType"].ToString());
                int examID     = Convert.ToInt32(ViewState["ExamID"].ToString());
                int employeeID = Convert.ToInt32(ViewState["EmployeeID"].ToString());

                RandomExamStatisticBLL objBll = new RandomExamStatisticBLL();
                IList <RailExam.Model.RandomExamStatistic> objList = null;
                if (typeID != 0 && employeeID == 0)
                {
                    int orgID = -1;
                    if (PrjPub.CurrentLoginUser.SuitRange == 1)
                    {
                        orgID = -1;
                    }
                    else
                    {
                        orgID = PrjPub.CurrentLoginUser.StationOrgID;
                    }

                    DateTime begin = Convert.ToDateTime(ViewState["Begin"].ToString());
                    DateTime end   = Convert.ToDateTime(ViewState["End"].ToString());
                    objList = objBll.GetErrorItemInfoByItemID(bookID, chapterID, typeID, examID, begin, end, orgID, -1, itemID);
                }
                else if (typeID == 0 && employeeID == 0)
                {
                    objList = objBll.GetErrorItemInfoByItemID(bookID, chapterID, typeID, examID, DateTime.Today, DateTime.Today, -1, -1, itemID);
                }
                else if (employeeID != 0)
                {
                    objList = objBll.GetErrorItemInfoByItemID(bookID, chapterID, typeID, examID, DateTime.Today, DateTime.Today, -1, employeeID, itemID);
                }

                foreach (RailExam.Model.RandomExamStatistic statistic in objList)
                {
                    if (statistic.Answer != "")
                    {
                        string[] str = statistic.Answer.Split('|');

                        string strAnswer = string.Empty;
                        for (int i = 0; i < str.Length; i++)
                        {
                            strAnswer += strAnswer == string.Empty ? intToString(Convert.ToInt32(str[i]) + 1) : "|" + intToString(Convert.ToInt32(str[i]) + 1);
                        }

                        statistic.Answer = strAnswer;
                    }

                    if (statistic.StandardAnswer != "")
                    {
                        string[] str = statistic.StandardAnswer.Split('|');

                        string strAnswer = string.Empty;
                        for (int i = 0; i < str.Length; i++)
                        {
                            strAnswer += strAnswer == string.Empty ? intToString(Convert.ToInt32(str[i]) + 1) : "|" + intToString(Convert.ToInt32(str[i]) + 1);
                        }

                        statistic.StandardAnswer = strAnswer;
                    }
                }

                examsGrid.DataSource = objList;
                examsGrid.DataBind();
            }
        }
        public void FillAnswer()
        {
            RandomExamBLL objbll = new RandomExamBLL();

            RailExam.Model.RandomExam obj = objbll.GetExam(Convert.ToInt32(ViewState["ExamID"]));
            int year = obj.BeginTime.Year;

            string strSql = "select * from Random_Exam_Item_" + year + " where Random_Exam_Item_ID=" +
                            ViewState["RandomExamItemID"];
            OracleAccess db = new OracleAccess();
            DataSet      ds = db.RunSqlDataSet(strSql);

            if (ds.Tables[0].Rows.Count == 0)
            {
                return;
            }

            DataRow dr = ds.Tables[0].Rows[0];

            Response.Write("<table class='contentTable'>");

            if (Convert.ToInt32(dr["Type_ID"].ToString()) == 2)              //¶àÑ¡
            {
                string[] strAnswer = dr["Select_Answer"].ToString().Split(new char[] { '|' });
                for (int n = 0; n < strAnswer.Length; n++)
                {
                    string strN    = intToString(n + 1);
                    string strij   = n.ToString();
                    string strName = n.ToString();

                    if (("|" + dr["Standard_Answer"] + "|").IndexOf("|" + n + "|") != -1)
                    {
                        Response.Write(
                            "<tr><td>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; <input type='checkbox' checked='checked' id='Answer" +
                            strij + "' name='Answer" + strName + "' disabled='disabled' > " + strN + "." + strAnswer[n] +
                            "</td></tr>");
                        lblAnswer.Text = lblAnswer.Text + strN;
                    }
                    else
                    {
                        Response.Write(
                            "<tr><td>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; <input type='checkbox' id='Answer" +
                            strij + "' name='Answer" + strName + "' disabled='disabled' > " + strN + "." + strAnswer[n] +
                            "</td></tr>");
                    }
                }
            }
            else                //µ¥Ñ¡
            {
                string[] strAnswer = dr["Select_Answer"].ToString().Split(new char[] { '|' });
                for (int n = 0; n < strAnswer.Length; n++)
                {
                    string strN    = intToString(n + 1);
                    string strij   = n.ToString();
                    string strName = n.ToString();

                    if (dr["Standard_Answer"].ToString() == n.ToString())
                    {
                        Response.Write(
                            "<tr><td>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; <input  type='Radio' checked='checked' id='RAnswer" +
                            strij + "' name='RAnswer" + strName + "' disabled='disabled'> " + strN + "." + strAnswer[n] +
                            "</td></tr>");
                        lblAnswer.Text = strN;
                    }
                    else
                    {
                        Response.Write(
                            "<tr><td>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; <input type='Radio' id='RAnswer" +
                            strij + "' name='RAnswer" + strName + "' disabled='disabled'> " + strN + "." + strAnswer[n] +
                            "</td></tr>");
                    }
                }
            }
            Response.Write("</table>");
        }
        protected void btnOK_Click(object sender, EventArgs e)
        {
            string        strId  = Request.QueryString.Get("RandomExamID");
            RandomExamBLL objBll = new RandomExamBLL();

            RailExam.Model.RandomExam obj = objBll.GetExam(Convert.ToInt32(strId));

            #region 验证试卷完整性

            /*OracleAccess db = new OracleAccess();
             *
             * //查询本场考试现有生成试卷的总题数(完型填空子题除外)
             *      int beginYear = obj.BeginTime.Year;
             * string strSql =
             * @"select * from Random_Exam_Result_Answer_Cur a
             *          inner join Random_Exam_Item_"+beginYear+@" b on a.Random_Exam_Item_ID=b.Random_Exam_Item_ID
             *          where b.Type_ID<>5 and Random_Exam_Result_ID in (
             *          select Random_Exam_Result_ID from Random_Exam_Result_Current
             *          where Random_Exam_ID=" + strId + ")";
             * DataSet dsAnswer = db.RunSqlDataSet(strSql);
             *
             * //查询本场考试题目个数
             *      strSql = "select Sum(Item_Count) from Random_Exam_Subject where Random_Exam_ID=" + strId;
             * DataSet dsSubject = db.RunSqlDataSet(strSql);
             *      int itemCount = Convert.ToInt32(dsSubject.Tables[0].Rows[0][0]);
             *
             * //查询本服务器所有考生信息
             * strSql = "select a.* from Random_Exam_Arrange_Detail a "
             + " inner join Computer_Room b on a.Computer_Room_ID=b.Computer_Room_ID"
             + " inner join Computer_Server c on c.Computer_server_ID=b.Computer_Server_ID"
             + " where c.Computer_Server_No='" + PrjPub.ServerNo + "' "
             + " and Random_Exam_ID=" + strId;
             + DataSet ds = db.RunSqlDataSet(strSql);
             +      string strChooseID = string.Empty;
             + foreach (DataRow dr in ds.Tables[0].Rows)
             + {
             +  if (string.IsNullOrEmpty(strChooseID))
             +  {
             +      strChooseID += dr["User_Ids"].ToString();
             +  }
             +  else
             +  {
             +      strChooseID += "," + dr["User_Ids"];
             +  }
             + }
             +      int employeeCount = strChooseID.Split(',').Length;
             +
             + if (dsAnswer.Tables[0].Rows.Count != itemCount*employeeCount)
             + {
             +  Response.Write("<script>alert('本场考试试卷生成有误,请联系监考老师删除考试试卷后重新下载后生成!'); top.close();</script>");
             +  return;
             + }*/
            #endregion

            objBll.UpdateStartCode(Convert.ToInt32(strId), PrjPub.ServerNo, txtCode.Text);
            objBll.UpdateIsStart(Convert.ToInt32(strId), PrjPub.ServerNo, 1);

            SystemLogBLL objLogBll = new SystemLogBLL();
            objLogBll.WriteLog("“" + obj.ExamName + "”开始考试");
            Response.Write("<script>top.returnValue='true';top.close();</script>");
        }
Esempio n. 7
0
        protected void Page_Load(object sender, EventArgs e)
        {
            if (!IsPostBack)
            {
                if (PrjPub.HasEditRight("成绩查询"))
                {
                    HfUpdateRight.Value = "True";
                }
                else
                {
                    HfUpdateRight.Value = "False";
                }

                //UseType=0为路局角色
                if (PrjPub.HasDeleteRight("新增考试") && PrjPub.IsServerCenter && PrjPub.CurrentLoginUser.IsAdmin)// && PrjPub.CurrentLoginUser.UseType == 0
                {
                    hfDeleteRight.Value = "True";
                }
                else
                {
                    hfDeleteRight.Value = "False";
                }

                //如果是访问路局则只要是有成绩查询权限的用户均可以访问成绩查询页面
                if (PrjPub.IsServerCenter)
                {
                    hfIsAdmin.Value = "True";
                }
                //如果是访问路局则非本站段的用户不能访问成绩查询页面
                else
                {
                    hfOrgID.Value = ConfigurationManager.AppSettings["StationID"].ToString();
                    if ((PrjPub.CurrentLoginUser.StationOrgID.ToString() == hfOrgID.Value) || PrjPub.CurrentLoginUser.UseType == 0)
                    {
                        hfIsAdmin.Value = "True";
                    }
                    else
                    {
                        hfIsAdmin.Value = "False";
                    }
                }

                hfIsServer.Value = PrjPub.IsServerCenter.ToString();

                //hfWhereCluase.Value = "a.Org_ID=" + Request.QueryString.Get("orgID")
                //        +" and (Save_Status=1 or (Save_Status=2 and sysdate>Save_Date))";
            }

            string strDeleteID = Request.Form.Get("DeleteID");

            if (!string.IsNullOrEmpty(strDeleteID))
            {
                RandomExamBLL             examBLL = new RandomExamBLL();
                RailExam.Model.RandomExam obj     = examBLL.GetExam(Convert.ToInt32(strDeleteID));

                if (obj.HasTrainClass)
                {
                    SessionSet.PageMessage = "不能删除有培训班的考试!";
                    examsGrid.DataBind();
                    return;
                }

                examBLL.DeleteExam(int.Parse(strDeleteID));
                examsGrid.DataBind();
            }
        }