diff --git a/Learun.Framework.Ultimate V7/Learun.Application.Web/Areas/EducationalAdministration/Controllers/Exam_ExamLessonController.cs b/Learun.Framework.Ultimate V7/Learun.Application.Web/Areas/EducationalAdministration/Controllers/Exam_ExamLessonController.cs
index 0ea489bcd..b1e4b5ead 100644
--- a/Learun.Framework.Ultimate V7/Learun.Application.Web/Areas/EducationalAdministration/Controllers/Exam_ExamLessonController.cs
+++ b/Learun.Framework.Ultimate V7/Learun.Application.Web/Areas/EducationalAdministration/Controllers/Exam_ExamLessonController.cs
@@ -38,11 +38,11 @@ namespace Learun.Application.Web.Areas.EducationalAdministration.Controllers
return View();
}
///
- /// 导入
+ /// 导入/清空数据
///
///
[HttpGet]
- public ActionResult FormImport()
+ public ActionResult FormYearSemester()
{
return View();
}
@@ -104,6 +104,29 @@ namespace Learun.Application.Web.Areas.EducationalAdministration.Controllers
exam_ExamLessonIBLL.DeleteEntity(keyValue);
return Success("删除成功!");
}
+
+ ///
+ /// 导入开课计划
+ ///
+ ///
+ [HttpPost]
+ [AjaxOnly]
+ public ActionResult Import(string AcademicYearNo, string Semester)
+ {
+ int res = exam_ExamLessonIBLL.Import(AcademicYearNo, Semester);
+ return Success("导入" + res + "条数据!");
+ }
+ ///
+ /// 按条件清空数据
+ ///
+ ///
+ [HttpPost]
+ [AjaxOnly]
+ public ActionResult DeleteWhere(string AcademicYearNo, string Semester)
+ {
+ int res = exam_ExamLessonIBLL.DeleteWhere(AcademicYearNo, Semester);
+ return Success("清空" + res + "条数据!");
+ }
///
/// 保存实体数据(新增、修改)
///
@@ -116,6 +139,17 @@ namespace Learun.Application.Web.Areas.EducationalAdministration.Controllers
public ActionResult SaveForm(string keyValue, string strEntity)
{
Exam_ExamLessonEntity entity = strEntity.ToObject();
+ //判断课程编号有无重复
+ var model = exam_ExamLessonIBLL.GetEntityByLessonNo(entity.LessonNo);
+ if (model != null && string.IsNullOrEmpty(keyValue))
+ {
+ return Fail("课程编号重复!");
+ }
+ else if (model != null && !string.IsNullOrEmpty(keyValue) && keyValue != model.ELId)
+ {
+ return Fail("课程编号重复!");
+ }
+
exam_ExamLessonIBLL.SaveEntity(keyValue, entity);
if (string.IsNullOrEmpty(keyValue))
{
diff --git a/Learun.Framework.Ultimate V7/Learun.Application.Web/Areas/EducationalAdministration/Views/Exam_ExamLesson/Form.js b/Learun.Framework.Ultimate V7/Learun.Application.Web/Areas/EducationalAdministration/Views/Exam_ExamLesson/Form.js
index 9bf67d931..e349cba9a 100644
--- a/Learun.Framework.Ultimate V7/Learun.Application.Web/Areas/EducationalAdministration/Views/Exam_ExamLesson/Form.js
+++ b/Learun.Framework.Ultimate V7/Learun.Application.Web/Areas/EducationalAdministration/Views/Exam_ExamLesson/Form.js
@@ -30,7 +30,7 @@ var bootstrap = function ($, learun) {
value: 'value',
text: 'text'
});
-
+
$('#ELEnabled').lrRadioCheckbox({
type: 'radio',
code: 'YesOrNoBit',
@@ -41,7 +41,7 @@ var bootstrap = function ($, learun) {
$.lrSetForm(top.$.rootUrl + '/EducationalAdministration/Exam_ExamLesson/GetFormData?keyValue=' + keyValue, function (data) {
for (var id in data) {
if (!!data[id].length && data[id].length > 0) {
- $('#' + id ).jfGridSet('refreshdata', data[id]);
+ $('#' + id).jfGridSet('refreshdata', data[id]);
}
else {
$('[data-table="' + id + '"]').lrSetFormData(data[id]);
diff --git a/Learun.Framework.Ultimate V7/Learun.Application.Web/Areas/EducationalAdministration/Views/Exam_ExamLesson/FormImport.js b/Learun.Framework.Ultimate V7/Learun.Application.Web/Areas/EducationalAdministration/Views/Exam_ExamLesson/FormImport.js
deleted file mode 100644
index e67f3fc0c..000000000
--- a/Learun.Framework.Ultimate V7/Learun.Application.Web/Areas/EducationalAdministration/Views/Exam_ExamLesson/FormImport.js
+++ /dev/null
@@ -1,71 +0,0 @@
-/* * 版 本 Learun-ADMS V7.0.6 力软敏捷开发框架(http://www.learun.cn)
- * Copyright (c) 2013-2020 力软信息技术(苏州)有限公司
- * 创建人:超级管理员
- * 日 期:2022-04-12 15:47
- * 描 述:考试课程表
- */
-var acceptClick;
-var keyValue = request('keyValue');
-var bootstrap = function ($, learun) {
- "use strict";
- var page = {
- init: function () {
- $('.lr-form-wrap').lrscroll();
- page.bind();
- page.initData();
- },
- bind: function () {
- $('#AcademicYearNo').lrselect({
- placeholder: "学年",
- allowSearch: false,
- url: top.$.rootUrl + '/EducationalAdministration/EADateArrange/GetAcademicYearNo',
- value: 'value',
- text: 'text',
- maxHeight: 200,
- });
- //学期
- $('#Semester').lrselect({
- placeholder: "学期",
- allowSearch: false,
- url: top.$.rootUrl + '/EducationalAdministration/EADateArrange/GetSemester',
- value: 'value',
- text: 'text'
- });
-
- $('#ELEnabled').lrRadioCheckbox({
- type: 'radio',
- code: 'YesOrNoBit',
- });
- },
- initData: function () {
- if (!!keyValue) {
- $.lrSetForm(top.$.rootUrl + '/EducationalAdministration/Exam_ExamLesson/GetFormData?keyValue=' + keyValue, function (data) {
- for (var id in data) {
- if (!!data[id].length && data[id].length > 0) {
- $('#' + id ).jfGridSet('refreshdata', data[id]);
- }
- else {
- $('[data-table="' + id + '"]').lrSetFormData(data[id]);
- }
- }
- });
- }
- }
- };
- // 保存数据
- acceptClick = function (callBack) {
- if (!$('body').lrValidform()) {
- return false;
- }
- var postData = {
- strEntity: JSON.stringify($('body').lrGetFormData())
- };
- $.lrSaveForm(top.$.rootUrl + '/EducationalAdministration/Exam_ExamLesson/SaveForm?keyValue=' + keyValue, postData, function (res) {
- // 保存成功后才回调
- if (!!callBack) {
- callBack();
- }
- });
- };
- page.init();
-}
diff --git a/Learun.Framework.Ultimate V7/Learun.Application.Web/Areas/EducationalAdministration/Views/Exam_ExamLesson/FormImport.cshtml b/Learun.Framework.Ultimate V7/Learun.Application.Web/Areas/EducationalAdministration/Views/Exam_ExamLesson/FormYearSemester.cshtml
similarity index 95%
rename from Learun.Framework.Ultimate V7/Learun.Application.Web/Areas/EducationalAdministration/Views/Exam_ExamLesson/FormImport.cshtml
rename to Learun.Framework.Ultimate V7/Learun.Application.Web/Areas/EducationalAdministration/Views/Exam_ExamLesson/FormYearSemester.cshtml
index 29d9151f5..abb7ca9ac 100644
--- a/Learun.Framework.Ultimate V7/Learun.Application.Web/Areas/EducationalAdministration/Views/Exam_ExamLesson/FormImport.cshtml
+++ b/Learun.Framework.Ultimate V7/Learun.Application.Web/Areas/EducationalAdministration/Views/Exam_ExamLesson/FormYearSemester.cshtml
@@ -12,4 +12,4 @@
-@Html.AppendJsFile("/Areas/EducationalAdministration/Views/Exam_ExamLesson/FormImport.js")
+@Html.AppendJsFile("/Areas/EducationalAdministration/Views/Exam_ExamLesson/FormYearSemester.js")
diff --git a/Learun.Framework.Ultimate V7/Learun.Application.Web/Areas/EducationalAdministration/Views/Exam_ExamLesson/FormYearSemester.js b/Learun.Framework.Ultimate V7/Learun.Application.Web/Areas/EducationalAdministration/Views/Exam_ExamLesson/FormYearSemester.js
new file mode 100644
index 000000000..ed614f227
--- /dev/null
+++ b/Learun.Framework.Ultimate V7/Learun.Application.Web/Areas/EducationalAdministration/Views/Exam_ExamLesson/FormYearSemester.js
@@ -0,0 +1,83 @@
+/* * 版 本 Learun-ADMS V7.0.6 力软敏捷开发框架(http://www.learun.cn)
+ * Copyright (c) 2013-2020 力软信息技术(苏州)有限公司
+ * 创建人:超级管理员
+ * 日 期:2022-04-12 15:47
+ * 描 述:考试课程表
+ */
+var acceptClick;
+var type = request('type');
+var bootstrap = function ($, learun) {
+ "use strict";
+ var page = {
+ init: function () {
+ $('.lr-form-wrap').lrscroll();
+ page.bind();
+ //page.initData();
+ },
+ bind: function () {
+ $('#AcademicYearNo').lrselect({
+ placeholder: "学年",
+ allowSearch: false,
+ url: top.$.rootUrl + '/EducationalAdministration/EADateArrange/GetAcademicYearNo',
+ value: 'value',
+ text: 'text',
+ maxHeight: 200,
+ });
+ //学期
+ $('#Semester').lrselect({
+ placeholder: "学期",
+ allowSearch: false,
+ url: top.$.rootUrl + '/EducationalAdministration/EADateArrange/GetSemester',
+ value: 'value',
+ text: 'text'
+ });
+
+ },
+ initData: function () {
+ //if (!!keyValue) {
+ // $.lrSetForm(top.$.rootUrl + '/EducationalAdministration/Exam_ExamLesson/GetFormData?keyValue=' + keyValue, function (data) {
+ // for (var id in data) {
+ // if (!!data[id].length && data[id].length > 0) {
+ // $('#' + id ).jfGridSet('refreshdata', data[id]);
+ // }
+ // else {
+ // $('[data-table="' + id + '"]').lrSetFormData(data[id]);
+ // }
+ // }
+ // });
+ //}
+ }
+ };
+ // 保存数据
+ acceptClick = function (callBack) {
+ if (!$('body').lrValidform()) {
+ return false;
+ }
+ var postData = {
+ AcademicYearNo: $('#AcademicYearNo').lrselectGet(),
+ Semester: $('#Semester').lrselectGet()
+ };
+ //从开课计划导入
+ if (type == 1) {
+ $.lrSaveForm(top.$.rootUrl + '/EducationalAdministration/Exam_ExamLesson/Import', postData, function (res) {
+ // 保存成功后才回调
+ if (!!callBack) {
+ callBack();
+ }
+ });
+ } else if (type == 2) {
+ //按条件清空数据
+ learun.layerConfirm('是否确认清空!', function (res) {
+ if (res) {
+ $.lrSaveForm(top.$.rootUrl + '/EducationalAdministration/Exam_ExamLesson/DeleteWhere', postData, function (res) {
+ // 保存成功后才回调
+ if (!!callBack) {
+ callBack();
+ }
+ });
+ }
+ });
+ }
+ };
+ page.init();
+}
diff --git a/Learun.Framework.Ultimate V7/Learun.Application.Web/Areas/EducationalAdministration/Views/Exam_ExamLesson/Index.cshtml b/Learun.Framework.Ultimate V7/Learun.Application.Web/Areas/EducationalAdministration/Views/Exam_ExamLesson/Index.cshtml
index 04733641a..0e0739330 100644
--- a/Learun.Framework.Ultimate V7/Learun.Application.Web/Areas/EducationalAdministration/Views/Exam_ExamLesson/Index.cshtml
+++ b/Learun.Framework.Ultimate V7/Learun.Application.Web/Areas/EducationalAdministration/Views/Exam_ExamLesson/Index.cshtml
@@ -45,6 +45,7 @@
diff --git a/Learun.Framework.Ultimate V7/Learun.Application.Web/Areas/EducationalAdministration/Views/Exam_ExamLesson/Index.js b/Learun.Framework.Ultimate V7/Learun.Application.Web/Areas/EducationalAdministration/Views/Exam_ExamLesson/Index.js
index e8420c804..76e17965d 100644
--- a/Learun.Framework.Ultimate V7/Learun.Application.Web/Areas/EducationalAdministration/Views/Exam_ExamLesson/Index.js
+++ b/Learun.Framework.Ultimate V7/Learun.Application.Web/Areas/EducationalAdministration/Views/Exam_ExamLesson/Index.js
@@ -50,6 +50,10 @@ var bootstrap = function ($, learun) {
// 编辑
$('#lr_edit').on('click', function () {
var keyValue = $('#gridtable').jfGridValue('ELId');
+ if (keyValue.indexOf(',') != -1) {
+ learun.alert.warning("只能选择一条记录进行编辑!");
+ return false;
+ }
if (learun.checkrow(keyValue)) {
learun.layerForm({
id: 'form',
@@ -69,7 +73,7 @@ var bootstrap = function ($, learun) {
learun.layerForm({
id: 'form_import',
title: '导入',
- url: top.$.rootUrl + '/EducationalAdministration/Exam_ExamLesson/FormImport',
+ url: top.$.rootUrl + '/EducationalAdministration/Exam_ExamLesson/FormYearSemester?type=1',
width: 500,
height: 300,
btn: ['一键导入', '关闭'],
@@ -78,6 +82,21 @@ var bootstrap = function ($, learun) {
}
});
});
+
+ // 按条件清空数据
+ $('#lr_emptyWhere').on('click', function () {
+ learun.layerForm({
+ id: 'form_empty',
+ title: '清空数据',
+ url: top.$.rootUrl + '/EducationalAdministration/Exam_ExamLesson/FormYearSemester?type=2',
+ width: 500,
+ height: 300,
+ btn: ['清空', '关闭'],
+ callBack: function (id) {
+ return top[id].acceptClick(refreshGirdData);
+ }
+ });
+ });
// 删除
$('#lr_delete').on('click', function () {
var keyValue = $('#gridtable').jfGridValue('ELId');
@@ -140,7 +159,7 @@ var bootstrap = function ($, learun) {
{ label: "学年", name: "AcademicYearNo", width: 100, align: "left" },
{ label: "学期", name: "Semester", width: 100, align: "left" },
{ label: "课程编号", name: "LessonNo", width: 100, align: "left" },
- { label: "课程名称", name: "LessonName", width: 100, align: "left" },
+ { label: "课程名称", name: "LessonName", width: 200, align: "left" },
//{ label: "排序号", name: "ELOrder", width: 100, align: "left" },
{
label: "是否启用", name: "ELEnabled", width: 100, align: "left",
@@ -152,8 +171,7 @@ var bootstrap = function ($, learun) {
mainId: 'ELId',
isMultiselect: true,
isPage: true,
- sidx: 'ELOrder',
- sord: 'ASC'
+ sidx: 'AcademicYearNo desc,Semester desc,ELOrder asc'
});
page.search();
},
diff --git a/Learun.Framework.Ultimate V7/Learun.Application.Web/Learun.Application.Web.csproj b/Learun.Framework.Ultimate V7/Learun.Application.Web/Learun.Application.Web.csproj
index 369daaeae..fb58b7f0e 100644
--- a/Learun.Framework.Ultimate V7/Learun.Application.Web/Learun.Application.Web.csproj
+++ b/Learun.Framework.Ultimate V7/Learun.Application.Web/Learun.Application.Web.csproj
@@ -991,7 +991,7 @@
-
+
@@ -7613,7 +7613,7 @@
-
+
diff --git a/Learun.Framework.Ultimate V7/Learun.Framework.Module/Learun.Application.Module/Learun.Application.TwoDevelopment/EducationalAdministration/Exam_ExamLesson/Exam_ExamLessonBLL.cs b/Learun.Framework.Ultimate V7/Learun.Framework.Module/Learun.Application.Module/Learun.Application.TwoDevelopment/EducationalAdministration/Exam_ExamLesson/Exam_ExamLessonBLL.cs
index b03b6ac34..69aaa0108 100644
--- a/Learun.Framework.Ultimate V7/Learun.Framework.Module/Learun.Application.Module/Learun.Application.TwoDevelopment/EducationalAdministration/Exam_ExamLesson/Exam_ExamLessonBLL.cs
+++ b/Learun.Framework.Ultimate V7/Learun.Framework.Module/Learun.Application.Module/Learun.Application.TwoDevelopment/EducationalAdministration/Exam_ExamLesson/Exam_ExamLessonBLL.cs
@@ -67,6 +67,25 @@ namespace Learun.Application.TwoDevelopment.EducationalAdministration
}
}
+ public Exam_ExamLessonEntity GetEntityByLessonNo(string lessonNo)
+ {
+ try
+ {
+ return exam_ExamLessonService.GetEntityByLessonNo(lessonNo);
+ }
+ catch (Exception ex)
+ {
+ if (ex is ExceptionEx)
+ {
+ throw;
+ }
+ else
+ {
+ throw ExceptionEx.ThrowBusinessException(ex);
+ }
+ }
+ }
+
#endregion
#region 提交数据
@@ -143,6 +162,44 @@ namespace Learun.Application.TwoDevelopment.EducationalAdministration
}
}
+ public int Import(string AcademicYearNo, string Semester)
+ {
+ try
+ {
+ return exam_ExamLessonService.Import(AcademicYearNo, Semester);
+ }
+ catch (Exception ex)
+ {
+ if (ex is ExceptionEx)
+ {
+ throw;
+ }
+ else
+ {
+ throw ExceptionEx.ThrowBusinessException(ex);
+ }
+ }
+ }
+
+
+ public int DeleteWhere(string AcademicYearNo, string Semester)
+ {
+ try
+ {
+ return exam_ExamLessonService.DeleteWhere(AcademicYearNo, Semester);
+ }
+ catch (Exception ex)
+ {
+ if (ex is ExceptionEx)
+ {
+ throw;
+ }
+ else
+ {
+ throw ExceptionEx.ThrowBusinessException(ex);
+ }
+ }
+ }
#endregion
}
diff --git a/Learun.Framework.Ultimate V7/Learun.Framework.Module/Learun.Application.Module/Learun.Application.TwoDevelopment/EducationalAdministration/Exam_ExamLesson/Exam_ExamLessonIBLL.cs b/Learun.Framework.Ultimate V7/Learun.Framework.Module/Learun.Application.Module/Learun.Application.TwoDevelopment/EducationalAdministration/Exam_ExamLesson/Exam_ExamLessonIBLL.cs
index 86146648d..67cf0ca93 100644
--- a/Learun.Framework.Ultimate V7/Learun.Framework.Module/Learun.Application.Module/Learun.Application.TwoDevelopment/EducationalAdministration/Exam_ExamLesson/Exam_ExamLessonIBLL.cs
+++ b/Learun.Framework.Ultimate V7/Learun.Framework.Module/Learun.Application.Module/Learun.Application.TwoDevelopment/EducationalAdministration/Exam_ExamLesson/Exam_ExamLessonIBLL.cs
@@ -27,6 +27,7 @@ namespace Learun.Application.TwoDevelopment.EducationalAdministration
/// 主键
///
Exam_ExamLessonEntity GetExam_ExamLessonEntity(string keyValue);
+ Exam_ExamLessonEntity GetEntityByLessonNo(string lessonNo);
#endregion
#region 提交数据
@@ -48,6 +49,10 @@ namespace Learun.Application.TwoDevelopment.EducationalAdministration
/// 主键
/// 实体
void SaveEntity(string keyValue, Exam_ExamLessonEntity entity);
+
+ int Import(string AcademicYearNo, string Semester);
+ int DeleteWhere(string AcademicYearNo, string Semester);
+
#endregion
}
diff --git a/Learun.Framework.Ultimate V7/Learun.Framework.Module/Learun.Application.Module/Learun.Application.TwoDevelopment/EducationalAdministration/Exam_ExamLesson/Exam_ExamLessonService.cs b/Learun.Framework.Ultimate V7/Learun.Framework.Module/Learun.Application.Module/Learun.Application.TwoDevelopment/EducationalAdministration/Exam_ExamLesson/Exam_ExamLessonService.cs
index b9a29dcbe..c5ee2c626 100644
--- a/Learun.Framework.Ultimate V7/Learun.Framework.Module/Learun.Application.Module/Learun.Application.TwoDevelopment/EducationalAdministration/Exam_ExamLesson/Exam_ExamLessonService.cs
+++ b/Learun.Framework.Ultimate V7/Learun.Framework.Module/Learun.Application.Module/Learun.Application.TwoDevelopment/EducationalAdministration/Exam_ExamLesson/Exam_ExamLessonService.cs
@@ -104,6 +104,29 @@ namespace Learun.Application.TwoDevelopment.EducationalAdministration
}
}
+ ///
+ /// 获取Exam_ExamLesson表实体数据
+ ///
+ ///
+ ///
+ public Exam_ExamLessonEntity GetEntityByLessonNo(string lessonNo)
+ {
+ try
+ {
+ return this.BaseRepository("CollegeMIS").FindEntity(x => x.LessonNo == lessonNo);
+ }
+ catch (Exception ex)
+ {
+ if (ex is ExceptionEx)
+ {
+ throw;
+ }
+ else
+ {
+ throw ExceptionEx.ThrowServiceException(ex);
+ }
+ }
+ }
#endregion
#region 提交数据
@@ -116,7 +139,13 @@ namespace Learun.Application.TwoDevelopment.EducationalAdministration
{
try
{
- this.BaseRepository("CollegeMIS").Delete(t => t.ELId == keyValue);
+ if (keyValue.Contains(","))
+ {
+ keyValue = string.Join("','", keyValue.Split(','));
+ }
+
+ string sql = $"delete Exam_ExamLesson where ELId in ('{keyValue}')";
+ this.BaseRepository("CollegeMIS").ExecuteBySql(sql);
}
catch (Exception ex)
{
@@ -194,6 +223,66 @@ namespace Learun.Application.TwoDevelopment.EducationalAdministration
}
}
+ ///
+ /// 导入
+ ///
+ ///
+ ///
+ ///
+ public int Import(string AcademicYearNo, string Semester)
+ {
+ try
+ {
+ string sql = $@"insert into Exam_ExamLesson([ELId]
+ ,[AcademicYearNo]
+ ,[Semester]
+ ,[LessonName]
+ ,[LessonNo]
+ ,[ELOrder]
+ ,[ELEnabled])
+select NEWID(),AcademicYearNo,Semester,LessonName,[LessonNo],0,1 from OpenLessonPlan where AcademicYearNo='{AcademicYearNo}' and Semester='{Semester}'
+ and [LessonNo] not in (select [LessonNo] from Exam_ExamLesson where AcademicYearNo='{AcademicYearNo}' and Semester='{Semester}' )
+";
+ return this.BaseRepository("CollegeMIS").ExecuteBySql(sql);
+ }
+ catch (Exception ex)
+ {
+ if (ex is ExceptionEx)
+ {
+ throw;
+ }
+ else
+ {
+ throw ExceptionEx.ThrowServiceException(ex);
+ }
+ }
+ }
+
+ ///
+ /// 清空数据
+ ///
+ ///
+ ///
+ ///
+ public int DeleteWhere(string AcademicYearNo, string Semester)
+ {
+ try
+ {
+ string sql = $"delete Exam_ExamLesson where AcademicYearNo='{AcademicYearNo}' and Semester='{Semester}'";
+ return this.BaseRepository("CollegeMIS").ExecuteBySql(sql);
+ }
+ catch (Exception ex)
+ {
+ if (ex is ExceptionEx)
+ {
+ throw;
+ }
+ else
+ {
+ throw ExceptionEx.ThrowServiceException(ex);
+ }
+ }
+ }
#endregion
}