Example #1
0
        private void DownloadStudentInfoExcel()
        {
            string path = Server.MapPath("/RailExamBao/Excel/Excel.xls");

            RandomExamBLL objBll = new RandomExamBLL();

            RailExam.Model.RandomExam objRandomExam = objBll.GetExam(Convert.ToInt32(Request.QueryString.Get("id")));

            if (File.Exists(path))
            {
                FileInfo file = new FileInfo(path);
                this.Response.Clear();
                this.Response.Buffer          = true;
                this.Response.Charset         = "utf-7";
                this.Response.ContentEncoding = Encoding.UTF7;
                // 添加头信息,为"文件下载/另存为"对话框指定默认文件名
                this.Response.AddHeader("Content-Disposition",
                                        "attachment; filename=" + HttpUtility.UrlEncode(objRandomExam.ExamName + "参加考试学员名单") +
                                        ".xls");
                // 添加头信息,指定文件大小,让浏览器能够显示下载进度
                this.Response.AddHeader("Content-Length", file.Length.ToString());

                // 指定返回的是一个不能被客户端读取的流,必须被下载
                this.Response.ContentType = "application/ms-excel";

                // 把文件流发送到客户端
                this.Response.WriteFile(file.FullName);
            }
        }
        protected void FillPage(string strExamId)
        {
            RandomExamBLL randomExamBLL = new RandomExamBLL();

            RailExam.Model.RandomExam randomExam = randomExamBLL.GetExam(int.Parse(strExamId));

            if (randomExam != null)
            {
                ViewState["Year"] = randomExam.BeginTime.Year.ToString();
                lblTitle.Text     = randomExam.ExamName;
            }

            RandomExamSubjectBLL randomExamSubjectBLL = new RandomExamSubjectBLL();
            IList <RailExam.Model.RandomExamSubject> RandomExamSubjects = randomExamSubjectBLL.GetRandomExamSubjectByRandomExamId(int.Parse(strExamId));

            int     nItemCount  = 0;
            decimal nTotalScore = 0;

            for (int i = 0; i < RandomExamSubjects.Count; i++)
            {
                nItemCount  += RandomExamSubjects[i].ItemCount;
                nTotalScore += RandomExamSubjects[i].ItemCount * RandomExamSubjects[i].UnitScore;
            }

            // 用于前台JS判断是否完成全部试题
            hfPaperItemsCount.Value = nItemCount.ToString();

            lblTitleRight.Text = "总共" + nItemCount + "题,共 " + nTotalScore + "分";
        }
Example #3
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;
            }
        }
Example #4
0
        protected void Page_Load(object sender, EventArgs e)
        {
            if (!IsPostBack)
            {
                ViewState["mode"]      = Request.QueryString.Get("mode");
                ViewState["startmode"] = Request.QueryString.Get("startmode");

                hfMode.Value = ViewState["mode"].ToString();

                if (ViewState["mode"].ToString() == "ReadOnly")
                {
                    btnInput.Enabled = false;
                }

                string strId = Request.QueryString.Get("id");
                if (!string.IsNullOrEmpty(strId))
                {
                    HfRandomExamid.Value = strId;
                    RandomExamBLL             randomExamBLL = new RandomExamBLL();
                    RailExam.Model.RandomExam RandomExam    = randomExamBLL.GetExam(int.Parse(strId));
                    if (RandomExam != null)
                    {
                        txtPaperName.Text = RandomExam.ExamName;
                    }


                    ItemTypeBLL      objTypeBll  = new ItemTypeBLL();
                    IList <ItemType> objTypeList = objTypeBll.GetItemTypes();
                    foreach (ItemType objType in objTypeList)
                    {
                        if (RandomExam.IsComputerExam)
                        {
                            if (objType.ItemTypeId > PrjPub.ITEMTYPE_FILLBLANKDETAIL)
                            {
                                continue;
                            }
                        }

                        ListItem item = new ListItem();
                        item.Text  = objType.TypeName;
                        item.Value = objType.ItemTypeId.ToString();
                        lbType.Items.Add(item);
                    }

                    Grid1.DataBind();
                }
            }
            else
            {
                string strDeleteID = Request.Form.Get("DeleteID");
                if (!string.IsNullOrEmpty(strDeleteID))
                {
                    int nID = Int32.Parse(strDeleteID);
                    RandomExamSubjectBLL RandomExamSubjectBLL = new RandomExamSubjectBLL();
                    RandomExamSubjectBLL.DeleteRandomExamSubject(nID);
                    Grid1.DataBind();
                }
            }
        }
        private void BindBookTree()
        {
            string        strId  = Request.QueryString.Get("id");
            RandomExamBLL objBll = new RandomExamBLL();

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


            BookBLL bookBLL = new BookBLL();
            IList <RailExam.Model.Book> bookList = null;

            string strPostID = objRandomExam.PostID;

            string[] str    = strPostID.Split(',');
            int      orgID  = PrjPub.CurrentLoginUser.OrgID;
            int      leader = objRandomExam.IsGroupLeader;
            int      techID = objRandomExam.TechnicianTypeID;

            PostBLL   objPostBll = new PostBLL();
            Hashtable htBook     = new Hashtable();

            for (int i = 0; i < str.Length; i++)
            {
                int          postID      = Convert.ToInt32(str[i]);
                IList <Post> objPostList = objPostBll.GetPostsByParentID(postID);
                if (objPostList.Count > 0)
                {
                    continue;
                }

                bookList = bookBLL.GetEmployeeStudyBookInfoByKnowledgeID(-1, orgID, postID, leader, techID, 0);

                if (bookList.Count > 0)
                {
                    TreeViewNode tvn = null;

                    foreach (RailExam.Model.Book book in bookList)
                    {
                        if (!htBook.ContainsKey(book.bookId))
                        {
                            tvn       = new TreeViewNode();
                            tvn.ID    = book.bookId.ToString();
                            tvn.Value = book.bookId.ToString();
                            //int n = objItemBll.GetItemsByBookID(book.bookId, Convert.ToInt32(strItemTypeID));
                            tvn.Text    = book.bookName;
                            tvn.ToolTip = book.bookName;
                            tvn.Attributes.Add("isBook", "true");
                            tvn.ImageUrl           = "/RailExamBao/App_Themes/" + StyleSheetTheme + "/Images/TreeView/Book.gif";
                            tvn.ContentCallbackUrl = "/RailExamBao/Common/GetBookChapter.aspx?itemTypeID=1&item=no&id=" +
                                                     book.bookId;

                            tvBookChapter.Nodes.Add(tvn);

                            htBook.Add(book.bookId, book.bookName);
                        }
                    }
                }
            }
        }
Example #6
0
        protected void btnOK_Click(object sender, EventArgs e)
        {
            List <string> lst     = new List <string>();
            List <string> lstName = new List <string>();

            foreach (DataRow dr in dtAll.Rows)
            {
                if (usersDic.ContainsKey(dr["Random_Exam_ID"].ToString()))
                {
                    if (usersDic[dr["Random_Exam_ID"].ToString()])
                    {
                        lst.Add(dr["Random_Exam_ID"].ToString());
                    }
                }
            }

            foreach (GridViewRow r in grdEntity.Rows)
            {
                System.Web.UI.HtmlControls.HtmlGenericControl spanID =
                    (System.Web.UI.HtmlControls.HtmlGenericControl)r.FindControl("spanID");
                CheckBox currentCbx   = r.FindControl("item") as CheckBox;
                string   currentValue = spanID.InnerText;
                if (currentValue != "" && currentCbx.Checked && !lst.Contains(spanID.InnerText))
                {
                    lst.Add(spanID.InnerText);
                }
            }

            hfid.Value = string.Join("|", lst.ToArray());

            if (string.IsNullOrEmpty(hfid.Value))
            {
                SessionSet.PageMessage = "请至少选择一个考试!";
                return;
            }

            string[]      str    = hfid.Value.Split('|');
            RandomExamBLL objBll = new RandomExamBLL();

            string strName = string.Empty;

            for (int i = 0; i < str.Length; i++)
            {
                string examName = objBll.GetExam(Convert.ToInt32(str[i])).ExamName;

                if (strName == string.Empty)
                {
                    strName = examName;
                }
                else
                {
                    strName += "|" + examName;
                }
            }

            hfid.Value = hfid.Value + "$" + strName;

            ClientScript.RegisterClientScriptBlock(GetType(), "", "window.returnValue = '" + hfid.Value + "';window.close();", true);
        }
        protected void btnOK_Click(object sender, EventArgs e)
        {
            //获取当前考试的生成试卷的状态和次数
            RandomExamBLL objBll = new RandomExamBLL();

            RailExam.Model.RandomExam obj = objBll.GetExam(Convert.ToInt32(ViewState["ExamID"].ToString()));

            string strSql = "select * from Random_Exam_Computer_Server where Random_Exam_ID=" + ViewState["ExamID"].ToString()
                            + " and Computer_Server_No=" + PrjPub.ServerNo;
            OracleAccess db = new OracleAccess();
            DataRow      dr = db.RunSqlDataSet(strSql).Tables[0].Rows[0];

            if (txtCode.Text != dr["Random_Exam_Code"].ToString())
            {
                SessionSet.PageMessage = "验证码输入有误,请重新输入!";
                txtCode.Text           = "";
                return;
            }

            //获取当前考生即将考试的试卷
            string strIP = Pub.GetRealIP();
            RandomExamResultCurrentBLL objResultCurrentBll = new RandomExamResultCurrentBLL();

            RailExam.Model.RandomExamResultCurrent objResultCurrent =
                objResultCurrentBll.GetNowRandomExamResultInfo(Convert.ToInt32(ViewState["StudentID"].ToString()),
                                                               Convert.ToInt32(ViewState["ExamID"].ToString()));

            ViewState["CurrentID"] = objResultCurrent.RandomExamResultId;
            //objResultCurrentBll.UpdateRandomExamResultCurrentIP(Convert.ToInt32(ViewState["CurrentID"].ToString()), strIP);

            RandomExamApplyBLL objApplyBll = new RandomExamApplyBLL();
            RandomExamApply    objNowApply = objApplyBll.GetRandomExamApplyByExamResultCurID(objResultCurrent.RandomExamResultId);

            if (objNowApply.RandomExamApplyID == 0)
            {
                RandomExamApply objApply = new RandomExamApply();
                objApply.RandomExamResultCurID = Convert.ToInt32(ViewState["CurrentID"].ToString());
                objApply.RandomExamID          = Convert.ToInt32(ViewState["ExamID"].ToString());
                objApply.CodeFlag    = txtCode.Text == dr["Random_Exam_Code"].ToString();
                objApply.ApplyStatus = 0;
                objApply.IPAddress   = strIP;
                hfID.Value           = objApplyBll.AddRandomExamApply(objApply).ToString();
            }
            else
            {
                objNowApply.CodeFlag    = txtCode.Text == dr["Random_Exam_Code"].ToString();
                objNowApply.ApplyStatus = 0;
                objNowApply.IPAddress   = Pub.GetRealIP();
                objApplyBll.UpdateRandomExamApply(objNowApply);
                hfID.Value = objNowApply.RandomExamApplyID.ToString();
            }

            lblApply.Text    = "已提交考试请求,请等待回复......";
            btnClose.Visible = true;
            btnOK.Visible    = false;
            lblTitle.Visible = false;
            txtCode.Visible  = false;
            img.Visible      = true;
        }
