Example #1
0
        protected void Page_Load(object sender, EventArgs e)
        {
            string orgID = Request.QueryString.Get("orgid");
            string strId = Request.QueryString.Get("id");

            ViewState["NowOrgID"] = Convert.ToInt32(ConfigurationManager.AppSettings["StationID"]);

            if (!string.IsNullOrEmpty(strId))
            {
                FillHeading(strId, orgID);
            }

            if (!IsPostBack)
            {
                if (PrjPub.CurrentLoginUser != null)
                {
                    hfLoginEmployeeID.Value = PrjPub.CurrentLoginUser.EmployeeID.ToString();
                }
                else
                {
                    RandomExamResultBLL bll    = new RandomExamResultBLL();
                    RandomExamResult    result = bll.GetRandomExamResult(Convert.ToInt32(strId));
                    hfLoginEmployeeID.Value = result.ExamineeId.ToString();

                    if (hfLoginEmployeeID.Value == "0")
                    {
                        RandomExamResult result1 = bll.GetRandomExamResultTemp(Convert.ToInt32(strId));
                        hfLoginEmployeeID.Value = result1.ExamineeId.ToString();
                    }
                }
            }
        }
Example #2
0
        private void ReplyExam(string strId)
        {
            RandomExamResultBLL objResultBll = new RandomExamResultBLL();
            RandomExamResult    result       = objResultBll.GetRandomExamResult(Convert.ToInt32(strId));

            RandomExamResultCurrentBLL objBll = new RandomExamResultCurrentBLL();

            objBll.ReplyRandomExamResultCurrentByResultID(result.ExamineeId, Convert.ToInt32(strId));
            examsGrid.DataSource = objBll.GetRandomExamResultInfoByExamID(result.RandomExamId, GetSql());
            examsGrid.DataBind();
        }
        protected void Grid1_RowUpdating(object sender, GridViewUpdateEventArgs e)
        {
            string resultID   = ((HiddenField)Grid1.Rows[e.RowIndex].FindControl("hfID")).Value;
            string employeeID = ((HiddenField)Grid1.Rows[e.RowIndex].FindControl("hfExamineeID")).Value;
            string score      = ((TextBox)Grid1.Rows[e.RowIndex].FindControl("txtScore")).Text;

            RandomExamResultBLL objResultBll = new RandomExamResultBLL();

            if (resultID == "0")
            {
                RandomExamResult objResult = new RandomExamResult();
                objResult.OrganizationId  = Convert.ToInt32(ViewState["ExamOrgID"]);
                objResult.RandomExamId    = Convert.ToInt32(ViewState["ExamID"]);
                objResult.ExamineeId      = Convert.ToInt32(employeeID);
                objResult.BeginDateTime   = DateTime.Now;
                objResult.EndDateTime     = DateTime.Now;
                objResult.CurrentDateTime = DateTime.Now;
                objResult.ExamTime        = 0;
                objResult.AutoScore       = 0;
                objResult.Score           = Convert.ToDecimal(score);
                objResult.CorrectRate     = Convert.ToDecimal(score);
                objResult.IsPass          = Convert.ToDecimal(score) >= 60 ? true : false;
                objResult.StatusId        = 2;
                objResultBll.AddRandomExamResult(objResult);
            }
            else
            {
                RandomExamResult objResult = objResultBll.GetRandomExamResult(Convert.ToInt32(resultID));
                objResult.Score       = Convert.ToDecimal(score);
                objResult.CorrectRate = Convert.ToDecimal(score);
                objResult.IsPass      = Convert.ToDecimal(score) >= 60 ? true : false;
                objResultBll.UpdateRandomExamResultOther(objResult);
            }

            Grid1.EditIndex = -1;
            BindGrid();
        }
Example #4
0
        protected void FillHeading(string strId, string orgid)
        {
            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.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) + "分";
        }
