Browse Source

教学计划编辑明细和查看功能

中职版本
zhangli 3 years ago
parent
commit
3351d07c2a
11 changed files with 355 additions and 89 deletions
  1. +13
    -3
      Learun.Framework.Ultimate V7/Learun.Application.Web/Areas/EducationalAdministration/Controllers/TeachingPlanController.cs
  2. +35
    -20
      Learun.Framework.Ultimate V7/Learun.Application.Web/Areas/EducationalAdministration/Views/TeachingPlan/FormManage.js
  3. +38
    -0
      Learun.Framework.Ultimate V7/Learun.Application.Web/Areas/EducationalAdministration/Views/TeachingPlan/FormManageView.cshtml
  4. +165
    -0
      Learun.Framework.Ultimate V7/Learun.Application.Web/Areas/EducationalAdministration/Views/TeachingPlan/FormManageView.js
  5. +17
    -19
      Learun.Framework.Ultimate V7/Learun.Application.Web/Areas/EducationalAdministration/Views/TeachingPlan/IndexManage.js
  6. +13
    -12
      Learun.Framework.Ultimate V7/Learun.Application.Web/Areas/EducationalAdministration/Views/TeachingPlanItem/Form.cshtml
  7. +50
    -17
      Learun.Framework.Ultimate V7/Learun.Application.Web/Areas/EducationalAdministration/Views/TeachingPlanItem/Form.js
  8. +2
    -0
      Learun.Framework.Ultimate V7/Learun.Application.Web/Learun.Application.Web.csproj
  9. +2
    -2
      Learun.Framework.Ultimate V7/Learun.Framework.Module/Learun.Application.Module/Learun.Application.TwoDevelopment/EducationalAdministration/TeachingPlan/TeachingPlanBLL.cs
  10. +1
    -1
      Learun.Framework.Ultimate V7/Learun.Framework.Module/Learun.Application.Module/Learun.Application.TwoDevelopment/EducationalAdministration/TeachingPlan/TeachingPlanIBLL.cs
  11. +19
    -15
      Learun.Framework.Ultimate V7/Learun.Framework.Module/Learun.Application.Module/Learun.Application.TwoDevelopment/EducationalAdministration/TeachingPlan/TeachingPlanService.cs

+ 13
- 3
Learun.Framework.Ultimate V7/Learun.Application.Web/Areas/EducationalAdministration/Controllers/TeachingPlanController.cs View File

@@ -56,7 +56,16 @@ namespace Learun.Application.Web.Areas.EducationalAdministration.Controllers
{
return View();
}

/// <summary>
/// 教学计划和课程设置--查看
/// <summary>
/// <returns></returns>
[HttpGet]
public ActionResult FormManageView()
{
return View();
}
#endregion