Example #8
0
 protected void Page_Load(object sender, EventArgs e)
 {
     if (!IsPostBack)
     {
         RandomExamBLL objBll = new RandomExamBLL();
         txtName.Text          = objBll.GetExam(Convert.ToInt32(Request.QueryString.Get("examID"))).ExamName;
         ViewState["ExamName"] = txtName.Text;
     }
 }
        protected void Page_Load(object sender, EventArgs e)
        {
            if (!IsPostBack)
            {
                RandomExamBLL             objBll = new RandomExamBLL();
                RailExam.Model.RandomExam obj    = objBll.GetExam(Convert.ToInt32(Request.QueryString.Get("examID")));

                hfName.Value = obj.ExamName;
            }
        }
Example #10
0
        protected void FillHeading(string strId, string orgid)
        {
            RandomExamResultCurrentBLL randomExamResultBLL = new RandomExamResultCurrentBLL();
            RandomExamResultCurrent    randomExamResult    = new RandomExamResultCurrent();

            randomExamResult = randomExamResultBLL.GetRandomExamResult(int.Parse(strId));

            string strOrgName     = randomExamResult.OrganizationName;
            string strStationName = "";
            string strOrgName1    = "";
            int    n = strOrgName.IndexOf("-");

            if (n != -1)
            {
                strStationName = strOrgName.Substring(0, n);
                strOrgName1    = strOrgName.Substring(n + 1);
            }
            else
            {
                strStationName = strOrgName;
                strOrgName1    = "";
            }

            lblOrg.Text      = strStationName;
            lblWorkShop.Text = strOrgName1;
            lblPost.Text     = randomExamResult.PostName;
            lblName.Text     = randomExamResult.ExamineeName;
            lblTime.Text     = randomExamResult.BeginDateTime.ToString("yyyy-MM-dd HH:mm");
            lblScore.Text    = System.String.Format("{0:0.##}", randomExamResult.Score);

            int           RandomExamId  = randomExamResult.RandomExamId;
            RandomExamBLL randomExamBLL = new RandomExamBLL();

            RailExam.Model.RandomExam randomExam = randomExamBLL.GetExam(RandomExamId);

            if (randomExam != null)
            {
                lblTitle.Text = randomExam.ExamName;
            }

            RandomExamSubjectBLL randomExamSubjectBLL = new RandomExamSubjectBLL();
            IList <RailExam.Model.RandomExamSubject> RandomExamSubjects = randomExamSubjectBLL.GetRandomExamSubjectByRandomExamId(RandomExamId);

            int     nItemCount  = 0;
            decimal nTotalScore = 0;

            for (int i = 0; i < RandomExamSubjects.Count; i++)
            {
                nItemCount  += RandomExamSubjects[i].ItemCount;
                nTotalScore += RandomExamSubjects[i].ItemCount * RandomExamSubjects[i].UnitScore;
            }

            lblTitleRight.Text = "总共" + nItemCount + "题,共" + System.String.Format("{0:0.##}", nTotalScore) + "分";
        }
        protected void Page_Load(object sender, EventArgs e)
        {
            if (!IsPostBack && !CallBack1.IsCallback)
            {
                string strExamId = Request.QueryString.Get("id");
                ViewState["BeginTime"] = DateTime.Now.ToString();
                ViewState["StudentID"] = Request.QueryString.Get("employeeID");

                if (strExamId != null && strExamId != "")
                {
                    RandomExamBLL             randomExamBLL = new RandomExamBLL();
                    RailExam.Model.RandomExam randomExam    = randomExamBLL.GetExam(int.Parse(strExamId));

                    #region 考前判断(屏蔽)
                    //if (randomExam.StartMode == 2 && randomExam.OrgId.ToString() != ConfigurationManager.AppSettings["StationID"].ToString() && randomExam.OrgId != 32)
                    //{
                    //    OrganizationBLL OrgBll = new OrganizationBLL();
                    //    string strOrgName = OrgBll.GetOrganization(randomExam.OrgId).ShortName;
                    //    Response.Write("<script>alert('该考试为" + strOrgName + "统一时间考试,必须在" + strOrgName + "参加!'); top.window.close();</script>");
                    //    return;
                    //}
                    ////如果当前考试为手动控制,则需判断考试是否开始
                    //if (randomExam.StartMode == 2 && randomExam.IsStart == 0)
                    //{
                    //    Response.Write("<script>alert('该考试还没有开始,请耐心等待!'); top.window.close();</script>");
                    //    return;
                    //}
                    //if (randomExam.StartMode == 2 && randomExam.IsStart == 2)
                    //{
                    //    Response.Write("<script>alert('该考试已经结束!'); top.window.close();</script>");
                    //    return;
                    //}
                    #endregion

                    HiddenFieldExamTime.Value = DateTime.Now.AddMinutes(randomExam.ExamTime).ToString();
                    HfExamTime.Value          = (randomExam.ExamTime * 60).ToString();

                    //获取当前考生最新需要做的考试试卷主表记录
                    RandomExamResultCurrentBLL             objResultCurrentBll = new RandomExamResultCurrentBLL();
                    RailExam.Model.RandomExamResultCurrent objResultCurrent    =
                        objResultCurrentBll.GetNowRandomExamResultInfo(Convert.ToInt32(ViewState["StudentID"].ToString()),
                                                                       Convert.ToInt32(strExamId));
                    //设置当前考生本次考试还剩下的考试时间
                    HfExamTime.Value = ((randomExam.ExamTime * 60) - objResultCurrent.ExamTime).ToString();
                    FillPage(strExamId);
                }
            }
        }
        protected void Page_Load(object sender, EventArgs e)
        {
            if (!IsPostBack)
            {
                string employeeId = Request.QueryString.Get("employeeId");
                string examId     = Request.QueryString.Get("examId");

                RandomExamBLL randomBll = new RandomExamBLL();
                lblExam.Text = randomBll.GetExam(Convert.ToInt32(examId)).ExamName;

                string strSql = "select GetOrgName(GetStationOrgID(org_id)) StationOrgName,"
                                + "GetWorkShopName(org_id) WorkShopName,b.Post_Name,a.* from employee a"
                                + " inner join Post b on a.Post_ID=b.Post_ID "
                                + " where Employee_ID=" + employeeId;

                OracleAccess db = new OracleAccess();
                DataRow      dr = db.RunSqlDataSet(strSql).Tables[0].Rows[0];

                lblName.Text         = dr["Employee_Name"].ToString();
                lblSex.Text          = dr["Sex"].ToString();
                lblOrgName.Text      = dr["StationOrgName"].ToString();
                lblWorkShop.Text     = dr["WorkShopName"].ToString();
                lblPost.Text         = dr["Post_Name"].ToString();
                lblIdentityCard.Text = dr["Identity_CardNo"].ToString();
                lblPostNo.Text       = dr["Work_No"].ToString();

                DataSet ds = Pub.GetPhotoDateSet(employeeId);

                if (ds.Tables[0].Rows.Count > 0)
                {
                    if (ds.Tables[0].Rows[0][0] != DBNull.Value)
                    {
                        myImagePhoto.ImageUrl = "/RailExamBao/RandomExamTai/ShowImage.aspx?EmployeeID=" + employeeId;
                    }
                    else
                    {
                        myImagePhoto.ImageUrl = "../../images/empty.jpg";
                    }
                }
                else
                {
                    myImagePhoto.ImageUrl = "../../images/empty.jpg";
                }

                hfEmployeeID.Value = employeeId;
                hfExamID.Value     = examId;
            }
        }
Example #13
0
        protected void btnAddEmployee_Click(object sender, EventArgs e)
        {
            string strId = Request.QueryString.Get("RandomExamID");

            RandomExamBLL objBll = new RandomExamBLL();

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

            if (obj.CreatePerson != PrjPub.CurrentLoginUser.EmployeeName && PrjPub.CurrentLoginUser.RoleID != 362 && PrjPub.CurrentLoginUser.RoleID != 1)
            {
                SessionSet.PageMessage = "您没有添加考生的权限!添加考生只能由出卷人操作。";
                return;
            }

            ClientScript.RegisterStartupScript(GetType(), "jsSelectFirstNode", @"showEmployee(" + (obj.HasTrainClass ?1:0) + ")", 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());
            }
        }
Example #15
0
        protected void btnAll_Click(object sender, EventArgs e)
        {
            btnAll.Enabled = false;
            btnOK.Enabled  = false;
            hfSelect.Value = GetSql();
            OracleAccess db = new OracleAccess();

            dtAll = db.RunSqlDataSet(GetSql()).Tables[0];
            string[] strExam = new string[dtAll.Rows.Count];
            for (int i = 0; i < dtAll.Rows.Count; i++)
            {
                strExam[i] = dtAll.Rows[i]["Random_Exam_ID"].ToString();
            }

            RandomExamBLL objBll = new RandomExamBLL();

            string strID   = string.Empty;
            string strName = string.Empty;

            for (int i = 0; i < strExam.Length; i++)
            {
                string examName = objBll.GetExam(Convert.ToInt32(strExam[i])).ExamName;

                if (strName == string.Empty)
                {
                    strName = examName;
                }
                else
                {
                    strName += "|" + examName;
                }

                if (strID == string.Empty)
                {
                    strID = strExam[i];
                }
                else
                {
                    strID += "|" + strExam[i];
                }
            }

            hfid.Value = strID + "$" + strName;

            ClientScript.RegisterClientScriptBlock(GetType(), "", "window.returnValue = '" + hfid.Value + "';window.close();", true);
        }
        private void GetHashTable()
        {
            string        strId  = Request.QueryString.Get("id");
            RandomExamBLL objBll = new RandomExamBLL();

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


            BookBLL bookBLL = new BookBLL();
            IList <RailExam.Model.Book> bookList = null;

            string strPostID = objRandomExam.PostID;

            string[] str    = strPostID.Split(',');
            int      orgID  = PrjPub.CurrentLoginUser.OrgID;
            int      leader = objRandomExam.IsGroupLeader;
            int      techID = objRandomExam.TechnicianTypeID;

            PostBLL   objPostBll = new PostBLL();
            Hashtable htBook     = new Hashtable();

            for (int i = 0; i < str.Length; i++)
            {
                int          postID      = Convert.ToInt32(str[i]);
                IList <Post> objPostList = objPostBll.GetPostsByParentID(postID);
                if (objPostList.Count > 0)
                {
                    continue;
                }

                bookList = bookBLL.GetEmployeeStudyBookInfoByKnowledgeID(-1, orgID, postID, leader, techID, 0);

                if (bookList.Count > 0)
                {
                    foreach (RailExam.Model.Book book in bookList)
                    {
                        if (!htBook.ContainsKey(book.bookId))
                        {
                            htBook.Add(book.bookId, book.bookName);
                        }
                    }
                }
            }
            _htBook = htBook;
        }
