Ver código fonte

合同类别 编号名字重复

新疆影视学院高职
ndbs 2 anos atrás
pai
commit
0b0945df7f
4 arquivos alterados com 137 adições e 9 exclusões
  1. +31
    -5
      Learun.Framework.Ultimate V7/Learun.Application.Web/Areas/PersonnelManagement/Controllers/ContractCategoryController.cs
  2. +48
    -0
      Learun.Framework.Ultimate V7/Learun.Framework.Module/Learun.Application.Module/Learun.Application.TwoDevelopment/PersonnelManagement/ContractCategory/ContractCategoryBLL.cs
  3. +8
    -1
      Learun.Framework.Ultimate V7/Learun.Framework.Module/Learun.Application.Module/Learun.Application.TwoDevelopment/PersonnelManagement/ContractCategory/ContractCategoryIBLL.cs
  4. +50
    -3
      Learun.Framework.Ultimate V7/Learun.Framework.Module/Learun.Application.Module/Learun.Application.TwoDevelopment/PersonnelManagement/ContractCategory/ContractCategoryService.cs

+ 31
- 5
Learun.Framework.Ultimate V7/Learun.Application.Web/Areas/PersonnelManagement/Controllers/ContractCategoryController.cs Ver arquivo

@@ -26,7 +26,7 @@ namespace Learun.Application.Web.Areas.PersonnelManagement.Controllers
[HttpGet]
public ActionResult Index()
{
return View();
return View();
}
/// <summary>
/// 表单页
@@ -35,7 +35,7 @@ namespace Learun.Application.Web.Areas.PersonnelManagement.Controllers
[HttpGet]
public ActionResult Form()
{
return View();
return View();
}
#endregion

@@ -69,8 +69,9 @@ namespace Learun.Application.Web.Areas.PersonnelManagement.Controllers
[AjaxOnly]
public ActionResult GetFormData(string keyValue)
{
var ContractCategoryData = contractCategoryIBLL.GetContractCategoryEntity( keyValue );
var jsonData = new {
var ContractCategoryData = contractCategoryIBLL.GetContractCategoryEntity(keyValue);
var jsonData = new
{
ContractCategory = ContractCategoryData,
};
return Success(jsonData);
@@ -102,7 +103,32 @@ namespace Learun.Application.Web.Areas.PersonnelManagement.Controllers
public ActionResult SaveForm(string keyValue, string strEntity)
{
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("保存成功!");
}
#endregion


+ 48
- 0
Learun.Framework.Ultimate V7/Learun.Framework.Module/Learun.Application.Module/Learun.Application.TwoDevelopment/PersonnelManagement/ContractCategory/ContractCategoryBLL.cs Ver arquivo

@@ -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

}


+ 8
- 1
Learun.Framework.Ultimate V7/Learun.Framework.Module/Learun.Application.Module/Learun.Application.TwoDevelopment/PersonnelManagement/ContractCategory/ContractCategoryIBLL.cs Ver arquivo

@@ -44,6 +44,13 @@ namespace Learun.Application.TwoDevelopment.PersonnelManagement
/// <returns></returns>
void SaveEntity(string keyValue, ContractCategoryEntity entity);
#endregion

/// <summary>
/// 去重
/// </summary>
/// <param name="No"></param>
/// <param name="Name"></param>
/// <returns></returns>
ContractCategoryEntity GetNoEntity(string No);
ContractCategoryEntity GetNameEntity(string Name);
}
}

+ 50
- 3
Learun.Framework.Ultimate V7/Learun.Framework.Module/Learun.Application.Module/Learun.Application.TwoDevelopment/PersonnelManagement/ContractCategory/ContractCategoryService.cs Ver arquivo

@@ -45,7 +45,7 @@ namespace Learun.Application.TwoDevelopment.PersonnelManagement
dp.Add("Name", "%" + queryParam["Name"].ToString() + "%", DbType.String);
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)
{
@@ -97,7 +97,7 @@ namespace Learun.Application.TwoDevelopment.PersonnelManagement
{
try
{
this.BaseRepository("CollegeMIS").Delete<ContractCategoryEntity>(t=>t.Id == keyValue);
this.BaseRepository("CollegeMIS").Delete<ContractCategoryEntity>(t => t.Id == keyValue);
}
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

}


Carregando…
Cancelar
Salvar