#region 获取数据
@@ -148,10 +157,11 @@ namespace Learun.Application.Web.Areas.EducationalAdministration.Controllers
[HttpPost]
[ValidateAntiForgeryToken]
[AjaxOnly]
public ActionResult SaveForm(string keyValue, string strEntity)
public ActionResult SaveForm(string keyValue, string strEntity,string TeachingPlanItemList)
{
TeachingPlanEntity entity = strEntity.ToObject<TeachingPlanEntity>();
teachingPlanIBLL.SaveEntity(keyValue, entity);
List<TeachingPlanItemEntity> teachingPlanItemList = TeachingPlanItemList.ToObject<List<TeachingPlanItemEntity>>();
teachingPlanIBLL.SaveEntity(keyValue, entity, teachingPlanItemList);
if (string.IsNullOrEmpty(keyValue))
{
}


+ 35
- 20
Learun.Framework.Ultimate V7/Learun.Application.Web/Areas/EducationalAdministration/Views/TeachingPlan/FormManage.js View File

@@ -28,8 +28,8 @@ var bootstrap = function ($, learun) {
id: 'form_TeachingPlanItem',
title: '编辑明细',
url: top.$.rootUrl + '/EducationalAdministration/TeachingPlanItem/Form?keyValue=' + keyValue,
width: 860,
height: 580,
width: 650,
height: 430,
callBack: function (id) {
return top[id].acceptClick(refreshGirdData);
}
@@ -48,7 +48,7 @@ var bootstrap = function ($, learun) {
maxHeight: 200
});

$('#Major').lrDataSourceSelect({ code: 'CdMajorInfo', value: 'majorno',text: 'majorname' });
$('#Major').lrDataSourceSelect({ code: 'CdMajorInfo', value: 'majorno', text: 'majorname' });
$('#Enabled').lrRadioCheckbox({
type: 'radio',
code: 'YesOrNoBit',
@@ -69,7 +69,7 @@ var bootstrap = function ($, learun) {
}
},
{
label: '课程学时', name: 'CourseTime', width: 100, align: 'left'
label: '课程学时', name: 'LessonTime', width: 100, align: 'left'
},
{
label: '执行学期', name: 'Semester', width: 100, align: 'left'
@@ -105,9 +105,10 @@ var bootstrap = function ($, learun) {
}
};
refreshGirdData = function (temprow) {
var ifnewrow = true;
$.each(tempdatra, function (key, val) {
if (tempdatra[key].PAIId === temprow.PAIId) {
if (tempdatra[key].Id === temprow.Id) {
tempdatra[key] = temprow;
ifnewrow = false;
}
@@ -115,8 +116,8 @@ var bootstrap = function ($, learun) {
if (ifnewrow) {
tempdatra.push(temprow);
}
$('#Ass_PurchaseItemApply').jfGridSet('refreshdata', tempdatra);
$('#TeachingPlanItem').jfGridSet('refreshdata', tempdatra);
};

// 验证数据是否填写完整
@@ -124,25 +125,39 @@ var bootstrap = function ($, learun) {
if (!$('.lr-form-wrap').lrValidform()) {
return false;
}
var datas = $('#Ass_PurchaseItemApply').jfGridGet('rowdatas');
if (datas == null || datas.length == 0) {
learun.alert.warning("申请未包含明细!请先新增明细!");
return false;
}
//var datas = $('#TeachingPlanItem').jfGridGet('rowdatas');
//if (datas == null || datas.length == 0) {
// learun.alert.warning("申请未包含明细!请先新增明细!");
// return false;
//}
return true;
};
//// 保存数据
//acceptClick = function (callBack) {
// if (!$('body').lrValidform()) {
// return false;
// }
// var postData = {
// strEntity: JSON.stringify($('body').lrGetFormData())
// };
// $.lrSaveForm(top.$.rootUrl + '/EducationalAdministration/TeachingPlan/SaveForm?keyValue=' + keyValue, postData, function (res) {
// // 保存成功后才回调
// if (!!callBack) {
// callBack();
// }
// });
//};
// 保存数据
acceptClick = function (callBack) {
if (!$('body').lrValidform()) {
return false;
}
var postData = {
strEntity: JSON.stringify($('body').lrGetFormData())
};
save = function (callBack, i) {
var postData = {};
var formData = $('[data-table="TeachingPlan"]').lrGetFormData();
postData.strEntity = JSON.stringify(formData);
postData.TeachingPlanItemList = JSON.stringify($('#TeachingPlanItem').jfGridGet('rowdatas'));
$.lrSaveForm(top.$.rootUrl + '/EducationalAdministration/TeachingPlan/SaveForm?keyValue=' + keyValue, postData, function (res) {
// 保存成功后才回调
if (!!callBack) {
callBack();
callBack(res, formData, i);
}
});
};


+ 38
- 0
Learun.Framework.Ultimate V7/Learun.Application.Web/Areas/EducationalAdministration/Views/TeachingPlan/FormManageView.cshtml View File

@@ -0,0 +1,38 @@
@{
ViewBag.Title = "教学计划";
Layout = "~/Views/Shared/_Form.cshtml";
}
<div class="lr-form-wrap" id="form">
<div class="col-xs-6 lr-form-item" data-table="TeachingPlan">
<div class="lr-form-item-title">名称<font face="宋体">*</font></div>
<input id="Name" type="text" class="form-control" isvalid="yes" checkexpession="NotNull" readonly="readonly" />
</div>
<div class="col-xs-6 lr-form-item" data-table="TeachingPlan">
<div class="lr-form-item-title">年级</div>
<div id="Grade" readonly="readonly"></div>
</div>
<div class="col-xs-6 lr-form-item" data-table="TeachingPlan">
<div class="lr-form-item-title">专业</div>
<div id="Major" readonly="readonly"></div>
</div>
<div class="col-xs-6 lr-form-item" data-table="TeachingPlan">
<div class="lr-form-item-title">学制</div>
<input id="SchoolSystem" type="text" class="form-control" readonly="readonly"/>
</div>
<div class="col-xs-12 lr-form-item" data-table="TeachingPlan">
<div class="lr-form-item-title">总学分</div>
<input id="Credit" type="text" class="form-control" readonly="readonly"/>
</div>
<div class="col-xs-6 lr-form-item" data-table="TeachingPlan">
<div class="lr-form-item-title">启用</div>
<div id="Enabled" readonly="readonly"></div>
</div>
<div class="col-xs-12 lr-form-item" data-table="TeachingPlan">
<div class="lr-form-item-title">备注</div>
<textarea id="Remark" class="form-control" style="height:100px;" readonly="readonly"></textarea>
</div>
<div class="col-xs-12 lr-form-item lr-form-item-grid">
<div id="TeachingPlanItem"></div>
</div>
</div>
@Html.AppendJsFile("/Areas/EducationalAdministration/Views/TeachingPlan/FormManageView.js")

+ 165
- 0
Learun.Framework.Ultimate V7/Learun.Application.Web/Areas/EducationalAdministration/Views/TeachingPlan/FormManageView.js View File

@@ -0,0 +1,165 @@
/* * 版 本 Learun-ADMS V7.0.6 力软敏捷开发框架(http://www.learun.cn)
* Copyright (c) 2013-2020 力软信息技术(苏州)有限公司
* 创建人:超级管理员
* 日 期:2021-10-14 10:09
* 描 述:教学计划
*/
var acceptClick;
var keyValue = request('keyValue');
// 设置表单数据
var setFormData;
// 验证数据是否填写完整
var validForm;
// 保存数据
var save;
var refreshGirdData;
var selectedRow;
var tempdatra = new Array();
var bootstrap = function ($, learun) {
"use strict";
var page = {
init: function () {
$('.lr-form-wrap').lrscroll();
$("#detailedit").on('click', function () {
var keyValue = $('#TeachingPlanItem').jfGridValue('Id');
selectedRow = $('#TeachingPlanItem').jfGridGet('rowdata');
if (learun.checkrow(keyValue)) {
learun.layerForm({
id: 'form_TeachingPlanItem',
title: '编辑明细',
url: top.$.rootUrl + '/EducationalAdministration/TeachingPlanItem/Form?keyValue=' + keyValue,
width: 650,
height: 430,
callBack: function (id) {
return top[id].acceptClick(refreshGirdData);
}
});
}
});
page.bind();
page.initData();
},
bind: function () {
//年级
$('#Grade').lrselect({
url: top.$.rootUrl + '/EducationalAdministration/ClassInfo/GenerateNearByYear',
value: 'value',
text: 'text',
maxHeight: 200
});

$('#Major').lrDataSourceSelect({ code: 'CdMajorInfo', value: 'majorno', text: 'majorname' });
$('#Enabled').lrRadioCheckbox({
type: 'radio',
code: 'YesOrNoBit',
});
$('#TeachingPlanItem').jfGrid({
headData: [
{
label: '课程名称', name: 'LessonNo', width: 100, align: 'left',
formatterAsync: function (callback, value, row, op, $cell) {
learun.clientdata.getAsync('custmerData', {
url: '/LR_SystemModule/DataSource/GetDataTable?code=' + 'LessonInfo',
key: value,
keyId: 'lessonno',
callback: function (_data) {
callback(_data['lessonname']);
}
});
}
},
{
label: '课程学时', name: 'LessonTime', width: 100, align: 'left'
},
{
label: '执行学期', name: 'Semester', width: 100, align: 'left'
},
{
label: '周节次', name: 'WeeklyFestival', width: 100, align: 'left'
},
{
label: '开课起始周', name: 'WeeklyStart', width: 150, align: 'left'
},
{
label: '开课结束周', name: 'WeeklyEnd', width: 150, align: 'left'
},
],
height: 270,
mainId: 'Id'
});
},
initData: function () {
if (!!keyValue) {
$.lrSetForm(top.$.rootUrl + '/EducationalAdministration/TeachingPlan/GetFormData?keyValue=' + keyValue, function (data) {
for (var id in data) {
if (!!data[id].length && data[id].length > 0) {
$('#' + id).jfGridSet('refreshdata', data[id]);
tempdatra = data[id];
}
else {
$('[data-table="' + id + '"]').lrSetFormData(data[id]);
}
}
});
}
}
};
refreshGirdData = function (temprow) {
var ifnewrow = true;
$.each(tempdatra, function (key, val) {
if (tempdatra[key].Id === temprow.Id) {
tempdatra[key] = temprow;
ifnewrow = false;
}
});
if (ifnewrow) {
tempdatra.push(temprow);
}
$('#TeachingPlanItem').jfGridSet('refreshdata', tempdatra);

};

// 验证数据是否填写完整
validForm = function () {
if (!$('.lr-form-wrap').lrValidform()) {
return false;
}
//var datas = $('#TeachingPlanItem').jfGridGet('rowdatas');
//if (datas == null || datas.length == 0) {
// learun.alert.warning("申请未包含明细!请先新增明细!");
// return false;
//}
return true;
};
//// 保存数据
//acceptClick = function (callBack) {
// if (!$('body').lrValidform()) {
// return false;
// }
// var postData = {
// strEntity: JSON.stringify($('body').lrGetFormData())
// };
// $.lrSaveForm(top.$.rootUrl + '/EducationalAdministration/TeachingPlan/SaveForm?keyValue=' + keyValue, postData, function (res) {
// // 保存成功后才回调
// if (!!callBack) {
// callBack();
// }
// });
//};
// 保存数据
save = function (callBack, i) {
var postData = {};
var formData = $('[data-table="TeachingPlan"]').lrGetFormData();
postData.strEntity = JSON.stringify(formData);
postData.TeachingPlanItemList = JSON.stringify($('#TeachingPlanItem').jfGridGet('rowdatas'));
$.lrSaveForm(top.$.rootUrl + '/EducationalAdministration/TeachingPlan/SaveForm?keyValue=' + keyValue, postData, function (res) {
// 保存成功后才回调
if (!!callBack) {
callBack(res, formData, i);
}
});
};
page.init();
}

+ 17
- 19
Learun.Framework.Ultimate V7/Learun.Application.Web/Areas/EducationalAdministration/Views/TeachingPlan/IndexManage.js View File

@@ -20,16 +20,17 @@ var bootstrap = function ($, learun) {
$('#lr_refresh').on('click', function () {
location.reload();
});
// 新增
$('#lr_add').on('click', function () {
//查看
$('#lr_look').on('click', function () {
learun.layerForm({
id: 'form',
title: '新增',
url: top.$.rootUrl + '/EducationalAdministration/TeachingPlan/Form',
title: '查看',
url: top.$.rootUrl + '/EducationalAdministration/TeachingPlan/FormManageView',
width: 600,
height: 400,
btn: null,
callBack: function (id) {
return top[id].acceptClick(refreshGirdData);
//return top[id].acceptClick(refreshGirdData);
}
});
});
@@ -44,20 +45,17 @@ var bootstrap = function ($, learun) {
width: 1100,
height: 700,
callBack: function (id) {
return top[id].acceptClick(refreshGirdData);
}
});
}
});
// 删除
$('#lr_delete').on('click', function () {
var keyValue = $('#gridtable').jfGridValue('Id');
if (learun.checkrow(keyValue)) {
learun.layerConfirm('是否确认删除该项!', function (res) {
if (res) {
learun.deleteForm(top.$.rootUrl + '/EducationalAdministration/TeachingPlan/DeleteForm', { keyValue: keyValue }, function () {
refreshGirdData();
});
var res = false;
// 验证数据
res = top[id].validForm();
// 保存数据
if (res) {
res = top[id].save(function () {
page.search();
});
}
return res;
//return top[id].acceptClick(refreshGirdData);
}
});
}


+ 13
- 12
Learun.Framework.Ultimate V7/Learun.Application.Web/Areas/EducationalAdministration/Views/TeachingPlanItem/Form.cshtml View File

@@ -3,29 +3,30 @@
Layout = "~/Views/Shared/_Form.cshtml";
}
<div class="lr-form-wrap" id="form">
<div class="col-xs-12 lr-form-item" data-table="TeachingPlanItem" >
<div class="col-xs-12 lr-form-item" data-table="TeachingPlanItem">
<div class="lr-form-item-title">课程名称</div>
<input id="LessonNo" type="text" class="form-control" />
<input id="LessonNo" type="text" class="form-control" readonly="readonly" />
<input id="LessonName" type="text" class="form-control" readonly="readonly" />
</div>
<div class="col-xs-12 lr-form-item" data-table="TeachingPlanItem" >
<div class="col-xs-12 lr-form-item" data-table="TeachingPlanItem">
<div class="lr-form-item-title">课程学时</div>
<input id="LessonTime" type="text" class="form-control" />
<input id="LessonTime" type="text" class="form-control" readonly="readonly" />
</div>
<div class="col-xs-12 lr-form-item" data-table="TeachingPlanItem" >
<div class="col-xs-12 lr-form-item" data-table="TeachingPlanItem">
<div class="lr-form-item-title">执行学期</div>
<input id="Semester" type="text" class="form-control" />
<input id="Semester" type="text" class="form-control" />
</div>
<div class="col-xs-12 lr-form-item" data-table="TeachingPlanItem" >
<div class="col-xs-12 lr-form-item" data-table="TeachingPlanItem">
<div class="lr-form-item-title">周节次</div>
<input id="WeeklyFestival" type="text" class="form-control" />
<input id="WeeklyFestival" type="text" class="form-control" placeholder="共7节" />
</div>
<div class="col-xs-12 lr-form-item" data-table="TeachingPlanItem" >
<div class="col-xs-12 lr-form-item" data-table="TeachingPlanItem">
<div class="lr-form-item-title">开课起始周</div>
<input id="WeeklyStart" type="text" class="form-control" />
<input id="WeeklyStart" type="text" class="form-control" placeholder="共25周" />
</div>
<div class="col-xs-12 lr-form-item" data-table="TeachingPlanItem" >
<div class="col-xs-12 lr-form-item" data-table="TeachingPlanItem">
<div class="lr-form-item-title">开课结束周</div>
<input id="WeeklyEnd" type="text" class="form-control" />
<input id="WeeklyEnd" type="text" class="form-control" placeholder="共25周" />
</div>
</div>
@Html.AppendJsFile("/Areas/EducationalAdministration/Views/TeachingPlanItem/Form.js")

+ 50
- 17
Learun.Framework.Ultimate V7/Learun.Application.Web/Areas/EducationalAdministration/Views/TeachingPlanItem/Form.js View File

@@ -17,19 +17,37 @@ var bootstrap = function ($, learun) {
page.initData();
},
bind: function () {
$('#LessonNo').hide();
},
initData: function () {
//if (!!keyValue) {
// $.lrSetForm(top.$.rootUrl + '/EducationalAdministration/TeachingPlanItem/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]);
// }
// }
// });
//}

if (!!keyValue) {
$.lrSetForm(top.$.rootUrl + '/EducationalAdministration/TeachingPlanItem/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]);
}
if (!!selectedRow) {
$('#form').lrSetFormData(selectedRow);

if (!!selectedRow.LessonNo) {
learun.clientdata.getAsync('custmerData', {
url: '/LR_SystemModule/DataSource/GetDataTable?code=' + 'LessonInfo',
key: selectedRow.LessonNo,
keyId: 'lessonno',
callback: function (_data) {
$('#LessonName').val(_data['lessonname']);
}
});
}
});
}
}
}
};
@@ -38,15 +56,30 @@ var bootstrap = function ($, learun) {
if (!$('body').lrValidform()) {
return false;
}
var postData = {
strEntity: JSON.stringify($('body').lrGetFormData())
};
$.lrSaveForm(top.$.rootUrl + '/EducationalAdministration/TeachingPlanItem/SaveForm?keyValue=' + keyValue, postData, function (res) {
// 保存成功后才回调
if (!!callBack) {
callBack();
//var postData = {
// strEntity: JSON.stringify($('body').lrGetFormData())
//};
//$.lrSaveForm(top.$.rootUrl + '/EducationalAdministration/TeachingPlanItem/SaveForm?keyValue=' + keyValue, postData, function (res) {
// // 保存成功后才回调
// if (!!callBack) {
// callBack();
// }
//});


var postData = $('body').lrGetFormData();
if (!!keyValue) {
if (!!selectedRow) {
postData.Id = selectedRow.Id;
}
});
} else {
postData.Id = learun.newGuid();
}
if (!!callBack) {
callBack(postData);
return true;
}

};
page.init();
}

+ 2
- 0
Learun.Framework.Ultimate V7/Learun.Application.Web/Learun.Application.Web.csproj View File

@@ -1058,6 +1058,7 @@
<Content Include="Areas\EducationalAdministration\Views\Sys_SendFile\IssueForm.js" />
<Content Include="Areas\EducationalAdministration\Views\Sys_SendFile\ReadListParty.js" />
<Content Include="Areas\EducationalAdministration\Views\Sys_SendFile\ReadListDocument.js" />
<Content Include="Areas\EducationalAdministration\Views\TeachingPlan\FormManageView.js" />
<Content Include="Areas\EducationalAdministration\Views\TeachingPlan\FormManage.js" />
<Content Include="Areas\EducationalAdministration\Views\TeachingPlan\IndexManage.js" />
<Content Include="Areas\EducationalAdministration\Views\Thermography\IndexResult.js" />
@@ -7224,6 +7225,7 @@
<Content Include="Areas\EducationalAdministration\Views\Scholarshipxj\IndexTwo.cshtml" />
<Content Include="Areas\EducationalAdministration\Views\TeachingPlan\IndexManage.cshtml" />
<Content Include="Areas\EducationalAdministration\Views\TeachingPlan\FormManage.cshtml" />
<Content Include="Areas\EducationalAdministration\Views\TeachingPlan\FormManageView.cshtml" />
<None Include="Properties\PublishProfiles\FolderProfile.pubxml" />
<Content Include="Views\Login\Default-beifen.cshtml" />
<None Include="Properties\PublishProfiles\FolderProfile1.pubxml" />


+ 2
- 2
Learun.Framework.Ultimate V7/Learun.Framework.Module/Learun.Application.Module/Learun.Application.TwoDevelopment/EducationalAdministration/TeachingPlan/TeachingPlanBLL.cs View File

@@ -118,11 +118,11 @@ namespace Learun.Application.TwoDevelopment.EducationalAdministration
/// <param name="keyValue">主键</param>
/// <param name="entity">实体</param>
/// <returns></returns>
public void SaveEntity(string keyValue, TeachingPlanEntity entity)
public void SaveEntity(string keyValue, TeachingPlanEntity entity, List<TeachingPlanItemEntity> teachingPlanItemList)
{
try
{
teachingPlanService.SaveEntity(keyValue, entity);
teachingPlanService.SaveEntity(keyValue, entity, teachingPlanItemList);
}
catch (Exception ex)
{


+ 1
- 1
Learun.Framework.Ultimate V7/Learun.Framework.Module/Learun.Application.Module/Learun.Application.TwoDevelopment/EducationalAdministration/TeachingPlan/TeachingPlanIBLL.cs View File

@@ -42,7 +42,7 @@ namespace Learun.Application.TwoDevelopment.EducationalAdministration
/// </summary>
/// <param name="keyValue">主键</param>
/// <param name="entity">实体</param>
void SaveEntity(string keyValue, TeachingPlanEntity entity);
void SaveEntity(string keyValue, TeachingPlanEntity entity, List<TeachingPlanItemEntity> teachingPlanItemList);
#endregion

}


+ 19
- 15
Learun.Framework.Ultimate V7/Learun.Framework.Module/Learun.Application.Module/Learun.Application.TwoDevelopment/EducationalAdministration/TeachingPlan/TeachingPlanService.cs View File

@@ -169,7 +169,7 @@ join CdLessonType c on t.LessonTypeId=c.ltid ";
/// </summary>
/// <param name="keyValue">主键</param>
/// <param name="entity">实体</param>
public void SaveEntity(string keyValue, TeachingPlanEntity entity)
public void SaveEntity(string keyValue, TeachingPlanEntity entity, List<TeachingPlanItemEntity> teachingPlanItemList)
{
var db = this.BaseRepository("CollegeMIS").BeginTrans();
try
@@ -178,25 +178,29 @@ join CdLessonType c on t.LessonTypeId=c.ltid ";
{
entity.Modify(keyValue);
db.Update(entity);
//删除课程子表
db.Delete<TeachingPlanItemEntity>(x => x.TeachingPlanId == entity.Id);
foreach (var itemEntity in teachingPlanItemList)
{
itemEntity.TeachingPlanId = entity.Id;
db.Insert(itemEntity);
}
}
else
{
entity.Create();
db.Insert(entity);
}
//删除课程子表
db.Delete<TeachingPlanItemEntity>(x => x.TeachingPlanId == entity.Id);

//新增
var lessonInfoList = db.FindList<LessonInfoEntity>(x => x.TeachMajorNo == entity.Major);
foreach (var lessonInfo in lessonInfoList)
{
TeachingPlanItemEntity itemEntity = new TeachingPlanItemEntity();
itemEntity.Create();
itemEntity.TeachingPlanId = entity.Id;
itemEntity.LessonNo = lessonInfo.LessonNo;
itemEntity.LessonTime = lessonInfo.TotalStudyHour;
db.Insert(itemEntity);
//新增
var lessonInfoList = db.FindList<LessonInfoEntity>(x => x.TeachMajorNo == entity.Major);
foreach (var lessonInfo in lessonInfoList)
{
TeachingPlanItemEntity itemEntity = new TeachingPlanItemEntity();
itemEntity.Create();
itemEntity.TeachingPlanId = entity.Id;
itemEntity.LessonNo = lessonInfo.LessonNo;
itemEntity.LessonTime = lessonInfo.TotalStudyHour;
db.Insert(itemEntity);
}
}
db.Commit();
}


Loading…
Cancel
Save