Example #5
0
        protected void Page_Load(object sender, EventArgs e)
        {
            if (!IsPostBack)
            {
                try
                {
                    string strExamType     = Request.QueryString.Get("ExamType");
                    string strExamResultID = Request.QueryString.Get("ExamResultID");
                    if (strExamType == "1")
                    {
                        RandomExamResultBLL             objBll = new RandomExamResultBLL();
                        RailExam.Model.RandomExamResult obj    = new RandomExamResult();
                        if (string.IsNullOrEmpty(Request.QueryString.Get("IsResult")))
                        {
                            //正常提交
                            obj =
                                objBll.GetRandomExamResultTemp(Convert.ToInt32(strExamResultID));
                        }
                        else
                        {
                            //后台终止考试或结束考试
                            obj =
                                objBll.GetRandomExamResult(Convert.ToInt32(strExamResultID));
                        }
                        RandomExamBLL             objExamBll    = new RandomExamBLL();
                        RailExam.Model.RandomExam objRandomExam = objExamBll.GetExam(obj.RandomExamId);

                        if (objRandomExam.CanSeeScore)
                        {
                            hfIsShowResult.Value = "1";
                            lblScore.Text        = "成绩:" + System.String.Format("{0:0.##}", obj.Score) + "分";

                            if (objRandomExam.CanSeeAnswer)
                            {
                                hfIsShowAnswer.Value = "1";
                            }

                            //if (lblScore.Text == string.Empty)
                            //{
                            //    lblScore.Text = "成绩:" + String.Format("{0:0.##}", Request.QueryString.Get("nowScore")) + "分";
                            //}
                        }

                        if (objRandomExam.IsPublicScore)
                        {
                            if (obj.Score >= objRandomExam.PassScore)
                            {
                                lblPass.Text = "祝贺您本次考试合格通过!";
                            }
                            else
                            {
                                lblPass.Text = "您本次考试未合格未通过!";
                            }
                        }
                        else
                        {
                            lblPass.Text = "";
                        }

                        if (string.IsNullOrEmpty(Request.QueryString.Get("IsResult")))
                        {
                            //正常提交
                            try
                            {
                                OracleAccess dbPhoto = new OracleAccess();
                                string       strSql  = "select * from Random_Exam_Result_Detail_Temp where Random_Exam_Result_ID=" +
                                                       strExamResultID + " and Random_Exam_ID=" + obj.RandomExamId;
                                DataSet dsPhoto = dbPhoto.RunSqlDataSet(strSql);

                                if (dsPhoto.Tables[0].Rows.Count > 0)
                                {
                                    DataRow drPhoto    = dsPhoto.Tables[0].Rows[0];
                                    int     employeeId = Convert.ToInt32(drPhoto["Employee_ID"]);
                                    if (drPhoto["FingerPrint"] != DBNull.Value)
                                    {
                                        Pub.SavePhotoToLocal(obj.RandomExamId, employeeId, (byte[])drPhoto["FingerPrint"], 0, Convert.ToInt32(strExamResultID));
                                    }
                                    if (drPhoto["Photo1"] != DBNull.Value)
                                    {
                                        Pub.SavePhotoToLocal(obj.RandomExamId, employeeId, (byte[])drPhoto["Photo1"], 1, Convert.ToInt32(strExamResultID));
                                    }
                                    if (drPhoto["Photo2"] != DBNull.Value)
                                    {
                                        Pub.SavePhotoToLocal(obj.RandomExamId, employeeId, (byte[])drPhoto["Photo2"], 2, Convert.ToInt32(strExamResultID));
                                    }
                                    if (drPhoto["Photo3"] != DBNull.Value)
                                    {
                                        Pub.SavePhotoToLocal(obj.RandomExamId, employeeId, (byte[])drPhoto["Photo3"], 3, Convert.ToInt32(strExamResultID));
                                    }
                                }
                            }
                            catch
                            {
                                hfOrgID.Value = ConfigurationManager.AppSettings["StationID"];
                            }
                        }
                    }

                    hfOrgID.Value = ConfigurationManager.AppSettings["StationID"];
                }
                catch
                {
                    lblPass.Text = "";
                }
            }
        }