Exemplo n.º 1
0
        /// <summary>
        /// 确认发布考试
        /// </summary>
        /// <param name="info"></param>
        /// <returns></returns>
        public bool ReleaseExamination(ExaminationInfo info)
        {
            string sql = "insert into TBL_ExaminationPaper values (NEWID(),@paperTitle,@singleList,@singleOption,@judgeList,@judgeOption,@classId,@teacherId,@courseId,GETDATE(),@testTime,@rollOutTime)";

            SqlParameter[] pars =
            {
                new SqlParameter("@paperTitle",   SqlDbType.NVarChar),
                new SqlParameter("@singleList",   SqlDbType.NVarChar),
                new SqlParameter("@singleOption", SqlDbType.NVarChar),
                new SqlParameter("@judgeList",    SqlDbType.NVarChar),
                new SqlParameter("@judgeOption",  SqlDbType.NVarChar),
                new SqlParameter("@classId",      SqlDbType.UniqueIdentifier),
                new SqlParameter("@teacherId",    SqlDbType.UniqueIdentifier),
                new SqlParameter("@courseId",     SqlDbType.UniqueIdentifier),
                new SqlParameter("@testTime",     SqlDbType.NVarChar),
                new SqlParameter("@rollOutTime",  SqlDbType.NVarChar)
            };
            pars[0].Value = info.PaperTitle;
            pars[1].Value = info.SingleList;
            pars[2].Value = info.SingleOption;
            pars[3].Value = info.JudgeList;
            pars[4].Value = info.JudgeOption;
            pars[5].Value = info.ClassID;
            pars[6].Value = info.TeacherID;
            pars[7].Value = info.CourseID;
            pars[8].Value = info.TestTime;
            pars[9].Value = info.RollOutTime;

            int result = SQLHelper.ExecutSql(sql, CommandType.Text, pars);

            return(result > 0);
        }
Exemplo n.º 2
0
        /// <summary>
        /// 考卷发布确认提交
        /// </summary>
        /// <param name="paperTitle">试卷名称</param>
        /// <param name="singleList">选择列表</param>
        /// <param name="judgeList">判断列表</param>
        /// <param name="classId">考试班级</param>
        /// <param name="testTime">考试结束时间</param>
        /// <param name="rollOutTime">考试时长</param>
        /// <returns></returns>
        public ActionResult ReleaseCheck(string paperTitle, string singleList, string judgeList, string classId, string testTime, string rollOutTime)
        {
            #region 取出教师信息,随机排序考题选项
            User user     = (User)Session["User"];
            Guid userId   = user.ID;                                                                        // 教师ID
            Guid courseId = Guid.Parse(new TeacherBLL().GetTeacher(userId).Rows[0]["CourseID"].ToString()); // 科目ID

            string single_options = GetSingleOptionSrot();                                                  // 随机选择题排序规则 例:ABCD,CBDA...
            string judge_options  = GetJudgeOptionSrot();                                                   // 随机判断题排序规则 例:BA,AB...
            #endregion

            // 检测试卷名是否唯一
            bool checkTitle = new ExaminationBLL().CheckExamTitle(paperTitle);
            if (checkTitle)
            {
                return(Content(new AjaxResult
                {
                    state = ResultType.info.ToString(),
                    message = string.Format($"试卷名重复!")
                }.ToJson()));
            }

            // 整合考试信息Model
            ExaminationInfo examination = new ExaminationInfo();
            examination.PaperTitle   = paperTitle.Trim();
            examination.SingleList   = singleList.Substring(0, singleList.Length - 1);
            examination.SingleOption = single_options;
            examination.JudgeList    = judgeList.Substring(0, judgeList.Length - 1);
            examination.JudgeOption  = judge_options;
            examination.ClassID      = Guid.Parse(classId);
            examination.TeacherID    = userId;
            examination.CourseID     = courseId;
            examination.TestTime     = DateTime.Parse(testTime);
            examination.RollOutTime  = rollOutTime;

            // 提交结果
            bool release = new ExaminationBLL().ReleaseExamination(examination);
            switch (release)
            {
            case true:
                return(Content(new AjaxResult
                {
                    state = ResultType.info.ToString(),
                    message = string.Format($"《{paperTitle}》 发布成功!")
                }.ToJson()));

            case false:
                return(Content(new AjaxResult
                {
                    state = ResultType.info.ToString(),
                    message = string.Format($"《{paperTitle}》 发布失败!")
                }.ToJson()));

            default:
                return(Content(new AjaxResult
                {
                    state = ResultType.error.ToString(),
                    message = string.Format($"未知错误!")
                }.ToJson()));
            }
        }
Exemplo n.º 3
0
 public bool EditTo(ExaminationInfo entity)
 {
     return(efCore.EditTo(entity));
 }
Exemplo n.º 4
0
 /// <summary>
 /// 确认发布考试
 /// </summary>
 /// <param name="info"></param>
 /// <returns></returns>
 public bool ReleaseExamination(ExaminationInfo info)
 {
     return(examinationDAL.ReleaseExamination(info));
 }
Exemplo n.º 5
0
 public bool SaveAs(ExaminationInfo entity)
 {
     return(efCore.SaveAs(entity));
 }