Example #17
0
        private void BindGrid()
        {
            RandomExamBLL objBll = new RandomExamBLL();

            RailExam.Model.RandomExam objExam = objBll.GetExam(Convert.ToInt32(Request.QueryString.Get("eid")));
            if (!objExam.IsComputerExam)
            {
                gradesGrid.Levels[0].Columns[8].Visible  = false;
                gradesGrid.Levels[0].Columns[9].Visible  = false;
                gradesGrid.Levels[0].Columns[10].Visible = true;
                gradesGrid.Levels[0].Columns[12].Visible = false;
            }
            else
            {
                gradesGrid.Levels[0].Columns[8].Visible  = true;
                gradesGrid.Levels[0].Columns[9].Visible  = true;
                gradesGrid.Levels[0].Columns[10].Visible = false;
            }
        }
        protected void FillPage(string strExamId)
        {
            //获取考试基本信息
            RandomExamBLL randomExamBLL = new RandomExamBLL();

            RailExam.Model.RandomExam randomExam = randomExamBLL.GetExam(int.Parse(strExamId));
            if (randomExam != null)
            {
                lblTitle.Text = randomExam.ExamName;
            }

            //获取考试题数和分数
            RandomExamSubjectBLL randomExamSubjectBLL = new RandomExamSubjectBLL();
            IList <RailExam.Model.RandomExamSubject> RandomExamSubjects = randomExamSubjectBLL.GetRandomExamSubjectByRandomExamId(int.Parse(strExamId));
            int     nItemCount  = 0;
            decimal nTotalScore = 0;

            for (int i = 0; i < RandomExamSubjects.Count; i++)
            {
                nItemCount  += RandomExamSubjects[i].ItemCount;
                nTotalScore += RandomExamSubjects[i].ItemCount * RandomExamSubjects[i].UnitScore;
            }

            // 用于前台JS判断是否完成全部试题
            hfPaperItemsCount.Value = nItemCount.ToString();
            lblTitleRight.Text      = "总共" + nItemCount + "题,共" + System.String.Format("{0:0.##}", nTotalScore) + "分";


            string strSql = "select a.*,b.post_name, GetOrgName(a.org_id) as org_name from Employee a "
                            + "  left join post b on a.post_id = b.post_id"
                            + " where a.Employee_ID=" + Request.QueryString.Get("employeeID");
            OracleAccess db = new OracleAccess();

            DataRow dr = db.RunSqlDataSet(strSql).Tables[0].Rows[0];

            lblWorkNo.Text  = dr["Work_No"].ToString();
            lblIDCard.Text  = dr["Identity_CardNo"].ToString();
            lblSex.Text     = dr["Sex"].ToString();
            lblOrgName.Text = dr["org_name"].ToString();
            lblPost.Text    = dr["post_name"].ToString();
            lblName.Text    = dr["Employee_Name"].ToString();
        }
        protected void Callback1_Callback(object sender, CallBackEventArgs e)
        {
            try
            {
                string strId = ViewState["ExamID"].ToString();
                RandomExamResultCurrentBLL             objResultCurrentBll = new RandomExamResultCurrentBLL();
                RailExam.Model.RandomExamResultCurrent objResultCurrent    =
                    objResultCurrentBll.GetRandomExamResult(Convert.ToInt32(ViewState["RandomExamResultID"].ToString()));

                if (objResultCurrent.RandomExamId == 0)
                {
                    hfStart.Value = "2";
                }
                else
                {
                    objResultCurrent.ExamTime = Convert.ToInt32(ViewState["LastExamTime"].ToString()) + GetSecondBetweenTwoDate(DateTime.Now, DateTime.Parse(ViewState["BeginTime"].ToString()));
                    objResultCurrentBll.UpdateRandomExamResultCurrent(objResultCurrent);

                    RandomExamBLL             objBll        = new RandomExamBLL();
                    RailExam.Model.RandomExam objRandomExam = objBll.GetExam(Convert.ToInt32(strId));
                    hfStart.Value = objRandomExam.IsStart.ToString();
                }

                if (hfStart.Value == "2")
                {
                    RandomExamResultBLL objResultBll = new RandomExamResultBLL();
                    RandomExamResult    objResult    =
                        objResultBll.GetNewRandomExamResultByExamineeID(Convert.ToInt32(ViewState["EmployeeID"].ToString()),
                                                                        Convert.ToInt32(strId));

                    hfResultID.Value = objResult.RandomExamResultId.ToString();
                }
            }
            catch
            {
                hfStart.Value = "-1";
            }

            hfResultID.RenderControl(e.Output);
            hfStart.RenderControl(e.Output);
        }
Example #20
0
        protected void btnEnd_Click(object sender, EventArgs e)
        {
            string strId = Request.QueryString.Get("RandomExamID");

            if (string.IsNullOrEmpty(strId))
            {
                SessionSet.PageMessage = "缺少参数!";
                return;
            }
            //获取当前考试的生成试卷的状态和次数
            RandomExamBLL objBll = new RandomExamBLL();

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


            RandomExamComputerServerBLL serverBll = new RandomExamComputerServerBLL();
            RandomExamComputerServer    server    = serverBll.GetRandomExamComputerServer(objExam.RandomExamId,
                                                                                          PrjPub.ServerNo);

            if (server.IsStart == 0)
            {
                if (objExam.EndTime >= DateTime.Today)
                {
                    SessionSet.PageMessage = "当前考试还未开始考试!";
                    return;
                }
            }
            else if (server.IsStart == 2)
            {
                SessionSet.PageMessage = "当前考试已经结束!";
                return;
            }

            ClientScript.RegisterStartupScript(GetType(),
                                               "jsSelectFirstNode",
                                               @"EndPaper();",
                                               true);
        }
        protected void Page_Load(object sender, EventArgs e)
        {
            if (!IsPostBack)
            {
                dateBeginTime.DateValue = DateTime.Today.Year.ToString() + "-" + DateTime.Today.Month.ToString("00") +
                                          "-01 09:00:00";
                dateEndTime.DateValue = DateTime.Now.ToString("yyyy-MM-dd HH:mm:ss");
            }

            if (!string.IsNullOrEmpty(hfExamId.Value))
            {
                string[]      str    = hfExamId.Value.Split('|');
                RandomExamBLL objBll = new RandomExamBLL();

                string strName = string.Empty;
                for (int i = 0; i < str.Length; i++)
                {
                    string examName = objBll.GetExam(Convert.ToInt32(str[i])).ExamName;

                    if (strName == string.Empty)
                    {
                        strName = examName;
                    }
                    else
                    {
                        strName += "|" + examName;
                    }
                }

                txtSelectExam.Text = strName;
            }

            if (Request.Form.Get("RefreshExcel") != null && Request.Form.Get("RefreshExcel") != "")
            {
                DownloadExcel(Request.Form.Get("RefreshExcel"));
            }
        }
