Commit 94f78049 authored by 黄奎's avatar 黄奎

页面修改

parent f23c1d88
...@@ -622,7 +622,7 @@ namespace Edu.Module.Customer ...@@ -622,7 +622,7 @@ namespace Edu.Module.Customer
{ {
List<WhereHelper> list = new List<WhereHelper> List<WhereHelper> list = new List<WhereHelper>
{ {
new WhereHelper(nameof(RB_Customer_Category_Extend.CategoryName), model.CategoryName), new WhereHelper(nameof(RB_Customer_Category_Extend.CategoryName), model.CategoryName.Trim()),
new WhereHelper(nameof(RB_Customer_Category_Extend.Status), 0), new WhereHelper(nameof(RB_Customer_Category_Extend.Status), 0),
new WhereHelper(nameof(RB_Customer_Category_Extend.Group_Id), model.Group_Id) new WhereHelper(nameof(RB_Customer_Category_Extend.Group_Id), model.Group_Id)
}; };
...@@ -666,6 +666,35 @@ namespace Edu.Module.Customer ...@@ -666,6 +666,35 @@ namespace Edu.Module.Customer
return flag; return flag;
} }
/// <summary>
/// 同行合并
/// </summary>
/// <param name="CategoryId"></param>
/// <param name="NewCategoryId"></param>
/// <returns></returns>
public bool ReplaceCustomerCategoryModule(int CategoryId, int NewCategoryId)
{
bool flag = false;
var list = customerRepository.GetCustomerListRepository(new RB_Customer_Extend() { CategoryId = CategoryId });
if (list != null && list.Count > 0)
{
foreach (var item in list)
{
Dictionary<string, object> fileds = new Dictionary<string, object>()
{
{nameof(RB_Customer_Extend.CategoryId),NewCategoryId}
};
customerRepository.Update(fileds, new WhereHelper(nameof(RB_Customer_Extend.CustomerId), item.CustomerId));
}
}
Dictionary<string, object> cateFileds = new Dictionary<string, object>()
{
{nameof(RB_Customer_Category_Extend.Status),(int)DateStateEnum.Delete}
};
flag = customer_CategoryRepository.Update(cateFileds, new WhereHelper(nameof(RB_Customer_Category_Extend.CategoryId), CategoryId));
return flag;
}
/// <summary> /// <summary>
/// 根据编号获取同行信息 /// 根据编号获取同行信息
/// </summary> /// </summary>
......
...@@ -169,16 +169,38 @@ namespace Edu.WebApi.Controllers.Customer ...@@ -169,16 +169,38 @@ namespace Edu.WebApi.Controllers.Customer
School_Id = base.UserInfo.School_Id, School_Id = base.UserInfo.School_Id,
}; };
if (!string.IsNullOrEmpty(categoryModel.CategoryName)) if (!string.IsNullOrEmpty(categoryModel.CategoryName))
{
if (customerModule.CheckCustomerCategoryModule(categoryModel))
{
return ApiResult.Failed("已存在此同行,请重新选择!");
}
else
{ {
bool cflag = customerModule.SetCustomerCategoryModule(categoryModel); bool cflag = customerModule.SetCustomerCategoryModule(categoryModel);
model.CategoryId = categoryModel.CategoryId; model.CategoryId = categoryModel.CategoryId;
} }
}
var flag = customerModule.SetCustomerModule(model); var flag = customerModule.SetCustomerModule(model);
return flag ? ApiResult.Success() : ApiResult.Failed(); return flag ? ApiResult.Success() : ApiResult.Failed();
} }
/// <summary>
/// 替换同行
/// </summary>
/// <returns></returns>
[HttpPost]
public ApiResult ReplaceCategory()
{
var CategoryId = base.ParmJObj.GetInt("CategoryId");
var NewCategoryId= base.ParmJObj.GetInt("NewCategoryId");
if (NewCategoryId <= 0)
{
return ApiResult.Failed("请选择目标企业或校代!");
}
bool flag = customerModule.ReplaceCustomerCategoryModule(CategoryId, NewCategoryId);
return flag ? ApiResult.Success() : ApiResult.Failed();
}
/// <summary> /// <summary>
/// 根据编号删除客户 /// 根据编号删除客户
/// </summary> /// </summary>
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment