private void CheckAnswer(string strAnswer)
        {
            string   strId    = Request.QueryString.Get("id");
            PaperBLL paperBLL = new PaperBLL();

            RailExam.Model.Paper paper        = paperBLL.GetPaper(int.Parse(strId));
            PaperItemBLL         paperItemBLL = new PaperItemBLL();

            string[] strAnswers = strAnswer.Split(new char[] { '$' });

            decimal nanswerScore = 0;
            decimal nScore       = paper.TotalScore;

            for (int n = 0; n < strAnswers.Length; n++)
            {
                string    str2           = strAnswers[n].ToString();
                string[]  str3           = str2.Split(new char[] { '|' });
                string    strPaperItemId = str3[0].ToString();
                PaperItem paperItem      = paperItemBLL.GetPaperItem(int.Parse(strPaperItemId));
                string    strTrueAnswer  = str2.ToString().Substring(strPaperItemId.Length + 1);
                if (paperItem.StandardAnswer == strTrueAnswer)
                {
                    nanswerScore += paperItem.Score;
                }
            }

            string strA = "得分为" + nanswerScore + ",正确率为" + (nanswerScore * 100 / nScore).ToString("0.00") + "%";

            Response.Write("<script>alert('提交成功!" + strA + "'); top.window.close();</script>");
        }
        protected void FillPage(string strId)
        {
            PaperBLL paperBLL = new PaperBLL();

            RailExam.Model.Paper paper = paperBLL.GetPaper(int.Parse(strId));

            if (paper != null)
            {
                lblTitle.Text = paper.PaperName;
            }

            PaperItemBLL paperItemBLL = new PaperItemBLL();
            IList <RailExam.Model.PaperItem> paperItems = paperItemBLL.GetItemsByPaperId(int.Parse(strId));
            int nItemCount = paperItems.Count;

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

            for (int i = 0; i < paperItems.Count; i++)
            {
                nTotalScore += paperItems[i].Score;
            }

            lblTitleRight.Text = "总共" + nItemCount + "题,共 " + nTotalScore + "分";

            lblOrgName.Text = PrjPub.CurrentStudent.OrgName;
            lblPost.Text    = PrjPub.CurrentStudent.PostName;
            lblName.Text    = PrjPub.CurrentStudent.EmployeeName;
        }
Beispiel #3
0
        protected void FillHeading(string strId)
        {
            TaskResultBLL taskResultBLL = new TaskResultBLL();
            PaperBLL      kBLL          = new PaperBLL();

            RailExam.Model.TaskResult taskResult = taskResultBLL.GetTaskResult(int.Parse(strId));
            RailExam.Model.Paper      paper      = null;

            if (taskResult != null)
            {
                paper = kBLL.GetPaper(taskResult.PaperId);
                lblExamBeginDateTime.Text  = taskResult.BeginTime.ToString();
                lblExamEndDateTime.Text    = taskResult.EndTime.ToString();
                lblExamineeName.Text       = taskResult.EmployeeName;
                lblJudgeBeginDateTime.Text = taskResult.JudgeBeginTime.ToString();
                lblJudgeEndDateTime.Text   = taskResult.JudgeEndTime.ToString();
                lblJudgerName.Text         = taskResult.JudgeName;

                taskResultBLL.UpdateJudgeBeginTime(int.Parse(strId), DateTime.Now);
            }
            if (paper != null)
            {
                labeltitle.Text      = paper.PaperName;
                labelTitleRight.Text = "总共 " + paper.ItemCount + " 题,共 " + paper.TotalScore + " 分";
            }
        }