Example #22
0
        private void DownloadAll(string strType)
        {
            RandomExamBLL objBll = new RandomExamBLL();
            string        strId  = Request.QueryString.Get("eid");

            RailExam.Model.RandomExam obj = objBll.GetExam(int.Parse(strId));
            string filename = "";

            filename = Server.MapPath("/RailExamBao/Excel/" + strType + "/");

            string ZipName = Server.MapPath("/RailExamBao/Excel/Word.zip");

            GzipCompress(filename, ZipName);

            FileInfo file = new FileInfo(ZipName.ToString());

            this.Response.Clear();
            this.Response.Buffer          = true;
            this.Response.Charset         = "utf-7";
            this.Response.ContentEncoding = Encoding.UTF7;
            // 添加头信息,为"文件下载/另存为"对话框指定默认文件名
            if (strType.IndexOf("合格") >= 0)
            {
                this.Response.AddHeader("Content-Disposition", "attachment; filename=" + HttpUtility.UrlEncode(obj.ExamName + "合格试卷") + ".zip");
            }
            else
            {
                this.Response.AddHeader("Content-Disposition", "attachment; filename=" + HttpUtility.UrlEncode(obj.ExamName) + ".zip");
            }
            // 添加头信息,指定文件大小,让浏览器能够显示下载进度
            this.Response.AddHeader("Content-Length", file.Length.ToString());
            // 指定返回的是一个不能被客户端读取的流,必须被下载
            this.Response.ContentType = "application/ms-word";
            // 把文件流发送到客户端
            this.Response.WriteFile(file.FullName);
        }
        protected void Page_Load(object sender, EventArgs e)
        {
            if (!IsPostBack)
            {
                //if (PrjPub.IsServerCenter && PrjPub.CurrentLoginUser.SuitRange != 1)
                //{
                //    HfUpdateRight.Value = "False";
                //    HfDeleteRight.Value = "False";
                //}
                //else
                //{
                //    HfUpdateRight.Value = PrjPub.HasEditRight("新增考试").ToString();
                //    HfDeleteRight.Value = PrjPub.HasDeleteRight("新增考试").ToString();
                //}

                hfRailSystemID.Value = PrjPub.GetRailSystemId().ToString();

                if (PrjPub.CurrentLoginUser == null)
                {
                    Response.Redirect("/RailExamBao/Common/Error.aspx?error=Session过期请重新登录本系统!");
                    return;
                }

                if (PrjPub.CurrentLoginUser.IsAdmin && PrjPub.CurrentLoginUser.UseType == 0)
                {
                    hfIsAdmin.Value = "True";
                }
                else
                {
                    hfIsAdmin.Value = "False";
                }

                if (PrjPub.HasEditRight("新增考试") && PrjPub.IsServerCenter)
                {
                    HfUpdateRight.Value = "True";
                }
                else
                {
                    HfUpdateRight.Value = "False";
                }

                if (PrjPub.HasDeleteRight("新增考试") && PrjPub.IsServerCenter)
                {
                    HfDeleteRight.Value = "True";
                }
                else
                {
                    HfDeleteRight.Value = "False";
                }

                ListItem item = new ListItem();
                item.Value = Session["StationOrgID"].ToString();
                item.Text  = "--请选择--";
                ddlOrg.Items.Add(item);

                if (PrjPub.IsServerCenter && PrjPub.CurrentLoginUser.UseType == 0 && PrjPub.CurrentLoginUser.IsAdmin)
                {
                    ddlOrg.Visible = true;
                    lblOrg.Visible = true;

                    OrganizationBLL      objOrgBll = new OrganizationBLL();
                    IList <Organization> objList   = objOrgBll.GetOrganizationsByLevel(2);
                    foreach (Organization organization in objList)
                    {
                        ListItem litem = new ListItem();
                        litem.Value = organization.OrganizationId.ToString();
                        litem.Text  = organization.ShortName;
                        ddlOrg.Items.Add(litem);
                    }
                }
                else
                {
                    ddlOrg.Visible = false;
                    lblOrg.Visible = false;
                }

                hfOrgID.Value          = PrjPub.CurrentLoginUser.StationOrgID.ToString();
                HfExamCategoryId.Value = Request.QueryString.Get("id");
                Grid1.DataBind();
            }
            else
            {
                string strDeleteID = Request.Form.Get("DeleteID");
                if (!string.IsNullOrEmpty(strDeleteID))
                {
                    //RandomExamResultBLL reBll = new RandomExamResultBLL();
                    //IList<RailExam.Model.RandomExamResult> examResults = reBll.GetRandomExamResultByExamID(int.Parse(strDeleteID));

                    //if (examResults.Count > 0)
                    //{
                    //    SessionSet.PageMessage = "已有考生参加考试,该考试不能被删除!";
                    //    Grid1.DataBind();
                    //    return;
                    //}


                    DeleteData(int.Parse(strDeleteID));
                    Grid1.DataBind();
                }

                if (Request.Form.Get("Refresh") == "true")
                {
                    Grid1.DataBind();
                }

                if (Request.Form.Get("OutPut") != null && Request.Form.Get("OutPut") != string.Empty)
                {
                    OutputWord(Request.Form.Get("OutPut"));
                }

                if (Request.Form.Get("ResetID") != null && Request.Form.Get("ResetID") != string.Empty)
                {
                    Grid1.DataBind();
                }

                if (Request.Form.Get("arrangeID") != null && Request.Form.Get("arrangeID") != string.Empty)
                {
                    string                    strId   = Request.Form.Get("arrangeID");
                    RandomExamBLL             objBll  = new RandomExamBLL();
                    RailExam.Model.RandomExam objExam = objBll.GetExam(Convert.ToInt32(strId));

                    //if(objExam.HasPaper)
                    //{
                    //    SessionSet.PageMessage = "该考试已经生成试卷,不能重新安排微机教室!";
                    //    Grid1.DataBind();
                    //    return;
                    //}

                    if (!PrjPub.IsServerCenter)
                    {
                        Grid1.DataBind();
                        return;
                    }

                    if (PrjPub.CurrentLoginUser.RoleID != 1)
                    {
                        OracleAccess              db          = new OracleAccess();
                        RandomExamArrangeBLL      arrangeBll  = new RandomExamArrangeBLL();
                        IList <RandomExamArrange> arrangeList = arrangeBll.GetRandomExamArranges(Convert.ToInt32(strId));

                        if (arrangeList.Count == 0)
                        {
                            SessionSet.PageMessage = "该考试还未选择考生,不能安排微机教室!";
                            Grid1.DataBind();
                            return;
                        }

                        RandomExamArrange arrange = arrangeList[0];

                        bool            hasOrg      = false;
                        string[]        str         = arrange.UserIds.Split(',');
                        EmployeeBLL     employeebll = new EmployeeBLL();
                        OrganizationBLL orgBll      = new OrganizationBLL();
                        for (int i = 0; i < str.Length; i++)
                        {
                            Employee obj = employeebll.GetEmployee(Convert.ToInt32(str[i]));

                            if (orgBll.GetStationOrgID(obj.OrgID) == PrjPub.CurrentLoginUser.StationOrgID)
                            {
                                hasOrg = true;
                                break;
                            }
                        }

                        if (!hasOrg)
                        {
                            SessionSet.PageMessage = "该考试没有本站段考生,无须安排微机教室!";
                            Grid1.DataBind();
                            return;
                        }
                    }

                    Grid1.DataBind();
                    ClientScript.RegisterStartupScript(GetType(),
                                                       "jsSelectFirstNode",
                                                       @"showArrange(" + strId + ");",
                                                       true);
                }
            }
        }
Example #24
0
        protected void btnExcel_Click(object sender, EventArgs e)
        {
            RandomExamBLL objBll = new RandomExamBLL();

            RailExam.Model.RandomExam objRandomExam = objBll.GetExam(Convert.ToInt32(Request.QueryString.Get("id")));

            SpreadsheetClass xlsheet = new SpreadsheetClass();
            Worksheet        ws      = (Worksheet)xlsheet.Worksheets[1];

            ws.Cells.Font.set_Size(10);
            ws.Cells.Font.set_Name("宋体");

            ws.Cells[1, 1] = objRandomExam.ExamName + " 参加考试学员名单";
            Range rang1 = ws.get_Range(ws.Cells[1, 1], ws.Cells[1, 7]);

            rang1.set_MergeCells(true);
            rang1.set_HorizontalAlignment(XlHAlign.xlHAlignCenter);
            rang1.Font.set_Name("宋体");


            //write headertext
            ws.Cells[2, 1] = "序号";
            ((Range)ws.Cells[2, 1]).set_HorizontalAlignment(XlHAlign.xlHAlignCenter);


            ws.Cells[2, 2] = "姓名";
            ws.get_Range(ws.Cells[2, 2], ws.Cells[2, 2]).set_MergeCells(true);
            ws.get_Range(ws.Cells[2, 2], ws.Cells[2, 2]).set_HorizontalAlignment(XlHAlign.xlHAlignCenter);

            if (PrjPub.IsWuhan())
            {
                ws.Cells[2, 3] = "员工编码";
            }
            else
            {
                ws.Cells[2, 3] = "工资编号";
            }
            ws.get_Range(ws.Cells[2, 3], ws.Cells[2, 3]).set_MergeCells(true);
            ws.get_Range(ws.Cells[2, 3], ws.Cells[2, 3]).set_HorizontalAlignment(XlHAlign.xlHAlignCenter);

            ws.Cells[2, 4] = "职名";
            ws.get_Range(ws.Cells[2, 4], ws.Cells[2, 4]).set_MergeCells(true);
            ws.get_Range(ws.Cells[2, 4], ws.Cells[2, 4]).set_HorizontalAlignment(XlHAlign.xlHAlignCenter);

            ws.Cells[2, 5] = "组织机构";
            ws.get_Range(ws.Cells[2, 5], ws.Cells[2, 7]).set_MergeCells(true);
            ws.get_Range(ws.Cells[2, 5], ws.Cells[2, 7]).set_HorizontalAlignment(XlHAlign.xlHAlignCenter);

            ws.Cells[2, 8] = "考试地点";
            ws.get_Range(ws.Cells[2, 8], ws.Cells[2, 10]).set_MergeCells(true);
            ws.get_Range(ws.Cells[2, 8], ws.Cells[2, 10]).set_HorizontalAlignment(XlHAlign.xlHAlignCenter);

            for (int j = 0; j < gvChoose.Rows.Count; j++)
            {
                ws.Cells[3 + j, 1] = ((Label)gvChoose.Rows[j].FindControl("lblNo")).Text;

                ws.Cells[3 + j, 2] = ((Label)gvChoose.Rows[j].FindControl("LabelName")).Text;
                ws.get_Range(ws.Cells[3 + j, 2], ws.Cells[3 + j, 2]).set_MergeCells(true);
                ws.get_Range(ws.Cells[3 + j, 2], ws.Cells[3 + j, 2]).set_HorizontalAlignment(XlHAlign.xlHAlignLeft);

                ws.Cells[3 + j, 3] = "'" + ((Label)gvChoose.Rows[j].FindControl("LabelWorkNo")).Text;
                ws.get_Range(ws.Cells[3 + j, 3], ws.Cells[3 + j, 3]).set_MergeCells(true);
                ws.get_Range(ws.Cells[3 + j, 3], ws.Cells[3 + j, 3]).set_HorizontalAlignment(XlHAlign.xlHAlignLeft);


                ws.Cells[3 + j, 4] = ((Label)gvChoose.Rows[j].FindControl("LabelPostName")).Text;
                ws.get_Range(ws.Cells[3 + j, 4], ws.Cells[3 + j, 4]).set_MergeCells(true);
                ws.get_Range(ws.Cells[3 + j, 4], ws.Cells[3 + j, 4]).set_HorizontalAlignment(XlHAlign.xlHAlignLeft);

                ws.Cells[3 + j, 5] = ((Label)gvChoose.Rows[j].FindControl("Labelorgid")).Text;
                ws.get_Range(ws.Cells[3 + j, 5], ws.Cells[3 + j, 7]).set_MergeCells(true);
                ws.get_Range(ws.Cells[3 + j, 5], ws.Cells[3 + j, 7]).set_HorizontalAlignment(XlHAlign.xlHAlignCenter);

                ws.Cells[3 + j, 8] = ((Label)gvChoose.Rows[j].FindControl("lblComputeRoom")).Text;
                ws.get_Range(ws.Cells[3 + j, 8], ws.Cells[3 + j, 10]).set_MergeCells(true);
                ws.get_Range(ws.Cells[3 + j, 8], ws.Cells[3 + j, 10]).set_HorizontalAlignment(XlHAlign.xlHAlignCenter);
            }

            ws.Name = "1-1";
            ws.Cells.Columns.AutoFit();

            try
            {
                ((Worksheet)xlsheet.Worksheets[1]).Activate();

                string path = Server.MapPath("../Excel/Excel.xls");
                if (File.Exists(path))
                {
                    File.Delete(path);
                }
                xlsheet.Export(path, SheetExportActionEnum.ssExportActionNone, SheetExportFormat.ssExportAsAppropriate);

                FileInfo file = new FileInfo(path);
                this.Response.Clear();
                this.Response.Buffer          = true;
                this.Response.Charset         = "utf-7";
                this.Response.ContentEncoding = Encoding.UTF7;
                // 添加头信息,为"文件下载/另存为"对话框指定默认文件名
                this.Response.AddHeader("Content-Disposition",
                                        "attachment; filename=" + HttpUtility.UrlEncode(objRandomExam.ExamName + "参加考试学员名单") + ".xls");
                // 添加头信息,指定文件大小,让浏览器能够显示下载进度
                this.Response.AddHeader("Content-Length", file.Length.ToString());

                // 指定返回的是一个不能被客户端读取的流,必须被下载
                this.Response.ContentType = "application/ms-excel";

                // 把文件流发送到客户端
                this.Response.WriteFile(file.FullName);
            }
            catch
            {
                SessionSet.PageMessage = "系统错误,导出Excel文件失败!";
            }
        }
