@@ -132,6 +132,22 @@ namespace Learun.Application.Web.Areas.LogisticsManagement.Controllers | |||||
[HttpPost] | [HttpPost] | ||||
[ValidateAntiForgeryToken] | [ValidateAntiForgeryToken] | ||||
[AjaxOnly] | [AjaxOnly] | ||||
public ActionResult SaveData(string keyValue, string strEntity) | |||||
{ | |||||
Acc_DormitoryReturnEntity entity = strEntity.ToObject<Acc_DormitoryReturnEntity>(); | |||||
dormitoryReturnIBLL.SaveData(keyValue, entity); | |||||
return Success("保存成功!"); | |||||
} | |||||
/// <summary> | |||||
/// 保存实体数据(新增、修改) | |||||
/// </summary> | |||||
/// <param name="keyValue">主键</param> | |||||
/// <param name="strEntity">实体</param> | |||||
/// <returns></returns> | |||||
[HttpPost] | |||||
[ValidateAntiForgeryToken] | |||||
[AjaxOnly] | |||||
public ActionResult SaveForm(string type, string strEntity) | public ActionResult SaveForm(string type, string strEntity) | ||||
{ | { | ||||
Acc_DormitoryReturnEntity entity = strEntity.ToObject<Acc_DormitoryReturnEntity>(); | Acc_DormitoryReturnEntity entity = strEntity.ToObject<Acc_DormitoryReturnEntity>(); | ||||
@@ -9,11 +9,11 @@ | |||||
</div> | </div> | ||||
<div class="col-xs-12 lr-form-item" data-table="Acc_DormitoryReturn"> | <div class="col-xs-12 lr-form-item" data-table="Acc_DormitoryReturn"> | ||||
<div class="lr-form-item-title">出宿时间</div> | <div class="lr-form-item-title">出宿时间</div> | ||||
<input id="OutTime" type="text" class="form-control lr-input-wdatepicker" onfocus="WdatePicker({ dateFmt:'yyyy-MM-dd HH:mm:ss',onpicked: function () { $('#OutTime').trigger('change'); } })" /> | |||||
<input id="OutTime" type="text" class="form-control lr-input-wdatepicker" data-dateFmt="yyyy-MM-dd HH:mm:ss" onfocus="WdatePicker({ dateFmt:'yyyy-MM-dd HH:mm:ss',onpicked: function () { $('#OutTime').trigger('change'); } })" /> | |||||
</div> | </div> | ||||
<div class="col-xs-12 lr-form-item" data-table="Acc_DormitoryReturn"> | <div class="col-xs-12 lr-form-item" data-table="Acc_DormitoryReturn"> | ||||
<div class="lr-form-item-title">归宿时间</div> | <div class="lr-form-item-title">归宿时间</div> | ||||
<input id="ReturnTime" type="text" class="form-control lr-input-wdatepicker" onfocus="WdatePicker({ dateFmt:'yyyy-MM-dd HH:mm:ss',onpicked: function () { $('#ReturnTime').trigger('change'); } })" /> | |||||
<input id="ReturnTime" type="text" class="form-control lr-input-wdatepicker" data-dateFmt="yyyy-MM-dd HH:mm:ss" onfocus="WdatePicker({ dateFmt:'yyyy-MM-dd HH:mm:ss',onpicked: function () { $('#ReturnTime').trigger('change'); } })" /> | |||||
</div> | </div> | ||||
@*<div class="col-xs-12 lr-form-item" data-table="Acc_DormitoryReturn"> | @*<div class="col-xs-12 lr-form-item" data-table="Acc_DormitoryReturn"> | ||||
<div class="lr-form-item-title">检查日期</div> | <div class="lr-form-item-title">检查日期</div> | ||||
@@ -18,7 +18,7 @@ var bootstrap = function ($, learun) { | |||||
bind: function () { | bind: function () { | ||||
$('#DormitoryBuildId').lrselect({ | $('#DormitoryBuildId').lrselect({ | ||||
url: top.$.rootUrl + '/LR_SystemModule/DataSource/GetDataTable', | url: top.$.rootUrl + '/LR_SystemModule/DataSource/GetDataTable', | ||||
param: { code: 'DormitoryInfo', strWhere: "ParentID='" + ParentId + "' and BuildType='5' order by name" }, | |||||
param: { code: 'DormitoryInfo', strWhere: "ParentID='" + ParentId + "' and BuildType='5' and (StudentID is not null and len(StudentID)>0) order by name" }, | |||||
text: 'name', | text: 'name', | ||||
value: 'id', | value: 'id', | ||||
allowSearch: true | allowSearch: true | ||||
@@ -48,7 +48,7 @@ var bootstrap = function ($, learun) { | |||||
var postData = { | var postData = { | ||||
strEntity: JSON.stringify($('body').lrGetFormData()) | strEntity: JSON.stringify($('body').lrGetFormData()) | ||||
}; | }; | ||||
$.lrSaveForm(top.$.rootUrl + '/LogisticsManagement/DormitoryReturn/SaveForm?keyValue=' + keyValue, postData, function (res) { | |||||
$.lrSaveForm(top.$.rootUrl + '/LogisticsManagement/DormitoryReturn/SaveData?keyValue=' + keyValue, postData, function (res) { | |||||
// 保存成功后才回调 | // 保存成功后才回调 | ||||
if (!!callBack) { | if (!!callBack) { | ||||
callBack(); | callBack(); | ||||
@@ -167,6 +167,24 @@ namespace Learun.Application.TwoDevelopment.LogisticsManagement | |||||
} | } | ||||
} | } | ||||
public void SaveData(string keyValue, Acc_DormitoryReturnEntity entity) | |||||
{ | |||||
try | |||||
{ | |||||
dormitoryReturnService.SaveData(keyValue, entity); | |||||
} | |||||
catch (Exception ex) | |||||
{ | |||||
if (ex is ExceptionEx) | |||||
{ | |||||
throw; | |||||
} | |||||
else | |||||
{ | |||||
throw ExceptionEx.ThrowBusinessException(ex); | |||||
} | |||||
} | |||||
} | |||||
#endregion | #endregion | ||||
} | } | ||||
@@ -42,6 +42,7 @@ namespace Learun.Application.TwoDevelopment.LogisticsManagement | |||||
/// <param name="keyValue">主键</param> | /// <param name="keyValue">主键</param> | ||||
/// <param name="entity">实体</param> | /// <param name="entity">实体</param> | ||||
void SaveEntity(string type, Acc_DormitoryReturnEntity entity); | void SaveEntity(string type, Acc_DormitoryReturnEntity entity); | ||||
void SaveData(string keyValue, Acc_DormitoryReturnEntity entity); | |||||
#endregion | #endregion | ||||
} | } | ||||
@@ -190,6 +190,38 @@ namespace Learun.Application.TwoDevelopment.LogisticsManagement | |||||
} | } | ||||
} | } | ||||
/// <summary> | |||||
/// 保存 | |||||
/// </summary> | |||||
/// <param name="keyValue"></param> | |||||
/// <param name="entity"></param> | |||||
public void SaveData(string keyValue, Acc_DormitoryReturnEntity entity) | |||||
{ | |||||
try | |||||
{ | |||||
if (!string.IsNullOrEmpty(keyValue)) | |||||
{ | |||||
entity.Modify(keyValue); | |||||
this.BaseRepository("CollegeMIS").Update(entity); | |||||
} | |||||
else | |||||
{ | |||||
entity.Create(); | |||||
this.BaseRepository("CollegeMIS").Insert(entity); | |||||
} | |||||
} | |||||
catch (Exception ex) | |||||
{ | |||||
if (ex is ExceptionEx) | |||||
{ | |||||
throw; | |||||
} | |||||
else | |||||
{ | |||||
throw ExceptionEx.ThrowServiceException(ex); | |||||
} | |||||
} | |||||
} | |||||
#endregion | #endregion | ||||
} | } | ||||