/*private String text, qType, qClassify, qContent, qOptionalAnswer, qModelAnswer; * private Boolean formatFlag, isContent; * private Byte difficultyCoefficient; * private Int32 score; * private StringBuilder errorIds; * private List<Question> readyQs; * * public Dictionary<String, String> ImportDocx(String filePath) * { * * Dictionary<String, String> dic; * * dic = new Dictionary<String, String>(); * dic.Add("Status", "0"); * dic.Add("Data", ""); * dic.Add("Message", ""); * * try * { * * List<DocxParagraph> docxPara; * const String qTypes = "单选题;多选题;判断题;公文改错题;计算题;案例分析题;问答题;"; * DateTime now; * Regex typeRegex, contentRegex1, contentRegex2, optionalAnswerRegex, modelAnswerRegex, * difficultyCoefficientRegex, scoreRegex, digitRegex; * Int32 i1, i2, len, qId, qcId; * List<QuestionClassify> qcs; * QuestionClassify classify; * * formatFlag = true; * errorIds = new StringBuilder(); * * docxPara = OpenXmlDocHelper.GetDocxParagraphs(filePath); * * now = DateTime.Now; * * typeRegex = new Regex(@"^题型[::]{1}"); * contentRegex1 = new Regex(@"^\s*\d+[\..、]"); // 示例:1. * contentRegex2 = new Regex(@"^\s*\(.+\)|^\s*(.+)"); // 示例:(一) (一) * optionalAnswerRegex = new Regex(@"^\s*[a-zA-Z]{1}[\..、]{1}"); // 示例:A. B. C. * modelAnswerRegex = new Regex(@"^\s*((答案|参考答案){1}[::]{1})|【答】"); * difficultyCoefficientRegex = new Regex(@"^难度系数[::]{1}\d{1}"); * scoreRegex = new Regex(@"^分数[::]{1}\d+$"); * digitRegex = new Regex(@"\d+"); * * qType = ""; * qClassify = ""; * qContent = ""; * qOptionalAnswer = ""; * qModelAnswer = ""; * isContent = true; * * readyQs = new List<Question>(); * qcs = new List<QuestionClassify>(); * * // 获取数据编号 * qId = GetQId(); * qcId = GetQCId(); * * difficultyCoefficient = 0; * score = 0; * * foreach (var para in docxPara) * { * * text = para.Text; * #region 添加试题数据 * * switch (qType) * { * case "单选题": * case "多选题": * * if (qModelAnswer != "") * { * // 格式化单选题/多选题的答案 * qOptionalAnswer = FormatOptionalAnswer(qOptionalAnswer); * qModelAnswer = FormatModelAnswer(qModelAnswer); * * AddQuestion(qId, qcId); * } * break; * case "判断题": * case "计算题": * case "案例分析题": * case "问答题": * * if ((contentRegex1.IsMatch(text) || typeRegex.IsMatch(text)) * && qModelAnswer != "") * { * AddQuestion(qId, qcId); * } * * break; * * case "公文改错题": * * if ((contentRegex2.IsMatch(text) || typeRegex.IsMatch(text)) * && qModelAnswer != "") * { * AddQuestion(qId, qcId); * } * * break; * * default: * break; * } #endregion * #region 判断是否为分类行 * * // 此行为分类行 * if (text.IndexOf("分类:") == 0) * { * //TODO:添加分类数据,记录分类编号 * qClassify = text.Substring(3); * * // 判断分类是否存在 * classify = olsEni.QuestionClassifies.SingleOrDefault(model => model.QC_Name == qClassify); * * // 如果不存在,则新增 * if (null == classify) * { * * qcs.Add(new QuestionClassify() * { * QC_Id = qcId, * QC_Name = qClassify, * QC_Level = "000" + qcId.ToString(), * QC_AddTime = now, * QC_Status = 4 * }); * qcId += 1; * } * else * { * qcId = classify.QC_Id; * } * * continue; * } * #endregion * #region 判断是否为题型行 * * // 此行为题型行 * if (typeRegex.IsMatch(text)) * { * * qType = text.Substring(3); * qType = qType.Replace("单项选择题", "单选题"); * qType = qType.Replace("多项选择题", "多选题"); * * if (qTypes.IndexOf(qType) == -1) * { * //TODO:返回,提示“当前题型不支持导入” * dic["Message"] = "题型“" + qType + "”不支持导入。"; * return dic; * } * * continue; * } * #endregion * #region 判断是否为难度系数行 * * if (difficultyCoefficientRegex.IsMatch(text)) * { * difficultyCoefficient = Convert.ToByte(digitRegex.Match(text).Value); * continue; * } * #endregion * #region 判断是否为分数行 * * if (scoreRegex.IsMatch(text)) * { * score = Convert.ToInt32(digitRegex.Match(text).Value); * continue; * } * #endregion * #region 判断是否为试题内容行 * * //TODO:记录试题内容 * switch (qType) * { * case "单选题": * case "多选题": * case "判断题": * * if (contentRegex1.IsMatch(text)) * { * * // 提取标准答案 * text = contentRegex1.Replace(text, ""); * qContent = text; * qContent = qContent.Replace("(", "("); * qContent = qContent.Replace(")", ")"); * * i1 = qContent.LastIndexOf("("); * i2 = qContent.LastIndexOf(")"); * * if (i1 == -1 || i2 == -1) * { * //TODO:返回提示格式错误 * dic["Message"] = "题型格式有误。"; * return dic; * } * * len = i2 - i1 - 1; * qModelAnswer = qContent.Substring(i1 + 1, len); * if (qModelAnswer != "") * { * qContent = qContent.Replace(qModelAnswer, " "); * qModelAnswer = qModelAnswer.Trim(); * } * else // 避免模板中没有设置答案时不添加试题 * { * qModelAnswer = " "; * } * * continue; * * } * * break; * * case "公文改错题": * case "计算题": * case "案例分析题": * case "问答题": * * // 公文改错题;计算题;案例分析题;问答题; * // 判断是否为标准答案行 * if (modelAnswerRegex.IsMatch(text)) * { * * isContent = false; * * text = modelAnswerRegex.Replace(text, ""); * } * * if (isContent) * { * * if ("公文改错题" == qType) * { * text = contentRegex2.Replace(text, ""); * } * else * { * text = contentRegex1.Replace(text, ""); * } * qContent += text + "\\r\\n"; * } * * break; * * default: * * break; * } * #endregion * #region 判断是否为试题答案行 * * switch (qType) * { * * case "单选题": * case "多选题": * * // 单选题;多选题; * // 判断是否为备选答案行 * if (optionalAnswerRegex.IsMatch(text)) * { * * qOptionalAnswer += text + " "; * } * * break; * * case "公文改错题": * case "计算题": * case "案例分析题": * case "问答题": * * if (!isContent) * { * //TODO:记录试题答案 * qModelAnswer += text + "\\r\\n"; * } * * break; * * default: * break; * } * #endregion * * } * * AddQuestion(qId, qcId); * * foreach (var qc in qcs) * { * olsEni.QuestionClassifies.Add(qc); * } * * olsEni.SaveChanges(); * * foreach (var model in readyQs) * { * olsEni.Questions.Add(model); * } * * olsEni.SaveChanges(); * * * dic["Status"] = "1"; * * if (formatFlag) * { * dic["Message"] = "试题模板数据存在错误(" + errorIds.Remove(errorIds.Length - 2, 2).ToString() + ")。"; * } * * return dic; * } * catch (Exception ex) * { * dic["Message"] = StaticHelper.GetExceptionMessageAndRecord(ex); * return dic; * } * } * * private void AddQuestion(Int32 qId, Int32 qcId) * { * * qId += 1; * * readyQs.Add(new Question() * { * Q_Id = qId, * Q_Type = qType, * QC_Id = qcId, * Q_DifficultyCoefficient = difficultyCoefficient, * Q_Score = SetDefaultScore(qType, score), * Q_Content = qContent, * Q_OptionalAnswer = qOptionalAnswer, * Q_ModelAnswer = qModelAnswer, * Q_AddTime = now, * Q_Status = 4 * }); * * // 标识数据错误 * if (qOptionalAnswer == "{}" || qModelAnswer == "[]") * { * formatFlag = true; * errorIds.Append(qId + ", "); * } * * difficultyCoefficient = 0; * score = 0; * qContent = ""; * qOptionalAnswer = ""; * qModelAnswer = ""; * isContent = true; * }*/ public DataTablesResponse ListDataTablesAjax(DataTablesRequest dtRequest, Int32 qcId) { DataTablesResponse dtResponse; QuestionClassify qc; UModel <Question> umodel; List <SqlParameter> sps; List <Question> ms; umodel = new UModel <Question>(dtRequest, "Questions", "Q_Id"); sps = new List <SqlParameter>(); if (0 != qcId) { sps.Add(new SqlParameter("@QC_Id", qcId)); } dtResponse = umodel.GetList(sps, "Q_Status", new String[] { "QC_Name" }); ms = (List <Question>)dtResponse.data; foreach (var m1 in ms) { qc = olsEni.QuestionClassifies.SingleOrDefault(m => m.QC_Id == m1.QC_Id); if (null == qc) { m1.QC_Name = ""; continue; } m1.QC_Name = qc.QC_Name; } return(dtResponse); }
public DataTablesResponse ListDataTablesAjax(DataTablesRequest dtRequest, String taskName, DateTime beginTime, DateTime endTime) { String sql; DataTablesResponse dtResponse; UModel <VMExaminationTaskStatistic> umodel; List <SqlParameter> sps; umodel = new UModel <VMExaminationTaskStatistic>(dtRequest, "ExaminationTaskStatistic", "ETS_PaperTemplateId"); sql = "SELECT * FROM ExaminationTaskStatistic "; sps = new List <SqlParameter>(); if (taskName != "") { sps.Add(new SqlParameter("@LIKE_ETS_TaskName", "%" + taskName + "%")); } if (beginTime.Year != 1 && endTime.Year != 1) { endTime = endTime.AddHours(23).AddMinutes(59).AddSeconds(59); beginTime = beginTime.AddSeconds(-1); sps.Add(new SqlParameter("@GT_ETS_PaperTemplateDate", beginTime)); sps.Add(new SqlParameter("@LT_ETS_PaperTemplateDate", endTime)); } dtResponse = umodel.GetList(sql, sps); return(dtResponse); }
internal DataTablesResponse ListDetailDataTablesAjax(DataTablesRequest dtRequest, Int32 uId, String taskName, DateTime beginTime, DateTime endTime) { String sql; DataTablesResponse dtResponse; List <SqlParameter> sps; UModel <VMUserScoreDetail> umodel; umodel = new UModel <VMUserScoreDetail>(dtRequest, "UserScoreDetails", "USD_UserId"); sql = "SELECT * FROM UserScoreDetails "; sps = new List <SqlParameter>(); sps.Add(new SqlParameter("@EQ_USD_UserId", uId)); if (taskName != "") { sps.Add(new SqlParameter("@LIKE_USD_TaskName", "%" + taskName + "%")); } if (beginTime.Year != 1 && endTime.Year != 1) { endTime = endTime.AddHours(23).AddMinutes(59).AddSeconds(59); beginTime = beginTime.AddSeconds(-1); sps.Add(new SqlParameter("@GT_USD_StartTime", beginTime)); sps.Add(new SqlParameter("@LT_USD_StartTime", endTime)); } dtResponse = umodel.GetList(sql, sps); return(dtResponse); }
public DataTablesResponse ListDataTablesAjax(DataTablesRequest dtRequest) { DataTablesResponse dtResponse; UModel <Duty> umodel; umodel = new UModel <Duty>(dtRequest, "Duties", "Du_Id"); dtResponse = umodel.GetList("Du_Status", "Du_Sort"); return(dtResponse); }
public DataTablesResponse ListDataTablesAjax(DataTablesRequest dtRequest) { DataTablesResponse dtResponse; UModel <ExaminationTask> umodel; umodel = new UModel <ExaminationTask>(dtRequest, "ExaminationTasks", "ET_Id"); dtResponse = umodel.GetList("ET_Status"); return(dtResponse); }
public DataTablesResponse ListDataTablesAjax(DataTablesRequest dtRequest) { DataTablesResponse dtResponse; UModel <QuestionClassify> umodel; umodel = new UModel <QuestionClassify>(dtRequest, "QuestionClassifies", "QC_Id"); dtResponse = umodel.GetList("QC_Status"); return(dtResponse); }
public DataTablesResponse ListDataTablesAjax(DataTablesRequest dtRequest) { DataTablesResponse dtResponse; UModel <LearningDataCategory> umodel; umodel = new UModel <LearningDataCategory>(dtRequest, "LearningDataCategories", "LDC_Id"); dtResponse = umodel.GetList("LDC_Status", "LDC_Sort"); return(dtResponse); }
public DataTablesResponse ListDataTablesAjax(DataTablesRequest dtRequest) { DataTablesResponse dtResponse; UModel <Role> umodel; umodel = new UModel <Role>(dtRequest, "Roles", "R_Id"); dtResponse = umodel.GetList("R_Status"); return(dtResponse); }
public DataTablesResponse ListDataTablesAjax(DataTablesRequest dtRequest) { DataTablesResponse dtResponse; UModel <PermissionCategory> umodel; umodel = new UModel <PermissionCategory>(dtRequest, "PermissionCategories", "PC_Id"); dtResponse = umodel.GetList("PC_Status"); return(dtResponse); }
public DataTablesResponse ListDataTablesAjax(DataTablesRequest dtRequest) { DataTablesResponse dtResponse; UModel <Department> umodel; umodel = new UModel <Department>(dtRequest, "Departments", "D_Id"); dtResponse = umodel.GetList("D_Status", "D_Sort"); return(dtResponse); }
public DataTablesResponse ListDataTablesAjax(DataTablesRequest dtRequest, Byte mode) { DataTablesResponse dtResponse; List <SqlParameter> sps; UModel <ExaminationTask> umodel; sps = new List <SqlParameter>(); sps.Add(new SqlParameter("@ET_Mode", mode)); umodel = new UModel <ExaminationTask>(dtRequest, "ExaminationTasks", "ET_Id"); dtResponse = umodel.GetList(sps, "ET_Status"); return(dtResponse); }
public DataTablesResponse ListDataTablesAjax(DataTablesRequest dtRequest) { DataTablesResponse dtResponse; UModel <SystemLog> umodel; List <SystemLog> ms; umodel = new UModel <SystemLog>(dtRequest, "SystemLogs", "SL_Id"); dtResponse = umodel.GetList("SL_Status"); ms = (List <SystemLog>)dtResponse.data; dtResponse.data = ms; return(dtResponse); }
internal DataTablesResponse ListDetailDataTablesAjax(DataTablesRequest dtRequest, Int32 uId) { DataTablesResponse dtResponse; List <SqlParameter> sps; UModel <VMUserScoreDetail> umodel; umodel = new UModel <VMUserScoreDetail>(dtRequest, "UserScoreDetails", "USD_UserId"); sps = new List <SqlParameter>(); sps.Add(new SqlParameter("@USD_UserId", uId)); dtResponse = umodel.GetList("SELECT * FROM UserScoreDetails ", sps); return(dtResponse); }
public DataTablesResponse ListDataTablesAjaxStudent(DataTablesRequest dtRequest, Int32 uId, Byte etType, Byte pageType) { DataTablesResponse dtResponse; UModel <VMExaminationStudentPaperTemplate> umodel; List <SqlParameter> sps; umodel = new UModel <VMExaminationStudentPaperTemplate>(dtRequest, "ExaminationStudentPaperTemplates", "ESPT_PaperTemplateId"); sps = new List <SqlParameter>(); sps.Add(new SqlParameter("@EQ_ESPT_UserId", uId)); sps.Add(new SqlParameter("@EQ_ESPT_TaskType", etType)); sps.Add(new SqlParameter("@EQ_ESPT_PageType", pageType)); dtResponse = umodel.GetList(sps); return(dtResponse); }
public DataTablesResponse ListDataTablesAjax(DataTablesRequest dtRequest, Int32 ldcId) { DataTablesResponse dtResponse; UModel <LearningData> umodel; List <SqlParameter> sps; sps = new List <SqlParameter>(); if (0 != ldcId) { sps.Add(new SqlParameter("@LDC_Id", ldcId)); } umodel = new UModel <LearningData>(dtRequest, "LearningDatas", "LD_Id"); dtResponse = umodel.GetList(sps, "LD_Status", "LD_Sort"); return(dtResponse); }
public DataTablesResponse ListDataTablesAjax(DataTablesRequest dtRequest, Byte type, Byte enabled, Int32 uId) { String sql; DataTablesResponse dtResponse; List <SqlParameter> sps; UModel <ExaminationTask> umodel; sql = "SELECT et.* FROM ExaminationTasks et LEFT JOIN ExaminationTaskAttendees eta ON et.ET_Id = eta.ET_Id "; sps = new List <SqlParameter>(); sps.Add(new SqlParameter("@ET_Type", type)); sps.Add(new SqlParameter("@ET_Enabled", enabled)); sps.Add(new SqlParameter("@U_Id", uId)); umodel = new UModel <ExaminationTask>(dtRequest, "ExaminationTasks", "ET_Id"); dtResponse = umodel.GetList(sql, sps, "ET_Status"); return(dtResponse); }
public DataTablesResponse ListDataTablesAjax(DataTablesRequest dtRequest, Int32 departmentId) { String sql; DataTablesResponse dtResponse; List <SqlParameter> sps; UModel <User> umodel; List <User> ms; umodel = new UModel <User>(dtRequest, "Users", "U_Id"); sps = new List <SqlParameter>(); if (0 != departmentId) { sps.Add(new SqlParameter("@D_Id", departmentId)); } sql = "SELECT * FROM " + " (" + " SELECT u.U_Id U_Id, " + " u.U_Name U_Name, " + " u.U_IdCardNumber U_IdCardNumber, " + " u.U_AddTime U_AddTime, " + " '**********' U_Password, " + " u.U_Status U_Status, " + " u.U_Sort U_Sort, " + " d.D_Id D_Id, " + " d.D_Name D_Name, " + " D_Sort, " + " du.Du_Name " + " FROM Users u " + " LEFT JOIN User_Department ud ON u.U_Id = ud.U_Id" + " LEFT JOIN Departments d ON d.D_Id = ud.D_Id " + " LEFT JOIN Duties du ON du.Du_Id = u.Du_Id " + " ) TmpTable "; umodel = new UModel <User>(dtRequest, "Users", "U_Id"); dtResponse = umodel.GetList(sql, sps, "U_Status", new String[] { "D_Sort", "U_Sort" }, new String[] { "Du_Name" }); ms = (List <User>)dtResponse.data; dtResponse.data = ms; return(dtResponse); }
internal DataTablesResponse ListSummaryDataTablesAjax(DataTablesRequest dtRequest, Int32 dId = 0) { DataTablesResponse dtResponse; UModel <VMUserScoreSummary> umodel; List <SqlParameter> sps; umodel = new UModel <VMUserScoreSummary>(dtRequest, "UserScoreSummaries", "USS_UserId"); if (dId == 0) { dtResponse = umodel.GetList(); } else { sps = new List <SqlParameter>(); sps.Add(new SqlParameter("@USS_DepartmentId", dId)); dtResponse = umodel.GetList(sps); } return(dtResponse); }