Example #25
0
        protected void Page_Load(object sender, EventArgs e)
        {
            if (!IsPostBack)
            {
                string strId = Request.QueryString.Get("id");
                if (strId != null && strId != "")
                {
                    hfExamID.Value = strId;
                    RandomExamArrangeBLL eaBll = new RandomExamArrangeBLL();
                    IList <RailExam.Model.RandomExamArrange> ExamArranges = eaBll.GetRandomExamArranges(int.Parse(strId));

                    if (ExamArranges.Count > 0)
                    {
                        ViewState["ChooseId"]   = ExamArranges[0].UserIds;
                        ViewState["UpdateMode"] = 1;

                        string       strSql = "select Org_ID,Short_Name from Org where level_num=2 order by Order_Index";
                        OracleAccess db     = new OracleAccess();
                        DataSet      ds     = db.RunSqlDataSet(strSql);
                        ListItem     item   = new ListItem();
                        item.Text  = "--请选择--";
                        item.Value = "0";
                        ddlOrg.Items.Add(item);
                        bool hasOrg = false;
                        foreach (DataRow dr in ds.Tables[0].Rows)
                        {
                            item       = new ListItem();
                            item.Text  = dr["Short_Name"].ToString();
                            item.Value = dr["org_ID"].ToString();
                            ddlOrg.Items.Add(item);

                            if (PrjPub.CurrentLoginUser.StationOrgID.ToString() == dr["org_ID"].ToString())
                            {
                                hasOrg = true;
                            }
                        }

                        if (PrjPub.CurrentLoginUser.RoleID != 1)
                        {
                            if (hasOrg)
                            {
                                ddlOrg.SelectedValue = PrjPub.CurrentLoginUser.StationOrgID.ToString();
                                ddlOrg.Enabled       = false;
                            }
                            else
                            {
                                ddlOrg.SelectedValue = "0";
                            }
                        }
                        else
                        {
                            ddlOrg.SelectedValue = "0";
                        }

                        ddlOrg_SelectedIndexChanged(null, null);
                    }
                    else
                    {
                        ViewState["ChooseId"]   = "";
                        ViewState["UpdateMode"] = 0;
                    }

                    RandomExamBLL objBll        = new RandomExamBLL();
                    bool          hasTrainClass = objBll.GetExam(Convert.ToInt32(strId)).HasTrainClass;
                    if (hasTrainClass)
                    {
                        ViewState["HasTrainClass"] = "1";
                    }
                    else
                    {
                        ViewState["HasTrainClass"] = "0";
                    }
                }
                BindChoosedGrid(ViewState["ChooseId"].ToString());
            }

            string strRefreshArrange = Request.Form.Get("RefreshArrange");

            if (strRefreshArrange != "" && strRefreshArrange != null)
            {
                BindChoosedGrid(ViewState["ChooseId"].ToString());

                OracleAccess db = new OracleAccess();
                string       strSql;
                if (CheckIsAllArrange())
                {
                    strSql = " update Random_Exam set Is_All_Arrange=1 where Random_Exam_ID=" +
                             Request.QueryString.Get("id");
                    db.ExecuteNonQuery(strSql);
                }
            }

            if (Request.Form.Get("StudentInfo") != null && Request.Form.Get("StudentInfo") != "")
            {
                DownloadStudentInfoExcel();
            }
        }
