@@ -26,7 +26,7 @@ namespace Learun.Application.Web.Areas.EducationalAdministration.Controllers | |||
[HttpGet] | |||
public ActionResult Index() | |||
{ | |||
return View(); | |||
return View(); | |||
} | |||
/// <summary> | |||
/// 表单页 | |||
@@ -35,7 +35,7 @@ namespace Learun.Application.Web.Areas.EducationalAdministration.Controllers | |||
[HttpGet] | |||
public ActionResult Form() | |||
{ | |||
return View(); | |||
return View(); | |||
} | |||
#endregion | |||
@@ -82,8 +82,9 @@ namespace Learun.Application.Web.Areas.EducationalAdministration.Controllers | |||
[AjaxOnly] | |||
public ActionResult GetFormData(string keyValue) | |||
{ | |||
var TeachPlanData = teachPlanIBLL.GetTeachPlanEntity( keyValue ); | |||
var jsonData = new { | |||
var TeachPlanData = teachPlanIBLL.GetTeachPlanEntity(keyValue); | |||
var jsonData = new | |||
{ | |||
TeachPlan = TeachPlanData, | |||
}; | |||
return Success(jsonData); | |||
@@ -114,8 +115,24 @@ namespace Learun.Application.Web.Areas.EducationalAdministration.Controllers | |||
[AjaxOnly] | |||
public ActionResult SaveForm(string keyValue, string strEntity) | |||
{ | |||
UserInfo userInfo = LoginUserInfo.Get(); TeachPlanEntity entity = strEntity.ToObject<TeachPlanEntity>(); | |||
teachPlanIBLL.SaveEntity(userInfo,keyValue,entity); | |||
UserInfo userInfo = LoginUserInfo.Get(); | |||
TeachPlanEntity entity = strEntity.ToObject<TeachPlanEntity>(); | |||
var planList = teachPlanIBLL.GetPlan(entity.PlanNo); | |||
if (string.IsNullOrEmpty(keyValue)) | |||
{ | |||
if (planList != null) | |||
{ | |||
return Fail("计划号已存在!"); | |||
} | |||
} | |||
else | |||
{ | |||
if (planList != null && planList.ID != keyValue) | |||
{ | |||
return Fail("计划号已存在!"); | |||
} | |||
} | |||
teachPlanIBLL.SaveEntity(userInfo, keyValue, entity); | |||
return Success("保存成功!"); | |||
} | |||
#endregion | |||
@@ -39,21 +39,21 @@ var bootstrap = function ($, learun) { | |||
value: "ccode", | |||
text: "cname", | |||
maxHeight: 200, | |||
select: function (item) { | |||
if (item) { | |||
var code = $("#City").lrselectGet(); | |||
//县区 | |||
$('#County').lrselectRefresh({ | |||
allowSearch: true, | |||
//type: 'multiple', | |||
url: top.$.rootUrl + '/LR_SystemModule/DataSource/GetDataTable?code=DIC_AREA', | |||
param: { strWhere: "1=1 and charindex(aparent,('" + code + "'))>0 " }, | |||
value: "acode", | |||
text: "aname", | |||
maxHeight: 200, | |||
}); | |||
} | |||
} | |||
//select: function (item) { | |||
// if (item) { | |||
// var code = $("#City").lrselectGet(); | |||
// //县区 | |||
// $('#County').lrselectRefresh({ | |||
// allowSearch: true, | |||
// //type: 'multiple', | |||
// url: top.$.rootUrl + '/LR_SystemModule/DataSource/GetDataTable?code=DIC_AREA', | |||
// param: { strWhere: "1=1 and charindex(aparent,('" + code + "'))>0 " }, | |||
// value: "acode", | |||
// text: "aname", | |||
// maxHeight: 200, | |||
// }); | |||
// } | |||
//} | |||
}); | |||
//县区 | |||
$('#County').lrselect({ | |||
@@ -4,8 +4,8 @@ | |||
} | |||
<div class="lr-form-wrap"> | |||
<div class="col-xs-6 lr-form-item" data-table="TeachPlan" > | |||
<div class="lr-form-item-title">计划号</div> | |||
<input id="PlanNo" type="text" class="form-control" /> | |||
<div class="lr-form-item-title">计划号<font face="宋体">*</font></div> | |||
<input id="PlanNo" type="text" class="form-control" isvalid="yes" checkexpession="NotNull" /> | |||
</div> | |||
<div class="col-xs-6 lr-form-item" data-table="TeachPlan" > | |||
<div class="lr-form-item-title">版本号</div> | |||
@@ -91,6 +91,29 @@ namespace Learun.Application.TwoDevelopment.EducationalAdministration | |||
} | |||
} | |||
/// <summary> | |||
/// 获取TeachPlan表实体数据 | |||
/// <param name="keyValue">主键</param> | |||
/// <summary> | |||
/// <returns></returns> | |||
public TeachPlanEntity GetPlan(string PlanNo) | |||
{ | |||
try | |||
{ | |||
return teachPlanService.GetPlan(PlanNo); | |||
} | |||
catch (Exception ex) | |||
{ | |||
if (ex is ExceptionEx) | |||
{ | |||
throw; | |||
} | |||
else | |||
{ | |||
throw ExceptionEx.ThrowBusinessException(ex); | |||
} | |||
} | |||
} | |||
#endregion | |||
#region 提交数据 | |||
@@ -34,6 +34,7 @@ namespace Learun.Application.TwoDevelopment.EducationalAdministration | |||
/// <summary> | |||
/// <returns></returns> | |||
TeachPlanEntity GetTeachPlanEntity(string keyValue); | |||
TeachPlanEntity GetPlan(string PlanNo); | |||
#endregion | |||
#region 提交数据 | |||
@@ -57,12 +57,12 @@ namespace Learun.Application.TwoDevelopment.EducationalAdministration | |||
} | |||
if (!queryParam["DeptNo"].IsEmpty()) | |||
{ | |||
dp.Add("DeptNo",queryParam["DeptNo"].ToString(), DbType.String); | |||
dp.Add("DeptNo", queryParam["DeptNo"].ToString(), DbType.String); | |||
strSql.Append(" AND t.DeptNo = @DeptNo "); | |||
} | |||
if (!queryParam["MajorNo"].IsEmpty()) | |||
{ | |||
dp.Add("MajorNo",queryParam["MajorNo"].ToString(), DbType.String); | |||
dp.Add("MajorNo", queryParam["MajorNo"].ToString(), DbType.String); | |||
strSql.Append(" AND t.MajorNo = @MajorNo "); | |||
} | |||
if (!queryParam["Grade"].IsEmpty()) | |||
@@ -70,7 +70,7 @@ namespace Learun.Application.TwoDevelopment.EducationalAdministration | |||
dp.Add("Grade", "%" + queryParam["Grade"].ToString() + "%", DbType.String); | |||
strSql.Append(" AND t.Grade Like @Grade "); | |||
} | |||
return this.BaseRepository().FindList<TeachPlanEntity>(strSql.ToString(),dp, pagination); | |||
return this.BaseRepository().FindList<TeachPlanEntity>(strSql.ToString(), dp, pagination); | |||
} | |||
catch (Exception ex) | |||
{ | |||
@@ -122,12 +122,12 @@ namespace Learun.Application.TwoDevelopment.EducationalAdministration | |||
} | |||
if (!queryParam["DeptNo"].IsEmpty()) | |||
{ | |||
dp.Add("DeptNo",queryParam["DeptNo"].ToString(), DbType.String); | |||
dp.Add("DeptNo", queryParam["DeptNo"].ToString(), DbType.String); | |||
strSql.Append(" AND t.DeptNo = @DeptNo "); | |||
} | |||
if (!queryParam["MajorNo"].IsEmpty()) | |||
{ | |||
dp.Add("MajorNo",queryParam["MajorNo"].ToString(), DbType.String); | |||
dp.Add("MajorNo", queryParam["MajorNo"].ToString(), DbType.String); | |||
strSql.Append(" AND t.MajorNo = @MajorNo "); | |||
} | |||
if (!queryParam["Grade"].IsEmpty()) | |||
@@ -135,7 +135,7 @@ namespace Learun.Application.TwoDevelopment.EducationalAdministration | |||
dp.Add("Grade", "%" + queryParam["Grade"].ToString() + "%", DbType.String); | |||
strSql.Append(" AND t.Grade Like @Grade "); | |||
} | |||
return this.BaseRepository().FindList<TeachPlanEntity>(strSql.ToString(),dp); | |||
return this.BaseRepository().FindList<TeachPlanEntity>(strSql.ToString(), dp); | |||
} | |||
catch (Exception ex) | |||
{ | |||
@@ -173,7 +173,29 @@ namespace Learun.Application.TwoDevelopment.EducationalAdministration | |||
} | |||
} | |||
} | |||
/// <summary> | |||
/// 获取TeachPlan表实体数据 | |||
/// <param name="keyValue">主键</param> | |||
/// <summary> | |||
/// <returns></returns> | |||
public TeachPlanEntity GetPlan(string PlanNo) | |||
{ | |||
try | |||
{ | |||
return this.BaseRepository().FindEntity<TeachPlanEntity>(x => x.PlanNo == PlanNo); | |||
} | |||
catch (Exception ex) | |||
{ | |||
if (ex is ExceptionEx) | |||
{ | |||
throw; | |||
} | |||
else | |||
{ | |||
throw ExceptionEx.ThrowServiceException(ex); | |||
} | |||
} | |||
} | |||
#endregion | |||
#region 提交数据 | |||
@@ -187,7 +209,7 @@ namespace Learun.Application.TwoDevelopment.EducationalAdministration | |||
{ | |||
try | |||
{ | |||
this.BaseRepository().Delete<TeachPlanEntity>(t=>t.ID == keyValue); | |||
this.BaseRepository().Delete<TeachPlanEntity>(t => t.ID == keyValue); | |||
} | |||
catch (Exception ex) | |||
{ | |||
@@ -207,13 +229,13 @@ namespace Learun.Application.TwoDevelopment.EducationalAdministration | |||
/// <param name="keyValue">主键</param> | |||
/// <summary> | |||
/// <returns></returns> | |||
public void SaveEntity( UserInfo userInfo, string keyValue, TeachPlanEntity entity) | |||
public void SaveEntity(UserInfo userInfo, string keyValue, TeachPlanEntity entity) | |||
{ | |||
try | |||
{ | |||
if (!string.IsNullOrEmpty(keyValue)) | |||
{ | |||
entity.Modify(keyValue,userInfo); | |||
entity.Modify(keyValue, userInfo); | |||
this.BaseRepository().Update(entity); | |||
} | |||
else | |||