Beispiel #4
0
        protected void FillHeading(string strId)
        {
            ExamResultBLL examResultBLL = new ExamResultBLL();
            PaperBLL      kBLL          = new PaperBLL();

            RailExam.Model.ExamResult examResult = examResultBLL.GetExamResultByOrgID(Convert.ToInt32(strId), Convert.ToInt32(ViewState["OrgID"].ToString()));
            RailExam.Model.Paper      paper      = null;
            EmployeeBLL ebLL = new EmployeeBLL();

            RailExam.Model.Employee Employee = ebLL.GetEmployee(examResult.ExamineeId);

            string strOrgName     = Employee.OrgName;
            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     = Employee.PostName;
            lblName.Text     = Employee.EmployeeName;
            lblTime.Text     = examResult.BeginDateTime.ToString("yyyy-MM-dd HH:mm");
            lblScore.Text    = examResult.Score.ToString();

            if (examResult != null)
            {
                paper = kBLL.GetPaper(examResult.PaperId);
            }


            PaperItemBLL paperItemBLL = new PaperItemBLL();
            IList <RailExam.Model.PaperItem> paperItems = paperItemBLL.GetItemsByPaperId(paper.PaperId);
            int nItemCount = paperItems.Count;

            decimal nTotalScore = 0;

            for (int i = 0; i < paperItems.Count; i++)
            {
                nTotalScore += paperItems[i].Score;
            }


            if (paper != null)
            {
                lblTitle.Text      = paper.PaperName;
                lblTitleRight.Text = "总共 " + nItemCount + " 题,共 " + nTotalScore + " 分";
            }
        }
        protected void FillPage(string strId)
        {
            PaperBLL paperBLL = new PaperBLL();

            RailExam.Model.Paper paper = paperBLL.GetPaper(int.Parse(strId));
            if (paper != null)
            {
                lblTitle.Text = paper.PaperName;

                lblTitleRight.Text      = "总共" + paper.ItemCount + "题共 " + paper.TotalScore + "分";
                hfPaperItemsCount.Value = paper.ItemCount.ToString();
            }
        }
Beispiel #6
0
        protected void FillPage(int nId)
        {
            PaperBLL paperBLL = new PaperBLL();

            RailExam.Model.Paper paper = paperBLL.GetPaper(nId);

            if (paper != null)
            {
                txtCategoryName.Text  = paper.CategoryName;
                ddlMode.SelectedValue = paper.CreateMode.ToString();

                PaperSubjectBLL paperSubjectBLL = new PaperSubjectBLL();

                IList <PaperSubject> psList = paperSubjectBLL.GetPaperSubjectByPaperId(paper.PaperId);

                if (psList.Count > 0)
                {
                    ddlMode.Enabled         = false;
                    ddlStrategyMode.Enabled = false;
                }
                else
                {
                    ddlMode.Enabled         = true;
                    ddlStrategyMode.Enabled = true;
                }

                txtPaperName.Text   = paper.PaperName;
                hfCategoryId.Value  = paper.CategoryId.ToString();
                txtDescription.Text = paper.Description;
                txtMemo.Text        = paper.Memo;

                if (ddlMode.SelectedValue == "3")
                {
                    ddlStrategyMode.Visible = true;
                    LabelMode.Visible       = true;
                }
            }

            if (ViewState["mode"].ToString() == "ReadOnly")
            {
                txtPaperName.Enabled   = false;
                txtDescription.Enabled = false;
                txtMemo.Enabled        = false;
            }
        }
        protected void FillHeading(string strId)
        {
            TaskResultBLL taskResultBLL = new TaskResultBLL();
            PaperBLL      kBLL          = new PaperBLL();

            RailExam.Model.TaskResult taskResult = taskResultBLL.GetTaskResult(int.Parse(strId));
            RailExam.Model.Paper      paper      = null;

            if (taskResult != null)
            {
                paper = kBLL.GetPaper(taskResult.PaperId);
            }
            if (paper != null)
            {
                lblTitle.Text      = paper.PaperName;
                lblTitleRight.Text = "总共 " + paper.ItemCount + " 题,共 " + paper.TotalScore + " 分";
            }
        }