Example #26
0
        protected void FillPaper()
        {
            // QueryString id stands for EXAM_RESULT_ID
            string strId = Request.QueryString.Get("id");
            string orgid = Request.QueryString.Get("orgid");

            // Not pass id
            if (string.IsNullOrEmpty(strId))
            {
                SessionSet.PageMessage = "参数错误!";

                return;
            }

            RandomExamResultBLL randomExamResultBLL = new RandomExamResultBLL();
            RandomExamResult    randomExamResult    = new RandomExamResult();

            if (ViewState["NowOrgID"].ToString() != orgid)
            {
                randomExamResult = randomExamResultBLL.GetRandomExamResultByOrgID(int.Parse(strId), int.Parse(orgid));
            }
            else
            {
                randomExamResult = randomExamResultBLL.GetRandomExamResultTemp(int.Parse(strId));
            }
            int RandomExamId       = randomExamResult.RandomExamId;
            int randomExamResultId = int.Parse(strId);

            OracleAccess  db     = new OracleAccess();
            RandomExamBLL objBll = new RandomExamBLL();
            int           year   = objBll.GetExam(RandomExamId).BeginTime.Year;

            RandomExamItemBLL              randomItemBLL             = new RandomExamItemBLL();
            RandomExamSubjectBLL           subjectBLL                = new RandomExamSubjectBLL();
            RandomExamResultAnswerBLL      randomExamResultAnswerBLL = new RandomExamResultAnswerBLL();
            IList <RandomExamSubject>      randomExamSubjects        = subjectBLL.GetRandomExamSubjectByRandomExamId(RandomExamId);
            IList <RandomExamResultAnswer> examResultAnswers         = new List <RandomExamResultAnswer>();

            if (ViewState["NowOrgID"].ToString() != orgid)
            {
                examResultAnswers = randomExamResultAnswerBLL.GetExamResultAnswersByOrgID(int.Parse(strId), int.Parse(orgid));
            }
            else
            {
                examResultAnswers = randomExamResultAnswerBLL.GetExamResultAnswers(randomExamResultId);
            }

            int z = 1;

            if (randomExamSubjects != null)
            {
                for (int i = 0; i < randomExamSubjects.Count; i++)
                {
                    RandomExamSubject      paperSubject = randomExamSubjects[i];
                    IList <RandomExamItem> PaperItems   = new List <RandomExamItem>();
                    if (ViewState["NowOrgID"].ToString() != orgid)
                    {
                        PaperItems = randomItemBLL.GetItemsByOrgID(paperSubject.RandomExamSubjectId, randomExamResultId, int.Parse(orgid), year);
                    }
                    else
                    {
                        PaperItems = randomItemBLL.GetItems(paperSubject.RandomExamSubjectId, randomExamResultId, year);
                    }

                    Response.Write("<table width='100%'>");
                    Response.Write(" <tr > <td class='ExamBigTitle' >");
                    Response.Write(" " + GetNo(i) + "");
                    Response.Write(".&nbsp;" + paperSubject.SubjectName + "");
                    Response.Write("  (共" + paperSubject.ItemCount + "题,共" + System.String.Format("{0:0.##}", paperSubject.ItemCount * paperSubject.UnitScore) + "分)</td></tr >");

                    if (PaperItems != null)
                    {
                        for (int j = 0; j < PaperItems.Count; j++)
                        {
                            RandomExamItem paperItem = PaperItems[j];
                            int            k         = j + 1;

                            if (paperItem.TypeId != 5)
                            {
                                z = 1;
                                Response.Write("<tr > <td class='ExamResultItem'>&nbsp;&nbsp;&nbsp;"
                                               + k + ".&nbsp; " + paperItem.Content + "&nbsp;&nbsp;(" +
                                               System.String.Format("{0:0.##}", paperSubject.UnitScore) +
                                               "分)</td></tr >");
                            }
                            else
                            {
                                string strSql = "select * from Random_Exam_Item_" + year + " where Item_ID='" +
                                                paperItem.ItemId + "' and Random_Exam_ID=" + RandomExamId;
                                DataRow dr = db.RunSqlDataSet(strSql).Tables[0].Rows[0];

                                IList <RandomExamItem> randomExamItems = randomItemBLL.GetItemsByParentItemID(Convert.ToInt32(dr["Parent_Item_ID"]), RandomExamId, year);

                                Response.Write("<tr > <td class='ExamResultItem'>&nbsp;&nbsp;&nbsp;("
                                               + z + ").&nbsp; " + paperItem.Content + "&nbsp;&nbsp;(" + System.String.Format("{0:0.##}", (decimal)paperSubject.UnitScore / (decimal)randomExamItems.Count) +
                                               "分)</td></tr >");
                                z++;
                            }

                            // 组织用户答案
                            RandomExamResultAnswer theExamResultAnswer = null;
                            string[] strUserAnswers = new string[0];
                            string   strUserAnswer  = string.Empty;

                            foreach (RandomExamResultAnswer resultAnswer in examResultAnswers)
                            {
                                if (resultAnswer.RandomExamItemId == paperItem.RandomExamItemId)
                                {
                                    theExamResultAnswer = resultAnswer;
                                    break;
                                }
                            }

                            // 若子表无记录,结束页面输出
                            if (theExamResultAnswer == null)
                            {
                                SessionSet.PageMessage = "数据错误!";
                            }

                            // 否则组织考生答案
                            if (theExamResultAnswer.Answer != null || theExamResultAnswer.Answer == string.Empty)
                            {
                                strUserAnswers = theExamResultAnswer.Answer.Split(new char[] { '|' });
                            }


                            for (int n = 0; n < strUserAnswers.Length; n++)
                            {
                                string strN = intToString(int.Parse(strUserAnswers[n]) + 1);
                                if (n == 0)
                                {
                                    strUserAnswer += strN;
                                }
                                else
                                {
                                    strUserAnswer += "," + strN;
                                }
                            }

                            //多选


                            if (paperSubject.ItemTypeId == 2)
                            {
                                string[] strAnswer = paperItem.SelectAnswer.Split(new char[] { '|' });
                                for (int n = 0; n < strAnswer.Length; n++)
                                {
                                    string strN = intToString(n + 1);
                                    Response.Write(" <tr ><td class='ExamItemAnswer'>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; "
                                                   + strN + "." + strAnswer[n] + "</td></tr >");
                                }
                            }
                            else if (paperSubject.ItemTypeId == 1 || paperSubject.ItemTypeId == 3 || paperItem.TypeId == 5)
                            {
                                //单选


                                string[] strAnswer = paperItem.SelectAnswer.Split(new char[] { '|' });
                                for (int n = 0; n < strAnswer.Length; n++)
                                {
                                    string strN = intToString(n + 1);

                                    Response.Write("<tr > <td class='ExamItemAnswer'>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; "
                                                   + strN + "." + strAnswer[n] + "</td></tr >");
                                }
                            }

                            if (paperSubject.ItemTypeId == 1 || paperSubject.ItemTypeId == 2 || paperSubject.ItemTypeId == 3 || paperItem.TypeId == 5)
                            {
                                // 组织正确答案
                                string[] strRightAnswers = paperItem.StandardAnswer.Split(new char[] { '|' });
                                string   strRightAnswer  = "";
                                for (int n = 0; n < strRightAnswers.Length; n++)
                                {
                                    string strN = intToString(int.Parse(strRightAnswers[n]) + 1);
                                    if (n == 0)
                                    {
                                        strRightAnswer += strN;
                                    }
                                    else
                                    {
                                        strRightAnswer += "," + strN;
                                    }
                                }

                                string strScore = "0";

                                if (paperItem.TypeId == 5)
                                {
                                    if (strRightAnswer == strUserAnswer)
                                    {
                                        strScore = System.String.Format("{0:0.##}", paperItem.Score);
                                    }
                                }
                                else
                                {
                                    if (strRightAnswer == strUserAnswer)
                                    {
                                        strScore = System.String.Format("{0:0.##}", paperSubject.UnitScore);
                                    }
                                }


                                if (strScore == "0")
                                {
                                    Response.Write(" <tr><td class='ExamAnswerZero'>&nbsp;&nbsp;&nbsp;★标准答案:"
                                                   + "<span id='span-" + paperItem.RandomExamItemId + "-0' name='span-" +
                                                   paperItem.RandomExamItemId
                                                   + "'>" + strRightAnswer + "</span>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;考生答案:"
                                                   + "<span id='span-" + paperItem.RandomExamItemId + "-1' name='span-" +
                                                   paperItem.RandomExamItemId
                                                   + "'>" + strUserAnswer + "</span>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;得分:" + strScore + "</td></tr>");
                                }
                                else
                                {
                                    Response.Write(" <tr><td class='ExamAnswer'>&nbsp;&nbsp;&nbsp;★标准答案:"
                                                   + "<span id='span-" + paperItem.RandomExamItemId + "-0' name='span-" +
                                                   paperItem.RandomExamItemId
                                                   + "'>" + strRightAnswer + "</span>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;考生答案:"
                                                   + "<span id='span-" + paperItem.RandomExamItemId + "-1' name='span-" +
                                                   paperItem.RandomExamItemId
                                                   + "'>" + strUserAnswer + "</span>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;得分:" + strScore + "</td></tr>");
                                }
                            }
                        }
                    }
                    Response.Write(" </table> ");
                }
            }
            else
            {
                SessionSet.PageMessage = "数据错误!";

                return;
            }
        }
        protected void btnOK_Click(object sender, EventArgs e)
        {
            try
            {
                string                    examId        = Request.QueryString.Get("examID");
                RandomExamBLL             objBll        = new RandomExamBLL();
                RailExam.Model.RandomExam objRandomExam = objBll.GetExam(Convert.ToInt32(examId));
                if (objRandomExam.IsStart != 2)
                {
                    SessionSet.PageMessage = "考试还未结束不能生成补考试卷!";
                    return;
                }

                //OrganizationBLL OrgBll = new OrganizationBLL();
                //Organization org = OrgBll.GetOrganization(objRandomExam.OrgId);
                //if (org.SuitRange != 1 && !objRandomExam.IsUpload)
                //{
                //    Grid1.DataBind();
                //    SessionSet.PageMessage = "考试为站段考试,还未上传考试成绩不能生成补考试卷!";
                //    return;
                //}

                if (objRandomExam.HasTrainClass)
                {
                    string strTrainClassID = "";
                    RandomExamTrainClassBLL      trainClassBLL = new RandomExamTrainClassBLL();
                    IList <RandomExamTrainClass> trainClasses  =
                        trainClassBLL.GetRandomExamTrainClassByRandomExamID(Convert.ToInt32(examId));
                    foreach (RandomExamTrainClass trainClass in trainClasses)
                    {
                        if (strTrainClassID == "")
                        {
                            strTrainClassID = "'" + trainClass.TrainClassID + "'";
                        }
                        else
                        {
                            strTrainClassID = strTrainClassID + ",'" + trainClass.TrainClassID + "'";
                        }
                    }
                }

                string  OrganizationName = "";
                string  strExamineeName  = "";
                decimal dScoreLower      = 0;
                decimal dScoreUpper      = 1000;

                IList <RandomExamResult> examResults   = null;
                RandomExamResultBLL      bllExamResult = new RandomExamResultBLL();

                examResults = bllExamResult.GetRandomExamResults(objRandomExam.RandomExamId, OrganizationName, "", strExamineeName, string.Empty, dScoreLower,
                                                                 dScoreUpper, objRandomExam.OrgId);


                string strID     = string.Empty;
                string strNoPass = string.Empty;
                foreach (RandomExamResult result in examResults)
                {
                    if (strID == string.Empty)
                    {
                        strID = result.ExamineeId.ToString();
                    }
                    else
                    {
                        strID = strID + "," + result.ExamineeId;
                    }

                    //当补考考生不为未参加考试考生时
                    if (ddlSelect.SelectedValue != "2")
                    {
                        if (result.Score < objRandomExam.PassScore)
                        {
                            if (strNoPass == string.Empty)
                            {
                                strNoPass = result.ExamineeId.ToString();
                            }
                            else
                            {
                                strNoPass = strNoPass + "," + result.ExamineeId;
                            }
                        }
                    }
                }

                RandomExamArrangeBLL      objArrangebll  = new RandomExamArrangeBLL();
                IList <RandomExamArrange> objArrangeList =
                    objArrangebll.GetRandomExamArranges(objRandomExam.RandomExamId);
                string strChooseID = string.Empty;
                if (objArrangeList.Count > 0)
                {
                    strChooseID = objArrangeList[0].UserIds;
                }
                string[] str = strChooseID.Split(',');

                string strNoResult = string.Empty;
                //当补考考生不为不及格考生时
                if (ddlSelect.SelectedValue != "1")
                {
                    for (int i = 0; i < str.Length; i++)
                    {
                        if (("," + strID + ",").IndexOf(("," + str[i] + ",")) < 0)
                        {
                            if (strNoResult == string.Empty)
                            {
                                strNoResult = str[i];
                            }
                            else
                            {
                                strNoResult = strNoResult + "," + str[i];
                            }
                        }
                    }
                }

                string strTotal = string.Empty;
                if (strNoResult == string.Empty && strNoPass == string.Empty)
                {
                    strTotal = string.Empty;
                }
                else if (strNoResult == string.Empty && strNoPass != string.Empty)
                {
                    strTotal = strNoPass;
                }
                else if (strNoResult != string.Empty && strNoPass == string.Empty)
                {
                    strTotal = strNoResult;
                }
                else if (strNoResult != string.Empty && strNoPass != string.Empty)
                {
                    strTotal = strNoPass + "," + strNoResult;
                }

                if (strTotal == string.Empty)
                {
                    SessionSet.PageMessage = "所选考试无考试不及格和未参加考试学员,不需生成补考考试!";
                    return;
                }

                int nowExamID = objBll.AddResetRandomExam(objRandomExam.RandomExamId);

                if (nowExamID == 0)
                {
                    SessionSet.PageMessage = "复制失败!";
                    return;
                }

                RandomExamArrange objArrange = new RandomExamArrange();
                objArrange.RandomExamId = nowExamID;
                objArrange.UserIds      = strTotal;
                objArrange.Memo         = string.Empty;
                int newArrangeId = objArrangebll.AddRandomExamArrange(objArrange);

                OracleAccess db     = new OracleAccess();
                string       strSql = "select * from Random_Exam_Arrange_Detail where Random_Exam_ID=" + objRandomExam.RandomExamId;
                DataSet      ds     = db.RunSqlDataSet(strSql);

                str = strTotal.Split(',');

                foreach (DataRow dr in ds.Tables[0].Rows)
                {
                    string strArrange = string.Empty;
                    for (int i = 0; i < str.Length; i++)
                    {
                        if (("," + dr["User_Ids"] + ",").IndexOf("," + str[i] + ",") >= 0)
                        {
                            if (strArrange == string.Empty)
                            {
                                strArrange = str[i];
                            }
                            else
                            {
                                strArrange += "," + str[i];
                            }
                        }
                    }

                    if (strArrange != string.Empty)
                    {
                        XmlDocument doc = new XmlDocument();
                        //Request.PhysicalApplicationPath取得config文件路径
                        doc.Load(Path.Combine(HttpContext.Current.Request.PhysicalApplicationPath, "web.config"));
                        XmlNode node  = doc.SelectSingleNode("configuration/dataConfiguration/@defaultDatabase");
                        string  value = node.Value;
                        int     id    = 0;
                        if (value == "Oracle")
                        {
                            OracleParameter para1 = new OracleParameter("p_User_Ids", OracleType.Clob);
                            OracleParameter para2 = new OracleParameter("p_random_exam_arrange_de_id", OracleType.Number);
                            para2.Direction = ParameterDirection.Output;
                            OracleParameter para3 = new OracleParameter("p_random_exam_arrange_Id", OracleType.Number);
                            para3.Value = newArrangeId;
                            OracleParameter para4 = new OracleParameter("p_random_Exam_ID", OracleType.Number);
                            para4.Value = nowExamID;
                            OracleParameter para5 = new OracleParameter("p_computer_room_id", OracleType.Number);
                            para5.Value = Convert.ToInt32(dr["Computer_Room_ID"].ToString());


                            IDataParameter[] paras = new IDataParameter[] { para1, para2, para3, para4, para5 };
                            id =
                                Pub.RunAddProcedure(false, "USP_RANDOM_EXAM_ARRANGE_DE_I", paras,
                                                    System.Text.Encoding.Unicode.GetBytes(strArrange));
                        }
                    }
                }

                //向Random_Exam_Computer_Server 机房考试状态表 插入记录
                strSql = "select c.Computer_Server_No 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 a.Random_Exam_ID=" + nowExamID;
                DataSet dsComputer = db.RunSqlDataSet(strSql);

                string serverNo = "";
                foreach (DataRow dr in dsComputer.Tables[0].Rows)
                {
                    if (serverNo != dr["Computer_Server_No"].ToString())
                    {
                        serverNo = dr["Computer_Server_No"].ToString();
                        strSql   = "insert into Random_Exam_Computer_Server"
                                   + "(Random_Exam_ID,Computer_Server_No,Status_ID,Is_Start,Has_Paper,"
                                   + "Random_Exam_Code,Is_Upload,DownLoaded) "
                                   + "values (" + nowExamID + "," + serverNo + ",0,0,0,'',0,0)";
                        db.ExecuteNonQuery(strSql);
                    }
                }

                Response.Write("<script>top.returnValue='true';top.close();</script>");
            }
            catch
            {
                SessionSet.PageMessage = "复制失败!";
            }
        }
Example #28
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();
            }
        }
