@@ -26,7 +26,7 @@ namespace Learun.Application.Web.Areas.PersonnelManagement.Controllers | |||||
[HttpGet] | [HttpGet] | ||||
public ActionResult Index() | public ActionResult Index() | ||||
{ | { | ||||
return View(); | |||||
return View(); | |||||
} | } | ||||
/// <summary> | /// <summary> | ||||
/// 表单页 | /// 表单页 | ||||
@@ -35,7 +35,7 @@ namespace Learun.Application.Web.Areas.PersonnelManagement.Controllers | |||||
[HttpGet] | [HttpGet] | ||||
public ActionResult Form() | public ActionResult Form() | ||||
{ | { | ||||
return View(); | |||||
return View(); | |||||
} | } | ||||
#endregion | #endregion | ||||
@@ -69,8 +69,9 @@ namespace Learun.Application.Web.Areas.PersonnelManagement.Controllers | |||||
[AjaxOnly] | [AjaxOnly] | ||||
public ActionResult GetFormData(string keyValue) | public ActionResult GetFormData(string keyValue) | ||||
{ | { | ||||
var ContractCategoryData = contractCategoryIBLL.GetContractCategoryEntity( keyValue ); | |||||
var jsonData = new { | |||||
var ContractCategoryData = contractCategoryIBLL.GetContractCategoryEntity(keyValue); | |||||
var jsonData = new | |||||
{ | |||||
ContractCategory = ContractCategoryData, | ContractCategory = ContractCategoryData, | ||||
}; | }; | ||||
return Success(jsonData); | return Success(jsonData); | ||||
@@ -102,7 +103,32 @@ namespace Learun.Application.Web.Areas.PersonnelManagement.Controllers | |||||
public ActionResult SaveForm(string keyValue, string strEntity) | public ActionResult SaveForm(string keyValue, string strEntity) | ||||
{ | { | ||||
ContractCategoryEntity entity = strEntity.ToObject<ContractCategoryEntity>(); | ContractCategoryEntity entity = strEntity.ToObject<ContractCategoryEntity>(); | ||||
contractCategoryIBLL.SaveEntity(keyValue,entity); | |||||
var NoModel = contractCategoryIBLL.GetNoEntity(entity.Code); | |||||
var NameModel = contractCategoryIBLL.GetNameEntity(entity.Name); | |||||
if (string.IsNullOrEmpty(keyValue)) | |||||
{ | |||||
if (NoModel != null) | |||||
{ | |||||
return Fail("类别编号已存在!"); | |||||
} | |||||
if (NameModel != null) | |||||
{ | |||||
return Fail("类别名称已存在!"); | |||||
} | |||||
} | |||||
else | |||||
{ | |||||
if (NoModel != null && NoModel.Id != keyValue) | |||||
{ | |||||
return Fail("类别编号已存在!"); | |||||
} | |||||
if (NameModel != null && NameModel.Id != keyValue) | |||||
{ | |||||
return Fail("类别名称已存在!"); | |||||
} | |||||
} | |||||
contractCategoryIBLL.SaveEntity(keyValue, entity); | |||||
return Success("保存成功!"); | return Success("保存成功!"); | ||||
} | } | ||||
#endregion | #endregion | ||||
@@ -118,6 +118,54 @@ namespace Learun.Application.TwoDevelopment.PersonnelManagement | |||||
} | } | ||||
} | } | ||||
/// <summary> | |||||
/// 去重 | |||||
/// </summary> | |||||
/// <param name="No"></param> | |||||
/// <param name="Name"></param> | |||||
/// <returns></returns> | |||||
public ContractCategoryEntity GetNoEntity(string No) | |||||
{ | |||||
try | |||||
{ | |||||
return contractCategoryService.GetNoEntity(No); | |||||
} | |||||
catch (Exception ex) | |||||
{ | |||||
if (ex is ExceptionEx) | |||||
{ | |||||
throw; | |||||
} | |||||
else | |||||
{ | |||||
throw ExceptionEx.ThrowBusinessException(ex); | |||||
} | |||||
} | |||||
} | |||||
/// <summary> | |||||
/// 去重 | |||||
/// </summary> | |||||
/// <param name="No"></param> | |||||
/// <param name="Name"></param> | |||||
/// <returns></returns> | |||||
public ContractCategoryEntity GetNameEntity(string Name) | |||||
{ | |||||
try | |||||
{ | |||||
return contractCategoryService.GetNameEntity(Name); | |||||
} | |||||
catch (Exception ex) | |||||
{ | |||||
if (ex is ExceptionEx) | |||||
{ | |||||
throw; | |||||
} | |||||
else | |||||
{ | |||||
throw ExceptionEx.ThrowBusinessException(ex); | |||||
} | |||||
} | |||||
} | |||||
#endregion | #endregion | ||||
} | } | ||||
@@ -44,6 +44,13 @@ namespace Learun.Application.TwoDevelopment.PersonnelManagement | |||||
/// <returns></returns> | /// <returns></returns> | ||||
void SaveEntity(string keyValue, ContractCategoryEntity entity); | void SaveEntity(string keyValue, ContractCategoryEntity entity); | ||||
#endregion | #endregion | ||||
/// <summary> | |||||
/// 去重 | |||||
/// </summary> | |||||
/// <param name="No"></param> | |||||
/// <param name="Name"></param> | |||||
/// <returns></returns> | |||||
ContractCategoryEntity GetNoEntity(string No); | |||||
ContractCategoryEntity GetNameEntity(string Name); | |||||
} | } | ||||
} | } |
@@ -45,7 +45,7 @@ namespace Learun.Application.TwoDevelopment.PersonnelManagement | |||||
dp.Add("Name", "%" + queryParam["Name"].ToString() + "%", DbType.String); | dp.Add("Name", "%" + queryParam["Name"].ToString() + "%", DbType.String); | ||||
strSql.Append(" AND t.Name Like @Name "); | strSql.Append(" AND t.Name Like @Name "); | ||||
} | } | ||||
return this.BaseRepository("CollegeMIS").FindList<ContractCategoryEntity>(strSql.ToString(),dp, pagination); | |||||
return this.BaseRepository("CollegeMIS").FindList<ContractCategoryEntity>(strSql.ToString(), dp, pagination); | |||||
} | } | ||||
catch (Exception ex) | catch (Exception ex) | ||||
{ | { | ||||
@@ -97,7 +97,7 @@ namespace Learun.Application.TwoDevelopment.PersonnelManagement | |||||
{ | { | ||||
try | try | ||||
{ | { | ||||
this.BaseRepository("CollegeMIS").Delete<ContractCategoryEntity>(t=>t.Id == keyValue); | |||||
this.BaseRepository("CollegeMIS").Delete<ContractCategoryEntity>(t => t.Id == keyValue); | |||||
} | } | ||||
catch (Exception ex) | catch (Exception ex) | ||||
{ | { | ||||
@@ -144,7 +144,54 @@ namespace Learun.Application.TwoDevelopment.PersonnelManagement | |||||
} | } | ||||
} | } | ||||
} | } | ||||
/// <summary> | |||||
/// 去重 | |||||
/// </summary> | |||||
/// <param name="No"></param> | |||||
/// <param name="Name"></param> | |||||
/// <returns></returns> | |||||
public ContractCategoryEntity GetNoEntity(string No) | |||||
{ | |||||
try | |||||
{ | |||||
return this.BaseRepository("CollegeMIS").FindEntity<ContractCategoryEntity>(t => t.Code == No); | |||||
} | |||||
catch (Exception ex) | |||||
{ | |||||
if (ex is ExceptionEx) | |||||
{ | |||||
throw; | |||||
} | |||||
else | |||||
{ | |||||
throw ExceptionEx.ThrowServiceException(ex); | |||||
} | |||||
} | |||||
} | |||||
/// <summary> | |||||
/// 去重 | |||||
/// </summary> | |||||
/// <param name="No"></param> | |||||
/// <param name="Name"></param> | |||||
/// <returns></returns> | |||||
public ContractCategoryEntity GetNameEntity(string Name) | |||||
{ | |||||
try | |||||
{ | |||||
return this.BaseRepository("CollegeMIS").FindEntity<ContractCategoryEntity>(t => t.Name == Name); | |||||
} | |||||
catch (Exception ex) | |||||
{ | |||||
if (ex is ExceptionEx) | |||||
{ | |||||
throw; | |||||
} | |||||
else | |||||
{ | |||||
throw ExceptionEx.ThrowServiceException(ex); | |||||
} | |||||
} | |||||
} | |||||
#endregion | #endregion | ||||
} | } | ||||