Beispiel #8
0
        private void OutputData(string id)
        {
            PaperBLL paperBLL = new PaperBLL();

            RailExam.Model.Paper paper = paperBLL.GetPaper(int.Parse(id));


            string str = "<table border='0' cellpadding='0' cellspacing='0' >";

            str += "<tr><td colspan='2' align='center' style='font-size:28px' >" + paper.PaperName + "</td> </tr><tr> <td  colspan='2' align='right'>总共" + paper.ItemCount + "题共 " + paper.TotalScore + "分</td></tr> ";

            str += "<tr> <td style='width: 15%; vertical-align: top'>";
            str += "<table border='1' cellpadding='0' cellspacing='0' ><tr><td style='width: 100px; height: 50px' valign='top'> 所属单位:</td> </tr> <tr><td style='height: 50px' valign='top'>车间:</td> </tr><tr><td style='height: 50px' valign='top'>姓名:</td></tr><tr><td style='height: 50px' valign='top'>职名:</td></tr><tr><td style='height: 50px' valign='top'>考试日期:</td></tr></table> </td> ";


            str += " <td style='width: 85%; vertical-align: top'>   ";
            str += GetFillPaperString(id);
            str += "</td></tr></table> ";

            string strReplace;

            if (PrjPub.IsServerCenter)
            {
                strReplace = "http://" + ConfigurationManager.AppSettings["ServerIP"] + "/RailExamBao/";
            }
            else
            {
                strReplace = "http://" + ConfigurationManager.AppSettings["StationIP"] + "/RailExamBao/";
            }
            str = str.Replace("/RailExamBao/", strReplace);

            Response.Clear();
            Response.Charset = "utf-7";
            Response.Buffer  = true;
            EnableViewState  = false;
            Response.AppendHeader("Content-Disposition", "attachment;filename=Paper.doc");

            Response.ContentEncoding = System.Text.Encoding.GetEncoding("utf-7");
            Response.ContentType     = "application/ms-word";
            Response.Write(str);
            Response.End();
        }
Beispiel #9
0
        protected void FillHeading(string strId)
        {
            ExamResultBLL examResultBLL = new ExamResultBLL();
            PaperBLL      kBLL          = new PaperBLL();

            RailExam.Model.ExamResult examResult = examResultBLL.GetExamResult(int.Parse(strId));
            RailExam.Model.Paper      paper      = null;

            if (examResult != null)
            {
                paper = kBLL.GetPaper(examResult.PaperId);
                lblExamBeginDateTime.Text     = examResult.BeginDateTime.ToString();
                lblExamEndDateTime.Text       = examResult.EndDateTime.ToString();
                lblExamineeName.Text          = examResult.ExamineeName;
                HiddenFieldEmployeeName.Value = lblExamineeName.Text;

                lblJudgeBeginDateTime.Text = examResult.JudgeBeginDateTime.ToString();
                lblJudgeEndDateTime.Text   = examResult.JudgeEndDateTime.ToString();
                lblJudgerName.Text         = examResult.JudgeName;
                if (examResult.Score <= 0M)
                {
                    lblScore.Text      = examResult.AutoScore.ToString();
                    ViewState["Score"] = examResult.AutoScore;
                    lblScore.Text     += "分";
                }
                else
                {
                    lblScore.Text      = examResult.Score.ToString();
                    ViewState["Score"] = examResult.Score;
                    lblScore.Text     += "分";
                }

                HiddenFieldScore.Value = lblScore.Text;
                examResultBLL.UpdateJudgeBeginTime(int.Parse(strId), DateTime.Now);
            }
            if (paper != null)
            {
                this.lblTitle.Text      = paper.PaperName;
                this.lblTitleRight.Text = "总共 " + paper.ItemCount + " 题,共 " + paper.TotalScore + " 分";
            }
        }
        protected void Page_Load(object sender, EventArgs e)
        {
            if (!IsPostBack)
            {
                ViewState["mode"]  = Request.QueryString.Get("mode");
                hfMode.Value       = ViewState["mode"].ToString();
                btnPreview.Visible = false;
                btnEdit.Visible    = false;
                string strId = Request.QueryString.Get("id");
                this.btnPreview.Attributes.Add("onclick", "ManagePaper(" + strId + ")");
                PaperBLL             paperBLL = new PaperBLL();
                RailExam.Model.Paper paper    = paperBLL.GetPaper(int.Parse(strId));

                if (paper != null)
                {
                    lblPaperName.Text         = paper.PaperName;
                    lblPaperCategoryName.Text = paper.CategoryName;
                    hfCategoryId.Value        = paper.CategoryId.ToString();
                }
            }
        }