Example #29
0
        protected void FillPaper()
        {
            // QueryString id stands for EXAM_RESULT_ID
            string strId = Request.QueryString.Get("id");
            string orgid = Request.QueryString.Get("orgid");

            // Not pass id
            if (string.IsNullOrEmpty(strId))
            {
                SessionSet.PageMessage = "参数错误!";
                return;
            }

            RandomExamResultBLL randomExamResultBLL = new RandomExamResultBLL();
            RandomExamResult    randomExamResult    = new RandomExamResult();

            randomExamResult = randomExamResultBLL.GetRandomExamResultStation(int.Parse(strId));
            int RandomExamId       = randomExamResult.RandomExamId;
            int randomExamResultId = int.Parse(strId);

            RandomExamBLL objBll = new RandomExamBLL();
            int           year   = objBll.GetExam(RandomExamId).BeginTime.Year;

            RandomExamItemBLL         randomItemBLL      = new RandomExamItemBLL();
            RandomExamSubjectBLL      subjectBLL         = new RandomExamSubjectBLL();
            IList <RandomExamSubject> randomExamSubjects = subjectBLL.GetRandomExamSubjectByRandomExamId(RandomExamId);

            //RandomExamResultAnswerBLL randomExamResultAnswerBLL = new RandomExamResultAnswerBLL();
            //IList<RandomExamResultAnswer> examResultAnswers = new List<RandomExamResultAnswer>();
            //if (ViewState["NowOrgID"].ToString() != orgid)
            //{
            //    examResultAnswers = randomExamResultAnswerBLL.GetExamResultAnswersStation(randomExamResultId);
            //}
            //else
            //{
            //    examResultAnswers = randomExamResultAnswerBLL.GetExamResultAnswers(randomExamResultId);
            //}

            IList <RandomExamItem> TotalItems = new List <RandomExamItem>();

            //按年取出每张试卷的Random_Exam_Item_Year 表中的记录
            if (ViewState["NowOrgID"].ToString() != orgid)
            {
                TotalItems = randomItemBLL.GetItemsStation(0, randomExamResultId, year);
            }
            else
            {
                TotalItems = randomItemBLL.GetItems(0, randomExamResultId, year);
            }

            OracleAccess db = new OracleAccess();

            //按考试取出每张试卷的完形填空子题
            string    strSql   = "select * from Random_Exam_Item_" + year + " where Type_ID=" + PrjPub.ITEMTYPE_FILLBLANKDETAIL + " and Random_Exam_ID=" + RandomExamId;
            DataTable dtDetail = db.RunSqlDataSet(strSql).Tables[0];

            //按考试取出每张试卷的完形填空主题
            //strSql = "select * from Random_Exam_Item_" + year + " where Type_ID="+ PrjPub.ITEMTYPE_FILLBLANK +" and Random_Exam_ID=" + RandomExamId;
            //DataTable dt= db.RunSqlDataSet(strSql).Tables[0];

            int z       = 1;
            int hasyear = 0;

            if (randomExamSubjects != null)
            {
                for (int i = 0; i < randomExamSubjects.Count; i++)
                {
                    RandomExamSubject      paperSubject = randomExamSubjects[i];
                    IList <RandomExamItem> PaperItems   = new List <RandomExamItem>();

                    PaperItems = GetSubjectItems(TotalItems, paperSubject.RandomExamSubjectId);

                    if (ViewState["NowOrgID"].ToString() != orgid)
                    {
                        //PaperItems = randomItemBLL.GetItemsStation(paperSubject.RandomExamSubjectId, randomExamResultId,  year);
                        hasyear = 1;
                    }
                    else
                    {
                        //PaperItems = randomItemBLL.GetItems(paperSubject.RandomExamSubjectId, randomExamResultId, year);
                        hasyear = 0;
                    }

                    Response.Write("<table width='100%'>");
                    Response.Write(" <tr > <td class='ExamBigTitle' >");
                    Response.Write(" " + GetNo(i) + "");
                    Response.Write(".&nbsp;" + paperSubject.SubjectName + "");
                    Response.Write("  (共" + paperSubject.ItemCount + "题,共" + System.String.Format("{0:0.##}", paperSubject.ItemCount * paperSubject.UnitScore) + "分)</td></tr >");

                    if (PaperItems != null)
                    {
                        int x = 1;
                        for (int j = 0; j < PaperItems.Count; j++)
                        {
                            RandomExamItem paperItem = PaperItems[j];
                            int            k         = j + 1;

                            if (paperItem.TypeId != 5)
                            {
                                if (paperItem.TypeId == 4)
                                {
                                    k = x;
                                    x++;
                                }

                                z = 1;
                                Response.Write("<tr > <td class='ExamResultItem'><a name='Test" + i + j + "' id='Test" + i + j + "'></a>&nbsp;&nbsp;&nbsp;"
                                               + k + ".&nbsp; " + paperItem.Content + "&nbsp;&nbsp;(" +
                                               System.String.Format("{0:0.##}", paperSubject.UnitScore) +
                                               "分)</td></tr >");
                            }
                            else
                            {
                                //string strSql = "select * from Random_Exam_Item_" + year + " where Item_ID='" +
                                //                paperItem.ItemId + "' and Random_Exam_ID=" + RandomExamId;
                                //DataRow dr = db.RunSqlDataSet(strSql).Tables[0].Rows[0];
                                //IList<RandomExamItem> randomExamItems = randomItemBLL.GetItemsByParentItemID(Convert.ToInt32(dr["Parent_Item_ID"]), RandomExamId, year);

                                //查找当前完型子题的主题ID
                                DataRow[] drsDetail = dtDetail.Select("Item_ID=" + paperItem.ItemId);

                                int detailCount = 0;
                                if (drsDetail.Length > 0)
                                {
                                    //通过完形填空的主题ID查找完形填空的子题个数,为计算每个子题分数做准备
                                    DataRow[] drs = dtDetail.Select("Parent_Item_ID=" + drsDetail[0]["Parent_Item_ID"]);
                                    detailCount = drs.Length;
                                }

                                Response.Write("<tr > <td class='ExamResultItem'><a name='Test" + i + j + "' id='Test" + i + j + "'></a>&nbsp;&nbsp;&nbsp;"//+ z + ").&nbsp; "
                                               + paperItem.Content + "&nbsp;&nbsp;(" + System.String.Format("{0:0.##}", (decimal)paperSubject.UnitScore / (decimal)detailCount) +
                                               "分)</td></tr >");
                                z++;
                            }

                            string[] strUserAnswers = new string[0];
                            string   strUserAnswer  = string.Empty;

                            // 组织用户答案
                            //RandomExamResultAnswer theExamResultAnswer = null;
                            //foreach (RandomExamResultAnswer resultAnswer in examResultAnswers)
                            //{
                            //    if (resultAnswer.RandomExamItemId == paperItem.RandomExamItemId)
                            //    {
                            //        theExamResultAnswer = resultAnswer;
                            //        break;
                            //    }
                            //}
                            //// 若子表无记录,结束页面输出
                            //if (theExamResultAnswer == null)
                            //{
                            //    SessionSet.PageMessage = "数据错误!";
                            //}
                            //// 否则组织考生答案
                            //if (theExamResultAnswer.Answer != null || theExamResultAnswer.Answer == string.Empty)
                            //{
                            //    strUserAnswers = theExamResultAnswer.Answer.Split(new char[] { '|' });
                            //}

                            if (paperItem.Answer == null)
                            {
                                SessionSet.PageMessage = "数据错误!";
                            }

                            if (!string.IsNullOrEmpty(paperItem.Answer))
                            {
                                strUserAnswers = paperItem.Answer.Split(new char[] { '|' });
                            }

                            for (int n = 0; n < strUserAnswers.Length; n++)
                            {
                                string strN = intToString(int.Parse(strUserAnswers[n]) + 1);
                                if (n == 0)
                                {
                                    strUserAnswer += strN;
                                }
                                else
                                {
                                    strUserAnswer += "," + strN;
                                }
                            }

                            //多选


                            if (paperSubject.ItemTypeId == PrjPub.ITEMTYPE_MULTICHOOSE)
                            {
                                string[] strAnswer = paperItem.SelectAnswer.Split(new char[] { '|' });
                                for (int n = 0; n < strAnswer.Length; n++)
                                {
                                    string strN  = intToString(n + 1);
                                    string strij = "-" + paperItem.RandomExamItemId + "-" + i.ToString() + "-"
                                                   + j.ToString() + "-" + n.ToString();
                                    string strName = i.ToString() + j.ToString();

                                    Response.Write(" <tr ><td class='ExamItemAnswer'>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; "
                                                   + strN + "." + strAnswer[n] + "</td></tr >");
                                }
                            }
                            else if (paperSubject.ItemTypeId == PrjPub.ITEMTYPE_JUDGE || paperSubject.ItemTypeId == PrjPub.ITEMTYPE_SINGLECHOOSE || paperItem.TypeId == 5)
                            {
                                //单选


                                string[] strAnswer = paperItem.SelectAnswer.Split(new char[] { '|' });
                                for (int n = 0; n < strAnswer.Length; n++)
                                {
                                    string strN = intToString(n + 1);
                                    Response.Write("<tr > <td class='ExamItemAnswer'>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; "
                                                   + strN + "." + strAnswer[n] + "</td></tr >");
                                }
                            }

                            if (paperSubject.ItemTypeId == 1 || paperSubject.ItemTypeId == 2 || paperSubject.ItemTypeId == 3 || paperItem.TypeId == 5)
                            {
                                // 组织正确答案
                                string[] strRightAnswers = paperItem.StandardAnswer.Split(new char[] { '|' });
                                string   strRightAnswer  = "";
                                for (int n = 0; n < strRightAnswers.Length; n++)
                                {
                                    string strN = intToString(int.Parse(strRightAnswers[n]) + 1);
                                    if (n == 0)
                                    {
                                        strRightAnswer += strN;
                                    }
                                    else
                                    {
                                        strRightAnswer += "," + strN;
                                    }
                                }

                                string strScore   = "0";
                                string couldScore = "0";
                                if (paperItem.TypeId == 5)
                                {
                                    if (strRightAnswer == strUserAnswer)
                                    {
                                        strScore = System.String.Format("{0:0.##}", paperItem.Score);
                                    }

                                    couldScore = paperItem.Score.ToString();
                                }
                                else
                                {
                                    if (strRightAnswer == strUserAnswer)
                                    {
                                        strScore = System.String.Format("{0:0.##}", paperSubject.UnitScore);
                                    }

                                    couldScore = paperSubject.UnitScore.ToString();
                                }

                                if (strScore == "0")
                                {
                                    if (hfLoginEmployeeID.Value == "0")
                                    {
                                        string strFirst = @"""";
                                        Response.Write(" <tr><td id='span-" + paperItem.RandomExamItemId + "' class='ExamAnswerZero'>&nbsp;&nbsp;&nbsp;★标准答案:"
                                                       + "<span id='span-" + paperItem.RandomExamItemId + "-0' name='span-" +
                                                       paperItem.RandomExamItemId
                                                       + "'>" + strRightAnswer +
                                                       "</span>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;考生答案:"
                                                       + "<span id='span-" + paperItem.RandomExamItemId + "-1' name='span-" +
                                                       paperItem.RandomExamItemId
                                                       + "'>" + strUserAnswer +
                                                       "</span>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;得分:" +
                                                       "<span id='span-" + paperItem.RandomExamItemId + "-2'>" + strScore +
                                                       "</span>"
                                                       + "&nbsp;&nbsp;&nbsp;<a id='a-" + paperItem.RandomExamItemId + "' onclick=" + strFirst + "updateScore(" + randomExamResultId + "," + paperItem.RandomExamItemId + "," + couldScore + ",'" + paperItem.StandardAnswer + "'," + hasyear + ")" + strFirst
                                                       + " href='#Test" + i + j + "' style='cursor: hand;'>更改考生答案</a></td></tr>");
                                    }
                                    else
                                    {
                                        Response.Write(" <tr><td class='ExamAnswerZero'>&nbsp;&nbsp;&nbsp;★标准答案:"
                                                       + "<span id='span-" + paperItem.RandomExamItemId + "-0' name='span-" +
                                                       paperItem.RandomExamItemId
                                                       + "'>" + strRightAnswer +
                                                       "</span>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;考生答案:"
                                                       + "<span id='span-" + paperItem.RandomExamItemId + "-1' name='span-" +
                                                       paperItem.RandomExamItemId
                                                       + "'>" + strUserAnswer +
                                                       "</span>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;得分:" +
                                                       "<span id='span-" + paperItem.RandomExamItemId + "-2'>" + strScore +
                                                       "</span></td></tr>");
                                    }
                                }
                                else
                                {
                                    Response.Write(" <tr><td class='ExamAnswer'>&nbsp;&nbsp;&nbsp;★标准答案:"
                                                   + "<span id='span-" + paperItem.RandomExamItemId + "-0' name='span-" +
                                                   paperItem.RandomExamItemId
                                                   + "'>" + strRightAnswer +
                                                   "</span>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;考生答案:"
                                                   + "<span id='span-" + paperItem.RandomExamItemId + "-1' name='span-" +
                                                   paperItem.RandomExamItemId
                                                   + "'>" + strUserAnswer +
                                                   "</span>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;得分:" + strScore +
                                                   "</td></tr>");
                                }
                            }
                        }
                    }
                    Response.Write(" </table> ");
                }
            }
            else
            {
                SessionSet.PageMessage = "数据错误!";

                return;
            }
        }
Example #30
0
        protected void FillHeading(string strId, string orgid)
        {
            RandomExamResultBLL randomExamResultBLL = new RandomExamResultBLL();
            RandomExamResult    randomExamResult    = new RandomExamResult();

            randomExamResult = randomExamResultBLL.GetRandomExamResultStation(int.Parse(strId));

            OracleAccess db     = new OracleAccess();
            string       strSql = "select a.*"
                                  + " from Random_Exam_Result_Detail a"
                                  + " where a.Random_Exam_Result_ID=" + randomExamResult.RandomExamResultId
                                  + " and Employee_ID=" + randomExamResult.ExamineeId
                                  + " and Random_Exam_ID=" + randomExamResult.RandomExamId;

            DataTable dtExam = db.RunSqlDataSet(strSql).Tables[0];

            if (dtExam.Rows.Count == 0)
            {
                strSql = "select a.*"
                         + " from Random_Exam_Result_Detail_Temp a"
                         + " where a.Random_Exam_Result_ID=" + randomExamResult.RandomExamResultId
                         + " and Employee_ID=" + randomExamResult.ExamineeId
                         + " and Random_Exam_ID=" + randomExamResult.RandomExamId;

                dtExam = db.RunSqlDataSet(strSql).Tables[0];
            }

            if (dtExam.Rows.Count > 0)
            {
                bool isExists =
                    Directory.Exists(Server.MapPath("/RailExamBao/Online/Photo/" + randomExamResult.RandomExamId + "/"));

                DataRow drExam = dtExam.Rows[0];
                lblFignerDate.Text = drExam["FingerPrint_Date"] == DBNull.Value
                                         ? string.Empty
                                         : Convert.ToDateTime(drExam["FingerPrint_Date"]).ToString("yyyy-MM-dd HH:mm");
                lblPhotoDate1.Text = drExam["Photo1_Date"] == DBNull.Value
                                         ? string.Empty
                                         : Convert.ToDateTime(drExam["Photo1_Date"]).ToString("yyyy-MM-dd HH:mm");
                lblPhotoDate2.Text = drExam["Photo2_Date"] == DBNull.Value
                                         ? string.Empty
                                         : Convert.ToDateTime(drExam["Photo2_Date"]).ToString("yyyy-MM-dd HH:mm");
                lblPhotoDate3.Text = drExam["Photo3_Date"] == DBNull.Value
                                         ? string.Empty
                                         : Convert.ToDateTime(drExam["Photo3_Date"]).ToString("yyyy-MM-dd HH:mm");

                string filepath = Server.MapPath("/RailExamBao/Online/Photo/" + randomExamResult.RandomExamId + "/") + randomExamResult.ExamineeId + "_" + randomExamResult.RandomExamResultId + "_";
                string path     = "../Online/Photo/" + randomExamResult.RandomExamId + "/" + randomExamResult.ExamineeId + "_" + randomExamResult.RandomExamResultId + "_";

                if (PrjPub.IsServerCenter && isExists)
                {
                    if (File.Exists(filepath + "00.jpg"))
                    {
                        fignerImage.ImageUrl = path + "00.jpg";
                    }
                    else
                    {
                        fignerImage.ImageUrl = "../images/empty.jpg";
                    }
                }
                else
                {
                    if (drExam["FingerPrint"] != DBNull.Value)
                    {
                        fignerImage.ImageUrl = "ShowResultImage.aspx?resultDetailID=" +
                                               drExam["Random_Exam_Result_Detail_ID"] + "&typeID=0";
                    }
                    else
                    {
                        fignerImage.ImageUrl = "../images/empty.jpg";
                    }
                }

                DataSet ds = Pub.GetPhotoDateSet(randomExamResult.ExamineeId.ToString());
                if (ds.Tables[0].Rows.Count > 0)
                {
                    if (ds.Tables[0].Rows[0][0] != DBNull.Value)
                    {
                        picImage.ImageUrl = "../RandomExamTai/ShowImage.aspx?EmployeeID=" + randomExamResult.ExamineeId;
                    }
                    else
                    {
                        picImage.ImageUrl = "../images/empty.jpg";
                    }
                }
                else
                {
                    picImage.ImageUrl = "../images/empty.jpg";
                }

                if (PrjPub.IsServerCenter && isExists)
                {
                    if (File.Exists(filepath + "01.jpg"))
                    {
                        photoImage1.ImageUrl = path + "01.jpg";
                    }
                    else
                    {
                        photoImage1.ImageUrl = "../images/empty.jpg";
                    }
                }
                else
                {
                    if (drExam["Photo1"] != DBNull.Value)
                    {
                        photoImage1.ImageUrl = "ShowResultImage.aspx?resultDetailID=" +
                                               drExam["Random_Exam_Result_Detail_ID"] + "&typeID=1";
                    }
                    else
                    {
                        photoImage1.ImageUrl = "../images/empty.jpg";
                    }
                }

                if (PrjPub.IsServerCenter && isExists)
                {
                    if (File.Exists(filepath + "02.jpg"))
                    {
                        photoImage2.ImageUrl = path + "02.jpg";
                    }
                    else
                    {
                        photoImage2.ImageUrl = "../images/empty.jpg";
                    }
                }
                else
                {
                    if (drExam["Photo2"] != DBNull.Value)
                    {
                        photoImage2.ImageUrl = "ShowResultImage.aspx?resultDetailID=" +
                                               drExam["Random_Exam_Result_Detail_ID"] + "&typeID=2";
                    }
                    else
                    {
                        photoImage2.ImageUrl = "../images/empty.jpg";
                    }
                }

                if (PrjPub.IsServerCenter && isExists)
                {
                    if (File.Exists(filepath + "03.jpg"))
                    {
                        photoImage3.ImageUrl = path + "03.jpg";
                    }
                    else
                    {
                        photoImage3.ImageUrl = "../images/empty.jpg";
                    }
                }
                else
                {
                    if (drExam["Photo3"] != DBNull.Value)
                    {
                        photoImage3.ImageUrl = "ShowResultImage.aspx?resultDetailID=" +
                                               drExam["Random_Exam_Result_Detail_ID"] + "&typeID=3";
                    }
                    else
                    {
                        photoImage3.ImageUrl = "../images/empty.jpg";
                    }
                }
            }
            else
            {
                fignerImage.ImageUrl = "../images/empty.jpg";
                DataSet ds = Pub.GetPhotoDateSet(randomExamResult.ExamineeId.ToString());

                if (ds.Tables[0].Rows.Count > 0)
                {
                    if (ds.Tables[0].Rows[0][0] != DBNull.Value)
                    {
                        picImage.ImageUrl = "../RandomExamTai/ShowImage.aspx?EmployeeID=" + randomExamResult.ExamineeId;
                    }
                    else
                    {
                        picImage.ImageUrl = "../images/empty.jpg";
                    }
                }
                else
                {
                    picImage.ImageUrl = "../images/empty.jpg";
                }
                photoImage1.ImageUrl = "../images/empty.jpg";
                photoImage2.ImageUrl = "../images/empty.jpg";
                photoImage3.ImageUrl = "../images/empty.jpg";
            }

            string strOrgName     = randomExamResult.OrganizationName;
            string strStationName = "";
            string strOrgName1    = "";
            int    n = strOrgName.IndexOf("-");

            if (n != -1)
            {
                strStationName = strOrgName.Substring(0, n);
                strOrgName1    = strOrgName.Substring(n + 1);
            }
            else
            {
                strStationName = strOrgName;
                strOrgName1    = "";
            }


            lblOrg.Text      = strStationName;
            lblWorkShop.Text = strOrgName1;
            lblPost.Text     = randomExamResult.PostName;
            lblName.Text     = randomExamResult.ExamineeName;
            lblTime.Text     = randomExamResult.BeginDateTime.ToString("yyyy-MM-dd HH:mm");
            lblScore.Text    = System.String.Format("{0:0.##}", randomExamResult.Score);

            int           RandomExamId  = randomExamResult.RandomExamId;
            RandomExamBLL randomExamBLL = new RandomExamBLL();

            RailExam.Model.RandomExam randomExam = randomExamBLL.GetExam(RandomExamId);

            if (randomExam != null)
            {
                lblTitle.Text = randomExam.ExamName;
            }

            RandomExamSubjectBLL randomExamSubjectBLL = new RandomExamSubjectBLL();
            IList <RailExam.Model.RandomExamSubject> RandomExamSubjects = randomExamSubjectBLL.GetRandomExamSubjectByRandomExamId(RandomExamId);

            int     nItemCount  = 0;
            decimal nTotalScore = 0;

            for (int i = 0; i < RandomExamSubjects.Count; i++)
            {
                nItemCount  += RandomExamSubjects[i].ItemCount;
                nTotalScore += RandomExamSubjects[i].ItemCount * RandomExamSubjects[i].UnitScore;
            }

            lblTitleRight.Text = "总共" + nItemCount + "题,共" + System.String.Format("{0:0.##}", nTotalScore) + "分";
        }