Beispiel #11
0
        private void OutputData(string id)
        {
            PaperBLL paperBLL = new PaperBLL();

            RailExam.Model.Paper paper = paperBLL.GetPaper(int.Parse(id));

            PaperItemBLL paperItemBLL = new PaperItemBLL();
            IList <RailExam.Model.PaperItem> paperItems = paperItemBLL.GetItemsByPaperId(int.Parse(id));

            int     nItemCount  = paperItems.Count;
            decimal nTotalScore = 0;

            for (int i = 0; i < paperItems.Count; i++)
            {
                nTotalScore += paperItems[i].Score;
            }

            string str = "<table border='0' cellpadding='0' cellspacing='0' >";

            str += "<tr><td colspan='2' align='center' style='font-size:28px' >" + paper.PaperName + "</td> </tr><tr> <td  colspan='2' align='right'>总共" + nItemCount + "题共 " + nTotalScore + "分</td></tr> ";

            str += "<tr> <td style='width: 15%; vertical-align: top'>";
            str += "<table border='1' cellpadding='0' cellspacing='0' ><tr><td style='width: 100px; height: 50px' valign='top'> 所属单位:</td> </tr> <tr><td style='height: 50px' valign='top'>车间:</td> </tr><tr><td style='height: 50px' valign='top'>姓名:</td></tr><tr><td style='height: 50px' valign='top'>职名:</td></tr><tr><td style='height: 50px' valign='top'>考试日期:</td></tr></table> </td> ";


            str += " <td style='width: 85%; vertical-align: top'>   ";
            str += GetFillPaperString(id);
            str += "</td></tr></table> ";

            Response.Clear();
            Response.Charset = "utf-7";
            Response.Buffer  = true;
            EnableViewState  = false;
            Response.AppendHeader("Content-Disposition", "attachment;filename=Paper.doc");

            Response.ContentEncoding = System.Text.Encoding.GetEncoding("utf-7");
            Response.ContentType     = "application/ms-word";
            Response.Write(str);
            Response.End();
        }
Beispiel #12
0
        protected void FillPage(int nId)
        {
            PaperBLL paperBLL = new PaperBLL();

            RailExam.Model.Paper paper = paperBLL.GetPaper(nId);

            if (paper != null)
            {
                lblTitle.Text = paper.PaperName;
            }

            PaperItemBLL paperItemBLL = new PaperItemBLL();
            IList <RailExam.Model.PaperItem> paperItems = paperItemBLL.GetItemsByPaperId(nId);

            int     nItemCount  = paperItems.Count;
            decimal nTotalScore = 0;

            for (int i = 0; i < paperItems.Count; i++)
            {
                nTotalScore += paperItems[i].Score;
            }

            lblTitleRight.Text = "总共" + nItemCount + "题,共 " + nTotalScore + "分";
        }
Beispiel #13
0
        private string GetExamOutString(string strId, string orgid)
        {
            ExamResultBLL examResultBLL = new ExamResultBLL();
            PaperBLL      kBLL          = new PaperBLL();

            RailExam.Model.ExamResult examResult = new RailExam.Model.ExamResult();
            if (ViewState["NowOrgID"].ToString() == orgid)
            {
                examResult = examResultBLL.GetExamResult(Convert.ToInt32(strId));
            }
            else
            {
                examResult = examResultBLL.GetExamResultByOrgID(Convert.ToInt32(strId), Convert.ToInt32(orgid));
            }
            RailExam.Model.Paper paper = null;
            EmployeeBLL          ebLL  = new EmployeeBLL();

            RailExam.Model.Employee Employee = ebLL.GetEmployee(examResult.ExamineeId);
            paper = kBLL.GetPaper(examResult.PaperId);

            PaperItemBLL paperItemBLL = new PaperItemBLL();
            IList <RailExam.Model.PaperItem> paperItems = paperItemBLL.GetItemsByPaperId(paper.PaperId);
            int nItemCount = paperItems.Count;

            decimal nTotalScore = 0;

            for (int i = 0; i < paperItems.Count; i++)
            {
                nTotalScore += paperItems[i].Score;
            }



            string strOrgName     = Employee.OrgName;
            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    = "";
            }

            string str = "<div style='text-align:center;font-size:18pt;'>" + PrjPub.GetRailName() + "考试试卷</div>";

            str += "<div style='text-align:left;font-size:10.5pt;'>考试名称:" + paper.PaperName + " </div>";
            str += "<div style='text-align:right;font-size:10.5pt;'>总共" + nItemCount + "题,共 " + nTotalScore + "分</div>";
            str += "<div style='text-align:center;'><table width='100%' border='1' cellpadding='0' cellspacing='0' >";
            str += "<tr><td  width='7%' style='font-size:10.5pt' >单位:</td>";
            str += "<td  width='26%' style='font-size:10.5pt' align='left' >" + strStationName + "</td>";
            str += "<td  width='7%' style='font-size:10.5pt' >车间:</td>";
            str += "<td  width='27%' style='font-size:10.5pt' align='left' >" + strOrgName1 + "</td>";
            str += "<td  width='7%' style='font-size:10.5pt' >职名:</td>";
            str += "<td  width='26%' style='font-size:10.5pt' align='left' >" + Employee.PostName + "</td></tr>";
            str += "<tr><td  width='7%' style='font-size:10.5pt' >姓名:</td>";
            str += "<td  width='26%' style='font-size:10.5pt' align='left' >" + Employee.EmployeeName + "</td>";
            str += "<td  width='7%' style='font-size:10.5pt' >时间:</td>";
            str += "<td  width='27%' style='font-size:10.5pt' align='left' >" + examResult.BeginDateTime.ToString("yyyy-MM-dd HH:mm") + "</td>";
            str += "<td  width='7%' style='font-size:10.5pt' >成绩:</td>";
            str += "<td  width='26%' style='font-size:10.5pt' align='left' >" + examResult.Score + "</td></tr></table></div>";
            str += "<br>";
            str += GetFillExamPaperString(strId, orgid);

            string strReplace;

            if (PrjPub.IsServerCenter)
            {
                strReplace = "http://" + ConfigurationManager.AppSettings["ServerIP"] + "/RailExamBao/";
            }
            else
            {
                strReplace = "http://" + ConfigurationManager.AppSettings["StationIP"] + "/RailExamBao/";
            }
            str = str.Replace("/RailExamBao/", strReplace);

            return(str);
        }
Beispiel #14
0
        protected void btnSaveAndNext_Click(object sender, EventArgs e)
        {
            PaperBLL paperBLL = new PaperBLL();

            RailExam.Model.Paper paper = new RailExam.Model.Paper();

            string strID   = string.Empty;
            string strMode = ViewState["mode"].ToString();

            if (strMode == "Insert")
            {
                paper.CategoryId   = int.Parse(hfCategoryId.Value);
                paper.PaperName    = txtPaperName.Text;
                paper.Description  = txtDescription.Text;
                paper.Memo         = txtMemo.Text;
                paper.CreatePerson = PrjPub.CurrentLoginUser.EmployeeName;
                paper.CreateMode   = int.Parse(ddlMode.SelectedValue);
                paper.CreateTime   = DateTime.Now;
                paper.ItemCount    = 0;
                paper.StatusId     = 1;
                paper.TotalScore   = 0;
                paper.OrgId        = PrjPub.CurrentLoginUser.StationOrgID;

                int id = paperBLL.AddPaper(paper);

                strID = id.ToString();

                if (ddlMode.SelectedValue == "1")
                {
                    Response.Redirect("PaperManageEditSecond.aspx?mode=" + strMode + "&id=" + strID);
                }
                else if (ddlMode.SelectedValue == "2")
                {
                    Response.Redirect("PaperManageStrategy.aspx?mode=" + strMode + "&id=" + strID);
                }
                else
                {
                    PaperStrategyBLL             paperStrategyBLL = new PaperStrategyBLL();
                    RailExam.Model.PaperStrategy paperStrategy    = new RailExam.Model.PaperStrategy();

                    paperStrategy.PaperCategoryId   = int.Parse(hfCategoryId.Value);
                    paperStrategy.PaperStrategyName = "temp";
                    paperStrategy.StrategyMode      = int.Parse(ddlStrategyMode.SelectedValue);
                    paperStrategy.SingleAsMultiple  = false;
                    paperStrategy.IsRandomOrder     = false;
                    paperStrategy.Description       = "";
                    paperStrategy.Memo = "";

                    string strStrategyID = paperStrategyBLL.AddPaperStrategy(paperStrategy).ToString();
                    Response.Redirect("PaperStrategyEditSecond.aspx?mode=" + strMode + "&id=" + strStrategyID + "&Paperid=" + strID);
                }
            }
            else
            {
                strID = Request.QueryString.Get("id");

                paper.PaperName   = txtPaperName.Text;
                paper.PaperId     = int.Parse(strID);
                paper.Memo        = txtMemo.Text;
                paper.Description = txtDescription.Text;
                paper.TotalScore  = 0;

                paperBLL.UpdatePaper(paper);

                if (ddlMode.SelectedValue == "2")
                {
                    PaperSubjectBLL paperSubjectBLL = new PaperSubjectBLL();

                    IList <PaperSubject> psList = paperSubjectBLL.GetPaperSubjectByPaperId(int.Parse(strID));

                    if (psList.Count > 0)
                    {
                        Response.Redirect("PaperManageEditSecond.aspx?mode=" + strMode + "&id=" + strID);
                    }
                    else
                    {
                        Response.Redirect("PaperManageStrategy.aspx?mode=" + strMode + "&id=" + strID);
                    }
                }
                else if (ddlMode.SelectedValue == "3")
                {
                    PaperSubjectBLL paperSubjectBLL = new PaperSubjectBLL();

                    IList <PaperSubject> psList = paperSubjectBLL.GetPaperSubjectByPaperId(int.Parse(strID));

                    if (psList.Count > 0)
                    {
                        Response.Redirect("PaperManageEditSecond.aspx?mode=" + strMode + "&id=" + strID);
                    }
                    else
                    {
                        string strStrategyID = Request.QueryString.Get("Strategyid");
                        if (!string.IsNullOrEmpty(strStrategyID))
                        {
                            Response.Redirect("PaperStrategyEditSecond.aspx?mode=" + strMode + "&id=" + strStrategyID + "&Paperid=" + strID);
                        }
                        else
                        {
                            PaperStrategyBLL             paperStrategyBLL = new PaperStrategyBLL();
                            RailExam.Model.PaperStrategy paperStrategy    = new RailExam.Model.PaperStrategy();

                            paperStrategy.PaperCategoryId   = int.Parse(hfCategoryId.Value);
                            paperStrategy.PaperStrategyName = "temp";
                            paperStrategy.StrategyMode      = int.Parse(ddlStrategyMode.SelectedValue);
                            paperStrategy.SingleAsMultiple  = false;
                            paperStrategy.IsRandomOrder     = false;
                            paperStrategy.Description       = "";
                            paperStrategy.Memo = "";
                            strStrategyID      = paperStrategyBLL.AddPaperStrategy(paperStrategy).ToString();
                            Response.Redirect("PaperStrategyEditSecond.aspx?mode=" + strMode + "&id=" + strStrategyID + "&Paperid=" + strID);
                        }
                    }
                }
                else
                {
                    Response.Redirect("PaperManageEditSecond.aspx?mode=" + strMode + "&id=" + strID);
                }
            }
        }