diff --git a/.gitignore b/.gitignore
index aa670e3218d3308051771b659e647aa4bd394979..b95bb29d4c322de4e7596a095e87ac25e03dd3d7 100644
--- a/.gitignore
+++ b/.gitignore
@@ -32,6 +32,7 @@ bld/
[Oo]bj/
[Ll]og/
[Ll]ogs/
+docker-images/
# Visual Studio 2015/2017 cache/options directory
.vs/
diff --git a/EOM.TSHotelManagement.Application/Application/NavBar/INavBarService.cs b/EOM.TSHotelManagement.Application/Application/NavBar/INavBarService.cs
index b673e188c2b4ba0a5b3dd5678027085c03af6263..f00f53395a432b7888e5da2ea928c7ed71dc89ac 100644
--- a/EOM.TSHotelManagement.Application/Application/NavBar/INavBarService.cs
+++ b/EOM.TSHotelManagement.Application/Application/NavBar/INavBarService.cs
@@ -17,18 +17,18 @@ namespace EOM.TSHotelManagement.Application
///
///
///
- BaseOutputDto AddNavBar(CreateNavBarInputDto input);
+ BaseResponse AddNavBar(CreateNavBarInputDto input);
///
/// 更新导航控件
///
///
///
- BaseOutputDto UpdateNavBar(UpdateNavBarInputDto input);
+ BaseResponse UpdateNavBar(UpdateNavBarInputDto input);
///
/// 删除导航控件
///
///
///
- BaseOutputDto DeleteNavBar(DeleteNavBarInputDto input);
+ BaseResponse DeleteNavBar(DeleteNavBarInputDto input);
}
}
\ No newline at end of file
diff --git a/EOM.TSHotelManagement.Application/Application/NavBar/NavBarService.cs b/EOM.TSHotelManagement.Application/Application/NavBar/NavBarService.cs
index 3ab3ed4bde6e94ce95171c42510705634dd771a7..f509d22caa7ddd7ab53fcda6e62a68e94a251ea5 100644
--- a/EOM.TSHotelManagement.Application/Application/NavBar/NavBarService.cs
+++ b/EOM.TSHotelManagement.Application/Application/NavBar/NavBarService.cs
@@ -30,14 +30,16 @@ namespace EOM.TSHotelManagement.Application
///
public ListOutputDto NavBarList()
{
- var navBarList = navBarRepository.GetList(a => a.IsDelete != 1);
-
- var listSource = EntityMapper.MapList(navBarList);
+ var navBars = navBarRepository.GetList();
+ var result = EntityMapper.MapList(navBars);
return new ListOutputDto
{
- listSource = listSource,
- total = listSource.Count
+ Data = new PagedData
+ {
+ Items = result,
+ TotalCount = result.Count
+ }
};
}
@@ -46,7 +48,7 @@ namespace EOM.TSHotelManagement.Application
///
///
///
- public BaseOutputDto AddNavBar(CreateNavBarInputDto input)
+ public BaseResponse AddNavBar(CreateNavBarInputDto input)
{
var navBar = new NavBar
{
@@ -60,22 +62,19 @@ namespace EOM.TSHotelManagement.Application
DataInsDate = input.DataInsDate
};
var result = navBarRepository.Insert(navBar);
- if (result)
- {
- return new BaseOutputDto
- {
- StatusCode = StatusCodeConstants.Success,
- Message = "添加成功"
- };
- }
- else
+ if (!result)
{
- return new BaseOutputDto
+ return new BaseResponse
{
- StatusCode = StatusCodeConstants.InternalServerError,
+ Code = BusinessStatusCode.InternalServerError,
Message = "添加失败"
};
}
+ return new BaseResponse
+ {
+ Code = BusinessStatusCode.Success,
+ Message = "添加成功"
+ };
}
///
@@ -83,14 +82,14 @@ namespace EOM.TSHotelManagement.Application
///
///
///
- public BaseOutputDto UpdateNavBar(UpdateNavBarInputDto input)
+ public BaseResponse UpdateNavBar(UpdateNavBarInputDto input)
{
var navBar = navBarRepository.GetById(input.NavigationBarId);
if (navBar == null)
{
- return new BaseOutputDto
+ return new BaseResponse
{
- StatusCode = StatusCodeConstants.NotFound,
+ Code = BusinessStatusCode.NotFound,
Message = "导航控件未找到"
};
}
@@ -100,22 +99,19 @@ namespace EOM.TSHotelManagement.Application
navBar.NavigationBarEvent = input.NavigationBarEvent;
navBar.MarginLeft = input.MarginLeft;
var result = navBarRepository.Update(navBar);
- if (result)
+ if (!result)
{
- return new BaseOutputDto
+ return new BaseResponse
{
- StatusCode = StatusCodeConstants.Success,
- Message = "更新成功"
- };
- }
- else
- {
- return new BaseOutputDto
- {
- StatusCode = StatusCodeConstants.InternalServerError,
+ Code = BusinessStatusCode.InternalServerError,
Message = "更新失败"
};
}
+ return new BaseResponse
+ {
+ Code = BusinessStatusCode.Success,
+ Message = "更新成功"
+ };
}
///
@@ -123,35 +119,32 @@ namespace EOM.TSHotelManagement.Application
///
///
///
- public BaseOutputDto DeleteNavBar(DeleteNavBarInputDto input)
+ public BaseResponse DeleteNavBar(DeleteNavBarInputDto input)
{
var navBar = navBarRepository.GetById(input.NavigationBarId);
if (navBar == null)
{
- return new BaseOutputDto
+ return new BaseResponse
{
- StatusCode = StatusCodeConstants.NotFound,
+ Code = BusinessStatusCode.NotFound,
Message = "导航控件未找到"
};
}
navBar.IsDelete = 1;
- var result = navBarRepository.Update(navBar);
- if (result)
- {
- return new BaseOutputDto
- {
- StatusCode = StatusCodeConstants.Success,
- Message = "删除成功"
- };
- }
- else
+ var result = navBarRepository.SoftDelete(navBar);
+ if (!result)
{
- return new BaseOutputDto
+ return new BaseResponse
{
- StatusCode = StatusCodeConstants.InternalServerError,
+ Code = BusinessStatusCode.InternalServerError,
Message = "删除失败"
};
}
+ return new BaseResponse
+ {
+ Code = BusinessStatusCode.Success,
+ Message = "删除成功"
+ };
}
}
}
diff --git a/EOM.TSHotelManagement.Application/Business/Asset/AssetService.cs b/EOM.TSHotelManagement.Application/Business/Asset/AssetService.cs
index cd62266712a7a11240c7688ecde909803b800856..dffc2a46dd014ae29c7a0b681b04353eb48929d7 100644
--- a/EOM.TSHotelManagement.Application/Business/Asset/AssetService.cs
+++ b/EOM.TSHotelManagement.Application/Business/Asset/AssetService.cs
@@ -67,21 +67,26 @@ namespace EOM.TSHotelManagement.Application
///
///
///
- public BaseOutputDto AddAssetInfo(CreateAssetInputDto asset)
+ public BaseResponse AddAssetInfo(CreateAssetInputDto asset)
{
try
{
if (assetRepository.IsAny(a => a.AssetNumber == asset.AssetNumber))
{
- return new BaseOutputDto() { Message = LocalizationHelper.GetLocalizedString("the asset number already exists.", "资产编号已存在"), StatusCode = StatusCodeConstants.InternalServerError };
+ return new BaseResponse() { Message = LocalizationHelper.GetLocalizedString("the asset number already exists.", "资产编号已存在"), Code = BusinessStatusCode.InternalServerError };
+ }
+ var entity = EntityMapper.Map(asset);
+ var result = assetRepository.Insert(entity);
+ if (!result)
+ {
+ return new BaseResponse() { Message = LocalizationHelper.GetLocalizedString("insert asset failed.", "资产添加失败"), Code = BusinessStatusCode.InternalServerError };
}
- var result = assetRepository.Insert(EntityMapper.Map(asset));
}
catch (Exception ex)
{
- return new BaseOutputDto() { Message = LocalizationHelper.GetLocalizedString(ex.Message, ex.Message), StatusCode = StatusCodeConstants.InternalServerError };
+ return new BaseResponse() { Message = LocalizationHelper.GetLocalizedString(ex.Message, ex.Message), Code = BusinessStatusCode.InternalServerError };
}
- return new BaseOutputDto();
+ return new BaseResponse();
}
///
@@ -91,38 +96,45 @@ namespace EOM.TSHotelManagement.Application
public ListOutputDto SelectAssetInfoAll(ReadAssetInputDto asset)
{
//查询所有部门信息
- List depts = new List();
- depts = deptRepository.GetList();
+ List depts = deptRepository.GetList();
//查询所有员工信息
- List employees = new List();
- employees = employeeRepository.GetList();
-
- ListOutputDto cs = new ListOutputDto();
+ List employees = employeeRepository.GetList();
var where = Expressionable.Create();
-
where = where.And(a => a.IsDelete == asset.IsDelete);
- int totalCount = 0;
+ int count = 0;
+ List assets = new List();
if (asset.Page != 0 && asset.PageSize != 0)
{
- cs.listSource = EntityMapper.MapList(assetRepository.AsQueryable().Where(where.ToExpression()).OrderBy(a => a.AssetNumber)
- .ToPageList((int)asset.Page, (int)asset.PageSize, ref totalCount));
- cs.total = totalCount;
+ assets = assetRepository.AsQueryable().Where(where.ToExpression()).OrderBy(a => a.AssetNumber)
+ .ToPageList((int)asset.Page, (int)asset.PageSize, ref count);
}
+ else
+ {
+ assets = assetRepository.AsQueryable().Where(where.ToExpression()).OrderBy(a => a.AssetNumber).ToList();
+ count = assets.Count;
+ }
+
+ var mapped = EntityMapper.MapList(assets);
- cs.listSource.ForEach(source =>
+ mapped.ForEach(source =>
{
var dept = depts.SingleOrDefault(a => a.DepartmentNumber.Equals(source.DepartmentCode));
source.DepartmentName = dept == null ? "" : dept.DepartmentName;
var worker = employees.SingleOrDefault(a => a.EmployeeId.Equals(source.AcquiredByEmployeeId));
source.AcquiredByEmployeeName = worker == null ? "" : worker.EmployeeName;
-
source.AssetValueFormatted = source.AssetValue == 0 ? "" : Decimal.Parse(source.AssetValue.ToString()).ToString("#,##0.00").ToString();
-
});
- return cs;
+ return new ListOutputDto
+ {
+ Data = new PagedData
+ {
+ Items = mapped,
+ TotalCount = count
+ }
+ };
}
///
@@ -130,21 +142,26 @@ namespace EOM.TSHotelManagement.Application
///
///
///
- public BaseOutputDto UpdAssetInfo(UpdateAssetInputDto asset)
+ public BaseResponse UpdAssetInfo(UpdateAssetInputDto asset)
{
try
{
if (!assetRepository.IsAny(a => a.AssetNumber == asset.AssetNumber))
{
- return new BaseOutputDto() { Message = LocalizationHelper.GetLocalizedString("asset number does not exist.", "资产编号不存在"), StatusCode = StatusCodeConstants.InternalServerError };
+ return new BaseResponse() { Message = LocalizationHelper.GetLocalizedString("asset number does not exist.", "资产编号不存在"), Code = BusinessStatusCode.InternalServerError };
+ }
+ var entity = EntityMapper.Map(asset);
+ var result = assetRepository.Update(entity);
+ if (!result)
+ {
+ return new BaseResponse() { Message = LocalizationHelper.GetLocalizedString("update asset failed.", "资产更新失败"), Code = BusinessStatusCode.InternalServerError };
}
- assetRepository.Update(EntityMapper.Map(asset));
}
catch (Exception ex)
{
- return new BaseOutputDto() { Message = LocalizationHelper.GetLocalizedString(ex.Message, ex.Message), StatusCode = StatusCodeConstants.InternalServerError };
+ return new BaseResponse() { Message = LocalizationHelper.GetLocalizedString(ex.Message, ex.Message), Code = BusinessStatusCode.InternalServerError };
}
- return new BaseOutputDto();
+ return new BaseResponse();
}
///
@@ -152,21 +169,21 @@ namespace EOM.TSHotelManagement.Application
///
///
///
- public BaseOutputDto DelAssetInfo(DeleteAssetInputDto asset)
+ public BaseResponse DelAssetInfo(DeleteAssetInputDto asset)
{
try
{
if (!assetRepository.IsAny(a => a.AssetNumber == asset.AssetNumber))
{
- return new BaseOutputDto() { Message = LocalizationHelper.GetLocalizedString("asset number does not exist.", "资产编号不存在"), StatusCode = StatusCodeConstants.InternalServerError };
+ return new BaseResponse() { Message = LocalizationHelper.GetLocalizedString("asset number does not exist.", "资产编号不存在"), Code = BusinessStatusCode.InternalServerError };
}
- assetRepository.Update(a => new Asset { IsDelete = asset.IsDelete }, a => a.AssetNumber == asset.AssetNumber);
+ assetRepository.SoftDelete(new Asset { IsDelete = asset.IsDelete, AssetNumber = asset.AssetNumber, Id = asset.Id });
}
catch (Exception ex)
{
- return new BaseOutputDto() { Message = LocalizationHelper.GetLocalizedString(ex.Message, ex.Message), StatusCode = StatusCodeConstants.InternalServerError };
+ return new BaseResponse() { Message = LocalizationHelper.GetLocalizedString(ex.Message, ex.Message), Code = BusinessStatusCode.InternalServerError };
}
- return new BaseOutputDto();
+ return new BaseResponse();
}
}
}
diff --git a/EOM.TSHotelManagement.Application/Business/Asset/IAssetService.cs b/EOM.TSHotelManagement.Application/Business/Asset/IAssetService.cs
index 09129a4afc23138c8d3e6a827094ad7145bfcf65..0f32d1ba4026f868797c92f703b92ba1320d87bc 100644
--- a/EOM.TSHotelManagement.Application/Business/Asset/IAssetService.cs
+++ b/EOM.TSHotelManagement.Application/Business/Asset/IAssetService.cs
@@ -35,7 +35,7 @@ namespace EOM.TSHotelManagement.Application
///
///
///
- BaseOutputDto AddAssetInfo(CreateAssetInputDto cash);
+ BaseResponse AddAssetInfo(CreateAssetInputDto cash);
///
/// 查询资产信息
@@ -48,13 +48,13 @@ namespace EOM.TSHotelManagement.Application
///
///
///
- BaseOutputDto UpdAssetInfo(UpdateAssetInputDto cash);
+ BaseResponse UpdAssetInfo(UpdateAssetInputDto cash);
///
/// 删除资产信息
///
///
///
- BaseOutputDto DelAssetInfo(DeleteAssetInputDto cash);
+ BaseResponse DelAssetInfo(DeleteAssetInputDto cash);
}
}
\ No newline at end of file
diff --git a/EOM.TSHotelManagement.Application/Business/Customer/CustomerAccountService.cs b/EOM.TSHotelManagement.Application/Business/Customer/CustomerAccountService.cs
index 5a0f45aa3856e62c1bf4c0f2cc1d39df4bcb1600..0a277bdaab90577017c5ac167513cfe4939d4711 100644
--- a/EOM.TSHotelManagement.Application/Business/Customer/CustomerAccountService.cs
+++ b/EOM.TSHotelManagement.Application/Business/Customer/CustomerAccountService.cs
@@ -4,19 +4,13 @@ using EOM.TSHotelManagement.Common.Util;
using EOM.TSHotelManagement.EntityFramework;
using jvncorelib.CodeLib;
using jvncorelib.EntityLib;
-using System;
-using System.Collections.Generic;
-using System.Linq;
using System.Security.Claims;
-using System.Text;
using System.Text.Json;
-using System.Text.Json.Serialization;
-using System.Threading.Tasks;
using System.Transactions;
namespace EOM.TSHotelManagement.Application
{
- public class CustomerAccountService:ICustomerAccountService
+ public class CustomerAccountService : ICustomerAccountService
{
///
/// 客户账号
@@ -53,23 +47,25 @@ namespace EOM.TSHotelManagement.Application
///
public SingleOutputDto Login(ReadCustomerAccountInputDto readCustomerAccountInputDto)
{
- if(readCustomerAccountInputDto.Account.IsNullOrEmpty() || readCustomerAccountInputDto.Password.IsNullOrEmpty())
- return new SingleOutputDto() { StatusCode = StatusCodeConstants.BadRequest, Message = LocalizationHelper.GetLocalizedString("Account or Password cannot be empty","账号或密码不能为空"), Source = new ReadCustomerAccountOutputDto()};
+ if (readCustomerAccountInputDto.Account.IsNullOrEmpty() || readCustomerAccountInputDto.Password.IsNullOrEmpty())
+ return new SingleOutputDto() { Code = BusinessStatusCode.BadRequest, Message = LocalizationHelper.GetLocalizedString("Account or Password cannot be empty", "账号或密码不能为空"), Data = new ReadCustomerAccountOutputDto() };
var customerAccount = customerAccountRepository.AsQueryable().Single(x => x.Account == readCustomerAccountInputDto.Account);
if (customerAccount == null)
- return new SingleOutputDto() { StatusCode = StatusCodeConstants.NotFound, Message = LocalizationHelper.GetLocalizedString("Account not found","账号不存在"), Source = new ReadCustomerAccountOutputDto() };
+ return new SingleOutputDto() { Code = BusinessStatusCode.NotFound, Message = LocalizationHelper.GetLocalizedString("Account not found", "账号不存在"), Data = new ReadCustomerAccountOutputDto() };
if (!dataProtector.CompareCustomerData(customerAccount.Password, readCustomerAccountInputDto.Password))
- return new SingleOutputDto() { StatusCode = StatusCodeConstants.Unauthorized, Message = LocalizationHelper.GetLocalizedString("Invalid account or password","账号或密码错误"), Source = new ReadCustomerAccountOutputDto() };
+ return new SingleOutputDto() { Code = BusinessStatusCode.Unauthorized, Message = LocalizationHelper.GetLocalizedString("Invalid account or password", "账号或密码错误"), Data = new ReadCustomerAccountOutputDto() };
customerAccount.Password = null;
- customerAccountRepository.Update(a => new CustomerAccount
+ customerAccountRepository.Update(new CustomerAccount
{
+ Id = customerAccount.Id,
+ Account = customerAccount.Account,
LastLoginIp = customerAccount.LastLoginIp,
LastLoginTime = customerAccount.LastLoginTime
- }, a => a.Account == customerAccount.Account);
+ });
customerAccount.UserToken = jWTHelper.GenerateJWT(new ClaimsIdentity(new Claim[]
{
@@ -81,9 +77,9 @@ namespace EOM.TSHotelManagement.Application
return new SingleOutputDto()
{
- StatusCode = StatusCodeConstants.Success,
- Message = LocalizationHelper.GetLocalizedString("Login successful","登录成功"),
- Source = new ReadCustomerAccountOutputDto
+ Code = BusinessStatusCode.Success,
+ Message = LocalizationHelper.GetLocalizedString("Login successful", "登录成功"),
+ Data = new ReadCustomerAccountOutputDto
{
Account = customerAccount.Account,
EmailAddress = customerAccount.EmailAddress,
@@ -104,24 +100,24 @@ namespace EOM.TSHotelManagement.Application
public SingleOutputDto Register(ReadCustomerAccountInputDto readCustomerAccountInputDto)
{
if (readCustomerAccountInputDto.Account.IsNullOrEmpty() || readCustomerAccountInputDto.Password.IsNullOrEmpty())
- return new SingleOutputDto() { StatusCode = StatusCodeConstants.BadRequest, Message = LocalizationHelper.GetLocalizedString("Account or Password cannot be empty", "账号或密码不能为空"), Source = new ReadCustomerAccountOutputDto() };
+ return new SingleOutputDto() { Code = BusinessStatusCode.BadRequest, Message = LocalizationHelper.GetLocalizedString("Account or Password cannot be empty", "账号或密码不能为空"), Data = new ReadCustomerAccountOutputDto() };
if (readCustomerAccountInputDto.Account.Length < 3 || readCustomerAccountInputDto.Account.Length > 20)
- return new SingleOutputDto() { StatusCode = StatusCodeConstants.BadRequest, Message = LocalizationHelper.GetLocalizedString("Account length must be between 3 and 20 characters", "账号长度必须在3到20个字符之间"), Source = new ReadCustomerAccountOutputDto() };
+ return new SingleOutputDto() { Code = BusinessStatusCode.BadRequest, Message = LocalizationHelper.GetLocalizedString("Account length must be between 3 and 20 characters", "账号长度必须在3到20个字符之间"), Data = new ReadCustomerAccountOutputDto() };
var accountRegex = new System.Text.RegularExpressions.Regex(@"^[a-zA-Z0-9_]+$");
if (!accountRegex.IsMatch(readCustomerAccountInputDto.Account))
- return new SingleOutputDto() { StatusCode = StatusCodeConstants.BadRequest, Message = LocalizationHelper.GetLocalizedString("Account can only contain letters, numbers, and underscores", "账号只能包含字母、数字和下划线"), Source = new ReadCustomerAccountOutputDto() };
+ return new SingleOutputDto() { Code = BusinessStatusCode.BadRequest, Message = LocalizationHelper.GetLocalizedString("Account can only contain letters, numbers, and underscores", "账号只能包含字母、数字和下划线"), Data = new ReadCustomerAccountOutputDto() };
var passwordRegex = new System.Text.RegularExpressions.Regex(@"^(?=.*[a-z])(?=.*[A-Z])(?=.*\d)[a-zA-Z\d]{8,}$");
if (!passwordRegex.IsMatch(readCustomerAccountInputDto.Password))
- return new SingleOutputDto() { StatusCode = StatusCodeConstants.BadRequest, Message = LocalizationHelper.GetLocalizedString("Password must be at least 8 characters long and contain at least one uppercase letter, one lowercase letter, and one number", "密码必须至少8个字符,并且包含至少一个大写字母、一个小写字母和一个数字"), Source = new ReadCustomerAccountOutputDto() };
+ return new SingleOutputDto() { Code = BusinessStatusCode.BadRequest, Message = LocalizationHelper.GetLocalizedString("Password must be at least 8 characters long and contain at least one uppercase letter, one lowercase letter, and one number", "密码必须至少8个字符,并且包含至少一个大写字母、一个小写字母和一个数字"), Data = new ReadCustomerAccountOutputDto() };
var customerAccount = customerAccountRepository.AsQueryable().Single(x => x.Account == readCustomerAccountInputDto.Account);
if (customerAccount != null)
- return new SingleOutputDto() { StatusCode = StatusCodeConstants.Conflict, Message = LocalizationHelper.GetLocalizedString("Account already exists","账号已存在"), Source = new ReadCustomerAccountOutputDto() };
-
+ return new SingleOutputDto() { Code = BusinessStatusCode.Conflict, Message = LocalizationHelper.GetLocalizedString("Account already exists", "账号已存在"), Data = new ReadCustomerAccountOutputDto() };
+
var password = dataProtector.EncryptCustomerData(readCustomerAccountInputDto.Password);
var customerNumber = new UniqueCode().GetNewId("TS-");
@@ -136,14 +132,18 @@ namespace EOM.TSHotelManagement.Application
Password = password,
Status = 0,
LastLoginIp = string.Empty,
- LastLoginTime = null,
+ LastLoginTime = DateTime.Now,
DataInsUsr = readCustomerAccountInputDto.Account,
DataInsDate = DateTime.Now
};
- customerAccountRepository.Insert(customerAccount);
+ var accountResult = customerAccountRepository.Insert(customerAccount);
+ if (!accountResult)
+ {
+ return new SingleOutputDto() { Code = BusinessStatusCode.InternalServerError, Message = LocalizationHelper.GetLocalizedString("Account insert failed", "账号插入失败"), Data = new ReadCustomerAccountOutputDto() };
+ }
- customerRepository.Insert(new Customer
+ var customerResult = customerRepository.Insert(new Customer
{
CustomerNumber = customerNumber,
CustomerName = string.Empty,
@@ -158,6 +158,10 @@ namespace EOM.TSHotelManagement.Application
DataInsUsr = readCustomerAccountInputDto.Account,
DataInsDate = DateTime.Now
});
+ if (!customerResult)
+ {
+ return new SingleOutputDto() { Code = BusinessStatusCode.InternalServerError, Message = LocalizationHelper.GetLocalizedString("Customer insert failed", "客户插入失败"), Data = new ReadCustomerAccountOutputDto() };
+ }
customerAccount.UserToken = jWTHelper.GenerateJWT(new ClaimsIdentity(new Claim[]
{
@@ -171,9 +175,9 @@ namespace EOM.TSHotelManagement.Application
return new SingleOutputDto()
{
- StatusCode = StatusCodeConstants.Success,
+ Code = BusinessStatusCode.Success,
Message = LocalizationHelper.GetLocalizedString("Register successful", "注册成功,稍后将自动登录"),
- Source = new ReadCustomerAccountOutputDto
+ Data = new ReadCustomerAccountOutputDto
{
Account = customerAccount.Account,
EmailAddress = customerAccount.EmailAddress,
diff --git a/EOM.TSHotelManagement.Application/Business/Customer/CustomerService.cs b/EOM.TSHotelManagement.Application/Business/Customer/CustomerService.cs
index 6f563547a99fa13b715b4aa4a95bfa8445005ce5..c2f5f7276e5e3d0305aa1e219143f65d4b8ed44a 100644
--- a/EOM.TSHotelManagement.Application/Business/Customer/CustomerService.cs
+++ b/EOM.TSHotelManagement.Application/Business/Customer/CustomerService.cs
@@ -82,7 +82,7 @@ namespace EOM.TSHotelManagement.Application
/// 添加客户信息
///
///
- public BaseOutputDto InsertCustomerInfo(CreateCustomerInputDto custo)
+ public BaseResponse InsertCustomerInfo(CreateCustomerInputDto custo)
{
string NewID = dataProtector.EncryptCustomerData(custo.IdCardNumber);
string NewTel = dataProtector.EncryptCustomerData(custo.CustomerPhoneNumber);
@@ -92,17 +92,23 @@ namespace EOM.TSHotelManagement.Application
{
if (custoRepository.IsAny(a => a.CustomerNumber == custo.CustomerNumber))
{
- return new BaseOutputDto() { Message = LocalizationHelper.GetLocalizedString("customer number already exist.", "客户编号已存在"), StatusCode = StatusCodeConstants.InternalServerError };
+ return new BaseResponse() { Message = LocalizationHelper.GetLocalizedString("customer number already exist.", "客户编号已存在"), Code = BusinessStatusCode.InternalServerError };
+ }
+ var customer = EntityMapper.Map(custo);
+ var result = custoRepository.Insert(customer);
+ if (!result)
+ {
+ LogHelper.LogError(LocalizationHelper.GetLocalizedString("Insert Customer Failed", "客户信息添加失败"), null);
+ return new BaseResponse(BusinessStatusCode.InternalServerError, LocalizationHelper.GetLocalizedString("Insert Customer Failed", "客户信息添加失败"));
}
- var result = custoRepository.Insert(EntityMapper.Map(custo));
}
catch (Exception ex)
{
LogHelper.LogError(LocalizationHelper.GetLocalizedString("Insert Customer Failed", "客户信息添加失败"), ex);
- return new BaseOutputDto(StatusCodeConstants.InternalServerError, LocalizationHelper.GetLocalizedString("Insert Customer Failed", "客户信息添加失败"));
+ return new BaseResponse(BusinessStatusCode.InternalServerError, LocalizationHelper.GetLocalizedString("Insert Customer Failed", "客户信息添加失败"));
}
- return new BaseOutputDto(StatusCodeConstants.Success, LocalizationHelper.GetLocalizedString("Insert Customer Success", "客户信息添加成功"));
+ return new BaseResponse(BusinessStatusCode.Success, LocalizationHelper.GetLocalizedString("Insert Customer Success", "客户信息添加成功"));
}
///
@@ -110,7 +116,7 @@ namespace EOM.TSHotelManagement.Application
///
///
///
- public BaseOutputDto UpdCustomerInfo(UpdateCustomerInputDto custo)
+ public BaseResponse UpdCustomerInfo(UpdateCustomerInputDto custo)
{
string NewID = dataProtector.EncryptCustomerData(custo.IdCardNumber);
string NewTel = dataProtector.EncryptCustomerData(custo.CustomerPhoneNumber);
@@ -120,24 +126,20 @@ namespace EOM.TSHotelManagement.Application
{
if (!custoRepository.IsAny(a => a.CustomerNumber == custo.CustomerNumber))
{
- return new BaseOutputDto() { Message = LocalizationHelper.GetLocalizedString("customer number does not exist.", "客户编号不存在"), StatusCode = StatusCodeConstants.InternalServerError };
+ return new BaseResponse() { Message = LocalizationHelper.GetLocalizedString("customer number does not exist.", "客户编号不存在"), Code = BusinessStatusCode.InternalServerError };
}
- var result = custoRepository.Update(EntityMapper.Map(custo));
-
- if (result)
+ var customer = EntityMapper.Map(custo);
+ var result = custoRepository.Update(customer);
+ if (!result)
{
- return new BaseOutputDto(StatusCodeConstants.Success, LocalizationHelper.GetLocalizedString("Update Customer Success", "客户信息更新成功"));
- }
- else
- {
- return new BaseOutputDto(StatusCodeConstants.InternalServerError, LocalizationHelper.GetLocalizedString("Update Customer Failed", "客户信息更新失败"));
+ return new BaseResponse() { Message = LocalizationHelper.GetLocalizedString("Update Customer Failed", "客户信息更新失败"), Code = BusinessStatusCode.InternalServerError };
}
}
catch (Exception ex)
{
- LogHelper.LogError(LocalizationHelper.GetLocalizedString("Update Customer Failed", "客户信息更新失败"), ex);
- return new BaseOutputDto(StatusCodeConstants.InternalServerError, LocalizationHelper.GetLocalizedString("Update Customer Failed", "客户信息更新失败"));
+ return new BaseResponse() { Message = LocalizationHelper.GetLocalizedString(ex.Message, ex.Message), Code = BusinessStatusCode.InternalServerError };
}
+ return new BaseResponse();
}
///
@@ -145,19 +147,19 @@ namespace EOM.TSHotelManagement.Application
///
///
///
- public BaseOutputDto DelCustomerInfo(DeleteCustomerInputDto custo)
+ public BaseResponse DelCustomerInfo(DeleteCustomerInputDto custo)
{
if (!custoRepository.IsAny(a => a.CustomerNumber == custo.CustomerNumber))
{
- return new BaseOutputDto() { Message = LocalizationHelper.GetLocalizedString("customer number does not exist.", "客户编号不存在"), StatusCode = StatusCodeConstants.InternalServerError };
+ return new BaseResponse() { Message = LocalizationHelper.GetLocalizedString("customer number does not exist.", "客户编号不存在"), Code = BusinessStatusCode.InternalServerError };
}
var occupied = Convert.ToInt32(RoomState.Occupied);
var isOccupied = custoRepository.Change().IsAny(a => a.CustomerNumber == custo.CustomerNumber && a.RoomStateId == occupied);
- var haveUnSettle = custoRepository.Change().IsAny(a => a.CustomerNumber == custo.CustomerNumber && a.SettlementStatus == SpendConsts.UnSettle.Code);
+ var haveUnSettle = custoRepository.Change().IsAny(a => a.CustomerNumber == custo.CustomerNumber && a.SettlementStatus == ConsumptionConstant.UnSettle.Code);
if (isOccupied)
- return new BaseOutputDto(StatusCodeConstants.InternalServerError, LocalizationHelper.GetLocalizedString("Customer is currently occupying a room", "客户当前正在占用房间"));
+ return new BaseResponse(BusinessStatusCode.InternalServerError, LocalizationHelper.GetLocalizedString("Customer is currently occupying a room", "客户当前正在占用房间"));
if (haveUnSettle)
- return new BaseOutputDto(StatusCodeConstants.InternalServerError, LocalizationHelper.GetLocalizedString("Customer has unsettled bills", "客户有未结算的账单"));
+ return new BaseResponse(BusinessStatusCode.InternalServerError, LocalizationHelper.GetLocalizedString("Customer has unsettled bills", "客户有未结算的账单"));
var result = custoRepository.Update(a => new Customer()
{
@@ -168,11 +170,11 @@ namespace EOM.TSHotelManagement.Application
if (result)
{
- return new BaseOutputDto(StatusCodeConstants.Success, LocalizationHelper.GetLocalizedString("Delete Customer Success", "客户信息删除成功"));
+ return new BaseResponse(BusinessStatusCode.Success, LocalizationHelper.GetLocalizedString("Delete Customer Success", "客户信息删除成功"));
}
else
{
- return new BaseOutputDto(StatusCodeConstants.InternalServerError, LocalizationHelper.GetLocalizedString("Delete Customer Failed", "客户信息删除失败"));
+ return new BaseResponse(BusinessStatusCode.InternalServerError, LocalizationHelper.GetLocalizedString("Delete Customer Failed", "客户信息删除失败"));
}
}
@@ -181,29 +183,29 @@ namespace EOM.TSHotelManagement.Application
///
///
///
- public BaseOutputDto UpdCustomerTypeByCustoNo(UpdateCustomerInputDto updateCustomerInputDto)
+ public BaseResponse UpdCustomerTypeByCustoNo(UpdateCustomerInputDto updateCustomerInputDto)
{
try
{
if (!custoRepository.IsAny(a => a.CustomerNumber == updateCustomerInputDto.CustomerNumber))
{
- return new BaseOutputDto() { Message = LocalizationHelper.GetLocalizedString("customer number does not exist.", "客户编号不存在"), StatusCode = StatusCodeConstants.InternalServerError };
+ return new BaseResponse() { Message = LocalizationHelper.GetLocalizedString("customer number does not exist.", "客户编号不存在"), Code = BusinessStatusCode.InternalServerError };
}
var result = custoRepository.Update(a => new Customer { CustomerType = updateCustomerInputDto.CustomerType }, a => a.CustomerNumber == updateCustomerInputDto.CustomerNumber);
if (result)
{
- return new BaseOutputDto(StatusCodeConstants.Success, LocalizationHelper.GetLocalizedString("Update Customer Type Success", "客户类型更新成功"));
+ return new BaseResponse(BusinessStatusCode.Success, LocalizationHelper.GetLocalizedString("Update Customer Type Success", "客户类型更新成功"));
}
else
{
- return new BaseOutputDto(StatusCodeConstants.InternalServerError, LocalizationHelper.GetLocalizedString("Update Customer Type Failed", "客户类型更新失败"));
+ return new BaseResponse(BusinessStatusCode.InternalServerError, LocalizationHelper.GetLocalizedString("Update Customer Type Failed", "客户类型更新失败"));
}
}
catch (Exception ex)
{
LogHelper.LogError(LocalizationHelper.GetLocalizedString("Update Customer Type Failed", "客户类型更新失败"), ex);
- return new BaseOutputDto(StatusCodeConstants.InternalServerError, LocalizationHelper.GetLocalizedString("Update Customer Type Failed", "客户类型更新失败"));
+ return new BaseResponse(BusinessStatusCode.InternalServerError, LocalizationHelper.GetLocalizedString("Update Customer Type Failed", "客户类型更新失败"));
}
}
@@ -213,32 +215,8 @@ namespace EOM.TSHotelManagement.Application
///
public ListOutputDto SelectCustomers(ReadCustomerInputDto readCustomerInputDto)
{
- ListOutputDto oSelectCustoAllDto = new ListOutputDto();
-
- //查询出所有性别类型
- var helper = new EnumHelper();
- var genders = Enum.GetValues(typeof(GenderType))
- .Cast()
- .Select(e => new EnumDto
- {
- Id = (int)e,
- Name = e.ToString(),
- Description = helper.GetEnumDescription(e)
- })
- .ToList();
- //查询出所有证件类型
- List passPortTypes = new List();
- passPortTypes = passPortTypeRepository.GetList();
- //查询出所有客户类型
- List custoTypes = new List();
- custoTypes = custoTypeRepository.GetList();
- //查询出所有客户信息
- List custos = new List();
-
var where = Expressionable.Create();
-
where = where.And(a => a.IsDelete == readCustomerInputDto.IsDelete);
-
if (!readCustomerInputDto.CustomerNumber.IsNullOrEmpty())
{
where = where.And(a => a.CustomerNumber.Equals(readCustomerInputDto.CustomerNumber));
@@ -255,9 +233,8 @@ namespace EOM.TSHotelManagement.Application
{
where = where.And(a => a.IdCardNumber.Contains(readCustomerInputDto.IdCardNumber));
}
-
var count = 0;
-
+ List custos = new List();
if (!readCustomerInputDto.IgnorePaging && readCustomerInputDto.Page != 0 && readCustomerInputDto.PageSize != 0)
{
custos = custoRepository.AsQueryable().Where(where.ToExpression()).OrderBy(a => a.CustomerNumber)
@@ -266,36 +243,31 @@ namespace EOM.TSHotelManagement.Application
else
{
custos = custoRepository.AsQueryable().Where(where.ToExpression()).OrderBy(a => a.CustomerNumber).ToList();
+ count = custos.Count;
}
-
var customerOutputDtos = EntityMapper.MapList(custos);
-
customerOutputDtos.ForEach(source =>
{
- //解密身份证号码
var sourceStr = dataProtector.DecryptCustomerData(source.IdCardNumber);
source.IdCardNumber = sourceStr;
- //解密联系方式
var sourceTelStr = dataProtector.DecryptCustomerData(source.CustomerPhoneNumber);
source.CustomerPhoneNumber = sourceTelStr;
-
- //性别类型
- var sexType = genders.SingleOrDefault(a => a.Id == source.CustomerGender);
+ var helper = new EnumHelper();
+ var sexType = Enum.GetValues(typeof(GenderType)).Cast().Select(e => new EnumDto { Id = (int)e, Name = e.ToString(), Description = helper.GetEnumDescription(e) }).SingleOrDefault(a => a.Id == source.CustomerGender);
source.GenderName = sexType?.Description ?? "";
-
- //证件类型
- var passPortType = passPortTypes.SingleOrDefault(a => a.PassportId == source.PassportId);
+ var passPortType = passPortTypeRepository.AsQueryable().Where(a => a.PassportId == source.PassportId).First();
source.PassportName = passPortType?.PassportName ?? "";
-
- //客户类型
- var custoType = custoTypes.SingleOrDefault(a => a.CustomerType == source.CustomerType);
+ var custoType = custoTypeRepository.AsQueryable().Where(a => a.CustomerType == source.CustomerType).First();
source.CustomerTypeName = custoType?.CustomerTypeName ?? "";
});
-
- oSelectCustoAllDto.listSource = customerOutputDtos;
- oSelectCustoAllDto.total = count;
-
- return oSelectCustoAllDto;
+ return new ListOutputDto
+ {
+ Data = new PagedData
+ {
+ Items = customerOutputDtos,
+ TotalCount = count
+ }
+ };
}
///
@@ -339,7 +311,7 @@ namespace EOM.TSHotelManagement.Application
if (customer.IsNullOrEmpty())
{
- return new SingleOutputDto { StatusCode = StatusCodeConstants.InternalServerError, Message = "该用户不存在" };
+ return new SingleOutputDto { Code = BusinessStatusCode.InternalServerError, Message = "该用户不存在" };
}
//解密身份证号码
@@ -358,7 +330,7 @@ namespace EOM.TSHotelManagement.Application
var custoType = custoTypes.SingleOrDefault(a => a.CustomerType == customer.CustomerType);
customer.CustomerTypeName = custoType.CustomerTypeName.IsNullOrEmpty() ? "" : custoType.CustomerTypeName;
- singleOutputDto.Source = EntityMapper.Map(customer);
+ singleOutputDto.Data = EntityMapper.Map(customer);
return singleOutputDto;
}
diff --git a/EOM.TSHotelManagement.Application/Business/Customer/ICustomerAccountService.cs b/EOM.TSHotelManagement.Application/Business/Customer/ICustomerAccountService.cs
index 62a739dc65a38188e288b97f06fdd11b6477de21..fa1407c4fcf9f54cbcaefa449fed9ba6230d55a4 100644
--- a/EOM.TSHotelManagement.Application/Business/Customer/ICustomerAccountService.cs
+++ b/EOM.TSHotelManagement.Application/Business/Customer/ICustomerAccountService.cs
@@ -1,9 +1,4 @@
using EOM.TSHotelManagement.Common.Contract;
-using System;
-using System.Collections.Generic;
-using System.Linq;
-using System.Text;
-using System.Threading.Tasks;
namespace EOM.TSHotelManagement.Application
{
diff --git a/EOM.TSHotelManagement.Application/Business/Customer/ICustomerService.cs b/EOM.TSHotelManagement.Application/Business/Customer/ICustomerService.cs
index a93a29a0e612bed9ca65eebdfc33159c23af8409..03eb7ccc4897748e16ae1eda96707c97d8933d78 100644
--- a/EOM.TSHotelManagement.Application/Business/Customer/ICustomerService.cs
+++ b/EOM.TSHotelManagement.Application/Business/Customer/ICustomerService.cs
@@ -35,27 +35,27 @@ namespace EOM.TSHotelManagement.Application
///
///
///
- BaseOutputDto InsertCustomerInfo(CreateCustomerInputDto custo);
+ BaseResponse InsertCustomerInfo(CreateCustomerInputDto custo);
///
/// 更新客户信息
///
///
///
- BaseOutputDto UpdCustomerInfo(UpdateCustomerInputDto custo);
+ BaseResponse UpdCustomerInfo(UpdateCustomerInputDto custo);
///
/// 删除客户信息
///
///
///
- BaseOutputDto DelCustomerInfo(DeleteCustomerInputDto custo);
+ BaseResponse DelCustomerInfo(DeleteCustomerInputDto custo);
///
/// 更新客户类型(即会员等级)
///
///
- BaseOutputDto UpdCustomerTypeByCustoNo(UpdateCustomerInputDto updateCustomerInputDto);
+ BaseResponse UpdCustomerTypeByCustoNo(UpdateCustomerInputDto updateCustomerInputDto);
///
/// 查询所有客户信息
diff --git a/EOM.TSHotelManagement.Application/Business/EnergyManagement/EnergyManagementService.cs b/EOM.TSHotelManagement.Application/Business/EnergyManagement/EnergyManagementService.cs
index cf6cc4d43b9e4c4d1c501f3613eb33bb5c6f4718..b3500f3715b2d679a0809f852421fbdaec7785cf 100644
--- a/EOM.TSHotelManagement.Application/Business/EnergyManagement/EnergyManagementService.cs
+++ b/EOM.TSHotelManagement.Application/Business/EnergyManagement/EnergyManagementService.cs
@@ -80,12 +80,19 @@ namespace EOM.TSHotelManagement.Application
var count = 0;
- var listSource = wtiRepository.AsQueryable()
+ var Data = wtiRepository.AsQueryable()
.Where(where.ToExpression()).ToPageList(readEnergyManagementInputDto.Page, readEnergyManagementInputDto.PageSize, ref count);
- var readEnergies = EntityMapper.MapList(listSource);
+ var readEnergies = EntityMapper.MapList(Data);
- return new ListOutputDto { listSource = readEnergies, total = count };
+ return new ListOutputDto
+ {
+ Data = new PagedData
+ {
+ Items = readEnergies,
+ TotalCount = count
+ }
+ };
}
///
@@ -93,23 +100,23 @@ namespace EOM.TSHotelManagement.Application
///
///
///
- public BaseOutputDto InsertEnergyManagementInfo(CreateEnergyManagementInputDto w)
+ public BaseResponse InsertEnergyManagementInfo(CreateEnergyManagementInputDto w)
{
try
{
if (wtiRepository.IsAny(a => a.InformationId == w.InformationNumber))
{
- return new BaseOutputDto() { Message = LocalizationHelper.GetLocalizedString("information number already exist.", "信息编号已存在"), StatusCode = StatusCodeConstants.InternalServerError };
+ return new BaseResponse() { Message = LocalizationHelper.GetLocalizedString("information number already exist.", "信息编号已存在"), Code = BusinessStatusCode.InternalServerError };
}
var result = wtiRepository.Insert(EntityMapper.Map(w));
}
catch (Exception ex)
{
LogHelper.LogError(LocalizationHelper.GetLocalizedString("Insert Energy Management Failed", "水电信息添加失败"), ex);
- return new BaseOutputDto(StatusCodeConstants.InternalServerError, LocalizationHelper.GetLocalizedString("Insert Energy Management Failed", "水电信息添加失败"));
+ return new BaseResponse(BusinessStatusCode.InternalServerError, LocalizationHelper.GetLocalizedString("Insert Energy Management Failed", "水电信息添加失败"));
}
- return new BaseOutputDto(StatusCodeConstants.Success, LocalizationHelper.GetLocalizedString("Insert Energy Management Success", "水电信息添加成功"));
+ return new BaseResponse(BusinessStatusCode.Success, LocalizationHelper.GetLocalizedString("Insert Energy Management Success", "水电信息添加成功"));
}
///
@@ -117,29 +124,29 @@ namespace EOM.TSHotelManagement.Application
///
/// 包含要修改的数据,以及EnergyManagementNo作为查询条件
///
- public BaseOutputDto UpdateEnergyManagementInfo(UpdateEnergyManagementInputDto w)
+ public BaseResponse UpdateEnergyManagementInfo(UpdateEnergyManagementInputDto w)
{
try
{
if (!wtiRepository.IsAny(a => a.InformationId == w.InformationId))
{
- return new BaseOutputDto() { Message = LocalizationHelper.GetLocalizedString("information number does not exist.", "信息编号不存在"), StatusCode = StatusCodeConstants.InternalServerError };
+ return new BaseResponse() { Message = LocalizationHelper.GetLocalizedString("information number does not exist.", "信息编号不存在"), Code = BusinessStatusCode.InternalServerError };
}
var result = wtiRepository.Update(EntityMapper.Map(w));
if (result)
{
- return new BaseOutputDto(StatusCodeConstants.Success, LocalizationHelper.GetLocalizedString("Update Energy Management Success", "水电费信息更新成功"));
+ return new BaseResponse(BusinessStatusCode.Success, LocalizationHelper.GetLocalizedString("Update Energy Management Success", "水电费信息更新成功"));
}
else
{
- return new BaseOutputDto(StatusCodeConstants.InternalServerError, LocalizationHelper.GetLocalizedString("Update Energy Management Failed", "水电费信息更新失败"));
+ return new BaseResponse(BusinessStatusCode.InternalServerError, LocalizationHelper.GetLocalizedString("Update Energy Management Failed", "水电费信息更新失败"));
}
}
catch (Exception ex)
{
LogHelper.LogError(LocalizationHelper.GetLocalizedString("Update Energy Management Failed", "水电费信息更新失败"), ex);
- return new BaseOutputDto(StatusCodeConstants.InternalServerError, LocalizationHelper.GetLocalizedString("Update Energy Management Failed", "水电费信息更新失败"));
+ return new BaseResponse(BusinessStatusCode.InternalServerError, LocalizationHelper.GetLocalizedString("Update Energy Management Failed", "水电费信息更新失败"));
}
}
@@ -147,25 +154,25 @@ namespace EOM.TSHotelManagement.Application
/// 根据房间编号、使用时间删除水电费信息
///
///
- public BaseOutputDto DeleteEnergyManagementInfo(DeleteEnergyManagementInputDto hydroelectricity)
+ public BaseResponse DeleteEnergyManagementInfo(DeleteEnergyManagementInputDto hydroelectricity)
{
try
{
- var result = wtiRepository.Update(EntityMapper.Map(hydroelectricity));
+ var result = wtiRepository.SoftDelete(EntityMapper.Map(hydroelectricity));
if (result)
{
- return new BaseOutputDto(StatusCodeConstants.Success, LocalizationHelper.GetLocalizedString("Delete Energy Management Success", "水电费信息删除成功"));
+ return new BaseResponse(BusinessStatusCode.Success, LocalizationHelper.GetLocalizedString("Delete Energy Management Success", "水电费信息删除成功"));
}
else
{
- return new BaseOutputDto(StatusCodeConstants.InternalServerError, LocalizationHelper.GetLocalizedString("Delete Energy Management Failed", "水电费信息删除失败"));
+ return new BaseResponse(BusinessStatusCode.InternalServerError, LocalizationHelper.GetLocalizedString("Delete Energy Management Failed", "水电费信息删除失败"));
}
}
catch (Exception ex)
{
LogHelper.LogError(LocalizationHelper.GetLocalizedString("Delete Energy Management Failed", "水电费信息删除失败"), ex);
- return new BaseOutputDto(StatusCodeConstants.InternalServerError, LocalizationHelper.GetLocalizedString("Delete Energy Management Failed", "水电费信息删除失败"));
+ return new BaseResponse(BusinessStatusCode.InternalServerError, LocalizationHelper.GetLocalizedString("Delete Energy Management Failed", "水电费信息删除失败"));
}
}
}
diff --git a/EOM.TSHotelManagement.Application/Business/EnergyManagement/IEnergyManagementService.cs b/EOM.TSHotelManagement.Application/Business/EnergyManagement/IEnergyManagementService.cs
index 3ca644def57f681232d26f2b7d8ab0d46c04398b..7a230e48a0af5f4d3a5e8b38f10d9350148b9132 100644
--- a/EOM.TSHotelManagement.Application/Business/EnergyManagement/IEnergyManagementService.cs
+++ b/EOM.TSHotelManagement.Application/Business/EnergyManagement/IEnergyManagementService.cs
@@ -42,7 +42,7 @@ public interface IEnergyManagementService
///
///
///
- BaseOutputDto InsertEnergyManagementInfo(CreateEnergyManagementInputDto w);
+ BaseResponse InsertEnergyManagementInfo(CreateEnergyManagementInputDto w);
///
/// 修改水电费信息
@@ -50,7 +50,7 @@ public interface IEnergyManagementService
///
/// 包含要修改的数据,以及WtiNo作为查询条件
///
- BaseOutputDto UpdateEnergyManagementInfo(UpdateEnergyManagementInputDto w);
+ BaseResponse UpdateEnergyManagementInfo(UpdateEnergyManagementInputDto w);
///
/// 根据房间编号、使用时间删除水电费信息
@@ -58,5 +58,5 @@ public interface IEnergyManagementService
///
///
///
- BaseOutputDto DeleteEnergyManagementInfo(DeleteEnergyManagementInputDto deleteEnergyManagementInputDto);
+ BaseResponse DeleteEnergyManagementInfo(DeleteEnergyManagementInputDto deleteEnergyManagementInputDto);
}
diff --git a/EOM.TSHotelManagement.Application/Business/News/INewsService.cs b/EOM.TSHotelManagement.Application/Business/News/INewsService.cs
index 50b148815afbe5cb1ab566695b55fb3487ebb931..b38c967daa83fd23d0eb4e6a62e734d4b7f60c0f 100644
--- a/EOM.TSHotelManagement.Application/Business/News/INewsService.cs
+++ b/EOM.TSHotelManagement.Application/Business/News/INewsService.cs
@@ -1,9 +1,4 @@
using EOM.TSHotelManagement.Common.Contract;
-using System;
-using System.Collections.Generic;
-using System.Linq;
-using System.Text;
-using System.Threading.Tasks;
namespace EOM.TSHotelManagement.Application
{
@@ -26,18 +21,18 @@ namespace EOM.TSHotelManagement.Application
///
///
///
- BaseOutputDto AddNews(AddNewsInputDto addNewsInputDto);
+ BaseResponse AddNews(AddNewsInputDto addNewsInputDto);
///
/// 更新新闻
///
///
///
- BaseOutputDto UpdateNews(UpdateNewsInputDto updateNewsInputDto);
+ BaseResponse UpdateNews(UpdateNewsInputDto updateNewsInputDto);
///
/// 删除新闻
///
///
///
- BaseOutputDto DeleteNews(DeleteNewsInputDto deleteNewsInputDto);
+ BaseResponse DeleteNews(DeleteNewsInputDto deleteNewsInputDto);
}
}
diff --git a/EOM.TSHotelManagement.Application/Business/News/NewsService.cs b/EOM.TSHotelManagement.Application/Business/News/NewsService.cs
index 2da50e81cd428959e87f11580c6a6fe15240f2b3..6e6dfd5324825562ce920c79af8bde36863ed6c2 100644
--- a/EOM.TSHotelManagement.Application/Business/News/NewsService.cs
+++ b/EOM.TSHotelManagement.Application/Business/News/NewsService.cs
@@ -5,15 +5,10 @@ using EOM.TSHotelManagement.Common.Util;
using EOM.TSHotelManagement.EntityFramework;
using EOM.TSHotelManagement.Shared;
using jvncorelib.EntityLib;
-using System;
-using System.Collections.Generic;
-using System.Linq;
-using System.Text;
-using System.Threading.Tasks;
namespace EOM.TSHotelManagement.Application
{
- public class NewsService:INewsService
+ public class NewsService : INewsService
{
private readonly GenericRepository _newsRepository;
@@ -29,8 +24,6 @@ namespace EOM.TSHotelManagement.Application
///
public ListOutputDto SelectNews(ReadNewsInputDto readNewsInputDto)
{
- ListOutputDto listOutputDto = new ListOutputDto();
-
var helper = new EnumHelper();
var newsTypes = Enum.GetValues(typeof(NewsType))
.Cast()
@@ -63,7 +56,7 @@ namespace EOM.TSHotelManagement.Application
}
if (!readNewsInputDto.NewsType.IsNullOrEmpty())
{
- where = where.And(n => n.NewsType == readNewsInputDto.NewsTitle);
+ where = where.And(n => n.NewsType == readNewsInputDto.NewsType);
}
if (!readNewsInputDto.NewsStatus.IsNullOrEmpty())
{
@@ -76,15 +69,16 @@ namespace EOM.TSHotelManagement.Application
if (readNewsInputDto.IgnorePaging)
{
newsList = _newsRepository.AsQueryable().Where(where.ToExpression()).ToList();
+ count = newsList.Count;
}
else
{
- newsList = _newsRepository.AsQueryable().Where(where.ToExpression()).ToPageList(readNewsInputDto.Page, readNewsInputDto.PageSize,ref count);
+ newsList = _newsRepository.AsQueryable().Where(where.ToExpression()).ToPageList(readNewsInputDto.Page, readNewsInputDto.PageSize, ref count);
}
- listOutputDto.listSource = EntityMapper.MapList(newsList);
+ var mappedList = EntityMapper.MapList(newsList);
- listOutputDto.listSource.ForEach(source =>
+ mappedList.ForEach(source =>
{
var newsType = newsTypes.SingleOrDefault(a => a.Name == source.NewsType);
source.NewsTypeDescription = newsType?.Description ?? "";
@@ -92,9 +86,14 @@ namespace EOM.TSHotelManagement.Application
source.NewsStatusDescription = newsStatus?.Description ?? "";
});
- listOutputDto.total = count;
-
- return listOutputDto;
+ return new ListOutputDto
+ {
+ Data = new PagedData
+ {
+ Items = mappedList,
+ TotalCount = count
+ }
+ };
}
///
@@ -109,7 +108,7 @@ namespace EOM.TSHotelManagement.Application
{
return new SingleOutputDto
{
- StatusCode = StatusCodeConstants.NotFound,
+ Code = BusinessStatusCode.NotFound,
Message = "新闻未找到"
};
}
@@ -139,7 +138,7 @@ namespace EOM.TSHotelManagement.Application
return new SingleOutputDto
{
- Source = outputDto
+ Data = outputDto
};
}
@@ -148,7 +147,7 @@ namespace EOM.TSHotelManagement.Application
///
///
///
- public BaseOutputDto AddNews(AddNewsInputDto addNewsInputDto)
+ public BaseResponse AddNews(AddNewsInputDto addNewsInputDto)
{
var news = new News
{
@@ -163,19 +162,27 @@ namespace EOM.TSHotelManagement.Application
};
try
{
- _newsRepository.Insert(news);
+ var result = _newsRepository.Insert(news);
+ if (!result)
+ {
+ return new BaseResponse
+ {
+ Code = BusinessStatusCode.InternalServerError,
+ Message = "新闻添加失败"
+ };
+ }
}
catch (Exception ex)
{
- return new BaseOutputDto
+ return new BaseResponse
{
- StatusCode = StatusCodeConstants.InternalServerError,
+ Code = BusinessStatusCode.InternalServerError,
Message = $"新闻添加失败: {ex.Message}"
};
}
- return new BaseOutputDto
+ return new BaseResponse
{
- StatusCode = StatusCodeConstants.Success,
+ Code = BusinessStatusCode.Success,
Message = "新闻添加成功"
};
}
@@ -185,14 +192,14 @@ namespace EOM.TSHotelManagement.Application
///
///
///
- public BaseOutputDto UpdateNews(UpdateNewsInputDto updateNewsInputDto)
+ public BaseResponse UpdateNews(UpdateNewsInputDto updateNewsInputDto)
{
var news = _newsRepository.AsQueryable().Where(a => a.NewId == updateNewsInputDto.NewId).Single();
if (news.IsNullOrEmpty())
{
- return new BaseOutputDto
+ return new BaseResponse
{
- StatusCode = StatusCodeConstants.NotFound,
+ Code = BusinessStatusCode.NotFound,
Message = "新闻未找到"
};
}
@@ -205,19 +212,27 @@ namespace EOM.TSHotelManagement.Application
news.NewsImage = updateNewsInputDto.NewsImage;
try
{
- _newsRepository.Update(news);
+ var result = _newsRepository.Update(news);
+ if (!result)
+ {
+ return new BaseResponse
+ {
+ Code = BusinessStatusCode.InternalServerError,
+ Message = "新闻更新失败"
+ };
+ }
}
catch (Exception ex)
{
- return new BaseOutputDto
+ return new BaseResponse
{
- StatusCode = StatusCodeConstants.InternalServerError,
+ Code = BusinessStatusCode.InternalServerError,
Message = $"新闻更新失败: {ex.Message}"
};
}
- return new BaseOutputDto
+ return new BaseResponse
{
- StatusCode = StatusCodeConstants.Success,
+ Code = BusinessStatusCode.Success,
Message = "新闻更新成功"
};
}
@@ -227,32 +242,33 @@ namespace EOM.TSHotelManagement.Application
///
///
///
- public BaseOutputDto DeleteNews(DeleteNewsInputDto deleteNewsInputDto)
+ public BaseResponse DeleteNews(DeleteNewsInputDto deleteNewsInputDto)
{
var news = _newsRepository.AsQueryable().Where(a => a.NewId == deleteNewsInputDto.NewId).Single();
if (news.IsNullOrEmpty())
{
- return new BaseOutputDto
+ return new BaseResponse
{
- StatusCode = StatusCodeConstants.NotFound,
+ Code = BusinessStatusCode.NotFound,
Message = "新闻未找到"
};
}
try
{
- _newsRepository.Delete(news);
+ news.IsDelete = 1;
+ _newsRepository.SoftDelete(news);
}
catch (Exception ex)
{
- return new BaseOutputDto
+ return new BaseResponse
{
- StatusCode = StatusCodeConstants.InternalServerError,
+ Code = BusinessStatusCode.InternalServerError,
Message = $"新闻删除失败: {ex.Message}"
};
}
- return new BaseOutputDto
+ return new BaseResponse
{
- StatusCode = StatusCodeConstants.Success,
+ Code = BusinessStatusCode.Success,
Message = "新闻删除成功"
};
}
diff --git a/EOM.TSHotelManagement.Application/Business/PromotionContent/IPromotionContentService.cs b/EOM.TSHotelManagement.Application/Business/PromotionContent/IPromotionContentService.cs
index 0746465a40eb353531eb46b743b369d06831e27d..a0b3c16c77ce48cd40111360d3e5a391b750d574 100644
--- a/EOM.TSHotelManagement.Application/Business/PromotionContent/IPromotionContentService.cs
+++ b/EOM.TSHotelManagement.Application/Business/PromotionContent/IPromotionContentService.cs
@@ -47,20 +47,20 @@ namespace EOM.TSHotelManagement.Application
///
///
///
- BaseOutputDto AddPromotionContent(CreatePromotionContentInputDto createPromotionContentInputDto);
+ BaseResponse AddPromotionContent(CreatePromotionContentInputDto createPromotionContentInputDto);
///
/// 删除宣传联动内容
///
///
///
- BaseOutputDto DeletePromotionContent(DeletePromotionContentInputDto deletePromotionContentInputDto);
+ BaseResponse DeletePromotionContent(DeletePromotionContentInputDto deletePromotionContentInputDto);
///
/// 更新宣传联动内容
///
///
///
- BaseOutputDto UpdatePromotionContent(UpdatePromotionContentInputDto updatePromotionContentInputDto);
+ BaseResponse UpdatePromotionContent(UpdatePromotionContentInputDto updatePromotionContentInputDto);
}
}
\ No newline at end of file
diff --git a/EOM.TSHotelManagement.Application/Business/PromotionContent/PromotionContentService.cs b/EOM.TSHotelManagement.Application/Business/PromotionContent/PromotionContentService.cs
index 4ffe9a005202ef4e9ab41d9561db5dbb1b0f0680..074a652b4beb04d0e67389f3d9c329ed725b4733 100644
--- a/EOM.TSHotelManagement.Application/Business/PromotionContent/PromotionContentService.cs
+++ b/EOM.TSHotelManagement.Application/Business/PromotionContent/PromotionContentService.cs
@@ -55,28 +55,33 @@ namespace EOM.TSHotelManagement.Application
///
public ListOutputDto SelectPromotionContentAll(ReadPromotionContentInputDto readPromotionContentInputDto)
{
- ListOutputDto fonts = new ListOutputDto();
var count = 0;
var where = Expressionable.Create();
if (!readPromotionContentInputDto.IsDelete.IsNullOrEmpty())
{
where = where.And(a => a.IsDelete == readPromotionContentInputDto.IsDelete);
}
- var listSource = new List();
+ var Data = new List();
if (!readPromotionContentInputDto.IgnorePaging && readPromotionContentInputDto.Page != 0 && readPromotionContentInputDto.PageSize != 0)
{
- listSource = fontsRepository.AsQueryable()
+ Data = fontsRepository.AsQueryable()
.Where(where.ToExpression())
.ToPageList(readPromotionContentInputDto.Page, readPromotionContentInputDto.PageSize, ref count);
}
else
{
- listSource = fontsRepository.AsQueryable().ToList();
+ Data = fontsRepository.AsQueryable().ToList();
+ count = Data.Count;
}
-
- fonts.listSource = EntityMapper.MapList(listSource);
- fonts.total = count;
- return fonts;
+ var mapped = EntityMapper.MapList(Data);
+ return new ListOutputDto
+ {
+ Data = new PagedData
+ {
+ Items = mapped,
+ TotalCount = count
+ }
+ };
}
///
@@ -85,10 +90,16 @@ namespace EOM.TSHotelManagement.Application
///
public ListOutputDto SelectPromotionContents()
{
- ListOutputDto fonts = new ListOutputDto();
- var listSource = fontsRepository.AsQueryable().Where(a => a.IsDelete != 1).ToList();
- fonts.listSource = EntityMapper.MapList(listSource);
- return fonts;
+ var Data = fontsRepository.AsQueryable().Where(a => a.IsDelete != 1).ToList();
+ var mapped = EntityMapper.MapList(Data);
+ return new ListOutputDto
+ {
+ Data = new PagedData
+ {
+ Items = mapped,
+ TotalCount = mapped.Count
+ }
+ };
}
///
@@ -96,19 +107,25 @@ namespace EOM.TSHotelManagement.Application
///
///
///
- public BaseOutputDto AddPromotionContent(CreatePromotionContentInputDto createPromotionContentInputDto)
+ public BaseResponse AddPromotionContent(CreatePromotionContentInputDto createPromotionContentInputDto)
{
try
{
- fontsRepository.Insert(EntityMapper.Map(createPromotionContentInputDto));
+ var entity = EntityMapper.Map(createPromotionContentInputDto);
+ var result = fontsRepository.Insert(entity);
+ if (!result)
+ {
+ LogHelper.LogError(LocalizationHelper.GetLocalizedString("Insert Promotion Content Failed", "宣传联动内容添加失败"), null);
+ return new BaseResponse(BusinessStatusCode.InternalServerError, LocalizationHelper.GetLocalizedString("Insert Promotion Content Failed", "宣传联动内容添加失败"));
+ }
}
catch (Exception ex)
{
LogHelper.LogError(LocalizationHelper.GetLocalizedString("Insert Promotion Content Failed", "宣传联动内容添加失败"), ex);
- return new BaseOutputDto(StatusCodeConstants.InternalServerError, LocalizationHelper.GetLocalizedString("Insert Promotion Content Failed", "宣传联动内容添加失败"));
+ return new BaseResponse(BusinessStatusCode.InternalServerError, LocalizationHelper.GetLocalizedString("Insert Promotion Content Failed", "宣传联动内容添加失败"));
}
- return new BaseOutputDto(StatusCodeConstants.Success, LocalizationHelper.GetLocalizedString("Insert Promotion Content Success", "宣传联动内容添加成功"));
+ return new BaseResponse(BusinessStatusCode.Success, LocalizationHelper.GetLocalizedString("Insert Promotion Content Success", "宣传联动内容添加成功"));
}
///
@@ -116,24 +133,26 @@ namespace EOM.TSHotelManagement.Application
///
///
///
- public BaseOutputDto DeletePromotionContent(DeletePromotionContentInputDto deletePromotionContentInputDto)
+ public BaseResponse DeletePromotionContent(DeletePromotionContentInputDto deletePromotionContentInputDto)
{
try
{
- fontsRepository.Update(a => new PromotionContent
+ fontsRepository.SoftDelete(new PromotionContent
{
+ Id = deletePromotionContentInputDto.Id,
+ PromotionContentNumber = deletePromotionContentInputDto.PromotionContentNumber,
IsDelete = deletePromotionContentInputDto.IsDelete,
DataChgUsr = deletePromotionContentInputDto.DataChgUsr,
DataChgDate = deletePromotionContentInputDto.DataChgDate
- }, a => a.PromotionContentNumber == deletePromotionContentInputDto.PromotionContentNumber);
+ });
}
catch (Exception ex)
{
LogHelper.LogError(LocalizationHelper.GetLocalizedString("Delete Promotion Content Failed", "宣传联动内容删除失败"), ex);
- return new BaseOutputDto(StatusCodeConstants.InternalServerError, LocalizationHelper.GetLocalizedString("Delete Promotion Content Failed", "宣传联动内容删除失败"));
+ return new BaseResponse(BusinessStatusCode.InternalServerError, LocalizationHelper.GetLocalizedString("Delete Promotion Content Failed", "宣传联动内容删除失败"));
}
- return new BaseOutputDto(StatusCodeConstants.Success, LocalizationHelper.GetLocalizedString("Delete Promotion Content Success", "宣传联动内容删除成功"));
+ return new BaseResponse(BusinessStatusCode.Success, LocalizationHelper.GetLocalizedString("Delete Promotion Content Success", "宣传联动内容删除成功"));
}
///
@@ -141,19 +160,25 @@ namespace EOM.TSHotelManagement.Application
///
///
///
- public BaseOutputDto UpdatePromotionContent(UpdatePromotionContentInputDto updatePromotionContentInputDto)
+ public BaseResponse UpdatePromotionContent(UpdatePromotionContentInputDto updatePromotionContentInputDto)
{
try
{
- fontsRepository.Update(EntityMapper.Map(updatePromotionContentInputDto));
+ var entity = EntityMapper.Map(updatePromotionContentInputDto);
+ var result = fontsRepository.Update(entity);
+ if (!result)
+ {
+ LogHelper.LogError(LocalizationHelper.GetLocalizedString("Update Promotion Content Failed", "宣传联动内容更新失败"), null);
+ return new BaseResponse(BusinessStatusCode.InternalServerError, LocalizationHelper.GetLocalizedString("Update Promotion Content Failed", "宣传联动内容更新失败"));
+ }
}
catch (Exception ex)
{
LogHelper.LogError(LocalizationHelper.GetLocalizedString("Update Promotion Content Failed", "宣传联动内容更新失败"), ex);
- return new BaseOutputDto(StatusCodeConstants.InternalServerError, LocalizationHelper.GetLocalizedString("Update Promotion Content Failed", "宣传联动内容更新失败"));
+ return new BaseResponse(BusinessStatusCode.InternalServerError, LocalizationHelper.GetLocalizedString("Update Promotion Content Failed", "宣传联动内容更新失败"));
}
- return new BaseOutputDto(StatusCodeConstants.Success, LocalizationHelper.GetLocalizedString("Update Promotion Content Success", "宣传联动内容更新成功"));
+ return new BaseResponse(BusinessStatusCode.Success, LocalizationHelper.GetLocalizedString("Update Promotion Content Success", "宣传联动内容更新成功"));
}
}
diff --git a/EOM.TSHotelManagement.Application/Business/Reser/IReserService.cs b/EOM.TSHotelManagement.Application/Business/Reser/IReserService.cs
index 3abca1db99c7bb37c7858d7824e68c0b01c02112..431543c0a15bd78eb87adab373b874ef0be192ec 100644
--- a/EOM.TSHotelManagement.Application/Business/Reser/IReserService.cs
+++ b/EOM.TSHotelManagement.Application/Business/Reser/IReserService.cs
@@ -49,21 +49,21 @@ namespace EOM.TSHotelManagement.Application
///
///
///
- BaseOutputDto DeleteReserInfo(DeleteReserInputDto reser);
+ BaseResponse DeleteReserInfo(DeleteReserInputDto reser);
///
/// 更新预约信息
///
///
///
- BaseOutputDto UpdateReserInfo(UpdateReserInputDto reser);
+ BaseResponse UpdateReserInfo(UpdateReserInputDto reser);
///
/// 添加预约信息
///
///
///
- BaseOutputDto InserReserInfo(CreateReserInputDto r);
+ BaseResponse InserReserInfo(CreateReserInputDto r);
}
}
\ No newline at end of file
diff --git a/EOM.TSHotelManagement.Application/Business/Reser/ReserService.cs b/EOM.TSHotelManagement.Application/Business/Reser/ReserService.cs
index 722d84161eca41bb9ffec8329ed46a7d603bc72d..d174671f9417302361665dc197c1fa736471d97b 100644
--- a/EOM.TSHotelManagement.Application/Business/Reser/ReserService.cs
+++ b/EOM.TSHotelManagement.Application/Business/Reser/ReserService.cs
@@ -27,6 +27,7 @@ using EOM.TSHotelManagement.Common.Util;
using EOM.TSHotelManagement.EntityFramework;
using EOM.TSHotelManagement.Shared;
using SqlSugar;
+using System.Transactions;
namespace EOM.TSHotelManagement.Application
{
@@ -69,30 +70,23 @@ namespace EOM.TSHotelManagement.Application
///
public ListOutputDto SelectReserAll(ReadReserInputDto readReserInputDto)
{
- ListOutputDto rss = new ListOutputDto();
-
var where = Expressionable.Create();
-
where = where.And(a => a.IsDelete == readReserInputDto.IsDelete);
-
var count = 0;
-
- var listSource = new List();
-
+ var Data = new List();
if (!readReserInputDto.IgnorePaging && readReserInputDto.Page != 0 && readReserInputDto.PageSize != 0)
{
- listSource = reserRepository.AsQueryable().Where(where.ToExpression()).ToPageList(readReserInputDto.Page, readReserInputDto.PageSize, ref count);
+ Data = reserRepository.AsQueryable().Where(where.ToExpression()).ToPageList(readReserInputDto.Page, readReserInputDto.PageSize, ref count);
}
else
{
- listSource = reserRepository.AsQueryable().Where(where.ToExpression()).ToList();
+ Data = reserRepository.AsQueryable().Where(where.ToExpression()).ToList();
+ count = Data.Count;
}
-
- listSource.ForEach(source =>
+ Data.ForEach(source =>
{
try
{
- //解密联系方式
var sourceTelStr = dataProtector.DecryptReserData(source.ReservationPhoneNumber);
source.ReservationPhoneNumber = sourceTelStr;
}
@@ -101,10 +95,15 @@ namespace EOM.TSHotelManagement.Application
source.ReservationPhoneNumber = source.ReservationPhoneNumber;
}
});
-
- rss.listSource = EntityMapper.MapList(listSource);
- rss.total = count;
- return rss;
+ var mapped = EntityMapper.MapList(Data);
+ return new ListOutputDto
+ {
+ Data = new PagedData
+ {
+ Items = mapped,
+ TotalCount = count
+ }
+ };
}
///
@@ -115,14 +114,14 @@ namespace EOM.TSHotelManagement.Application
public SingleOutputDto SelectReserInfoByRoomNo(ReadReserInputDto readReserInputDt)
{
Reser res = null;
- res = reserRepository.GetSingle(a => a.ReservationRoomNumber == readReserInputDt.ReservationRoomNumber && a.IsDelete != 1);
+ res = reserRepository.GetFirst(a => a.ReservationRoomNumber == readReserInputDt.ReservationRoomNumber && a.IsDelete != 1);
//解密联系方式
var sourceTelStr = dataProtector.DecryptReserData(res.ReservationPhoneNumber);
res.ReservationPhoneNumber = sourceTelStr;
var outputReser = EntityMapper.Map(res);
- return new SingleOutputDto { Source = outputReser };
+ return new SingleOutputDto { Data = outputReser };
}
///
@@ -130,24 +129,33 @@ namespace EOM.TSHotelManagement.Application
///
///
///
- public BaseOutputDto DeleteReserInfo(DeleteReserInputDto reser)
+ public BaseResponse DeleteReserInfo(DeleteReserInputDto reser)
{
- var reserInfo = reserRepository.GetSingle(a => a.ReservationId == reser.ReservationId);
- var result = reserRepository.Update(a => new Reser()
- {
- IsDelete = reser.IsDelete,
- DataChgUsr = reser.DataChgUsr,
- DataChgDate = reser.DataChgDate
- }, a => a.ReservationId == reser.ReservationId);
+ var reserInfo = reserRepository.GetFirst(a => a.ReservationId == reser.ReservationId);
- if (result)
+ using (TransactionScope scope = new TransactionScope())
{
- roomRepository.Update(a => new Room { RoomStateId = (int)RoomState.Vacant }, a => a.RoomNumber.Equals(reserInfo.ReservationRoomNumber));
- return new BaseOutputDto(StatusCodeConstants.Success, LocalizationHelper.GetLocalizedString("Delete Reser Success", "预约信息删除成功"));
- }
- else
- {
- return new BaseOutputDto(StatusCodeConstants.InternalServerError, LocalizationHelper.GetLocalizedString("Delete Reser Failed", "预约信息删除失败"));
+ var result = reserRepository.SoftDelete(new Reser()
+ {
+ Id = reserInfo.Id,
+ ReservationId = reser.ReservationId,
+ IsDelete = reser.IsDelete,
+ DataChgUsr = reser.DataChgUsr,
+ DataChgDate = reser.DataChgDate
+ });
+
+ if (result)
+ {
+ var roomInfo = roomRepository.GetFirst(a => a.RoomNumber == reserInfo.ReservationRoomNumber);
+ roomInfo.RoomStateId = (int)RoomState.Vacant;
+ roomRepository.Update(roomInfo);
+ scope.Complete();
+ return new BaseResponse(BusinessStatusCode.Success, LocalizationHelper.GetLocalizedString("Delete Reser Success", "预约信息删除成功"));
+ }
+ else
+ {
+ return new BaseResponse(BusinessStatusCode.InternalServerError, LocalizationHelper.GetLocalizedString("Delete Reser Failed", "预约信息删除失败"));
+ }
}
}
@@ -156,27 +164,27 @@ namespace EOM.TSHotelManagement.Application
///
///
///
- public BaseOutputDto UpdateReserInfo(UpdateReserInputDto reser)
+ public BaseResponse UpdateReserInfo(UpdateReserInputDto reser)
{
string NewTel = dataProtector.EncryptReserData(reser.ReservationPhoneNumber);
reser.ReservationPhoneNumber = NewTel;
try
{
- var result = reserRepository.Update(EntityMapper.Map(reser));
-
+ var entity = EntityMapper.Map(reser);
+ var result = reserRepository.Update(entity);
if (result)
{
- return new BaseOutputDto(StatusCodeConstants.Success, LocalizationHelper.GetLocalizedString("Update Customer Success", "预约信息更新成功"));
+ return new BaseResponse(BusinessStatusCode.Success, LocalizationHelper.GetLocalizedString("Update Customer Success", "预约信息更新成功"));
}
else
{
- return new BaseOutputDto(StatusCodeConstants.InternalServerError, LocalizationHelper.GetLocalizedString("Update Customer Failed", "预约信息更新失败"));
+ return new BaseResponse(BusinessStatusCode.InternalServerError, LocalizationHelper.GetLocalizedString("Update Customer Failed", "预约信息更新失败"));
}
}
catch (Exception ex)
{
LogHelper.LogError(LocalizationHelper.GetLocalizedString("Update Customer Failed", "预约信息添加失败"), ex);
- return new BaseOutputDto(StatusCodeConstants.InternalServerError, LocalizationHelper.GetLocalizedString("Update Customer Failed", "预约信息更新失败"));
+ return new BaseResponse(BusinessStatusCode.InternalServerError, LocalizationHelper.GetLocalizedString("Update Customer Failed", "预约信息更新失败"));
}
}
@@ -185,33 +193,35 @@ namespace EOM.TSHotelManagement.Application
///
///
///
- public BaseOutputDto InserReserInfo(CreateReserInputDto r)
+ public BaseResponse InserReserInfo(CreateReserInputDto r)
{
string NewTel = dataProtector.EncryptReserData(r.ReservationPhoneNumber);
r.ReservationPhoneNumber = NewTel;
try
{
- var result = reserRepository.Insert(EntityMapper.Map(r));
-
+ var entity = EntityMapper.Map(r);
+ var result = reserRepository.Insert(entity);
if (result)
{
- roomRepository.Update(a => new Room()
+ var room = roomRepository.GetFirst(a => a.RoomNumber == r.ReservationRoomNumber);
+ room.RoomStateId = new EnumHelper().GetEnumValue(RoomState.Reserved);
+ var updateResult = roomRepository.Update(room);
+
+ if (!updateResult)
{
- RoomStateId = new EnumHelper().GetEnumValue(RoomState.Reserved),
- DataChgUsr = r.DataChgUsr,
- DataChgDate = r.DataChgDate
- }, a => a.RoomNumber == r.ReservationRoomNumber);
- return new BaseOutputDto(StatusCodeConstants.Success, LocalizationHelper.GetLocalizedString("Add Customer Success", "预约信息添加成功"));
+ return new BaseResponse(BusinessStatusCode.InternalServerError, LocalizationHelper.GetLocalizedString("Add Customer Failed", "预约信息添加失败"));
+ }
+ return new BaseResponse(BusinessStatusCode.Success, LocalizationHelper.GetLocalizedString("Add Customer Success", "预约信息添加成功"));
}
else
{
- return new BaseOutputDto(StatusCodeConstants.InternalServerError, LocalizationHelper.GetLocalizedString("Add Customer Failed", "预约信息添加失败"));
+ return new BaseResponse(BusinessStatusCode.InternalServerError, LocalizationHelper.GetLocalizedString("Add Customer Failed", "预约信息添加失败"));
}
}
catch (Exception ex)
{
LogHelper.LogError(LocalizationHelper.GetLocalizedString("Add Customer Failed", "预约信息添加失败"), ex);
- return new BaseOutputDto(StatusCodeConstants.InternalServerError, LocalizationHelper.GetLocalizedString("Add Customer Failed", "预约信息添加失败"));
+ return new BaseResponse(BusinessStatusCode.InternalServerError, LocalizationHelper.GetLocalizedString("Add Customer Failed", "预约信息添加失败"));
}
}
}
diff --git a/EOM.TSHotelManagement.Application/Business/Room/IRoomService.cs b/EOM.TSHotelManagement.Application/Business/Room/IRoomService.cs
index af183f5511216ed192f2f1006a99a33bdf7996af..8824bc29cbf97a9f0b59ca22b5d6843e6d1f6021 100644
--- a/EOM.TSHotelManagement.Application/Business/Room/IRoomService.cs
+++ b/EOM.TSHotelManagement.Application/Business/Room/IRoomService.cs
@@ -87,7 +87,7 @@ namespace EOM.TSHotelManagement.Application
///
///
///
- BaseOutputDto UpdateRoomInfo(UpdateRoomInputDto r);
+ BaseResponse UpdateRoomInfo(UpdateRoomInputDto r);
#endregion
#region 根据房间编号修改房间信息(预约)
@@ -96,7 +96,7 @@ namespace EOM.TSHotelManagement.Application
///
///
///
- BaseOutputDto UpdateRoomInfoWithReser(UpdateRoomInputDto r);
+ BaseResponse UpdateRoomInfoWithReser(UpdateRoomInputDto r);
#endregion
#region 查询可入住房间数量
@@ -153,7 +153,7 @@ namespace EOM.TSHotelManagement.Application
///
///
///
- BaseOutputDto UpdateRoomStateByRoomNo(UpdateRoomInputDto readRoomInputDto);
+ BaseResponse UpdateRoomStateByRoomNo(UpdateRoomInputDto readRoomInputDto);
#endregion
///
@@ -161,21 +161,21 @@ namespace EOM.TSHotelManagement.Application
///
///
///
- BaseOutputDto TransferRoom(TransferRoomDto transferRoomDto);
+ BaseResponse TransferRoom(TransferRoomDto transferRoomDto);
///
/// 退房操作
///
///
///
- BaseOutputDto CheckoutRoom(CheckoutRoomDto checkoutRoomDto);
+ BaseResponse CheckoutRoom(CheckoutRoomDto checkoutRoomDto);
///
/// 根据预约信息办理入住
///
///
///
- BaseOutputDto CheckinRoomByReservation(CheckinRoomByReservationDto checkinRoomByReservationDto);
+ BaseResponse CheckinRoomByReservation(CheckinRoomByReservationDto checkinRoomByReservationDto);
#region 添加房间
///
@@ -183,7 +183,7 @@ namespace EOM.TSHotelManagement.Application
///
///
///
- BaseOutputDto InsertRoom(CreateRoomInputDto rn);
+ BaseResponse InsertRoom(CreateRoomInputDto rn);
#endregion
#region 更新房间
@@ -192,7 +192,7 @@ namespace EOM.TSHotelManagement.Application
///
///
///
- BaseOutputDto UpdateRoom(UpdateRoomInputDto rn);
+ BaseResponse UpdateRoom(UpdateRoomInputDto rn);
#endregion
#region 删除房间
@@ -201,7 +201,7 @@ namespace EOM.TSHotelManagement.Application
///
///
///
- BaseOutputDto DeleteRoom(DeleteRoomInputDto rn);
+ BaseResponse DeleteRoom(DeleteRoomInputDto rn);
#endregion
}
diff --git a/EOM.TSHotelManagement.Application/Business/Room/IRoomTypeService.cs b/EOM.TSHotelManagement.Application/Business/Room/IRoomTypeService.cs
index 3196fd471196fa3174a63b5dfa626472d1cf89d1..c385b776d73c2d79f31747004d68f568fd4b3953 100644
--- a/EOM.TSHotelManagement.Application/Business/Room/IRoomTypeService.cs
+++ b/EOM.TSHotelManagement.Application/Business/Room/IRoomTypeService.cs
@@ -48,20 +48,20 @@ namespace EOM.TSHotelManagement.Application
///
///
///
- BaseOutputDto InsertRoomType(CreateRoomTypeInputDto readRoomTypeInputDto);
+ BaseResponse InsertRoomType(CreateRoomTypeInputDto readRoomTypeInputDto);
///
/// 更新房间状态
///
///
///
- BaseOutputDto UpdateRoomType(UpdateRoomTypeInputDto roomType);
+ BaseResponse UpdateRoomType(UpdateRoomTypeInputDto roomType);
///
/// 删除房间状态
///
///
///
- BaseOutputDto DeleteRoomType(DeleteRoomTypeInputDto roomType);
+ BaseResponse DeleteRoomType(DeleteRoomTypeInputDto roomType);
}
}
\ No newline at end of file
diff --git a/EOM.TSHotelManagement.Application/Business/Room/RoomService.cs b/EOM.TSHotelManagement.Application/Business/Room/RoomService.cs
index 315861e3aeb9c89e79ad45930ab7cb5a7bb65b81..1c3b931e00019505666287626098df72dde8ab36 100644
--- a/EOM.TSHotelManagement.Application/Business/Room/RoomService.cs
+++ b/EOM.TSHotelManagement.Application/Business/Room/RoomService.cs
@@ -115,32 +115,40 @@ namespace EOM.TSHotelManagement.Application
///
public ListOutputDto SelectRoomByRoomState(ReadRoomInputDto readRoomInputDto)
{
- List roomStates = new List();
- var helper = new EnumHelper();
- roomStates = Enum.GetValues(typeof(RoomState))
- .Cast()
- .Select(e => new EnumDto
+ var where = Expressionable.Create();
+
+ if (!readRoomInputDto.IsDelete.IsNullOrEmpty())
{
- Id = (int)e,
- Name = e.ToString(),
- Description = helper.GetEnumDescription(e)
- })
- .ToList();
- List roomTypes = new List();
- roomTypes = roomTypeRepository.GetList(a => a.IsDelete != 1);
+ where = where.And(a => a.IsDelete == readRoomInputDto.IsDelete);
+ }
+ if (readRoomInputDto.RoomStateId > 0)
+ {
+ where = where.And(a => a.RoomStateId == readRoomInputDto.RoomStateId);
+ }
+
+ var count = 0;
List rooms = new List();
- rooms = roomRepository.GetList(a => a.IsDelete != 1 && a.RoomStateId == readRoomInputDto.RoomStateId).OrderBy(a => a.RoomNumber).ToList();
- rooms.ForEach(source =>
+
+ if (!readRoomInputDto.IgnorePaging && readRoomInputDto.Page != 0 && readRoomInputDto.PageSize != 0)
{
- var roomState = roomStates.SingleOrDefault(a => a.Id == source.RoomStateId);
- source.RoomState = roomState.Description.IsNullOrEmpty() ? "" : roomState.Description;
- var roomType = roomTypes.SingleOrDefault(a => a.RoomTypeId == source.RoomTypeId);
- source.RoomName = roomType.RoomTypeName.IsNullOrEmpty() ? "" : roomType.RoomTypeName;
- });
+ rooms = roomRepository.AsQueryable().Where(where.ToExpression()).ToPageList(readRoomInputDto.Page, readRoomInputDto.PageSize, ref count);
+ }
+ else
+ {
+ rooms = roomRepository.AsQueryable().Where(where.ToExpression()).ToList();
+ count = rooms.Count;
+ }
- var listSource = EntityMapper.MapList(rooms);
+ var result = EntityMapper.MapList(rooms);
- return new ListOutputDto { listSource = listSource };
+ return new ListOutputDto
+ {
+ Data = new PagedData
+ {
+ Items = result,
+ TotalCount = count
+ }
+ };
}
///
@@ -149,32 +157,16 @@ namespace EOM.TSHotelManagement.Application
///
public ListOutputDto SelectCanUseRoomAll()
{
- List roomStates = new List();
- var helper = new EnumHelper();
- roomStates = Enum.GetValues(typeof(RoomState))
- .Cast()
- .Select(e => new EnumDto
- {
- Id = (int)e,
- Name = e.ToString(),
- Description = helper.GetEnumDescription(e)
- })
- .ToList();
- List roomTypes = new List();
- roomTypes = roomTypeRepository.GetList();
- List rooms = new List();
- rooms = roomRepository.GetList(a => a.IsDelete != 1 && a.RoomStateId == (int)RoomState.Vacant).OrderBy(a => a.RoomNumber).ToList();
- rooms.ForEach(source =>
+ var rooms = roomRepository.GetList(a => a.RoomStateId == (int)RoomState.Vacant);
+ var result = EntityMapper.MapList(rooms);
+ return new ListOutputDto
{
- var roomState = roomStates.SingleOrDefault(a => a.Id == source.RoomStateId);
- source.RoomState = roomState.Description.IsNullOrEmpty() ? "" : roomState.Description;
- var roomType = roomTypes.SingleOrDefault(a => a.RoomTypeId == source.RoomTypeId);
- source.RoomName = roomType.RoomTypeName.IsNullOrEmpty() ? "" : roomType.RoomTypeName;
- });
-
- var listSource = EntityMapper.MapList(rooms);
-
- return new ListOutputDto { listSource = listSource };
+ Data = new PagedData
+ {
+ Items = result,
+ TotalCount = result.Count
+ }
+ };
}
///
@@ -185,61 +177,50 @@ namespace EOM.TSHotelManagement.Application
{
var where = Expressionable.Create();
- where = where.And(a => a.IsDelete == readRoomInputDto.IsDelete);
-
- if (readRoomInputDto.RoomStateId > 0)
+ if (!readRoomInputDto.IsDelete.IsNullOrEmpty())
{
- where = where.And(a => a.RoomStateId == readRoomInputDto.RoomStateId);
+ where = where.And(a => a.IsDelete == readRoomInputDto.IsDelete);
}
- List roomStates = new List();
- var helper = new EnumHelper();
- roomStates = Enum.GetValues(typeof(RoomState))
- .Cast()
- .Select(e => new EnumDto
- {
- Id = (int)e,
- Name = e.ToString(),
- Description = helper.GetEnumDescription(e)
- })
- .ToList();
- List roomTypes = new List();
- roomTypes = roomTypeRepository.GetList();
- List rooms = new List();
-
var count = 0;
+ List rooms = new List();
if (!readRoomInputDto.IgnorePaging && readRoomInputDto.Page != 0 && readRoomInputDto.PageSize != 0)
{
- rooms = roomRepository.AsQueryable().Where(where.ToExpression()).OrderBy(a => a.RoomNumber).ToPageList(readRoomInputDto.Page, readRoomInputDto.PageSize, ref count);
+ rooms = roomRepository.AsQueryable().Where(where.ToExpression()).ToPageList(readRoomInputDto.Page, readRoomInputDto.PageSize, ref count);
}
else
{
- rooms = roomRepository.GetList(a => a.IsDelete != 1).OrderBy(a => a.RoomNumber).ToList();
+ rooms = roomRepository.AsQueryable().Where(where.ToExpression()).ToList();
+ count = rooms.Count;
}
- var listCustoNo = rooms.Select(a => a.CustomerNumber).Distinct().ToList();
- List custos = new List();
- custos = custoRepository.GetList(a => listCustoNo.Contains(a.CustomerNumber));
-
- rooms.ForEach(source =>
+ var result = EntityMapper.MapList(rooms);
+ var roomTypes = roomTypeRepository.AsQueryable().Where(a => a.IsDelete != 1).ToList();
+ foreach (var item in result)
{
- var roomState = roomStates.SingleOrDefault(a => a.Id == source.RoomStateId);
- source.RoomState = roomState.Description.IsNullOrEmpty() ? "" : roomState.Description;
- var roomType = roomTypes.SingleOrDefault(a => a.RoomTypeId == source.RoomTypeId);
- source.RoomName = roomType.RoomTypeName.IsNullOrEmpty() ? "" : roomType.RoomTypeName;
-
- var custo = custos.SingleOrDefault(a => a.CustomerNumber.Equals(source.CustomerNumber));
- source.CustomerName = custo.IsNullOrEmpty() ? "" : custo.CustomerName;
-
- //把入住时间格式化
- source.LastCheckInTimeFormatted = (source.LastCheckInTime + "").IsNullOrEmpty() ? ""
- : source.LastCheckInTime.ToString();
-
- });
- var listSource = EntityMapper.MapList(rooms);
-
- return new ListOutputDto { listSource = listSource, total = count };
+ var helper = new EnumHelper();
+ var roomStates = Enum.GetValues(typeof(RoomState))
+ .Cast()
+ .Select(e => new EnumDto
+ {
+ Id = (int)e,
+ Name = e.ToString(),
+ Description = helper.GetEnumDescription(e)
+ })
+ .ToList();
+ item.RoomState = roomStates.Where(a => a.Id == item.RoomStateId).Single().Description;
+ var roomType = roomTypes.Single(a => a.RoomTypeId == item.RoomTypeId);
+ item.RoomName = roomType.RoomTypeName;
+ }
+ return new ListOutputDto
+ {
+ Data = new PagedData
+ {
+ Items = result,
+ TotalCount = count
+ }
+ };
}
///
@@ -248,39 +229,37 @@ namespace EOM.TSHotelManagement.Application
///
public ListOutputDto SelectRoomByTypeName(ReadRoomInputDto readRoomInputDto)
{
- List roomStates = new List();
- var helper = new EnumHelper();
- roomStates = Enum.GetValues(typeof(RoomState))
- .Cast()
- .Select(e => new EnumDto
+ var where = Expressionable.Create();
+
+ if (!readRoomInputDto.RoomTypeName.IsNullOrEmpty())
{
- Id = (int)e,
- Name = e.ToString(),
- Description = helper.GetEnumDescription(e)
- })
- .ToList();
- List roomTypes = new List();
- roomTypes = roomTypeRepository.GetList(a => a.IsDelete != 1 && a.RoomTypeName == readRoomInputDto.RoomTypeName);
- var listTypes = roomTypes.Select(a => a.RoomTypeId).Distinct().ToList();
+ var roomType = roomTypeRepository.GetFirst(a => a.RoomTypeName == readRoomInputDto.RoomTypeName);
+ where = where.And(a => a.RoomTypeId == roomType.RoomTypeId);
+ }
+
+ var count = 0;
List rooms = new List();
- rooms = roomRepository.GetList(a => a.IsDelete != 1 && listTypes.Contains(a.RoomTypeId)).OrderBy(a => a.RoomNumber).ToList();
- var listCustoNo = rooms.Select(a => a.CustomerNumber).Distinct().ToList();
- List custos = new List();
- custos = custoRepository.GetList(a => listCustoNo.Contains(a.CustomerNumber));
- rooms.ForEach(source =>
- {
- var roomState = roomStates.SingleOrDefault(a => a.Id == source.RoomStateId);
- source.RoomState = roomState.Description.IsNullOrEmpty() ? "" : roomState.Description;
- var roomType = roomTypes.SingleOrDefault(a => a.RoomTypeId == source.RoomTypeId);
- source.RoomName = roomType.RoomTypeName.IsNullOrEmpty() ? "" : roomType.RoomTypeName;
- var custo = custos.SingleOrDefault(a => a.CustomerNumber.Equals(source.CustomerNumber));
- source.CustomerName = custo.IsNullOrEmpty() ? "" : custo.CustomerName;
+ if (!readRoomInputDto.IgnorePaging && readRoomInputDto.Page != 0 && readRoomInputDto.PageSize != 0)
+ {
+ rooms = roomRepository.AsQueryable().Where(where.ToExpression()).ToPageList(readRoomInputDto.Page, readRoomInputDto.PageSize, ref count);
+ }
+ else
+ {
+ rooms = roomRepository.AsQueryable().Where(where.ToExpression()).ToList();
+ count = rooms.Count;
+ }
- });
- var listSource = EntityMapper.MapList(rooms);
+ var result = EntityMapper.MapList(rooms);
- return new ListOutputDto { listSource = listSource };
+ return new ListOutputDto
+ {
+ Data = new PagedData
+ {
+ Items = result,
+ TotalCount = count
+ }
+ };
}
///
@@ -302,12 +281,12 @@ namespace EOM.TSHotelManagement.Application
})
.ToList();
Room room = new Room();
- room = roomRepository.GetSingle(a => a.IsDelete != 1 && a.RoomNumber == readRoomInputDto.RoomNumber);
+ room = roomRepository.GetFirst(a => a.IsDelete != 1 && a.RoomNumber == readRoomInputDto.RoomNumber);
if (!room.IsNullOrEmpty())
{
var roomSate = roomStates.SingleOrDefault(a => a.Id == room.RoomStateId);
room.RoomState = roomSate.Description.IsNullOrEmpty() ? "" : roomSate.Description;
- var roomType = roomTypeRepository.GetSingle(a => a.RoomTypeId == room.RoomTypeId);
+ var roomType = roomTypeRepository.GetFirst(a => a.RoomTypeId == room.RoomTypeId);
room.RoomName = roomType.RoomTypeName.IsNullOrEmpty() ? "" : roomType.RoomTypeName;
}
else
@@ -315,9 +294,9 @@ namespace EOM.TSHotelManagement.Application
room = new Room();
}
- var Source = EntityMapper.Map(room);
+ var Data = EntityMapper.Map(room);
- return new SingleOutputDto() { Source = Source };
+ return new SingleOutputDto() { Data = Data };
}
///
@@ -327,13 +306,13 @@ namespace EOM.TSHotelManagement.Application
///
public SingleOutputDto DayByRoomNo(ReadRoomInputDto roomInputDto)
{
- var room = roomRepository.GetSingle(a => a.RoomNumber == roomInputDto.RoomNumber);
+ var room = roomRepository.GetFirst(a => a.RoomNumber == roomInputDto.RoomNumber);
if (room?.LastCheckInTime != null)
{
var days = Math.Abs((room.LastCheckInTime.Value.ToDateTime(TimeOnly.MinValue) - DateTime.Now).Days);
- return new SingleOutputDto { Source = new ReadRoomOutputDto { StayDays = days } };
+ return new SingleOutputDto { Data = new ReadRoomOutputDto { StayDays = days } };
}
- return new SingleOutputDto { Source = new ReadRoomOutputDto { StayDays = 0 } };
+ return new SingleOutputDto { Data = new ReadRoomOutputDto { StayDays = 0 } };
}
///
@@ -341,24 +320,26 @@ namespace EOM.TSHotelManagement.Application
///
///
///
- public BaseOutputDto UpdateRoomInfo(UpdateRoomInputDto r)
+ public BaseResponse UpdateRoomInfo(UpdateRoomInputDto r)
{
try
{
- roomRepository.Update(a => new Room()
+ roomRepository.Update(new Room()
{
+ Id = r.Id,
+ RoomNumber = r.RoomNumber,
LastCheckInTime = r.LastCheckInTime,
RoomStateId = r.RoomStateId,
CustomerNumber = r.CustomerNumber,
DataChgDate = r.DataChgDate,
DataChgUsr = r.DataChgUsr,
- }, a => a.RoomNumber == r.RoomNumber);
+ });
}
catch (Exception ex)
{
- return new BaseOutputDto { Message = LocalizationHelper.GetLocalizedString(ex.Message, ex.Message), StatusCode = StatusCodeConstants.InternalServerError };
+ return new BaseResponse { Message = LocalizationHelper.GetLocalizedString(ex.Message, ex.Message), Code = BusinessStatusCode.InternalServerError };
}
- return new BaseOutputDto();
+ return new BaseResponse();
}
///
@@ -366,22 +347,24 @@ namespace EOM.TSHotelManagement.Application
///
///
///
- public BaseOutputDto UpdateRoomInfoWithReser(UpdateRoomInputDto r)
+ public BaseResponse UpdateRoomInfoWithReser(UpdateRoomInputDto r)
{
try
{
- roomRepository.Update(a => new Room()
+ roomRepository.Update(new Room()
{
+ Id = r.Id,
+ RoomNumber = r.RoomNumber,
RoomStateId = r.RoomStateId,
DataChgUsr = r.DataChgUsr,
DataInsDate = r.DataInsDate,
- }, a => a.RoomNumber == r.RoomNumber);
+ });
}
catch (Exception ex)
{
- return new BaseOutputDto { Message = LocalizationHelper.GetLocalizedString(ex.Message, ex.Message), StatusCode = StatusCodeConstants.InternalServerError };
+ return new BaseResponse { Message = LocalizationHelper.GetLocalizedString(ex.Message, ex.Message), Code = BusinessStatusCode.InternalServerError };
}
- return new BaseOutputDto();
+ return new BaseResponse();
}
///
@@ -395,7 +378,7 @@ namespace EOM.TSHotelManagement.Application
var count = roomRepository.Count(a => a.RoomStateId == (int)RoomState.Vacant && a.IsDelete != 1);
return new SingleOutputDto
{
- Source = new ReadRoomOutputDto { Vacant = count }
+ Data = new ReadRoomOutputDto { Vacant = count }
};
}
catch (Exception ex)
@@ -403,7 +386,7 @@ namespace EOM.TSHotelManagement.Application
return new SingleOutputDto
{
Message = LocalizationHelper.GetLocalizedString(ex.Message, ex.Message),
- StatusCode = StatusCodeConstants.InternalServerError
+ Code = BusinessStatusCode.InternalServerError
};
}
}
@@ -419,7 +402,7 @@ namespace EOM.TSHotelManagement.Application
var count = roomRepository.Count(a => a.RoomStateId == (int)RoomState.Occupied && a.IsDelete != 1);
return new SingleOutputDto
{
- Source = new ReadRoomOutputDto { Occupied = count }
+ Data = new ReadRoomOutputDto { Occupied = count }
};
}
catch (Exception ex)
@@ -427,7 +410,7 @@ namespace EOM.TSHotelManagement.Application
return new SingleOutputDto
{
Message = LocalizationHelper.GetLocalizedString(ex.Message, ex.Message),
- StatusCode = StatusCodeConstants.InternalServerError
+ Code = BusinessStatusCode.InternalServerError
};
}
}
@@ -438,7 +421,7 @@ namespace EOM.TSHotelManagement.Application
///
public object SelectRoomByRoomPrice(ReadRoomInputDto r)
{
- return roomRepository.GetSingle(a => a.RoomNumber == r.RoomNumber).RoomRent;
+ return roomRepository.GetFirst(a => a.RoomNumber == r.RoomNumber).RoomRent;
}
///
@@ -452,7 +435,7 @@ namespace EOM.TSHotelManagement.Application
var count = roomRepository.Count(a => a.RoomStateId == (int)RoomState.Dirty && a.IsDelete != 1);
return new SingleOutputDto
{
- Source = new ReadRoomOutputDto { Dirty = count }
+ Data = new ReadRoomOutputDto { Dirty = count }
};
}
catch (Exception ex)
@@ -460,7 +443,7 @@ namespace EOM.TSHotelManagement.Application
return new SingleOutputDto
{
Message = LocalizationHelper.GetLocalizedString(ex.Message, ex.Message),
- StatusCode = StatusCodeConstants.InternalServerError
+ Code = BusinessStatusCode.InternalServerError
};
}
}
@@ -476,7 +459,7 @@ namespace EOM.TSHotelManagement.Application
var count = roomRepository.Count(a => a.RoomStateId == (int)RoomState.Maintenance && a.IsDelete != 1);
return new SingleOutputDto
{
- Source = new ReadRoomOutputDto { Maintenance = count }
+ Data = new ReadRoomOutputDto { Maintenance = count }
};
}
catch (Exception ex)
@@ -484,7 +467,7 @@ namespace EOM.TSHotelManagement.Application
return new SingleOutputDto
{
Message = LocalizationHelper.GetLocalizedString(ex.Message, ex.Message),
- StatusCode = StatusCodeConstants.InternalServerError
+ Code = BusinessStatusCode.InternalServerError
};
}
}
@@ -500,7 +483,7 @@ namespace EOM.TSHotelManagement.Application
var count = roomRepository.Count(a => a.RoomStateId == (int)RoomState.Reserved && a.IsDelete != 1);
return new SingleOutputDto
{
- Source = new ReadRoomOutputDto { Reserved = count }
+ Data = new ReadRoomOutputDto { Reserved = count }
};
}
catch (Exception ex)
@@ -508,7 +491,7 @@ namespace EOM.TSHotelManagement.Application
return new SingleOutputDto
{
Message = LocalizationHelper.GetLocalizedString(ex.Message, ex.Message),
- StatusCode = StatusCodeConstants.InternalServerError
+ Code = BusinessStatusCode.InternalServerError
};
}
}
@@ -518,20 +501,23 @@ namespace EOM.TSHotelManagement.Application
///
///
///
- public BaseOutputDto UpdateRoomStateByRoomNo(UpdateRoomInputDto updateRoomInputDto)
+ public BaseResponse UpdateRoomStateByRoomNo(UpdateRoomInputDto updateRoomInputDto)
{
try
{
- roomRepository.Update(a => new Room()
+ var room = roomRepository.GetFirst(a => a.RoomNumber == updateRoomInputDto.RoomNumber);
+ roomRepository.Update(new Room()
{
+ Id = room.Id,
+ RoomNumber = room.RoomNumber,
RoomStateId = updateRoomInputDto.RoomStateId
- }, a => a.RoomNumber == updateRoomInputDto.RoomNumber);
+ });
}
catch (Exception ex)
{
- return new BaseOutputDto { Message = LocalizationHelper.GetLocalizedString(ex.Message, ex.Message), StatusCode = StatusCodeConstants.InternalServerError };
+ return new BaseResponse { Message = LocalizationHelper.GetLocalizedString(ex.Message, ex.Message), Code = BusinessStatusCode.InternalServerError };
}
- return new BaseOutputDto();
+ return new BaseResponse();
}
///
@@ -539,22 +525,29 @@ namespace EOM.TSHotelManagement.Application
///
///
///
- public BaseOutputDto InsertRoom(CreateRoomInputDto rn)
+ public BaseResponse InsertRoom(CreateRoomInputDto rn)
{
try
{
- var isExist = roomRepository.IsAny(a => a.RoomNumber == rn.RoomNumber);
+ var isExist = roomRepository.IsAny(a => a.RoomNumber == rn.RoomNumber && a.IsDelete != 1);
if (isExist)
- return new BaseOutputDto { Message = LocalizationHelper.GetLocalizedString("This room already exists.", "房间已存在。"), StatusCode = StatusCodeConstants.InternalServerError };
+ return new BaseResponse { Message = LocalizationHelper.GetLocalizedString("This room already exists.", "房间已存在。"), Code = BusinessStatusCode.InternalServerError };
- roomRepository.Insert(EntityMapper.Map(rn));
+ var entity = EntityMapper.Map(rn);
+ entity.LastCheckInTime = DateOnly.MinValue;
+ entity.LastCheckOutTime = DateOnly.MinValue;
+ var result = roomRepository.Insert(entity);
+ if (!result)
+ {
+ return new BaseResponse { Message = LocalizationHelper.GetLocalizedString("Failed to add room.", "添加房间失败。"), Code = BusinessStatusCode.InternalServerError };
+ }
}
catch (Exception ex)
{
- return new BaseOutputDto { Message = LocalizationHelper.GetLocalizedString(ex.Message, ex.Message), StatusCode = StatusCodeConstants.InternalServerError };
+ return new BaseResponse { Message = LocalizationHelper.GetLocalizedString(ex.Message, ex.Message), Code = BusinessStatusCode.InternalServerError };
}
- return new BaseOutputDto();
+ return new BaseResponse();
}
///
@@ -562,21 +555,27 @@ namespace EOM.TSHotelManagement.Application
///
///
///
- public BaseOutputDto UpdateRoom(UpdateRoomInputDto rn)
+ public BaseResponse UpdateRoom(UpdateRoomInputDto rn)
{
try
{
var isExist = roomRepository.IsAny(a => a.RoomNumber == rn.RoomNumber);
if (!isExist)
- return new BaseOutputDto { Message = LocalizationHelper.GetLocalizedString("This room does not exist.", "房间不存在。"), StatusCode = StatusCodeConstants.InternalServerError };
- roomRepository.Update(EntityMapper.Map(rn));
+ return new BaseResponse { Message = LocalizationHelper.GetLocalizedString("This room does not exist.", "房间不存在。"), Code = BusinessStatusCode.InternalServerError };
+
+ var entity = EntityMapper.Map(rn);
+ var result = roomRepository.Update(entity);
+ if (!result)
+ {
+ return new BaseResponse { Message = LocalizationHelper.GetLocalizedString("Failed to update room.", "更新房间失败。"), Code = BusinessStatusCode.InternalServerError };
+ }
}
catch (Exception ex)
{
- return new BaseOutputDto { Message = LocalizationHelper.GetLocalizedString(ex.Message, ex.Message), StatusCode = StatusCodeConstants.InternalServerError };
+ return new BaseResponse { Message = LocalizationHelper.GetLocalizedString(ex.Message, ex.Message), Code = BusinessStatusCode.InternalServerError };
}
- return new BaseOutputDto();
+ return new BaseResponse();
}
///
@@ -584,21 +583,21 @@ namespace EOM.TSHotelManagement.Application
///
///
///
- public BaseOutputDto DeleteRoom(DeleteRoomInputDto rn)
+ public BaseResponse DeleteRoom(DeleteRoomInputDto rn)
{
try
{
var isExist = roomRepository.IsAny(a => a.RoomNumber == rn.RoomNumber);
if (!isExist)
- return new BaseOutputDto { Message = LocalizationHelper.GetLocalizedString("This room does not exist.", "房间不存在。"), StatusCode = StatusCodeConstants.InternalServerError };
+ return new BaseResponse { Message = LocalizationHelper.GetLocalizedString("This room does not exist.", "房间不存在。"), Code = BusinessStatusCode.InternalServerError };
roomRepository.Update(EntityMapper.Map(rn));
}
catch (Exception ex)
{
- return new BaseOutputDto { Message = LocalizationHelper.GetLocalizedString(ex.Message, ex.Message), StatusCode = StatusCodeConstants.InternalServerError };
+ return new BaseResponse { Message = LocalizationHelper.GetLocalizedString(ex.Message, ex.Message), Code = BusinessStatusCode.InternalServerError };
}
- return new BaseOutputDto();
+ return new BaseResponse();
}
///
@@ -606,43 +605,43 @@ namespace EOM.TSHotelManagement.Application
///
///
///
- public BaseOutputDto TransferRoom(TransferRoomDto transferRoomDto)
+ public BaseResponse TransferRoom(TransferRoomDto transferRoomDto)
{
try
{
using (TransactionScope scope = new TransactionScope())
{
- var customer = custoRepository.GetSingle(a => a.CustomerNumber == transferRoomDto.CustomerNumber && a.IsDelete != 1);
+ var customer = custoRepository.GetFirst(a => a.CustomerNumber == transferRoomDto.CustomerNumber && a.IsDelete != 1);
if (customer.IsNullOrEmpty())
- return new BaseOutputDto { Message = LocalizationHelper.GetLocalizedString("The customer does not exist", "客户不存在"), StatusCode = StatusCodeConstants.InternalServerError };
+ return new BaseResponse { Message = LocalizationHelper.GetLocalizedString("The customer does not exist", "客户不存在"), Code = BusinessStatusCode.InternalServerError };
var originalSpends = spendRepository.GetList(a => a.RoomNumber == transferRoomDto.OriginalRoomNumber
- && a.CustomerNumber == transferRoomDto.CustomerNumber && a.SettlementStatus == SpendConsts.UnSettle.Code
+ && a.CustomerNumber == transferRoomDto.CustomerNumber && a.SettlementStatus == ConsumptionConstant.UnSettle.Code
&& a.IsDelete == 0).ToList();
var vipRules = vipLevelRuleRepository.GetList(a => a.IsDelete != 1).ToList();
- var originalRoom = roomRepository.GetSingle(a => a.RoomNumber == transferRoomDto.OriginalRoomNumber);
+ var originalRoom = roomRepository.GetFirst(a => a.RoomNumber == transferRoomDto.OriginalRoomNumber);
if (originalRoom.CustomerNumber != transferRoomDto.CustomerNumber)
- return new BaseOutputDto { Message = LocalizationHelper.GetLocalizedString("The customer does not match the original room", "客户与原房间不匹配"), StatusCode = StatusCodeConstants.InternalServerError };
+ return new BaseResponse { Message = LocalizationHelper.GetLocalizedString("The customer does not match the original room", "客户与原房间不匹配"), Code = BusinessStatusCode.InternalServerError };
if (!originalRoom.LastCheckInTime.HasValue)
- return new BaseOutputDto { Message = LocalizationHelper.GetLocalizedString("The original room lacks check-in time", "原房间缺少入住时间"), StatusCode = StatusCodeConstants.InternalServerError };
+ return new BaseResponse { Message = LocalizationHelper.GetLocalizedString("The original room lacks check-in time", "原房间缺少入住时间"), Code = BusinessStatusCode.InternalServerError };
- var targetRoom = roomRepository.GetSingle(a => a.RoomNumber == transferRoomDto.TargetRoomNumber);
+ var targetRoom = roomRepository.GetFirst(a => a.RoomNumber == transferRoomDto.TargetRoomNumber);
if (targetRoom.IsNullOrEmpty())
- return new BaseOutputDto { Message = LocalizationHelper.GetLocalizedString("The room does not exist", "房间不存在"), StatusCode = StatusCodeConstants.InternalServerError };
+ return new BaseResponse { Message = LocalizationHelper.GetLocalizedString("The room does not exist", "房间不存在"), Code = BusinessStatusCode.InternalServerError };
if (targetRoom.RoomStateId != (int)RoomState.Vacant)
- return new BaseOutputDto { Message = LocalizationHelper.GetLocalizedString("The room is not vacant", "房间不处于空房状态"), StatusCode = StatusCodeConstants.InternalServerError };
+ return new BaseResponse { Message = LocalizationHelper.GetLocalizedString("The room is not vacant", "房间不处于空房状态"), Code = BusinessStatusCode.InternalServerError };
var staySpan = DateTime.Now - originalRoom.LastCheckInTime.Value.ToDateTime(TimeOnly.MinValue);
var stayDays = Math.Max((int)Math.Ceiling(staySpan.TotalDays), 1);
var originalSpendNumbers = originalSpends.Select(a => a.SpendNumber).ToList();
- var totalSpent = originalSpends.Sum(a => a.ConsumptionAmount);
+ var TotalCountSpent = originalSpends.Sum(a => a.ConsumptionAmount);
var newLevelId = vipRules
- .Where(vipRule => totalSpent >= vipRule.RuleValue)
+ .Where(vipRule => TotalCountSpent >= vipRule.RuleValue)
.OrderByDescending(vipRule => vipRule.RuleValue)
.ThenByDescending(vipRule => vipRule.VipLevelId)
.FirstOrDefault()?.VipLevelId ?? 0;
@@ -657,43 +656,51 @@ namespace EOM.TSHotelManagement.Application
}, a => a.CustomerNumber == transferRoomDto.CustomerNumber);
}
- var customerType = custoTypeRepository.GetSingle(a => a.CustomerType == customer.CustomerType);
+ var customerType = custoTypeRepository.GetFirst(a => a.CustomerType == customer.CustomerType);
if (customerType.IsNullOrEmpty())
- return new BaseOutputDto { Message = LocalizationHelper.GetLocalizedString("The customer type does not exist", "客户类型不存在"), StatusCode = StatusCodeConstants.InternalServerError };
+ return new BaseResponse { Message = LocalizationHelper.GetLocalizedString("The customer type does not exist", "客户类型不存在"), Code = BusinessStatusCode.InternalServerError };
decimal discountFactor = customerType.Discount / 100M;
decimal originalRoomBill = originalRoom.RoomRent * stayDays * discountFactor;
//更新目标房间状态
- roomRepository.Update(a => new Room
+ roomRepository.Update(new Room
{
+ Id = targetRoom.Id,
+ RoomNumber = targetRoom.RoomNumber,
CustomerNumber = originalRoom.CustomerNumber,
LastCheckInTime = DateOnly.FromDateTime(DateTime.Now),
RoomStateId = (int)RoomState.Occupied,
DataChgDate = transferRoomDto.DataChgDate,
DataChgUsr = transferRoomDto.DataChgUsr
- }, a => a.RoomNumber == targetRoom.RoomNumber);
+ });
//更新原房间状态
- roomRepository.Update(a => new Room
+ roomRepository.Update(new Room
{
+ Id = originalRoom.Id,
+ RoomNumber = originalRoom.RoomNumber,
CustomerNumber = string.Empty,
LastCheckInTime = DateOnly.MinValue,
LastCheckOutTime = DateOnly.FromDateTime(DateTime.Now),
RoomStateId = (int)RoomState.Dirty,
DataChgDate = transferRoomDto.DataChgDate,
DataChgUsr = transferRoomDto.DataChgUsr
- }, a => a.RoomNumber == originalRoom.RoomNumber);
+ });
//转移原房间消费记录
if (originalSpendNumbers.Count > 0)
{
- spendRepository.Update(a => new Spend
+ var originalSpendList = spendRepository.AsQueryable().Where(a => originalSpendNumbers.Contains(a.SpendNumber)).ToList();
+ var spends = new List();
+
+ foreach (var spend in originalSpendList)
{
- RoomNumber = transferRoomDto.TargetRoomNumber,
- DataChgUsr = transferRoomDto.DataChgUsr,
- DataChgDate = transferRoomDto.DataChgDate,
- }, a => originalSpendNumbers.Contains(a.SpendNumber));
+ spend.SpendNumber = spend.SpendNumber;
+ spend.RoomNumber = transferRoomDto.TargetRoomNumber;
+ }
+
+ spendRepository.UpdateRange(spends);
}
//添加旧房间消费记录
@@ -706,7 +713,7 @@ namespace EOM.TSHotelManagement.Application
ProductName = "居住" + transferRoomDto.OriginalRoomNumber + "共" + stayDays + "天",
ProductPrice = originalRoom.RoomRent,
ConsumptionTime = DateTime.Now,
- SettlementStatus = SpendConsts.UnSettle.Code,
+ SettlementStatus = ConsumptionConstant.UnSettle.Code,
ConsumptionQuantity = stayDays,
ConsumptionAmount = originalRoomBill,
ConsumptionType = SpendType.Room.Code,
@@ -722,9 +729,9 @@ namespace EOM.TSHotelManagement.Application
}
catch (Exception ex)
{
- return new BaseOutputDto { Message = LocalizationHelper.GetLocalizedString(ex.Message, ex.Message), StatusCode = StatusCodeConstants.InternalServerError };
+ return new BaseResponse { Message = LocalizationHelper.GetLocalizedString(ex.Message, ex.Message), Code = BusinessStatusCode.InternalServerError };
}
- return new BaseOutputDto();
+ return new BaseResponse();
}
///
@@ -732,7 +739,7 @@ namespace EOM.TSHotelManagement.Application
///
///
///
- public BaseOutputDto CheckoutRoom(CheckoutRoomDto checkoutRoomDto)
+ public BaseResponse CheckoutRoom(CheckoutRoomDto checkoutRoomDto)
{
try
{
@@ -740,19 +747,21 @@ namespace EOM.TSHotelManagement.Application
{
var customer = custoRepository.AsQueryable().Where(a => a.CustomerNumber == checkoutRoomDto.CustomerNumber && a.IsDelete != 1);
if (!customer.Any())
- return new BaseOutputDto { Message = LocalizationHelper.GetLocalizedString("The customer does not exist", "客户不存在"), StatusCode = StatusCodeConstants.InternalServerError };
+ return new BaseResponse { Message = LocalizationHelper.GetLocalizedString("The customer does not exist", "客户不存在"), Code = BusinessStatusCode.InternalServerError };
- var room = roomRepository.GetSingle(a => a.RoomNumber == checkoutRoomDto.RoomNumber);
+ var room = roomRepository.GetFirst(a => a.RoomNumber == checkoutRoomDto.RoomNumber);
//更新房间状态
- roomRepository.Update(a => new Room
+ roomRepository.Update(new Room
{
+ Id = room.Id,
+ RoomNumber = room.RoomNumber,
CustomerNumber = null,
LastCheckInTime = DateOnly.MinValue,
LastCheckOutTime = DateOnly.FromDateTime(DateTime.Now),
RoomStateId = (int)RoomState.Dirty,
DataChgDate = checkoutRoomDto.DataChgDate,
DataChgUsr = checkoutRoomDto.DataChgUsr
- }, a => a.RoomNumber == room.RoomNumber);
+ });
//添加能源使用记录
var energy = new EnergyManagement
@@ -773,16 +782,32 @@ namespace EOM.TSHotelManagement.Application
//结算消费记录
var spendNumbers = spendRepository.GetList(a => a.RoomNumber == checkoutRoomDto.RoomNumber
- && a.CustomerNumber.Equals(checkoutRoomDto.CustomerNumber) && a.SettlementStatus.Equals(SpendConsts.UnSettle)
- && a.IsDelete == 0).Select(a => a.SpendNumber).ToList();
+ && a.CustomerNumber.Equals(checkoutRoomDto.CustomerNumber) && a.SettlementStatus.Equals(ConsumptionConstant.UnSettle)
+ && a.IsDelete == 0).ToList();
if (spendNumbers.Count > 0)
{
- spendRepository.Update(a => new Spend
+ var spends = new List();
+ foreach (var spend in spendNumbers)
{
- SettlementStatus = SpendConsts.Settled.Code,
- DataChgDate = checkoutRoomDto.DataChgDate,
- DataChgUsr = checkoutRoomDto.DataChgUsr
- }, a => spendNumbers.Contains(a.SpendNumber));
+ spends.Add(new Spend
+ {
+ SpendNumber = spend.SpendNumber,
+ RoomNumber = checkoutRoomDto.RoomNumber,
+ CustomerNumber = checkoutRoomDto.CustomerNumber,
+ ProductName = spend.ProductName,
+ ProductPrice = spend.ProductPrice,
+ ConsumptionQuantity = spend.ConsumptionQuantity,
+ ConsumptionAmount = spend.ConsumptionAmount,
+ ConsumptionTime = DateTime.Now,
+ SettlementStatus = ConsumptionConstant.Settled.Code,
+ ConsumptionType = spend.ConsumptionType,
+ IsDelete = 0,
+ DataInsDate = checkoutRoomDto.DataChgDate,
+ DataInsUsr = checkoutRoomDto.DataChgUsr
+ });
+ }
+
+ spendRepository.UpdateRange(spends);
}
scope.Complete();
@@ -790,9 +815,9 @@ namespace EOM.TSHotelManagement.Application
}
catch (Exception ex)
{
- return new BaseOutputDto { Message = LocalizationHelper.GetLocalizedString(ex.Message, ex.Message), StatusCode = StatusCodeConstants.InternalServerError };
+ return new BaseResponse { Message = LocalizationHelper.GetLocalizedString(ex.Message, ex.Message), Code = BusinessStatusCode.InternalServerError };
}
- return new BaseOutputDto();
+ return new BaseResponse();
}
///
@@ -800,7 +825,7 @@ namespace EOM.TSHotelManagement.Application
///
///
///
- public BaseOutputDto CheckinRoomByReservation(CheckinRoomByReservationDto checkinRoomByReservationDto)
+ public BaseResponse CheckinRoomByReservation(CheckinRoomByReservationDto checkinRoomByReservationDto)
{
try
{
@@ -821,33 +846,52 @@ namespace EOM.TSHotelManagement.Application
DataInsUsr = checkinRoomByReservationDto.DataInsUsr,
DataInsDate = checkinRoomByReservationDto.DataInsDate
};
- custoRepository.Insert(customer);
+ var customerResult = custoRepository.Insert(customer);
+ if (!customerResult)
+ {
+ return new BaseResponse { Message = LocalizationHelper.GetLocalizedString("Failed to add customer.", "添加客户失败。"), Code = BusinessStatusCode.InternalServerError };
+ }
- roomRepository.Update(a => new Room()
+ var room = roomRepository.GetFirst(a => a.RoomNumber == checkinRoomByReservationDto.RoomNumber && a.IsDelete != 1);
+ var roomUpdateResult = roomRepository.Update(new Room()
{
+ RoomNumber = room.RoomNumber,
+ Id = room.Id,
LastCheckInTime = DateOnly.FromDateTime(DateTime.Now),
CustomerNumber = customer.CustomerNumber,
RoomStateId = new EnumHelper().GetEnumValue(RoomState.Occupied),
- RoomNumber = checkinRoomByReservationDto.RoomNumber,
DataChgDate = checkinRoomByReservationDto.DataChgDate,
DataChgUsr = checkinRoomByReservationDto.DataChgUsr
- }, a => a.RoomNumber == checkinRoomByReservationDto.RoomNumber);
+ });
+
+ if (!roomUpdateResult)
+ {
+ return new BaseResponse { Message = LocalizationHelper.GetLocalizedString("Failed to update room.", "更新房间失败。"), Code = BusinessStatusCode.InternalServerError };
+ }
- reserRepository.Update(a => new Reser
+ var reser = reserRepository.GetFirst(a => a.ReservationId == checkinRoomByReservationDto.ReservationId && a.IsDelete != 1);
+ var reserUpdateResult = reserRepository.Update(new Reser
{
+ ReservationId = reser.ReservationId,
+ Id = reser.Id,
IsDelete = 1,
DataChgUsr = checkinRoomByReservationDto.DataChgUsr,
DataChgDate = checkinRoomByReservationDto.DataChgDate
- }, a => a.ReservationId == checkinRoomByReservationDto.ReservationId);
+ });
+
+ if (!reserUpdateResult)
+ {
+ return new BaseResponse { Message = LocalizationHelper.GetLocalizedString("Failed to update reservation.", "更新预约失败。"), Code = BusinessStatusCode.InternalServerError };
+ }
scope.Complete();
}
}
catch (Exception ex)
{
- return new BaseOutputDto { Message = LocalizationHelper.GetLocalizedString(ex.Message, ex.Message), StatusCode = StatusCodeConstants.InternalServerError };
+ return new BaseResponse { Message = LocalizationHelper.GetLocalizedString(ex.Message, ex.Message), Code = BusinessStatusCode.InternalServerError };
}
- return new BaseOutputDto();
+ return new BaseResponse();
}
}
}
diff --git a/EOM.TSHotelManagement.Application/Business/Room/RoomTypeService.cs b/EOM.TSHotelManagement.Application/Business/Room/RoomTypeService.cs
index 465b33533891e0ee8e54548c2f5dfe27cc32b9c7..71006dc7c090de7b4b0896147142073d7a3c1b6d 100644
--- a/EOM.TSHotelManagement.Application/Business/Room/RoomTypeService.cs
+++ b/EOM.TSHotelManagement.Application/Business/Room/RoomTypeService.cs
@@ -84,6 +84,7 @@ namespace EOM.TSHotelManagement.Application
else
{
types = roomTypeRepository.AsQueryable().Where(where.ToExpression()).ToList();
+ count = types.Count;
}
types.ForEach(t =>
@@ -91,12 +92,15 @@ namespace EOM.TSHotelManagement.Application
t.DeleteMarkDescription = t.IsDelete == 0 ? "否" : "是";
});
- var listSource = EntityMapper.MapList(types);
+ var mapped = EntityMapper.MapList(types);
return new ListOutputDto
{
- listSource = listSource,
- total = listSource.Count
+ Data = new PagedData
+ {
+ Items = mapped,
+ TotalCount = count
+ }
};
}
#endregion
@@ -111,12 +115,12 @@ namespace EOM.TSHotelManagement.Application
{
RoomType roomtype = new RoomType();
Room room = new Room();
- room = roomRepository.GetSingle(a => a.RoomNumber == readRoomTypeInputDto.RoomNumber && a.IsDelete != 1);
- roomtype.RoomTypeName = roomTypeRepository.GetSingle(a => a.RoomTypeId == room.RoomTypeId).RoomTypeName;
+ room = roomRepository.GetFirst(a => a.RoomNumber == readRoomTypeInputDto.RoomNumber && a.IsDelete != 1);
+ roomtype.RoomTypeName = roomTypeRepository.GetFirst(a => a.RoomTypeId == room.RoomTypeId).RoomTypeName;
var source = EntityMapper.Map(roomtype);
- return new SingleOutputDto { Source = source };
+ return new SingleOutputDto { Data = source };
}
#endregion
@@ -125,20 +129,20 @@ namespace EOM.TSHotelManagement.Application
///
///
///
- public BaseOutputDto InsertRoomType(CreateRoomTypeInputDto roomType)
+ public BaseResponse InsertRoomType(CreateRoomTypeInputDto roomType)
{
try
{
var existRoomType = roomTypeRepository.IsAny(a => a.RoomTypeId == roomType.RoomTypeId);
if (existRoomType)
- return new BaseOutputDto { Message = LocalizationHelper.GetLocalizedString("This room type already exists.", "房间类型已存在。"), StatusCode = StatusCodeConstants.InternalServerError };
+ return new BaseResponse { Message = LocalizationHelper.GetLocalizedString("This room type already exists.", "房间类型已存在。"), Code = BusinessStatusCode.InternalServerError };
roomTypeRepository.Insert(EntityMapper.Map(roomType));
}
catch (Exception ex)
{
- return new BaseOutputDto { Message = LocalizationHelper.GetLocalizedString(ex.Message, ex.Message), StatusCode = StatusCodeConstants.InternalServerError };
+ return new BaseResponse { Message = LocalizationHelper.GetLocalizedString(ex.Message, ex.Message), Code = BusinessStatusCode.InternalServerError };
}
- return new BaseOutputDto();
+ return new BaseResponse();
}
///
@@ -146,25 +150,27 @@ namespace EOM.TSHotelManagement.Application
///
///
///
- public BaseOutputDto UpdateRoomType(UpdateRoomTypeInputDto roomType)
+ public BaseResponse UpdateRoomType(UpdateRoomTypeInputDto roomType)
{
try
{
- roomTypeRepository.Update(a => new RoomType
+ roomTypeRepository.Update(new RoomType
{
+ RoomTypeId = roomType.RoomTypeId,
+ Id = roomType.Id,
RoomTypeName = roomType.RoomTypeName,
RoomRent = roomType.RoomRent,
RoomDeposit = roomType.RoomDeposit,
IsDelete = roomType.IsDelete,
DataChgUsr = roomType.DataChgUsr,
DataChgDate = roomType.DataChgDate
- }, a => a.RoomTypeId == roomType.RoomTypeId);
+ });
}
catch (Exception ex)
{
- return new BaseOutputDto { Message = LocalizationHelper.GetLocalizedString(ex.Message, ex.Message), StatusCode = StatusCodeConstants.InternalServerError };
+ return new BaseResponse { Message = LocalizationHelper.GetLocalizedString(ex.Message, ex.Message), Code = BusinessStatusCode.InternalServerError };
}
- return new BaseOutputDto();
+ return new BaseResponse();
}
///
@@ -172,20 +178,22 @@ namespace EOM.TSHotelManagement.Application
///
///
///
- public BaseOutputDto DeleteRoomType(DeleteRoomTypeInputDto roomType)
+ public BaseResponse DeleteRoomType(DeleteRoomTypeInputDto roomType)
{
try
{
- roomTypeRepository.Update(a => new RoomType
+ roomTypeRepository.SoftDelete(new RoomType
{
+ RoomTypeId = roomType.RoomTypeId,
+ Id = roomType.Id,
IsDelete = 1
- }, a => a.RoomTypeId == roomType.RoomTypeId);
+ });
}
catch (Exception ex)
{
- return new BaseOutputDto { Message = LocalizationHelper.GetLocalizedString(ex.Message, ex.Message), StatusCode = StatusCodeConstants.InternalServerError };
+ return new BaseResponse { Message = LocalizationHelper.GetLocalizedString(ex.Message, ex.Message), Code = BusinessStatusCode.InternalServerError };
}
- return new BaseOutputDto();
+ return new BaseResponse();
}
}
}
diff --git a/EOM.TSHotelManagement.Application/Business/Sellthing/ISellService.cs b/EOM.TSHotelManagement.Application/Business/Sellthing/ISellService.cs
index 089b129203dfa2a1629e9d413633b1e223a1d722..6d778f407cc5d9c3df7d80aac747c86f571203c0 100644
--- a/EOM.TSHotelManagement.Application/Business/Sellthing/ISellService.cs
+++ b/EOM.TSHotelManagement.Application/Business/Sellthing/ISellService.cs
@@ -41,21 +41,21 @@ namespace EOM.TSHotelManagement.Application
///
///
///
- BaseOutputDto UpdateSellThing(UpdateSellThingInputDto updateSellThingInputDto);
+ BaseResponse UpdateSellThing(UpdateSellThingInputDto updateSellThingInputDto);
///
/// 修改商品信息
///
///
///
- BaseOutputDto UpdateSellthingInfo(UpdateSellThingInputDto sellThing);
+ BaseResponse UpdateSellthingInfo(UpdateSellThingInputDto sellThing);
///
/// 撤回客户消费信息
///
///
///
- BaseOutputDto DeleteSellthing(DeleteSellThingInputDto deleteSellThingInputDto);
+ BaseResponse DeleteSellthing(DeleteSellThingInputDto deleteSellThingInputDto);
///
/// 根据商品名称和价格查询商品编号
@@ -69,6 +69,6 @@ namespace EOM.TSHotelManagement.Application
///
///
///
- BaseOutputDto InsertSellThing(CreateSellThingInputDto st);
+ BaseResponse InsertSellThing(CreateSellThingInputDto st);
}
}
\ No newline at end of file
diff --git a/EOM.TSHotelManagement.Application/Business/Sellthing/SellService.cs b/EOM.TSHotelManagement.Application/Business/Sellthing/SellService.cs
index 52fa2f1e28f9661fb7f1567235bcd7a1a84091a1..0a9c788029d42ec4e0ba908e390987521650199d 100644
--- a/EOM.TSHotelManagement.Application/Business/Sellthing/SellService.cs
+++ b/EOM.TSHotelManagement.Application/Business/Sellthing/SellService.cs
@@ -94,6 +94,7 @@ namespace EOM.TSHotelManagement.Application
else
{
sellThings = sellThingRepository.GetList(exp.ToExpression());
+ count = sellThings.Count;
}
sellThings.ForEach(_sellThing =>
@@ -101,12 +102,15 @@ namespace EOM.TSHotelManagement.Application
_sellThing.ProductPriceFormatted = Decimal.Parse(_sellThing.ProductPrice.ToString()).ToString("#,##0.00").ToString();
});
- var listSource = EntityMapper.MapList(sellThings);
+ var result = EntityMapper.MapList(sellThings);
return new ListOutputDto
{
- listSource = listSource,
- total = count
+ Data = new PagedData
+ {
+ Items = result,
+ TotalCount = count
+ }
};
}
@@ -115,21 +119,27 @@ namespace EOM.TSHotelManagement.Application
///
///
///
- public BaseOutputDto UpdateSellThing(UpdateSellThingInputDto updateSellThingInputDto)
+ public BaseResponse UpdateSellThing(UpdateSellThingInputDto updateSellThingInputDto)
{
try
{
- sellThingRepository.Update(a => new SellThing()
+ var product = sellThingRepository.GetFirst(a => a.ProductNumber == updateSellThingInputDto.ProductNumber);
+ sellThingRepository.Update(new SellThing()
{
+ Id = updateSellThingInputDto.Id,
+ Specification = updateSellThingInputDto.Specification,
+ ProductPrice = updateSellThingInputDto.ProductPrice,
+ ProductName = updateSellThingInputDto.ProductName,
+ ProductNumber = product.ProductNumber,
Stock = Convert.ToInt32(updateSellThingInputDto.Stock),
DataChgDate = DateTime.Now
- }, a => a.ProductNumber == updateSellThingInputDto.ProductNumber);
+ });
}
catch (Exception ex)
{
- return new BaseOutputDto { Message = LocalizationHelper.GetLocalizedString(ex.Message, ex.Message), StatusCode = StatusCodeConstants.InternalServerError };
+ return new BaseResponse { Message = LocalizationHelper.GetLocalizedString(ex.Message, ex.Message), Code = BusinessStatusCode.InternalServerError };
}
- return new BaseOutputDto();
+ return new BaseResponse();
}
///
@@ -137,23 +147,24 @@ namespace EOM.TSHotelManagement.Application
///
///
///
- public BaseOutputDto UpdateSellthingInfo(UpdateSellThingInputDto sellThing)
+ public BaseResponse UpdateSellthingInfo(UpdateSellThingInputDto sellThing)
{
try
{
- sellThingRepository.Update(a => new SellThing()
+ var product = sellThingRepository.GetFirst(a => a.ProductNumber == sellThing.ProductNumber);
+ sellThingRepository.Update(new SellThing()
{
- ProductName = sellThing.ProductName,
- ProductPrice = sellThing.ProductPrice,
+ ProductName = product.ProductName,
+ ProductPrice = product.ProductPrice,
Stock = sellThing.Stock,
Specification = sellThing.Specification,
- }, a => a.ProductNumber == sellThing.ProductNumber);
+ });
}
catch (Exception ex)
{
- return new BaseOutputDto { Message = LocalizationHelper.GetLocalizedString(ex.Message, ex.Message), StatusCode = StatusCodeConstants.InternalServerError };
+ return new BaseResponse { Message = LocalizationHelper.GetLocalizedString(ex.Message, ex.Message), Code = BusinessStatusCode.InternalServerError };
}
- return new BaseOutputDto();
+ return new BaseResponse();
}
///
@@ -161,20 +172,23 @@ namespace EOM.TSHotelManagement.Application
///
///
///
- public BaseOutputDto DeleteSellthing(DeleteSellThingInputDto deleteSellThingInputDto)
+ public BaseResponse DeleteSellthing(DeleteSellThingInputDto deleteSellThingInputDto)
{
try
{
- sellThingRepository.Update(a => new SellThing()
+ var product = sellThingRepository.GetFirst(a => a.ProductNumber == deleteSellThingInputDto.ProductNumber);
+ sellThingRepository.SoftDelete(new SellThing()
{
- IsDelete = 1,
- }, a => a.ProductNumber == deleteSellThingInputDto.ProductNumber);
+ Id = product.Id,
+ ProductNumber = deleteSellThingInputDto.ProductNumber,
+ IsDelete = deleteSellThingInputDto.IsDelete,
+ });
}
catch (Exception ex)
{
- return new BaseOutputDto { Message = LocalizationHelper.GetLocalizedString(ex.Message, ex.Message), StatusCode = StatusCodeConstants.InternalServerError };
+ return new BaseResponse { Message = LocalizationHelper.GetLocalizedString(ex.Message, ex.Message), Code = BusinessStatusCode.InternalServerError };
}
- return new BaseOutputDto();
+ return new BaseResponse();
}
///
@@ -185,12 +199,12 @@ namespace EOM.TSHotelManagement.Application
public SingleOutputDto SelectSellThingByNameAndPrice(ReadSellThingInputDto readSellThingInputDto)
{
SellThing sellThing = null;
- sellThing = sellThingRepository.GetSingle(a => a.ProductNumber == readSellThingInputDto.ProductNumber || (a.ProductName == readSellThingInputDto.ProductName
+ sellThing = sellThingRepository.GetFirst(a => a.ProductNumber == readSellThingInputDto.ProductNumber || (a.ProductName == readSellThingInputDto.ProductName
&& a.ProductPrice == Convert.ToDecimal(readSellThingInputDto.ProductPrice)));
var source = EntityMapper.Map(sellThing);
- return new SingleOutputDto() { Source = source };
+ return new SingleOutputDto() { Data = source };
}
#region 添加商品
@@ -199,17 +213,22 @@ namespace EOM.TSHotelManagement.Application
///
///
///
- public BaseOutputDto InsertSellThing(CreateSellThingInputDto st)
+ public BaseResponse InsertSellThing(CreateSellThingInputDto st)
{
try
{
- sellThingRepository.Insert(EntityMapper.Map(st));
+ var entity = EntityMapper.Map(st);
+ var result = sellThingRepository.Insert(entity);
+ if (!result)
+ {
+ return new BaseResponse { Message = LocalizationHelper.GetLocalizedString("insert sellthing failed.", "商品添加失败"), Code = BusinessStatusCode.InternalServerError };
+ }
}
catch (Exception ex)
{
- return new BaseOutputDto { Message = LocalizationHelper.GetLocalizedString(ex.Message, ex.Message), StatusCode = StatusCodeConstants.InternalServerError };
+ return new BaseResponse { Message = LocalizationHelper.GetLocalizedString(ex.Message, ex.Message), Code = BusinessStatusCode.InternalServerError };
}
- return new BaseOutputDto();
+ return new BaseResponse();
}
#endregion
}
diff --git a/EOM.TSHotelManagement.Application/Business/Spend/ISpendService.cs b/EOM.TSHotelManagement.Application/Business/Spend/ISpendService.cs
index fcc078835403938dc2fa37dcd9aeb832bf75caa2..cc1bbd7045ec78171f0ecac93429c5dbbb0cf843 100644
--- a/EOM.TSHotelManagement.Application/Business/Spend/ISpendService.cs
+++ b/EOM.TSHotelManagement.Application/Business/Spend/ISpendService.cs
@@ -70,20 +70,20 @@ namespace EOM.TSHotelManagement.Application
///
///
///
- BaseOutputDto UndoCustomerSpend(UpdateSpendInputDto updateSpendInputDto);
+ BaseResponse UndoCustomerSpend(UpdateSpendInputDto updateSpendInputDto);
///
/// 添加客户消费信息
///
///
///
- BaseOutputDto AddCustomerSpend(AddCustomerSpendInputDto addCustomerSpendInputDto);
+ BaseResponse AddCustomerSpend(AddCustomerSpendInputDto addCustomerSpendInputDto);
///
/// 更新消费信息
///
///
///
- BaseOutputDto UpdSpenInfo(UpdateSpendInputDto updateSpendInputDto);
+ BaseResponse UpdSpendInfo(UpdateSpendInputDto updateSpendInputDto);
}
}
\ No newline at end of file
diff --git a/EOM.TSHotelManagement.Application/Business/Spend/SpendService.cs b/EOM.TSHotelManagement.Application/Business/Spend/SpendService.cs
index b6ef9420cee37183a6c629793c26ec1bade3d768..3d744517827c9778526999860383360cf3bd2528 100644
--- a/EOM.TSHotelManagement.Application/Business/Spend/SpendService.cs
+++ b/EOM.TSHotelManagement.Application/Business/Spend/SpendService.cs
@@ -99,26 +99,31 @@ namespace EOM.TSHotelManagement.Application
///
public ListOutputDto SeletHistorySpendInfoAll(ReadSpendInputDto readSpendInputDto)
{
- List ls = new List();
- ls = spendRepository.GetList(a => a.CustomerNumber == readSpendInputDto.CustomerNumber && a.SettlementStatus.Equals(SpendConsts.Settled.Code) && a.IsDelete != 1);
- ls.ForEach(source =>
+ var where = Expressionable.Create();
+ if (!readSpendInputDto.CustomerNumber.IsNullOrEmpty())
{
- source.SettlementStatusDescription = source.SettlementStatus.IsNullOrEmpty() ? ""
- : source.SettlementStatus.Equals(SpendConsts.Settled) ? "已结算" : "未结算";
-
- source.ProductPriceFormatted = (source.ProductPrice + "").IsNullOrEmpty() ? ""
- : Decimal.Parse(source.ProductPrice.ToString()).ToString("#,##0.00").ToString();
-
- source.ConsumptionAmountFormatted = (source.ConsumptionAmount + "").IsNullOrEmpty() ? ""
- : Decimal.Parse(source.ConsumptionAmount.ToString()).ToString("#,##0.00").ToString();
-
- source.ConsumptionTypeDescription = source.ConsumptionType == SpendType.Product.Code ? SpendType.Product.Description :
- source.ConsumptionType == SpendType.Room.Code ? SpendType.Room.Description : SpendType.Other.Description;
- });
-
- var listSource = EntityMapper.MapList(ls);
-
- return new ListOutputDto { listSource = listSource };
+ where = where.And(a => a.CustomerNumber == readSpendInputDto.CustomerNumber);
+ }
+ var count = 0;
+ List spends = new List();
+ if (!readSpendInputDto.IgnorePaging && readSpendInputDto.Page != 0 && readSpendInputDto.PageSize != 0)
+ {
+ spends = spendRepository.AsQueryable().Where(where.ToExpression()).ToPageList(readSpendInputDto.Page, readSpendInputDto.PageSize, ref count);
+ }
+ else
+ {
+ spends = spendRepository.AsQueryable().Where(where.ToExpression()).ToList();
+ count = spends.Count;
+ }
+ var result = EntityMapper.MapList(spends);
+ return new ListOutputDto
+ {
+ Data = new PagedData
+ {
+ Items = result,
+ TotalCount = count
+ }
+ };
}
#endregion
@@ -130,37 +135,31 @@ namespace EOM.TSHotelManagement.Application
///
public ListOutputDto SelectSpendByRoomNo(ReadSpendInputDto readSpendInputDto)
{
- List ls = new List();
- ls = spendRepository.GetList(a => a.RoomNumber == readSpendInputDto.RoomNumber && a.SettlementStatus.Equals(SpendConsts.UnSettle) && a.IsDelete != 1);
- var spendNames = ls.Select(a => a.ProductName).ToList();
- var spendInfos = sellThingRepository.AsQueryable().Where(a => spendNames.Contains(a.ProductName)).ToList();
- ls.ForEach(source =>
+ var where = Expressionable.Create();
+ if (!readSpendInputDto.RoomNumber.IsNullOrEmpty())
{
- if (source.ProductNumber.IsNullOrEmpty())
+ where = where.And(a => a.RoomNumber == readSpendInputDto.RoomNumber);
+ }
+ var count = 0;
+ List spends = new List();
+ if (!readSpendInputDto.IgnorePaging && readSpendInputDto.Page != 0 && readSpendInputDto.PageSize != 0)
+ {
+ spends = spendRepository.AsQueryable().Where(where.ToExpression()).ToPageList(readSpendInputDto.Page, readSpendInputDto.PageSize, ref count);
+ }
+ else
+ {
+ spends = spendRepository.AsQueryable().Where(where.ToExpression()).ToList();
+ count = spends.Count;
+ }
+ var result = EntityMapper.MapList(spends);
+ return new ListOutputDto
+ {
+ Data = new PagedData
{
- var spendInfo = spendInfos.SingleOrDefault(a => a.ProductName.Equals(source.ProductName));
- if (spendInfo != null)
- {
- source.ProductNumber = spendInfo.ProductNumber;
- }
+ Items = result,
+ TotalCount = count
}
-
- source.SettlementStatusDescription = source.SettlementStatus.IsNullOrEmpty() ? ""
- : source.SettlementStatus.Equals(SpendConsts.Settled) ? "已结算" : "未结算";
-
- source.ProductPriceFormatted = (source.ProductPrice + "").IsNullOrEmpty() ? ""
- : Decimal.Parse(source.ProductPrice.ToString()).ToString("#,##0.00").ToString();
-
- source.ConsumptionAmountFormatted = (source.ConsumptionAmount + "").IsNullOrEmpty() ? ""
- : Decimal.Parse(source.ConsumptionAmount.ToString()).ToString("#,##0.00").ToString();
-
- source.ConsumptionTypeDescription = source.ConsumptionType == SpendType.Product.Code ? SpendType.Product.Description :
- source.ConsumptionType == SpendType.Room.Code ? SpendType.Room.Description : SpendType.Other.Description;
- });
-
- var listSource = EntityMapper.MapList(ls);
-
- return new ListOutputDto { listSource = listSource };
+ };
}
#endregion
@@ -172,43 +171,26 @@ namespace EOM.TSHotelManagement.Application
public ListOutputDto SelectSpendInfoAll(ReadSpendInputDto readSpendInputDto)
{
var where = Expressionable.Create();
-
- if (!readSpendInputDto.IsDelete.IsNullOrEmpty())
- {
- where = where.And(a => a.IsDelete == readSpendInputDto.IsDelete);
- }
-
- List ls = new List();
-
var count = 0;
-
+ List spends = new List();
if (!readSpendInputDto.IgnorePaging && readSpendInputDto.Page != 0 && readSpendInputDto.PageSize != 0)
{
- ls = spendRepository.AsQueryable().Where(where.ToExpression()).OrderByDescending(a => a.ConsumptionTime).ToPageList(readSpendInputDto.Page, readSpendInputDto.PageSize, ref count);
+ spends = spendRepository.AsQueryable().Where(where.ToExpression()).ToPageList(readSpendInputDto.Page, readSpendInputDto.PageSize, ref count);
}
else
{
- ls = spendRepository.AsQueryable().Where(where.ToExpression()).OrderByDescending(a => a.ConsumptionTime).ToList();
+ spends = spendRepository.AsQueryable().Where(where.ToExpression()).ToList();
+ count = spends.Count;
}
-
- ls.ForEach(source =>
+ var result = EntityMapper.MapList(spends);
+ return new ListOutputDto
{
- source.SettlementStatusDescription = source.SettlementStatus.IsNullOrEmpty() ? ""
- : source.SettlementStatus.Equals(SpendConsts.Settled) ? "已结算" : "未结算";
-
- source.ProductPriceFormatted = (source.ProductPrice + "").IsNullOrEmpty() ? ""
- : Decimal.Parse(source.ProductPrice.ToString()).ToString("#,##0.00").ToString();
-
- source.ConsumptionAmountFormatted = (source.ConsumptionAmount + "").IsNullOrEmpty() ? ""
- : Decimal.Parse(source.ConsumptionAmount.ToString()).ToString("#,##0.00").ToString();
-
- source.ConsumptionTypeDescription = source.ConsumptionType == SpendType.Product.Code ? SpendType.Product.Description :
- source.ConsumptionType == SpendType.Room.Code ? SpendType.Room.Description : SpendType.Other.Description;
- });
-
- var listSource = EntityMapper.MapList(ls);
-
- return new ListOutputDto { listSource = listSource, total = count };
+ Data = new PagedData
+ {
+ Items = result,
+ TotalCount = count
+ }
+ };
}
#endregion
@@ -219,8 +201,7 @@ namespace EOM.TSHotelManagement.Application
///
public ListOutputDto SelectSpendInfoRoomNo(ReadSpendInputDto readSpendInputDto)
{
- List ls = new List();
- ls = spendRepository.GetList(a => a.RoomNumber == readSpendInputDto.RoomNumber && a.IsDelete != 1 && a.SettlementStatus.Equals(SpendConsts.UnSettle));
+ List ls = spendRepository.GetList(a => a.RoomNumber == readSpendInputDto.RoomNumber && a.IsDelete != 1 && a.SettlementStatus.Equals(ConsumptionConstant.UnSettle));
var spendNames = ls.Select(a => a.ProductName).ToList();
var spendInfos = sellThingRepository.AsQueryable().Where(a => spendNames.Contains(a.ProductName)).ToList();
ls.ForEach(source =>
@@ -235,7 +216,7 @@ namespace EOM.TSHotelManagement.Application
}
source.SettlementStatusDescription = source.SettlementStatus.IsNullOrEmpty() ? ""
- : source.SettlementStatus.Equals(SpendConsts.Settled) ? "已结算" : "未结算";
+ : source.SettlementStatus.Equals(ConsumptionConstant.Settled) ? "已结算" : "未结算";
source.ProductPriceFormatted = (source.ProductPrice + "").IsNullOrEmpty() ? ""
: Decimal.Parse(source.ProductPrice.ToString()).ToString("#,##0.00").ToString();
@@ -247,9 +228,15 @@ namespace EOM.TSHotelManagement.Application
source.ConsumptionType == SpendType.Room.Code ? SpendType.Room.Description : SpendType.Other.Description;
});
- var listSource = EntityMapper.MapList(ls);
-
- return new ListOutputDto { listSource = listSource };
+ var mapped = EntityMapper.MapList(ls);
+ return new ListOutputDto
+ {
+ Data = new PagedData
+ {
+ Items = mapped,
+ TotalCount = mapped.Count
+ }
+ };
}
#endregion
@@ -261,8 +248,8 @@ namespace EOM.TSHotelManagement.Application
///
public SingleOutputDto SumConsumptionAmount(ReadSpendInputDto readSpendInputDto)
{
- var totalAmount = spendRepository.GetList(a => a.RoomNumber == readSpendInputDto.RoomNumber && a.CustomerNumber == readSpendInputDto.CustomerNumber && a.SettlementStatus.Equals(SpendConsts.UnSettle)).Sum(a => a.ConsumptionAmount);
- return new SingleOutputDto { Source = new ReadSpendInputDto { ConsumptionAmount = totalAmount } };
+ var TotalCountAmount = spendRepository.GetList(a => a.RoomNumber == readSpendInputDto.RoomNumber && a.CustomerNumber == readSpendInputDto.CustomerNumber && a.SettlementStatus.Equals(ConsumptionConstant.UnSettle)).Sum(a => a.ConsumptionAmount);
+ return new SingleOutputDto { Data = new ReadSpendInputDto { ConsumptionAmount = TotalCountAmount } };
}
#endregion
@@ -271,22 +258,25 @@ namespace EOM.TSHotelManagement.Application
///
///
///
- public BaseOutputDto UndoCustomerSpend(UpdateSpendInputDto updateSpendInputDto)
+ public BaseResponse UndoCustomerSpend(UpdateSpendInputDto updateSpendInputDto)
{
try
{
- spendRepository.Update(a => new Spend()
+ var existingSpend = spendRepository.AsQueryable().Where(a => a.SpendNumber == updateSpendInputDto.SpendNumber && a.IsDelete != 1).Single();
+ spendRepository.Update(new Spend()
{
+ Id = existingSpend.Id,
+ SpendNumber = existingSpend.SpendNumber,
IsDelete = 1,
DataChgDate = updateSpendInputDto.DataChgDate,
DataChgUsr = updateSpendInputDto.DataChgUsr
- }, a => a.SpendNumber.Equals(updateSpendInputDto.SpendNumber));
+ });
}
catch (Exception ex)
{
- return new BaseOutputDto { Message = LocalizationHelper.GetLocalizedString(ex.Message, ex.Message), StatusCode = StatusCodeConstants.InternalServerError };
+ return new BaseResponse { Message = LocalizationHelper.GetLocalizedString(ex.Message, ex.Message), Code = BusinessStatusCode.InternalServerError };
}
- return new BaseOutputDto();
+ return new BaseResponse();
}
///
@@ -294,11 +284,11 @@ namespace EOM.TSHotelManagement.Application
///
///
///
- public BaseOutputDto AddCustomerSpend(AddCustomerSpendInputDto addCustomerSpendInputDto)
+ public BaseResponse AddCustomerSpend(AddCustomerSpendInputDto addCustomerSpendInputDto)
{
if (addCustomerSpendInputDto?.Quantity <= 0 || addCustomerSpendInputDto.Price <= 0)
{
- return new BaseOutputDto() { Message = "商品数量和价格必须大于零", StatusCode = StatusCodeConstants.BadRequest };
+ return new BaseResponse() { Message = "商品数量和价格必须大于零", Code = BusinessStatusCode.BadRequest };
}
using var scope = new TransactionScope(TransactionScopeAsyncFlowOption.Enabled);
@@ -308,22 +298,22 @@ namespace EOM.TSHotelManagement.Application
var room = roomRepository.AsQueryable().Single(a => a.RoomNumber == addCustomerSpendInputDto.RoomNumber);
if (room == null)
{
- return new BaseOutputDto() { Message = $"房间 '{addCustomerSpendInputDto.RoomNumber}' 不存在", StatusCode = StatusCodeConstants.BadRequest };
+ return new BaseResponse() { Message = $"房间 '{addCustomerSpendInputDto.RoomNumber}' 不存在", Code = BusinessStatusCode.BadRequest };
}
var customer = customerRepository.AsQueryable().Single(a => a.CustomerNumber == room.CustomerNumber);
if (customer == null)
{
- return new BaseOutputDto() { Message = $"客户 '{room.CustomerNumber}' 不存在", StatusCode = StatusCodeConstants.BadRequest };
+ return new BaseResponse() { Message = $"客户 '{room.CustomerNumber}' 不存在", Code = BusinessStatusCode.BadRequest };
}
var customerType = custoTypeRepository.AsQueryable().Single(a => a.CustomerType == customer.CustomerType);
decimal discountPercent = customerType?.Discount ?? 100m;
decimal originalAmount = addCustomerSpendInputDto.Price * addCustomerSpendInputDto.Quantity;
- decimal realAmount = DiscountConverter.RealAmount(discountPercent, originalAmount);
+ decimal realAmount = DiscountHelper.RealAmount(discountPercent, originalAmount);
- var existingSpend = spendRepository.AsQueryable().Single(a => a.RoomNumber == addCustomerSpendInputDto.RoomNumber && a.ProductNumber == addCustomerSpendInputDto.ProductNumber && a.IsDelete != 1 && a.SettlementStatus == SpendConsts.UnSettle.Code);
+ var existingSpend = spendRepository.AsQueryable().Single(a => a.RoomNumber == addCustomerSpendInputDto.RoomNumber && a.ProductNumber == addCustomerSpendInputDto.ProductNumber && a.IsDelete != 1 && a.SettlementStatus == ConsumptionConstant.UnSettle.Code);
if (existingSpend != null)
{
@@ -333,7 +323,11 @@ namespace EOM.TSHotelManagement.Application
existingSpend.DataChgDate = DateTime.Now;
existingSpend.DataChgUsr = addCustomerSpendInputDto.WorkerNo;
- spendRepository.Update(existingSpend);
+ var result = spendRepository.Update(existingSpend);
+ if (!result)
+ {
+ return new BaseResponse() { Message = "更新消费记录失败", Code = BusinessStatusCode.InternalServerError };
+ }
}
else
{
@@ -349,18 +343,29 @@ namespace EOM.TSHotelManagement.Application
ConsumptionAmount = realAmount,
ConsumptionTime = DateTime.Now,
ConsumptionType = SpendType.Product.Code,
- SettlementStatus = SpendConsts.UnSettle.Code,
+ SettlementStatus = ConsumptionConstant.UnSettle.Code,
DataInsUsr = addCustomerSpendInputDto.WorkerNo,
DataInsDate = DateTime.Now
};
- spendRepository.Insert(newSpend);
+ var result = spendRepository.Insert(newSpend);
+ if (!result)
+ {
+ return new BaseResponse() { Message = "添加消费记录失败", Code = BusinessStatusCode.InternalServerError };
+ }
}
- sellThingRepository.Update(a => new SellThing
+ var product = sellThingRepository.AsQueryable().Single(a => a.ProductNumber == addCustomerSpendInputDto.ProductNumber);
+ var updateResult = sellThingRepository.Update(new SellThing
+ {
+ ProductNumber = product.ProductNumber,
+ Id = product.Id,
+ Stock = product.Stock - addCustomerSpendInputDto.Quantity
+ });
+ if (!updateResult)
{
- Stock = a.Stock - addCustomerSpendInputDto.Quantity
- }, a => a.ProductNumber == addCustomerSpendInputDto.ProductNumber);
+ return new BaseResponse() { Message = "商品库存更新失败", Code = BusinessStatusCode.InternalServerError };
+ }
var logContent = $"{addCustomerSpendInputDto.WorkerNo} 添加了消费记录: " +
$"房间 {addCustomerSpendInputDto.RoomNumber}, " +
@@ -368,7 +373,8 @@ namespace EOM.TSHotelManagement.Application
$"数量 {addCustomerSpendInputDto.Quantity}, " +
$"金额 {realAmount.ToString("#,##0.00")}";
- operationLogRepository.Insert(new OperationLog
+
+ var log = new OperationLog
{
OperationTime = Convert.ToDateTime(DateTime.Now),
LogContent = logContent,
@@ -378,15 +384,20 @@ namespace EOM.TSHotelManagement.Application
IsDelete = 0,
DataInsUsr = addCustomerSpendInputDto.WorkerNo,
DataInsDate = Convert.ToDateTime(DateTime.Now)
- });
+ };
+ var logResult = operationLogRepository.Insert(log);
+ if (!logResult)
+ {
+ return new BaseResponse() { Message = "操作日志添加失败", Code = BusinessStatusCode.InternalServerError };
+ }
scope.Complete();
- return new BaseOutputDto();
+ return new BaseResponse();
}
catch (Exception ex)
{
- return new BaseOutputDto() { Message = $"添加消费记录失败,请稍后重试。{ex.Message}", StatusCode = StatusCodeConstants.InternalServerError };
+ return new BaseResponse() { Message = $"添加消费记录失败,请稍后重试。{ex.Message}", Code = BusinessStatusCode.InternalServerError };
}
}
@@ -395,26 +406,29 @@ namespace EOM.TSHotelManagement.Application
///
///
///
- public BaseOutputDto UpdSpenInfo(UpdateSpendInputDto spend)
+ public BaseResponse UpdSpendInfo(UpdateSpendInputDto spend)
{
try
{
- spendRepository.Update(a => new Spend()
+ spendRepository.Update(new Spend()
{
+ Id = spend.Id,
+ SpendNumber = spend.SpendNumber,
+ SettlementStatus = ConsumptionConstant.UnSettle.Code,
+ RoomNumber = spend.RoomNumber,
+ CustomerNumber = spend.CustomerNumber,
+ ProductName = spend.ProductName,
ConsumptionQuantity = spend.ConsumptionQuantity,
ConsumptionAmount = spend.ConsumptionAmount,
DataChgDate = spend.DataChgDate,
DataChgUsr = spend.DataChgUsr
- }, a => a.SettlementStatus.Equals(SpendConsts.UnSettle)
- && a.RoomNumber.Equals(spend.RoomNumber)
- && a.CustomerNumber.Equals(spend.CustomerNumber)
- && a.ProductName.Equals(spend.ProductName));
+ });
}
catch (Exception ex)
{
- return new BaseOutputDto { Message = LocalizationHelper.GetLocalizedString(ex.Message, ex.Message), StatusCode = StatusCodeConstants.InternalServerError };
+ return new BaseResponse { Message = LocalizationHelper.GetLocalizedString(ex.Message, ex.Message), Code = BusinessStatusCode.InternalServerError };
}
- return new BaseOutputDto();
+ return new BaseResponse();
}
}
diff --git a/EOM.TSHotelManagement.Application/Dashboard/DashboardService.cs b/EOM.TSHotelManagement.Application/Dashboard/DashboardService.cs
index 1fb1a8ebb59be2234134af81d718c2cdbfecd8cd..0c3c3e6a521d62bad194a22cc58fa80934754509 100644
--- a/EOM.TSHotelManagement.Application/Dashboard/DashboardService.cs
+++ b/EOM.TSHotelManagement.Application/Dashboard/DashboardService.cs
@@ -172,7 +172,7 @@ namespace EOM.TSHotelManagement.Application
roomStatisticsOutputDto.Types = new List();
roomStatisticsOutputDto.ReservationAlerts = new List();
roomStatisticsOutputDto.Message = LocalizationHelper.GetLocalizedString(ex.Message, ex.Message);
- roomStatisticsOutputDto.StatusCode = StatusCodeConstants.InternalServerError;
+ roomStatisticsOutputDto.Code = BusinessStatusCode.InternalServerError;
}
return roomStatisticsOutputDto;
@@ -223,7 +223,7 @@ namespace EOM.TSHotelManagement.Application
Total = allSpends.Where(a => a.ConsumptionTime.Date == today)
.Sum(a => a.ConsumptionAmount),
Settled = allSpends.Where(a => a.ConsumptionTime.Date == today &&
- a.SettlementStatus == SpendConsts.Settled.Code)
+ a.SettlementStatus == ConsumptionConstant.Settled.Code)
.Sum(a => a.ConsumptionAmount)
};
@@ -232,7 +232,7 @@ namespace EOM.TSHotelManagement.Application
Total = allSpends.Where(a => a.ConsumptionTime.Date >= weekStart)
.Sum(a => a.ConsumptionAmount),
Settled = allSpends.Where(a => a.ConsumptionTime.Date >= weekStart &&
- a.SettlementStatus == SpendConsts.Settled.Code)
+ a.SettlementStatus == ConsumptionConstant.Settled.Code)
.Sum(a => a.ConsumptionAmount)
};
@@ -241,21 +241,21 @@ namespace EOM.TSHotelManagement.Application
Total = allSpends.Where(a => a.ConsumptionTime.Date >= yearStart)
.Sum(a => a.ConsumptionAmount),
Settled = allSpends.Where(a => a.ConsumptionTime.Date >= yearStart &&
- a.SettlementStatus == SpendConsts.Settled.Code)
+ a.SettlementStatus == ConsumptionConstant.Settled.Code)
.Sum(a => a.ConsumptionAmount)
};
businessStatisticsOutputDto.TotalConsumption = new TempDailyConsumption
{
Total = allSpends.Sum(a => a.ConsumptionAmount),
- Settled = allSpends.Where(a => a.SettlementStatus == SpendConsts.Settled.Code)
+ Settled = allSpends.Where(a => a.SettlementStatus == ConsumptionConstant.Settled.Code)
.Sum(a => a.ConsumptionAmount)
};
}
catch (Exception ex)
{
businessStatisticsOutputDto.Message = LocalizationHelper.GetLocalizedString(ex.Message, ex.Message);
- businessStatisticsOutputDto.StatusCode = StatusCodeConstants.InternalServerError;
+ businessStatisticsOutputDto.Code = BusinessStatusCode.InternalServerError;
}
return businessStatisticsOutputDto;
@@ -274,8 +274,8 @@ namespace EOM.TSHotelManagement.Application
.Where(a => a.IsDelete != 1)
.ToList();
- var totalCount = sellThings.Count;
- if (totalCount == 0)
+ var TotalCount = sellThings.Count;
+ if (TotalCount == 0)
{
dto.TotalProducts = 0;
dto.InventoryWarning = new TempInventoryWarning
@@ -305,7 +305,7 @@ namespace EOM.TSHotelManagement.Application
dto.InventoryWarning = new TempInventoryWarning
{
Status = "error",
- Percent = (int)Math.Round((dangerProducts.Count * 100.0) / totalCount),
+ Percent = (int)Math.Round((dangerProducts.Count * 100.0) / TotalCount),
Text = LocalizationHelper.GetLocalizedString(
$"{dangerProducts.Count} products in critical stock",
$"{dangerProducts.Count}种商品库存告急"),
@@ -317,7 +317,7 @@ namespace EOM.TSHotelManagement.Application
dto.InventoryWarning = new TempInventoryWarning
{
Status = "warning",
- Percent = (int)Math.Round((warningProducts.Count * 100.0) / totalCount),
+ Percent = (int)Math.Round((warningProducts.Count * 100.0) / TotalCount),
Text = LocalizationHelper.GetLocalizedString(
$"{warningProducts.Count} products in low stock",
$"{warningProducts.Count}种商品库存预警"),
@@ -349,11 +349,11 @@ namespace EOM.TSHotelManagement.Application
Quantity = a.ConsumptionQuantity
}).ToList();
- dto.StatusCode = StatusCodeConstants.Success;
+ dto.Code = BusinessStatusCode.Success;
}
catch (Exception)
{
- dto.StatusCode = StatusCodeConstants.InternalServerError;
+ dto.Code = BusinessStatusCode.InternalServerError;
dto.Message = LocalizationHelper.GetLocalizedString(
"System error, please try again later",
"系统繁忙,请稍后重试"
@@ -390,22 +390,10 @@ namespace EOM.TSHotelManagement.Application
catch (Exception ex)
{
humanResourcesOutputDto.Message = LocalizationHelper.GetLocalizedString(ex.Message, ex.Message);
- humanResourcesOutputDto.StatusCode = StatusCodeConstants.InternalServerError;
+ humanResourcesOutputDto.Code = BusinessStatusCode.InternalServerError;
}
return humanResourcesOutputDto;
}
-
- private string GetWarningText(int lowStockCount)
- {
- return lowStockCount switch
- {
- 0 => LocalizationHelper.GetLocalizedString("Stock normal", "库存正常"),
- > 0 and <= 5 => LocalizationHelper.GetLocalizedString("Low stock warning", "库存偏低"),
- > 5 => LocalizationHelper.GetLocalizedString("Critical stock", "库存告急"),
- _ => LocalizationHelper.GetLocalizedString("Stock abnormal", "库存异常")
- };
- }
-
}
}
diff --git a/EOM.TSHotelManagement.Application/EOM.TSHotelManagement.Application.csproj b/EOM.TSHotelManagement.Application/EOM.TSHotelManagement.Application.csproj
index 025a8ffb6d3a014eebd9915d88f90ab74e30af97..642d27f17f2149b9558d5328e1866f8fe5f74f70 100644
--- a/EOM.TSHotelManagement.Application/EOM.TSHotelManagement.Application.csproj
+++ b/EOM.TSHotelManagement.Application/EOM.TSHotelManagement.Application.csproj
@@ -5,16 +5,25 @@
enable
disable
True
+ AnyCPU;x64
1701;1702;8618;
+
+ 1701;1702;8618;
+
+
1701;1702;8618;
+
+ 1701;1702;8618;
+
+
diff --git a/EOM.TSHotelManagement.Application/Employee/Check/EmployeeCheckService.cs b/EOM.TSHotelManagement.Application/Employee/Check/EmployeeCheckService.cs
index 5624b21c4d50f4ffd326e0e5a0d5b5bf0d5208d8..b4cafdb3eb122f475554b22b49a5f86997e2dfd5 100644
--- a/EOM.TSHotelManagement.Application/Employee/Check/EmployeeCheckService.cs
+++ b/EOM.TSHotelManagement.Application/Employee/Check/EmployeeCheckService.cs
@@ -83,18 +83,22 @@ namespace EOM.TSHotelManagement.Application
workerChecks = workerCheckRepository.AsQueryable().Where(where.ToExpression())
.OrderByDescending(a => a.CheckTime)
.ToList();
+ count = workerChecks.Count;
}
workerChecks.ForEach(source =>
{
- source.CheckStatusDescription = source.CheckStatus == 0 ? "打卡成功" : "打卡失败";
+ source.CheckStatusDescription = source.CheckStatus == 0 ? "早班" : "晚班";
});
var source = EntityMapper.MapList(workerChecks);
return new ListOutputDto
{
- listSource = source,
- total = count
+ Data = new PagedData
+ {
+ Items = source,
+ TotalCount = count
+ }
};
}
@@ -113,12 +117,12 @@ namespace EOM.TSHotelManagement.Application
}
catch (Exception)
{
- return new SingleOutputDto { StatusCode = StatusCodeConstants.InternalServerError, Message = LocalizationHelper.GetLocalizedString("Query employee sign-in days failed", "查询员工签到天数失败") };
+ return new SingleOutputDto { Code = BusinessStatusCode.InternalServerError, Message = LocalizationHelper.GetLocalizedString("Query employee sign-in days failed", "查询员工签到天数失败") };
}
return new SingleOutputDto
{
- Source = new ReadEmployeeCheckOutputDto
+ Data = new ReadEmployeeCheckOutputDto
{
CheckDay = checkDay
}
@@ -133,20 +137,42 @@ namespace EOM.TSHotelManagement.Application
///
public SingleOutputDto SelectToDayCheckInfoByWorkerNo(ReadEmployeeCheckInputDto wkn)
{
- var isChecked = false;
try
{
var today = DateTime.Today;
- isChecked = workerCheckRepository.AsQueryable()
+ var tomorrow = today.AddDays(1);
+ var morningChecked = workerCheckRepository.AsQueryable()
+ .Any(a => a.EmployeeId == wkn.EmployeeId
+ && a.IsDelete != 1
+ && a.CheckStatus == 0
+ && a.CheckTime >= today && a.CheckTime < tomorrow);
+
+ var eveningChecked = workerCheckRepository.AsQueryable()
.Any(a => a.EmployeeId == wkn.EmployeeId
&& a.IsDelete != 1
- && a.CheckTime >= today && a.CheckTime < today.AddDays(1));
+ && a.CheckStatus == 1
+ && a.CheckTime >= today && a.CheckTime < tomorrow);
+
+ var checkDay = workerCheckRepository.AsQueryable().Count(a => a.EmployeeId == wkn.EmployeeId && a.IsDelete != 1);
+
+ return new SingleOutputDto
+ {
+ Data = new ReadEmployeeCheckOutputDto
+ {
+ MorningChecked = morningChecked,
+ EveningChecked = eveningChecked,
+ CheckDay = checkDay
+ }
+ };
}
catch (Exception ex)
{
- return new SingleOutputDto { StatusCode = StatusCodeConstants.InternalServerError, Message = LocalizationHelper.GetLocalizedString($"Error:\n{ex.Message}", $"错误:\n{ex.Message}") };
+ return new SingleOutputDto
+ {
+ Code = BusinessStatusCode.InternalServerError,
+ Message = LocalizationHelper.GetLocalizedString($"Error:\n{ex.Message}", $"错误:\n{ex.Message}")
+ };
}
- return new SingleOutputDto { Source = new ReadEmployeeCheckOutputDto { IsChecked = isChecked } };
}
///
@@ -154,17 +180,22 @@ namespace EOM.TSHotelManagement.Application
///
///
///
- public BaseOutputDto AddCheckInfo(CreateEmployeeCheckInputDto workerCheck)
+ public BaseResponse AddCheckInfo(CreateEmployeeCheckInputDto workerCheck)
{
try
{
- workerCheckRepository.Insert(EntityMapper.Map(workerCheck));
+ var entity = EntityMapper.Map(workerCheck);
+ var result = workerCheckRepository.Insert(entity);
+ if (!result)
+ {
+ return new BaseResponse { Message = LocalizationHelper.GetLocalizedString("insert employee check failed.", "员工打卡添加失败"), Code = BusinessStatusCode.InternalServerError };
+ }
}
catch (Exception ex)
{
- return new BaseOutputDto { Message = LocalizationHelper.GetLocalizedString(ex.Message, ex.Message), StatusCode = StatusCodeConstants.InternalServerError };
+ return new BaseResponse { Message = LocalizationHelper.GetLocalizedString(ex.Message, ex.Message), Code = BusinessStatusCode.InternalServerError };
}
- return new BaseOutputDto();
+ return new BaseResponse();
}
}
}
diff --git a/EOM.TSHotelManagement.Application/Employee/Check/IEmployeeCheckService.cs b/EOM.TSHotelManagement.Application/Employee/Check/IEmployeeCheckService.cs
index e852513d81ecc9c515fe3d0d235d1100228fbf93..70ada87eadf100ddc1147a7a9a5a2f6a214bc190 100644
--- a/EOM.TSHotelManagement.Application/Employee/Check/IEmployeeCheckService.cs
+++ b/EOM.TSHotelManagement.Application/Employee/Check/IEmployeeCheckService.cs
@@ -56,6 +56,6 @@ namespace EOM.TSHotelManagement.Application
///
///
///
- BaseOutputDto AddCheckInfo(CreateEmployeeCheckInputDto workerCheck);
+ BaseResponse AddCheckInfo(CreateEmployeeCheckInputDto workerCheck);
}
}
\ No newline at end of file
diff --git a/EOM.TSHotelManagement.Application/Employee/EmployeeService.cs b/EOM.TSHotelManagement.Application/Employee/EmployeeService.cs
index 265281d9ca61d202617f924357069dc9b3c80116..71f7d88df498a0ee3cd4ff0e0af4d07b066740b0 100644
--- a/EOM.TSHotelManagement.Application/Employee/EmployeeService.cs
+++ b/EOM.TSHotelManagement.Application/Employee/EmployeeService.cs
@@ -104,7 +104,7 @@ namespace EOM.TSHotelManagement.Application
///
///
///
- public BaseOutputDto UpdateEmployee(UpdateEmployeeInputDto updateEmployeeInputDto)
+ public BaseResponse UpdateEmployee(UpdateEmployeeInputDto updateEmployeeInputDto)
{
try
{
@@ -123,16 +123,16 @@ namespace EOM.TSHotelManagement.Application
updateEmployeeInputDto.PhoneNumber = sourceTelStr;
updateEmployeeInputDto.IdCardNumber = sourceIdStr;
- var password = workerRepository.GetSingle(a => a.EmployeeId == updateEmployeeInputDto.EmployeeId).Password;
+ var password = workerRepository.GetFirst(a => a.EmployeeId == updateEmployeeInputDto.EmployeeId).Password;
updateEmployeeInputDto.Password = password;
workerRepository.Update(EntityMapper.Map(updateEmployeeInputDto));
}
catch (Exception ex)
{
- return new BaseOutputDto { Message = LocalizationHelper.GetLocalizedString(ex.Message, ex.Message), StatusCode = StatusCodeConstants.InternalServerError };
+ return new BaseResponse { Message = LocalizationHelper.GetLocalizedString(ex.Message, ex.Message), Code = BusinessStatusCode.InternalServerError };
}
- return new BaseOutputDto();
+ return new BaseResponse();
}
@@ -141,7 +141,7 @@ namespace EOM.TSHotelManagement.Application
///
///
///
- public BaseOutputDto ManagerEmployeeAccount(UpdateEmployeeInputDto updateEmployeeInputDto)
+ public BaseResponse ManagerEmployeeAccount(UpdateEmployeeInputDto updateEmployeeInputDto)
{
try
{
@@ -152,9 +152,9 @@ namespace EOM.TSHotelManagement.Application
}
catch (Exception ex)
{
- return new BaseOutputDto { Message = LocalizationHelper.GetLocalizedString(ex.Message, ex.Message), StatusCode = StatusCodeConstants.InternalServerError };
+ return new BaseResponse { Message = LocalizationHelper.GetLocalizedString(ex.Message, ex.Message), Code = BusinessStatusCode.InternalServerError };
}
- return new BaseOutputDto();
+ return new BaseResponse();
}
///
@@ -162,7 +162,7 @@ namespace EOM.TSHotelManagement.Application
///
///
///
- public BaseOutputDto AddEmployee(CreateEmployeeInputDto createEmployeeInputDto)
+ public BaseResponse AddEmployee(CreateEmployeeInputDto createEmployeeInputDto)
{
try
{
@@ -183,22 +183,25 @@ namespace EOM.TSHotelManagement.Application
var newPassword = new RandomStringGenerator().GenerateSecurePassword();
sourcePwdStr = dataProtector.EncryptEmployeeData(newPassword);
+ var emailTemplate = EmailTemplate.GetNewRegistrationTemplate(newPassword);
+ var result = mailHelper.SendMail(new List { createEmployeeInputDto.EmailAddress }, emailTemplate.Subject, emailTemplate.Body, new List { createEmployeeInputDto.EmailAddress });
+ if (!result)
+ {
+ return new BaseResponse { Message = LocalizationHelper.GetLocalizedString("E-Mail Config Invaild, Add Employee Faild", "电子邮件配置无效,添加员工失败"), Code = BusinessStatusCode.InternalServerError };
+ }
+
createEmployeeInputDto.PhoneNumber = sourceTelStr;
createEmployeeInputDto.IdCardNumber = sourceIdStr;
createEmployeeInputDto.Password = sourcePwdStr;
workerRepository.Insert(EntityMapper.Map(createEmployeeInputDto));
- var emailTemplate = EmailTemplate.GetNewRegistrationTemplate(newPassword);
-
- mailHelper.SendMail(new List { createEmployeeInputDto.EmailAddress }, emailTemplate.Subject, emailTemplate.Body, new List { createEmployeeInputDto.EmailAddress });
-
}
catch (Exception ex)
{
- return new BaseOutputDto { Message = LocalizationHelper.GetLocalizedString(ex.Message, ex.Message), StatusCode = StatusCodeConstants.InternalServerError };
+ return new BaseResponse { Message = LocalizationHelper.GetLocalizedString(ex.Message, ex.Message), Code = BusinessStatusCode.InternalServerError };
}
- return new BaseOutputDto();
+ return new BaseResponse();
}
///
@@ -253,6 +256,7 @@ namespace EOM.TSHotelManagement.Application
employees = workerRepository.AsQueryable().Where(where.ToExpression())
.OrderBy(a => a.EmployeeId)
.ToList();
+ count = employees.Count;
}
employees.ForEach(source =>
@@ -284,9 +288,16 @@ namespace EOM.TSHotelManagement.Application
source.PoliticalAffiliationName = new EnumHelper().GetDescriptionByName(source.PoliticalAffiliation);
});
- var listSource = EntityMapper.MapList(employees);
+ var Data = EntityMapper.MapList(employees);
- return new ListOutputDto { listSource = listSource, total = count };
+ return new ListOutputDto
+ {
+ Data = new PagedData
+ {
+ Items = Data,
+ TotalCount = count
+ }
+ };
}
///
@@ -307,7 +318,7 @@ namespace EOM.TSHotelManagement.Application
Description = helper.GetEnumDescription(e)
})
.ToList();
- w = workerRepository.GetSingle(a => a.EmployeeId == readEmployeeInputDto.EmployeeId);
+ w = workerRepository.GetFirst(a => a.EmployeeId == readEmployeeInputDto.EmployeeId);
//解密身份证号码
var sourceStr = w.IdCardNumber.IsNullOrEmpty() ? "" : dataProtector.DecryptEmployeeData(w.IdCardNumber);
w.IdCardNumber = sourceStr;
@@ -318,29 +329,29 @@ namespace EOM.TSHotelManagement.Application
var sexType = genders.SingleOrDefault(a => a.Id == w.Gender);
w.GenderName = sexType.Description.IsNullOrEmpty() ? "" : sexType.Description;
//教育程度
- var eduction = educationRepository.GetSingle(a => a.EducationNumber == w.EducationLevel);
+ var eduction = educationRepository.GetFirst(a => a.EducationNumber == w.EducationLevel);
w.EducationLevelName = eduction.EducationName.IsNullOrEmpty() ? "" : eduction.EducationName;
//民族类型
- var nation = nationRepository.GetSingle(a => a.NationNumber == w.Ethnicity);
+ var nation = nationRepository.GetFirst(a => a.NationNumber == w.Ethnicity);
w.EthnicityName = nation.NationName.IsNullOrEmpty() ? "" : nation.NationName;
//部门
- var dept = deptRepository.GetSingle(a => a.DepartmentNumber == w.Department);
+ var dept = deptRepository.GetFirst(a => a.DepartmentNumber == w.Department);
w.DepartmentName = dept.DepartmentName.IsNullOrEmpty() ? "" : dept.DepartmentName;
//职位
- var position = positionRepository.GetSingle(a => a.PositionNumber == w.Position);
+ var position = positionRepository.GetFirst(a => a.PositionNumber == w.Position);
w.PositionName = position.PositionName.IsNullOrEmpty() ? "" : position.PositionName;
- var passport = passportTypeRepository.GetSingle(a => a.PassportId == w.IdCardType);
+ var passport = passportTypeRepository.GetFirst(a => a.PassportId == w.IdCardType);
w.IdCardTypeName = passport.IsNullOrEmpty() ? "" : passport.PassportName;
//面貌
w.PoliticalAffiliationName = new EnumHelper().GetDescriptionByName(w.PoliticalAffiliation);
var source = EntityMapper.Map(w);
- var employeePhoto = photoRepository.GetSingle(a => a.EmployeeId.Equals(source.EmployeeId));
+ var employeePhoto = photoRepository.GetFirst(a => a.EmployeeId.Equals(source.EmployeeId));
if (employeePhoto != null && !string.IsNullOrEmpty(employeePhoto.PhotoPath))
source.PhotoUrl = employeePhoto.PhotoPath ?? string.Empty;
- return new SingleOutputDto { Source = source };
+ return new SingleOutputDto { Data = source };
}
///
@@ -361,11 +372,11 @@ namespace EOM.TSHotelManagement.Application
Description = helper.GetEnumDescription(e)
})
.ToList();
- w = workerRepository.GetSingle(a => a.EmployeeId == readEmployeeInputDto.EmployeeId || a.EmailAddress == readEmployeeInputDto.EmailAddress);
+ w = workerRepository.GetFirst(a => a.EmployeeId == readEmployeeInputDto.EmployeeId || a.EmailAddress == readEmployeeInputDto.EmailAddress);
if (w == null)
{
w = null;
- return new SingleOutputDto { Source = null, Message = LocalizationHelper.GetLocalizedString("Employee does not exist or entered incorrectly", "员工不存在或输入有误") };
+ return new SingleOutputDto { Data = null, Message = LocalizationHelper.GetLocalizedString("Employee does not exist or entered incorrectly", "员工不存在或输入有误") };
}
var dbPwd = string.Empty;
@@ -374,28 +385,28 @@ namespace EOM.TSHotelManagement.Application
if (dbPwd != readEmployeeInputDto.Password)
{
w = null;
- return new SingleOutputDto { Source = EntityMapper.Map(w) };
+ return new SingleOutputDto { Data = EntityMapper.Map(w) };
}
w.Password = "";
//性别类型
var sexType = genders.SingleOrDefault(a => a.Id == w.Gender);
w.GenderName = sexType.Description.IsNullOrEmpty() ? "" : sexType.Description;
//教育程度
- var eduction = educationRepository.GetSingle(a => a.EducationNumber == w.EducationLevel);
+ var eduction = educationRepository.GetFirst(a => a.EducationNumber == w.EducationLevel);
w.EducationLevelName = eduction.EducationName.IsNullOrEmpty() ? "" : eduction.EducationName;
//民族类型
- var nation = nationRepository.GetSingle(a => a.NationNumber == w.Ethnicity);
+ var nation = nationRepository.GetFirst(a => a.NationNumber == w.Ethnicity);
w.EthnicityName = nation.NationName.IsNullOrEmpty() ? "" : nation.NationName;
//部门
- var dept = deptRepository.GetSingle(a => a.DepartmentNumber == w.Department);
+ var dept = deptRepository.GetFirst(a => a.DepartmentNumber == w.Department);
w.DepartmentName = dept.DepartmentName.IsNullOrEmpty() ? "" : dept.DepartmentName;
//职位
- var position = positionRepository.GetSingle(a => a.PositionNumber == w.Position);
+ var position = positionRepository.GetFirst(a => a.PositionNumber == w.Position);
w.PositionName = position.PositionName.IsNullOrEmpty() ? "" : position.PositionName;
w.UserToken = jWTHelper.GenerateJWT(new ClaimsIdentity(new List { new Claim(ClaimTypes.Name, w.EmployeeName), new Claim(ClaimTypes.SerialNumber, w.EmployeeId) }));
- return new SingleOutputDto { Source = EntityMapper.Map(w) };
+ return new SingleOutputDto { Data = EntityMapper.Map(w) };
}
///
@@ -403,18 +414,18 @@ namespace EOM.TSHotelManagement.Application
///
///
///
- public BaseOutputDto UpdateEmployeeAccountPassword(UpdateEmployeeInputDto updateEmployeeInputDto)
+ public BaseResponse UpdateEmployeeAccountPassword(UpdateEmployeeInputDto updateEmployeeInputDto)
{
try
{
- var employee = workerRepository.GetSingle(a => a.EmployeeId == updateEmployeeInputDto.EmployeeId);
+ var employee = workerRepository.GetFirst(a => a.EmployeeId == updateEmployeeInputDto.EmployeeId);
if (employee.IsNullOrEmpty())
{
- return new BaseOutputDto()
+ return new BaseResponse()
{
Message = LocalizationHelper.GetLocalizedString("This employee does not exists", "员工不存在"),
- StatusCode = StatusCodeConstants.InternalServerError
+ Code = BusinessStatusCode.InternalServerError
};
}
@@ -422,19 +433,19 @@ namespace EOM.TSHotelManagement.Application
if (!updateEmployeeInputDto.OldPassword.Equals(currentPassword))
{
- return new BaseOutputDto()
+ return new BaseResponse()
{
Message = LocalizationHelper.GetLocalizedString("The old password is incorrect", "旧密码不正确"),
- StatusCode = StatusCodeConstants.InternalServerError
+ Code = BusinessStatusCode.InternalServerError
};
}
if (updateEmployeeInputDto.Password.Equals(currentPassword))
{
- return new BaseOutputDto()
+ return new BaseResponse()
{
Message = LocalizationHelper.GetLocalizedString("The new password cannot be the same as the old password", "新密码不能与旧密码相同"),
- StatusCode = StatusCodeConstants.InternalServerError
+ Code = BusinessStatusCode.InternalServerError
};
}
@@ -447,20 +458,22 @@ namespace EOM.TSHotelManagement.Application
mailHelper.SendMail(new List { employee.EmailAddress }, mailTemplate.Subject, mailTemplate.Body, new List { employee.EmailAddress });
}
- workerRepository.Update(a => new Employee()
+ workerRepository.Update(new Employee()
{
+ Id = employee.Id,
+ EmployeeId = employee.EmployeeId,
Password = encrypted,
IsInitialize = 1,
DataChgUsr = updateEmployeeInputDto.DataChgUsr,
DataChgDate = updateEmployeeInputDto.DataChgDate
- }, a => a.EmployeeId == updateEmployeeInputDto.EmployeeId);
+ });
}
catch (Exception ex)
{
- return new BaseOutputDto { Message = LocalizationHelper.GetLocalizedString(ex.Message, ex.Message), StatusCode = StatusCodeConstants.InternalServerError };
+ return new BaseResponse { Message = LocalizationHelper.GetLocalizedString(ex.Message, ex.Message), Code = BusinessStatusCode.InternalServerError };
}
- return new BaseOutputDto();
+ return new BaseResponse();
}
///
@@ -468,41 +481,52 @@ namespace EOM.TSHotelManagement.Application
///
///
///
- public BaseOutputDto ResetEmployeeAccountPassword(UpdateEmployeeInputDto updateEmployeeInputDto)
+ public BaseResponse ResetEmployeeAccountPassword(UpdateEmployeeInputDto updateEmployeeInputDto)
{
try
{
var newPwd = new RandomStringGenerator().GenerateSecurePassword();
string encrypted = dataProtector.EncryptEmployeeData(newPwd);
- var employeeMailAddress = workerRepository.GetSingle(a => a.EmployeeId == updateEmployeeInputDto.EmployeeId).EmailAddress;
+ var employee = workerRepository.GetFirst(a => a.EmployeeId == updateEmployeeInputDto.EmployeeId);
- if (employeeMailAddress.IsNullOrEmpty())
+ var emailAddress = employee.EmailAddress;
+
+ if (emailAddress.IsNullOrEmpty())
{
- return new BaseOutputDto()
+ return new BaseResponse()
{
Message = LocalizationHelper.GetLocalizedString("No bound email address was found for the employee. Password reset cannot be completed."
, "未找到员工绑定的电子邮箱,无法重置密码。"),
- StatusCode = StatusCodeConstants.InternalServerError
+ Code = BusinessStatusCode.InternalServerError
};
}
var mailTemplate = EmailTemplate.GetResetPasswordTemplate(newPwd);
- mailHelper.SendMail(new List { employeeMailAddress }, mailTemplate.Subject, mailTemplate.Body, new List { employeeMailAddress });
- workerRepository.Update(a => new Employee()
+ var result = mailHelper.SendMail(new List { emailAddress },
+ mailTemplate.Subject, mailTemplate.Body,
+ new List { emailAddress });
+ if (!result)
{
+ return new BaseResponse { Message = LocalizationHelper.GetLocalizedString("E-Mail Config Invaild, Reset Password Faild", "电子邮件配置无效,重置密码失败"), Code = BusinessStatusCode.InternalServerError };
+ }
+
+ workerRepository.Update(new Employee()
+ {
+ Id = employee.Id,
+ EmployeeId = employee.EmployeeId,
Password = encrypted,
DataChgUsr = updateEmployeeInputDto.DataChgUsr,
DataChgDate = updateEmployeeInputDto.DataChgDate
- }, a => a.EmployeeId == updateEmployeeInputDto.EmployeeId);
+ });
}
catch (Exception ex)
{
- return new BaseOutputDto { Message = LocalizationHelper.GetLocalizedString(ex.Message, ex.Message), StatusCode = StatusCodeConstants.InternalServerError };
+ return new BaseResponse { Message = LocalizationHelper.GetLocalizedString(ex.Message, ex.Message), Code = BusinessStatusCode.InternalServerError };
}
- return new BaseOutputDto();
+ return new BaseResponse();
}
}
}
diff --git a/EOM.TSHotelManagement.Application/Employee/History/EmployeeHistoryService.cs b/EOM.TSHotelManagement.Application/Employee/History/EmployeeHistoryService.cs
index a6c7d0fdee2e78257131c4a5aa867d8c415b158c..ea4ed2186b42df1442c12bd6455af760a1facb2c 100644
--- a/EOM.TSHotelManagement.Application/Employee/History/EmployeeHistoryService.cs
+++ b/EOM.TSHotelManagement.Application/Employee/History/EmployeeHistoryService.cs
@@ -52,7 +52,7 @@ namespace EOM.TSHotelManagement.Application
///
///
///
- public BaseOutputDto AddHistoryByEmployeeId(CreateEmployeeHistoryInputDto workerHistory)
+ public BaseResponse AddHistoryByEmployeeId(CreateEmployeeHistoryInputDto workerHistory)
{
try
{
@@ -60,9 +60,9 @@ namespace EOM.TSHotelManagement.Application
}
catch (Exception ex)
{
- return new BaseOutputDto { Message = LocalizationHelper.GetLocalizedString(ex.Message, ex.Message), StatusCode = StatusCodeConstants.InternalServerError };
+ return new BaseResponse { Message = LocalizationHelper.GetLocalizedString(ex.Message, ex.Message), Code = BusinessStatusCode.InternalServerError };
}
- return new BaseOutputDto();
+ return new BaseResponse();
}
///
@@ -72,10 +72,16 @@ namespace EOM.TSHotelManagement.Application
///
public ListOutputDto SelectHistoryByEmployeeId(ReadEmployeeHistoryInputDto wid)
{
- List why = new List();
- why = workerHistoryRepository.GetList(a => a.IsDelete != 1 && a.EmployeeId == wid.EmployeeId);
- var source = EntityMapper.MapList(why);
- return new ListOutputDto { listSource = source, total = source.Count };
+ List why = workerHistoryRepository.GetList(a => a.IsDelete != 1 && a.EmployeeId == wid.EmployeeId);
+ var result = EntityMapper.MapList(why);
+ return new ListOutputDto
+ {
+ Data = new PagedData
+ {
+ Items = result,
+ TotalCount = result.Count
+ }
+ };
}
}
}
diff --git a/EOM.TSHotelManagement.Application/Employee/History/IEmployeeHistoryService.cs b/EOM.TSHotelManagement.Application/Employee/History/IEmployeeHistoryService.cs
index 380a8b53dfb78d9fe026b6a838aa13acd6844101..2ab1cc244417bbe2fdba4c55dfcf6925b267ba24 100644
--- a/EOM.TSHotelManagement.Application/Employee/History/IEmployeeHistoryService.cs
+++ b/EOM.TSHotelManagement.Application/Employee/History/IEmployeeHistoryService.cs
@@ -35,7 +35,7 @@ namespace EOM.TSHotelManagement.Application
///
///
///
- BaseOutputDto AddHistoryByEmployeeId(CreateEmployeeHistoryInputDto workerHistory);
+ BaseResponse AddHistoryByEmployeeId(CreateEmployeeHistoryInputDto workerHistory);
///
/// 根据工号查询履历信息
diff --git a/EOM.TSHotelManagement.Application/Employee/IEmployeeService.cs b/EOM.TSHotelManagement.Application/Employee/IEmployeeService.cs
index c703691afdee5701cfe52ad1a0fab3f9bd6f9bfb..83697fc0dc2d688db7f282f3e4f8b16ccd3299f0 100644
--- a/EOM.TSHotelManagement.Application/Employee/IEmployeeService.cs
+++ b/EOM.TSHotelManagement.Application/Employee/IEmployeeService.cs
@@ -35,21 +35,21 @@ namespace EOM.TSHotelManagement.Application
///
///
///
- BaseOutputDto UpdateEmployee(UpdateEmployeeInputDto updateEmployeeInputDto);
+ BaseResponse UpdateEmployee(UpdateEmployeeInputDto updateEmployeeInputDto);
///
/// 员工账号禁/启用
///
///
///
- BaseOutputDto ManagerEmployeeAccount(UpdateEmployeeInputDto updateEmployeeInputDto);
+ BaseResponse ManagerEmployeeAccount(UpdateEmployeeInputDto updateEmployeeInputDto);
///
/// 添加员工信息
///
///
///
- BaseOutputDto AddEmployee(CreateEmployeeInputDto createEmployeeInputDto);
+ BaseResponse AddEmployee(CreateEmployeeInputDto createEmployeeInputDto);
///
/// 获取所有工作人员信息
@@ -76,13 +76,13 @@ namespace EOM.TSHotelManagement.Application
///
///
///
- BaseOutputDto UpdateEmployeeAccountPassword(UpdateEmployeeInputDto updateEmployeeInputDto);
+ BaseResponse UpdateEmployeeAccountPassword(UpdateEmployeeInputDto updateEmployeeInputDto);
///
/// 重置员工账号密码
///
///
///
- BaseOutputDto ResetEmployeeAccountPassword(UpdateEmployeeInputDto updateEmployeeInputDto);
+ BaseResponse ResetEmployeeAccountPassword(UpdateEmployeeInputDto updateEmployeeInputDto);
}
}
\ No newline at end of file
diff --git a/EOM.TSHotelManagement.Application/Employee/Photo/EmployeePhotoService.cs b/EOM.TSHotelManagement.Application/Employee/Photo/EmployeePhotoService.cs
index f75c0e2c877c9b48375c2057629ed1075b734e95..5fb53cd9b00d874dc30f09848fc8cd3ffb3e274e 100644
--- a/EOM.TSHotelManagement.Application/Employee/Photo/EmployeePhotoService.cs
+++ b/EOM.TSHotelManagement.Application/Employee/Photo/EmployeePhotoService.cs
@@ -40,15 +40,15 @@ namespace EOM.TSHotelManagement.Application
///
public SingleOutputDto EmployeePhoto(ReadEmployeePhotoInputDto readEmployeePhotoInputDto)
{
- var workerPicSource = new EmployeePhoto();
+ var workerPicData = new EmployeePhoto();
- workerPicSource = workerPicRepository.GetSingle(a => a.EmployeeId.Equals(readEmployeePhotoInputDto.EmployeeId));
+ workerPicData = workerPicRepository.GetFirst(a => a.EmployeeId.Equals(readEmployeePhotoInputDto.EmployeeId));
- if (workerPicSource.IsNullOrEmpty())
+ if (workerPicData.IsNullOrEmpty())
{
return new SingleOutputDto
{
- Source = new ReadEmployeePhotoOutputDto
+ Data = new ReadEmployeePhotoOutputDto
{
PhotoId = 0,
PhotoPath = "",
@@ -59,7 +59,7 @@ namespace EOM.TSHotelManagement.Application
return new SingleOutputDto
{
- Source = EntityMapper.Map(workerPicSource)
+ Data = EntityMapper.Map(workerPicData)
};
}
///
@@ -74,7 +74,7 @@ namespace EOM.TSHotelManagement.Application
{
if (file == null || file.Length == 0)
{
- return new SingleOutputDto { Message = LocalizationHelper.GetLocalizedString("File cannot null", "文件不能为空"), StatusCode = StatusCodeConstants.BadRequest };
+ return new SingleOutputDto { Message = LocalizationHelper.GetLocalizedString("File cannot null", "文件不能为空"), Code = BusinessStatusCode.BadRequest };
}
if (file.Length > 1048576)
@@ -82,7 +82,7 @@ namespace EOM.TSHotelManagement.Application
return new SingleOutputDto
{
Message = LocalizationHelper.GetLocalizedString("Image size exceeds 1MB limit", "图片大小不能超过1MB"),
- StatusCode = StatusCodeConstants.BadRequest
+ Code = BusinessStatusCode.BadRequest
};
}
if (file.ContentType != "image/jpeg" && file.ContentType != "image/png")
@@ -90,14 +90,14 @@ namespace EOM.TSHotelManagement.Application
return new SingleOutputDto
{
Message = LocalizationHelper.GetLocalizedString("Invalid image format", "图片格式不正确"),
- StatusCode = StatusCodeConstants.BadRequest
+ Code = BusinessStatusCode.BadRequest
};
}
var token = lskyHelper.GetImageStorageTokenAsync().Result;
if (string.IsNullOrEmpty(token))
{
- return new SingleOutputDto { Message = LocalizationHelper.GetLocalizedString("Get Token Fail", "获取Token失败"), StatusCode = StatusCodeConstants.InternalServerError };
+ return new SingleOutputDto { Message = LocalizationHelper.GetLocalizedString("Get Token Fail", "获取Token失败"), Code = BusinessStatusCode.InternalServerError };
}
using var stream = file.OpenReadStream();
@@ -110,11 +110,11 @@ namespace EOM.TSHotelManagement.Application
).Result;
if (string.IsNullOrEmpty(imageUrl))
{
- return new SingleOutputDto { Message = "图片上传失败", StatusCode = StatusCodeConstants.InternalServerError };
+ return new SingleOutputDto { Message = "图片上传失败", Code = BusinessStatusCode.InternalServerError };
}
- var workerPicSource = workerPicRepository.GetSingle(a => a.EmployeeId.Equals(createEmployeePhotoInputDto.EmployeeId));
- if (workerPicSource.IsNullOrEmpty())
+ var workerPicData = workerPicRepository.GetFirst(a => a.EmployeeId.Equals(createEmployeePhotoInputDto.EmployeeId));
+ if (workerPicData.IsNullOrEmpty())
{
workerPicRepository.Insert(new EmployeePhoto
{
@@ -124,15 +124,17 @@ namespace EOM.TSHotelManagement.Application
}
else
{
- workerPicRepository.Update(a => new EmployeePhoto
+ workerPicRepository.Update(new EmployeePhoto
{
+ Id = workerPicData.Id,
+ EmployeeId = workerPicData.EmployeeId,
PhotoPath = imageUrl
- }, a => a.EmployeeId.Equals(createEmployeePhotoInputDto.EmployeeId));
+ });
}
return new SingleOutputDto
{
- Source = new ReadEmployeePhotoOutputDto
+ Data = new ReadEmployeePhotoOutputDto
{
PhotoId = 0,
PhotoPath = imageUrl,
@@ -142,7 +144,7 @@ namespace EOM.TSHotelManagement.Application
}
catch (Exception ex)
{
- return new SingleOutputDto { Message = LocalizationHelper.GetLocalizedString(ex.Message, ex.Message), StatusCode = StatusCodeConstants.InternalServerError };
+ return new SingleOutputDto { Message = LocalizationHelper.GetLocalizedString(ex.Message, ex.Message), Code = BusinessStatusCode.InternalServerError };
}
}
@@ -151,7 +153,7 @@ namespace EOM.TSHotelManagement.Application
///
///
///
- public BaseOutputDto DeleteWorkerPhoto(DeleteEmployeePhotoInputDto deleteEmployeePhotoInputDto)
+ public BaseResponse DeleteWorkerPhoto(DeleteEmployeePhotoInputDto deleteEmployeePhotoInputDto)
{
try
{
@@ -159,9 +161,9 @@ namespace EOM.TSHotelManagement.Application
}
catch (Exception ex)
{
- return new BaseOutputDto { Message = LocalizationHelper.GetLocalizedString(ex.Message, ex.Message), StatusCode = StatusCodeConstants.InternalServerError };
+ return new BaseResponse { Message = LocalizationHelper.GetLocalizedString(ex.Message, ex.Message), Code = BusinessStatusCode.InternalServerError };
}
- return new BaseOutputDto();
+ return new BaseResponse();
}
///
@@ -169,20 +171,23 @@ namespace EOM.TSHotelManagement.Application
///
///
///
- public BaseOutputDto UpdateWorkerPhoto(UpdateEmployeePhotoInputDto updateEmployeePhotoInputDto)
+ public BaseResponse UpdateWorkerPhoto(UpdateEmployeePhotoInputDto updateEmployeePhotoInputDto)
{
try
{
- workerPicRepository.Update(a => new EmployeePhoto
+ var workerPicData = workerPicRepository.GetFirst(a => a.EmployeeId.Equals(updateEmployeePhotoInputDto.EmployeeId));
+ workerPicRepository.Update(new EmployeePhoto
{
+ Id = workerPicData.Id,
+ EmployeeId = workerPicData.EmployeeId,
PhotoPath = updateEmployeePhotoInputDto.PhotoUrl
- }, a => a.EmployeeId.Equals(updateEmployeePhotoInputDto.EmployeeId));
+ });
}
catch (Exception ex)
{
- return new BaseOutputDto { Message = LocalizationHelper.GetLocalizedString(ex.Message, ex.Message), StatusCode = StatusCodeConstants.InternalServerError };
+ return new BaseResponse { Message = LocalizationHelper.GetLocalizedString(ex.Message, ex.Message), Code = BusinessStatusCode.InternalServerError };
}
- return new BaseOutputDto();
+ return new BaseResponse();
}
}
}
diff --git a/EOM.TSHotelManagement.Application/Employee/Photo/IEmployeePhotoService.cs b/EOM.TSHotelManagement.Application/Employee/Photo/IEmployeePhotoService.cs
index c521cfc5f1799d1bec241689ef1e8937048a8f7a..7f2e62efd21dee7d60842502afb13d9592c7a7e4 100644
--- a/EOM.TSHotelManagement.Application/Employee/Photo/IEmployeePhotoService.cs
+++ b/EOM.TSHotelManagement.Application/Employee/Photo/IEmployeePhotoService.cs
@@ -26,12 +26,12 @@ namespace EOM.TSHotelManagement.Application
///
///
///
- BaseOutputDto DeleteWorkerPhoto(DeleteEmployeePhotoInputDto deleteEmployeePhotoInputDto);
+ BaseResponse DeleteWorkerPhoto(DeleteEmployeePhotoInputDto deleteEmployeePhotoInputDto);
///
/// 更新员工照片
///
///
///
- BaseOutputDto UpdateWorkerPhoto(UpdateEmployeePhotoInputDto updateEmployeePhotoInputDto);
+ BaseResponse UpdateWorkerPhoto(UpdateEmployeePhotoInputDto updateEmployeePhotoInputDto);
}
}
diff --git a/EOM.TSHotelManagement.Application/Employee/RewardPunishment/IRewardPunishmentService.cs b/EOM.TSHotelManagement.Application/Employee/RewardPunishment/IRewardPunishmentService.cs
index 8ab8a000d8de38c43845a6f007fca2a690289a89..a5fd27b5fa76397d391b9a015eb67e647398c389 100644
--- a/EOM.TSHotelManagement.Application/Employee/RewardPunishment/IRewardPunishmentService.cs
+++ b/EOM.TSHotelManagement.Application/Employee/RewardPunishment/IRewardPunishmentService.cs
@@ -35,7 +35,7 @@ namespace EOM.TSHotelManagement.Application
///
///
///
- BaseOutputDto AddRewardPunishment(CreateEmployeeRewardPunishmentInputDto goodBad);
+ BaseResponse AddRewardPunishment(CreateEmployeeRewardPunishmentInputDto goodBad);
///
/// 根据工号查找所有的奖惩记录信息
diff --git a/EOM.TSHotelManagement.Application/Employee/RewardPunishment/RewardPunishmentService.cs b/EOM.TSHotelManagement.Application/Employee/RewardPunishment/RewardPunishmentService.cs
index 311d2d9f6e64a2c32bdaa309211a6d817ed38dd7..f8203213af53a90cd365cb1527c7dc13c01b3138 100644
--- a/EOM.TSHotelManagement.Application/Employee/RewardPunishment/RewardPunishmentService.cs
+++ b/EOM.TSHotelManagement.Application/Employee/RewardPunishment/RewardPunishmentService.cs
@@ -68,17 +68,22 @@ namespace EOM.TSHotelManagement.Application
///
///
///
- public BaseOutputDto AddRewardPunishment(CreateEmployeeRewardPunishmentInputDto goodBad)
+ public BaseResponse AddRewardPunishment(CreateEmployeeRewardPunishmentInputDto goodBad)
{
try
{
- rewardPunishmentRepository.Insert(EntityMapper.Map(goodBad));
+ var entity = EntityMapper.Map(goodBad);
+ var result = rewardPunishmentRepository.Insert(entity);
+ if (!result)
+ {
+ return new BaseResponse { Message = LocalizationHelper.GetLocalizedString("Add reward punishment failed", "员工奖惩记录添加失败"), Code = BusinessStatusCode.InternalServerError };
+ }
}
catch (Exception ex)
{
- return new BaseOutputDto { Message = LocalizationHelper.GetLocalizedString(ex.Message, ex.Message), StatusCode = StatusCodeConstants.InternalServerError };
+ return new BaseResponse { Message = LocalizationHelper.GetLocalizedString(ex.Message, ex.Message), Code = BusinessStatusCode.InternalServerError };
}
- return new BaseOutputDto();
+ return new BaseResponse();
}
///
@@ -101,10 +106,8 @@ namespace EOM.TSHotelManagement.Application
}
//查询所有超级管理员
- List admins = new List();
- admins = adminRepository.GetList(a => a.IsDelete != 1);
- List gBTypes = new List();
- gBTypes = goodbadTypeRepository.GetList(a => a.IsDelete != 1);
+ List admins = adminRepository.GetList(a => a.IsDelete != 1);
+ List gBTypes = goodbadTypeRepository.GetList(a => a.IsDelete != 1);
List gb = new List();
var count = 0;
@@ -120,6 +123,7 @@ namespace EOM.TSHotelManagement.Application
gb = rewardPunishmentRepository.AsQueryable().Where(where.ToExpression())
.OrderByDescending(a => a.RewardPunishmentTime)
.ToList();
+ count = gb.Count;
}
gb.ForEach(source =>
@@ -133,10 +137,15 @@ namespace EOM.TSHotelManagement.Application
source.OperatorName = admin.Name.IsNullOrEmpty() ? "" : admin.Name;
});
+ var mapped = EntityMapper.MapList(gb);
+
return new ListOutputDto
{
- listSource = EntityMapper.MapList(gb),
- total = count
+ Data = new PagedData
+ {
+ Items = mapped,
+ TotalCount = count
+ }
};
}
}
diff --git a/EOM.TSHotelManagement.Application/SystemManagement/Administrator/AdminService.cs b/EOM.TSHotelManagement.Application/SystemManagement/Administrator/AdminService.cs
index f2ac3cbd9a08e833497727d070401a3d3ac582cc..1f270143ad44ce6a24b026c6e150cc15cce96915 100644
--- a/EOM.TSHotelManagement.Application/SystemManagement/Administrator/AdminService.cs
+++ b/EOM.TSHotelManagement.Application/SystemManagement/Administrator/AdminService.cs
@@ -91,7 +91,7 @@ namespace EOM.TSHotelManagement.Application
throw new ArgumentNullException(nameof(readAdministratorInputDto));
}
- var existingAdmin = adminRepository.GetSingle(a => a.Account == readAdministratorInputDto.Account);
+ var existingAdmin = adminRepository.GetFirst(a => a.Account == readAdministratorInputDto.Account);
if (existingAdmin == null)
{
@@ -116,8 +116,9 @@ namespace EOM.TSHotelManagement.Application
}
catch (Exception)
{
- var originalPwd = dataProtector.DecryptAdministratorData(existingAdmin.Password);
- var passed = originalPwd == existingAdmin.Password;
+ var originalPwd = dataProtector.DecryptAdministratorData(readAdministratorInputDto.Password);
+ var currentPwd = dataProtector.DecryptAdministratorData(existingAdmin.Password);
+ var passed = originalPwd == currentPwd;
if (!passed)
{
return null;
@@ -133,14 +134,14 @@ namespace EOM.TSHotelManagement.Application
existingAdmin.UserToken = jWTHelper.GenerateJWT(new ClaimsIdentity(new Claim[]
{
new Claim(ClaimTypes.Name, existingAdmin.Name),
- new Claim(ClaimTypes.SerialNumber, existingAdmin.Account)
+ new Claim(ClaimTypes.SerialNumber, existingAdmin.Number)
}));
var source = EntityMapper.Map(existingAdmin);
return new SingleOutputDto
{
- Source = source
+ Data = source
};
}
@@ -156,38 +157,36 @@ namespace EOM.TSHotelManagement.Application
{
where = where.And(a => a.IsDelete == readAdministratorInputDto.IsDelete);
}
+
var count = 0;
- var listAdmins = new List();
- var listAdminType = adminTypeRepository.GetList(a => a.IsDelete != 1);
+ List administrators = new List();
if (!readAdministratorInputDto.IgnorePaging && readAdministratorInputDto.Page != 0 && readAdministratorInputDto.PageSize != 0)
{
- listAdmins = adminRepository.AsQueryable().Where(where.ToExpression()).ToPageList(readAdministratorInputDto.Page, readAdministratorInputDto.PageSize, ref count);
+ administrators = adminRepository.AsQueryable().Where(where.ToExpression()).ToPageList(readAdministratorInputDto.Page, readAdministratorInputDto.PageSize, ref count);
}
else
{
- listAdmins = adminRepository.AsQueryable().Where(where.ToExpression()).ToList();
+ administrators = adminRepository.AsQueryable().Where(where.ToExpression()).ToList();
+ count = administrators.Count;
}
- listAdmins.ForEach(admins =>
+ administrators.ForEach(admin =>
{
- var isAdminType = admins.IsSuperAdmin == 1 ? "是" : "否";
- admins.IsSuperAdminDescription = isAdminType;
-
- var adminType = listAdminType.SingleOrDefault(a => a.TypeId.Equals(admins.Type));
- admins.TypeName = adminType == null ? "" : adminType.TypeName;
-
- var adminDelete = admins.IsDelete == 1 ? "是" : "否";
- admins.DeleteDescription = adminDelete;
-
+ var type = adminTypeRepository.GetFirst(a => a.TypeId == admin.Type);
+ admin.TypeName = type?.TypeName ?? "";
+ admin.IsSuperAdminDescription = admin.IsSuperAdmin == 1 ? "是" : "否";
});
- var listSouce = EntityMapper.MapList(listAdmins);
+ var result = EntityMapper.MapList(administrators);
return new ListOutputDto
{
- listSource = listSouce,
- total = count
+ Data = new PagedData
+ {
+ Items = result,
+ TotalCount = count
+ }
};
}
@@ -196,29 +195,34 @@ namespace EOM.TSHotelManagement.Application
///
///
///
- public BaseOutputDto AddAdmin(CreateAdministratorInputDto createAdministratorInputDto)
+ public BaseResponse AddAdmin(CreateAdministratorInputDto createAdministratorInputDto)
{
try
{
var haveSuperAdmin = adminRepository.IsAny(a => a.IsSuperAdmin == createAdministratorInputDto.IsSuperAdmin && a.IsDelete != 1);
if (haveSuperAdmin)
{
- return new BaseOutputDto { Message = LocalizationHelper.GetLocalizedString("Super Administrator already exists", "超级管理员已存在"), StatusCode = StatusCodeConstants.InternalServerError };
+ return new BaseResponse { Message = LocalizationHelper.GetLocalizedString("Super Administrator already exists", "超级管理员已存在"), Code = BusinessStatusCode.InternalServerError };
}
var haveAdmin = adminRepository.IsAny(a => a.Account == createAdministratorInputDto.Account);
if (haveAdmin)
{
- return new BaseOutputDto { Message = LocalizationHelper.GetLocalizedString("Administrator already exists", "管理员已存在"), StatusCode = StatusCodeConstants.InternalServerError };
+ return new BaseResponse { Message = LocalizationHelper.GetLocalizedString("Administrator already exists", "管理员已存在"), Code = BusinessStatusCode.InternalServerError };
}
createAdministratorInputDto.Password = dataProtector.EncryptAdministratorData(createAdministratorInputDto.Password);
- adminRepository.Insert(EntityMapper.Map(createAdministratorInputDto));
+ var admin = EntityMapper.Map(createAdministratorInputDto);
+ var result = adminRepository.Insert(admin);
+ if (!result)
+ {
+ return new BaseResponse { Message = LocalizationHelper.GetLocalizedString("Add Administrator Failed", "添加管理员失败"), Code = BusinessStatusCode.InternalServerError };
+ }
}
catch (Exception ex)
{
- return new BaseOutputDto { Message = LocalizationHelper.GetLocalizedString(ex.Message, ex.Message), StatusCode = StatusCodeConstants.InternalServerError };
+ return new BaseResponse { Message = LocalizationHelper.GetLocalizedString(ex.Message, ex.Message), Code = BusinessStatusCode.InternalServerError };
}
- return new BaseOutputDto();
+ return new BaseResponse();
}
///
@@ -226,18 +230,23 @@ namespace EOM.TSHotelManagement.Application
///
///
///
- public BaseOutputDto UpdAdmin(UpdateAdministratorInputDto updateAdministratorInputDto)
+ public BaseResponse UpdAdmin(UpdateAdministratorInputDto updateAdministratorInputDto)
{
try
{
updateAdministratorInputDto.Password = dataProtector.EncryptAdministratorData(updateAdministratorInputDto.Password);
- adminRepository.Insert(EntityMapper.Map(updateAdministratorInputDto));
+ var admin = EntityMapper.Map(updateAdministratorInputDto);
+ var result = adminRepository.Update(admin);
+ if (!result)
+ {
+ return new BaseResponse { Message = LocalizationHelper.GetLocalizedString("Update Administrator Failed", "更新管理员失败"), Code = BusinessStatusCode.InternalServerError };
+ }
}
catch (Exception ex)
{
- return new BaseOutputDto { Message = LocalizationHelper.GetLocalizedString(ex.Message, ex.Message), StatusCode = StatusCodeConstants.InternalServerError };
+ return new BaseResponse { Message = LocalizationHelper.GetLocalizedString(ex.Message, ex.Message), Code = BusinessStatusCode.InternalServerError };
}
- return new BaseOutputDto();
+ return new BaseResponse();
}
///
@@ -245,22 +254,22 @@ namespace EOM.TSHotelManagement.Application
///
///
///
- public BaseOutputDto DelAdmin(DeleteAdministratorInputDto deleteAdministratorInputDto)
+ public BaseResponse DelAdmin(DeleteAdministratorInputDto deleteAdministratorInputDto)
{
try
{
var isSuperAdmin = adminRepository.IsAny(a => a.Number == deleteAdministratorInputDto.Number && a.IsSuperAdmin == 1);
if (isSuperAdmin)
{
- return new BaseOutputDto { Message = LocalizationHelper.GetLocalizedString("Super Administrator cannot be deleted", "超级管理员无法删除"), StatusCode = StatusCodeConstants.InternalServerError };
+ return new BaseResponse { Message = LocalizationHelper.GetLocalizedString("Super Administrator cannot be deleted", "超级管理员无法删除"), Code = BusinessStatusCode.InternalServerError };
}
- adminRepository.Delete(EntityMapper.Map(deleteAdministratorInputDto));
+ adminRepository.SoftDelete(EntityMapper.Map(deleteAdministratorInputDto));
}
catch (Exception ex)
{
- return new BaseOutputDto { Message = LocalizationHelper.GetLocalizedString(ex.Message, ex.Message), StatusCode = StatusCodeConstants.InternalServerError };
+ return new BaseResponse { Message = LocalizationHelper.GetLocalizedString(ex.Message, ex.Message), Code = BusinessStatusCode.InternalServerError };
}
- return new BaseOutputDto();
+ return new BaseResponse();
}
///
@@ -269,13 +278,35 @@ namespace EOM.TSHotelManagement.Application
///
public ListOutputDto GetAllAdminTypes(ReadAdministratorTypeInputDto readAdministratorTypeInputDto)
{
- var listAdminTypes = adminTypeRepository.GetList(a => a.IsDelete != 1);
+ var where = Expressionable.Create();
- var listSouce = EntityMapper.MapList(listAdminTypes);
+ if (!readAdministratorTypeInputDto.IsDelete.IsNullOrEmpty())
+ {
+ where = where.And(a => a.IsDelete == readAdministratorTypeInputDto.IsDelete);
+ }
+
+ var count = 0;
+ List administratorTypes = new List();
+
+ if (!readAdministratorTypeInputDto.IgnorePaging && readAdministratorTypeInputDto.Page != 0 && readAdministratorTypeInputDto.PageSize != 0)
+ {
+ administratorTypes = adminTypeRepository.AsQueryable().Where(where.ToExpression()).ToPageList(readAdministratorTypeInputDto.Page, readAdministratorTypeInputDto.PageSize, ref count);
+ }
+ else
+ {
+ administratorTypes = adminTypeRepository.AsQueryable().Where(where.ToExpression()).ToList();
+ count = administratorTypes.Count;
+ }
+
+ var result = EntityMapper.MapList(administratorTypes);
return new ListOutputDto
{
- listSource = listSouce
+ Data = new PagedData
+ {
+ Items = result,
+ TotalCount = count
+ }
};
}
@@ -284,7 +315,7 @@ namespace EOM.TSHotelManagement.Application
///
///
///
- public BaseOutputDto AddAdminType(CreateAdministratorTypeInputDto createAdministratorTypeInputDto)
+ public BaseResponse AddAdminType(CreateAdministratorTypeInputDto createAdministratorTypeInputDto)
{
try
{
@@ -292,9 +323,9 @@ namespace EOM.TSHotelManagement.Application
}
catch (Exception ex)
{
- return new BaseOutputDto { Message = LocalizationHelper.GetLocalizedString(ex.Message, ex.Message), StatusCode = StatusCodeConstants.InternalServerError };
+ return new BaseResponse { Message = LocalizationHelper.GetLocalizedString(ex.Message, ex.Message), Code = BusinessStatusCode.InternalServerError };
}
- return new BaseOutputDto();
+ return new BaseResponse();
}
///
@@ -302,17 +333,17 @@ namespace EOM.TSHotelManagement.Application
///
///
///
- public BaseOutputDto UpdAdminType(UpdateAdministratorTypeInputDto updateAdministratorTypeInputDto)
+ public BaseResponse UpdAdminType(UpdateAdministratorTypeInputDto updateAdministratorTypeInputDto)
{
try
{
- adminTypeRepository.Insert(EntityMapper.Map(updateAdministratorTypeInputDto));
+ adminTypeRepository.Update(EntityMapper.Map(updateAdministratorTypeInputDto));
}
catch (Exception ex)
{
- return new BaseOutputDto { Message = LocalizationHelper.GetLocalizedString(ex.Message, ex.Message), StatusCode = StatusCodeConstants.InternalServerError };
+ return new BaseResponse { Message = LocalizationHelper.GetLocalizedString(ex.Message, ex.Message), Code = BusinessStatusCode.InternalServerError };
}
- return new BaseOutputDto();
+ return new BaseResponse();
}
///
@@ -320,17 +351,19 @@ namespace EOM.TSHotelManagement.Application
///
///
///
- public BaseOutputDto DelAdminType(DeleteAdministratorTypeInputDto deleteAdministratorTypeInputDto)
+ public BaseResponse DelAdminType(DeleteAdministratorTypeInputDto deleteAdministratorTypeInputDto)
{
try
{
- adminTypeRepository.Delete(EntityMapper.Map(deleteAdministratorTypeInputDto));
+ var adminType = adminTypeRepository.GetFirst(a => a.TypeId == deleteAdministratorTypeInputDto.TypeId);
+ adminType.IsDelete = deleteAdministratorTypeInputDto.IsDelete;
+ adminTypeRepository.SoftDelete(adminType);
}
catch (Exception ex)
{
- return new BaseOutputDto { Message = LocalizationHelper.GetLocalizedString(ex.Message, ex.Message), StatusCode = StatusCodeConstants.InternalServerError };
+ return new BaseResponse { Message = LocalizationHelper.GetLocalizedString(ex.Message, ex.Message), Code = BusinessStatusCode.InternalServerError };
}
- return new BaseOutputDto();
+ return new BaseResponse();
}
}
}
diff --git a/EOM.TSHotelManagement.Application/SystemManagement/Administrator/IAdminService.cs b/EOM.TSHotelManagement.Application/SystemManagement/Administrator/IAdminService.cs
index fb10e4fa55be8356a177fd8eff4a23f77fd93dec..03bb4416fc1a414fcda5b02cdee7711ffb3d34a1 100644
--- a/EOM.TSHotelManagement.Application/SystemManagement/Administrator/IAdminService.cs
+++ b/EOM.TSHotelManagement.Application/SystemManagement/Administrator/IAdminService.cs
@@ -48,21 +48,21 @@ namespace EOM.TSHotelManagement.Application
///
///
///
- BaseOutputDto AddAdmin(CreateAdministratorInputDto createAdministratorInputDto);
+ BaseResponse AddAdmin(CreateAdministratorInputDto createAdministratorInputDto);
///
/// 更新管理员
///
///
///
- BaseOutputDto UpdAdmin(UpdateAdministratorInputDto updateAdministratorInputDto);
+ BaseResponse UpdAdmin(UpdateAdministratorInputDto updateAdministratorInputDto);
///
/// 删除管理员
///
///
///
- BaseOutputDto DelAdmin(DeleteAdministratorInputDto deleteAdministratorInputDto);
+ BaseResponse DelAdmin(DeleteAdministratorInputDto deleteAdministratorInputDto);
///
/// 获取所有管理员类型
@@ -75,20 +75,20 @@ namespace EOM.TSHotelManagement.Application
///
///
///
- BaseOutputDto AddAdminType(CreateAdministratorTypeInputDto createAdministratorTypeInputDto);
+ BaseResponse AddAdminType(CreateAdministratorTypeInputDto createAdministratorTypeInputDto);
///
/// 更新管理员类型
///
///
///
- BaseOutputDto UpdAdminType(UpdateAdministratorTypeInputDto updateAdministratorTypeInputDto);
+ BaseResponse UpdAdminType(UpdateAdministratorTypeInputDto updateAdministratorTypeInputDto);
///
/// 删除管理员类型
///
///
///
- BaseOutputDto DelAdminType(DeleteAdministratorTypeInputDto deleteAdministratorTypeInputDto);
+ BaseResponse DelAdminType(DeleteAdministratorTypeInputDto deleteAdministratorTypeInputDto);
}
}
\ No newline at end of file
diff --git a/EOM.TSHotelManagement.Application/SystemManagement/Base/BaseService.cs b/EOM.TSHotelManagement.Application/SystemManagement/Base/BaseService.cs
index fa7c40805f7fb7847ccaeb7019cc510d73a414a5..ed739fc1b662a26c3f5eacfc7112cc8f783c51d5 100644
--- a/EOM.TSHotelManagement.Application/SystemManagement/Base/BaseService.cs
+++ b/EOM.TSHotelManagement.Application/SystemManagement/Base/BaseService.cs
@@ -134,8 +134,11 @@ namespace EOM.TSHotelManagement.Application
return new ListOutputDto
{
- listSource = enumList,
- total = enumList.Count
+ Data = new PagedData
+ {
+ Items = enumList,
+ TotalCount = enumList.Count
+ }
};
}
@@ -162,8 +165,11 @@ namespace EOM.TSHotelManagement.Application
return new ListOutputDto
{
- listSource = enumList,
- total = enumList.Count
+ Data = new PagedData
+ {
+ Items = enumList,
+ TotalCount = enumList.Count
+ }
};
}
@@ -189,8 +195,11 @@ namespace EOM.TSHotelManagement.Application
return new ListOutputDto
{
- listSource = enumList,
- total = enumList.Count
+ Data = new PagedData
+ {
+ Items = enumList,
+ TotalCount = enumList.Count
+ }
};
}
#endregion
@@ -223,10 +232,18 @@ namespace EOM.TSHotelManagement.Application
else
{
positions = positionRepository.AsQueryable().Where(where.ToExpression()).ToList();
+ count = positions.Count;
}
var result = EntityMapper.MapList(positions);
- return new ListOutputDto { listSource = result, total = count };
+ return new ListOutputDto
+ {
+ Data = new PagedData
+ {
+ Items = result,
+ TotalCount = count
+ }
+ };
}
///
@@ -235,9 +252,9 @@ namespace EOM.TSHotelManagement.Application
///
public SingleOutputDto SelectPosition(ReadPositionInputDto positionInputDto)
{
- var position = positionRepository.GetSingle(a => a.Id == positionInputDto.PositionId);
+ var position = positionRepository.GetFirst(a => a.Id == positionInputDto.PositionId);
var result = EntityMapper.Map(position);
- return new SingleOutputDto { Source = result };
+ return new SingleOutputDto { Data = result };
}
///
@@ -245,11 +262,11 @@ namespace EOM.TSHotelManagement.Application
///
///
///
- public BaseOutputDto AddPosition(CreatePositionInputDto createPositionInputDto)
+ public BaseResponse AddPosition(CreatePositionInputDto createPositionInputDto)
{
var position = EntityMapper.Map(createPositionInputDto);
var result = positionRepository.Insert(position);
- return new BaseOutputDto { StatusCode = result ? StatusCodeConstants.Success : StatusCodeConstants.InternalServerError };
+ return new BaseResponse { Code = result ? BusinessStatusCode.Success : BusinessStatusCode.InternalServerError };
}
///
@@ -257,15 +274,10 @@ namespace EOM.TSHotelManagement.Application
///
///
///
- public BaseOutputDto DelPosition(DeletePositionInputDto deletePositionInputDto)
+ public BaseResponse DelPosition(DeletePositionInputDto deletePositionInputDto)
{
- var result = positionRepository.Update(a => new Position()
- {
- IsDelete = deletePositionInputDto.IsDelete,
- DataChgUsr = deletePositionInputDto.DataChgUsr,
- DataChgDate = deletePositionInputDto.DataChgDate
- }, a => a.PositionNumber == deletePositionInputDto.PositionNumber);
- return new BaseOutputDto { StatusCode = result ? StatusCodeConstants.Success : StatusCodeConstants.InternalServerError };
+ var result = positionRepository.SoftDelete(EntityMapper.Map(deletePositionInputDto));
+ return new BaseResponse { Code = result ? BusinessStatusCode.Success : BusinessStatusCode.InternalServerError };
}
///
@@ -273,15 +285,11 @@ namespace EOM.TSHotelManagement.Application
///
///
///
- public BaseOutputDto UpdPosition(UpdatePositionInputDto updatePositionInputDto)
+ public BaseResponse UpdPosition(UpdatePositionInputDto updatePositionInputDto)
{
- var result = positionRepository.Update(a => new Position()
- {
- PositionName = updatePositionInputDto.PositionName,
- DataChgUsr = updatePositionInputDto.DataChgUsr,
- DataChgDate = updatePositionInputDto.DataChgDate
- }, a => a.PositionNumber == updatePositionInputDto.PositionNumber);
- return new BaseOutputDto { StatusCode = result ? StatusCodeConstants.Success : StatusCodeConstants.InternalServerError };
+ var position = EntityMapper.Map(updatePositionInputDto);
+ var result = positionRepository.Update(position);
+ return new BaseResponse { Code = result ? BusinessStatusCode.Success : BusinessStatusCode.InternalServerError };
}
#endregion
@@ -311,10 +319,18 @@ namespace EOM.TSHotelManagement.Application
else
{
nations = nationRepository.AsQueryable().Where(where.ToExpression()).ToList();
+ count = nations.Count;
}
var result = EntityMapper.MapList(nations);
- return new ListOutputDto { listSource = result, total = count };
+ return new ListOutputDto
+ {
+ Data = new PagedData
+ {
+ Items = result,
+ TotalCount = count
+ }
+ };
}
///
@@ -323,9 +339,9 @@ namespace EOM.TSHotelManagement.Application
///
public SingleOutputDto SelectNation(ReadNationInputDto nationInputDto)
{
- var nation = nationRepository.GetSingle(a => a.Id == nationInputDto.NationId);
+ var nation = nationRepository.GetFirst(a => a.Id == nationInputDto.NationId);
var result = EntityMapper.Map(nation);
- return new SingleOutputDto { Source = result };
+ return new SingleOutputDto { Data = result };
}
///
@@ -333,11 +349,11 @@ namespace EOM.TSHotelManagement.Application
///
///
///
- public BaseOutputDto AddNation(CreateNationInputDto createNationInputDto)
+ public BaseResponse AddNation(CreateNationInputDto createNationInputDto)
{
var nation = EntityMapper.Map(createNationInputDto);
var result = nationRepository.Insert(nation);
- return new BaseOutputDto { StatusCode = result ? StatusCodeConstants.Success : StatusCodeConstants.InternalServerError };
+ return new BaseResponse { Code = result ? BusinessStatusCode.Success : BusinessStatusCode.InternalServerError };
}
///
@@ -345,15 +361,10 @@ namespace EOM.TSHotelManagement.Application
///
///
///
- public BaseOutputDto DelNation(DeleteNationInputDto deleteNationInputDto)
+ public BaseResponse DelNation(DeleteNationInputDto deleteNationInputDto)
{
- var result = nationRepository.Update(a => new Nation()
- {
- IsDelete = deleteNationInputDto.IsDelete,
- DataChgUsr = deleteNationInputDto.DataChgUsr,
- DataChgDate = deleteNationInputDto.DataChgDate
- }, a => a.NationNumber == deleteNationInputDto.NationNumber);
- return new BaseOutputDto { StatusCode = result ? StatusCodeConstants.Success : StatusCodeConstants.InternalServerError };
+ var result = nationRepository.SoftDelete(EntityMapper.Map(deleteNationInputDto));
+ return new BaseResponse { Code = result ? BusinessStatusCode.Success : BusinessStatusCode.InternalServerError };
}
///
@@ -361,15 +372,11 @@ namespace EOM.TSHotelManagement.Application
///
///
///
- public BaseOutputDto UpdNation(UpdateNationInputDto updateNationInputDto)
+ public BaseResponse UpdNation(UpdateNationInputDto updateNationInputDto)
{
- var result = nationRepository.Update(a => new Nation()
- {
- NationName = updateNationInputDto.NationName,
- DataChgUsr = updateNationInputDto.DataChgUsr,
- DataChgDate = updateNationInputDto.DataChgDate
- }, a => a.NationNumber == updateNationInputDto.NationNumber);
- return new BaseOutputDto { StatusCode = result ? StatusCodeConstants.Success : StatusCodeConstants.InternalServerError };
+ var nation = EntityMapper.Map(updateNationInputDto);
+ var result = nationRepository.Update(nation);
+ return new BaseResponse { Code = result ? BusinessStatusCode.Success : BusinessStatusCode.InternalServerError };
}
#endregion
@@ -398,10 +405,18 @@ namespace EOM.TSHotelManagement.Application
else
{
educations = educationRepository.AsQueryable().Where(where.ToExpression()).ToList();
+ count = educations.Count;
}
var result = EntityMapper.MapList(educations);
- return new ListOutputDto { listSource = result, total = count };
+ return new ListOutputDto
+ {
+ Data = new PagedData
+ {
+ Items = result,
+ TotalCount = count
+ }
+ };
}
///
@@ -410,9 +425,9 @@ namespace EOM.TSHotelManagement.Application
///
public SingleOutputDto SelectEducation(ReadEducationInputDto educationInputDto)
{
- var education = educationRepository.GetSingle(a => a.EducationNumber == educationInputDto.EducationNumber);
+ var education = educationRepository.GetFirst(a => a.EducationNumber == educationInputDto.EducationNumber);
var result = EntityMapper.Map(education);
- return new SingleOutputDto { Source = result };
+ return new SingleOutputDto { Data = result };
}
///
@@ -420,11 +435,11 @@ namespace EOM.TSHotelManagement.Application
///
///
///
- public BaseOutputDto AddEducation(CreateEducationInputDto createEducationInputDto)
+ public BaseResponse AddEducation(CreateEducationInputDto createEducationInputDto)
{
var education = EntityMapper.Map(createEducationInputDto);
var result = educationRepository.Insert(education);
- return new BaseOutputDto { StatusCode = result ? StatusCodeConstants.Success : StatusCodeConstants.InternalServerError };
+ return new BaseResponse { Code = result ? BusinessStatusCode.Success : BusinessStatusCode.InternalServerError };
}
///
@@ -432,15 +447,10 @@ namespace EOM.TSHotelManagement.Application
///
///
///
- public BaseOutputDto DelEducation(DeleteEducationInputDto deleteEducationInputDto)
+ public BaseResponse DelEducation(DeleteEducationInputDto deleteEducationInputDto)
{
- var result = educationRepository.Update(a => new Education()
- {
- IsDelete = deleteEducationInputDto.IsDelete,
- DataChgUsr = deleteEducationInputDto.DataChgUsr,
- DataChgDate = deleteEducationInputDto.DataChgDate
- }, a => a.EducationNumber == deleteEducationInputDto.EducationNumber);
- return new BaseOutputDto { StatusCode = result ? StatusCodeConstants.Success : StatusCodeConstants.InternalServerError };
+ var result = educationRepository.SoftDelete(EntityMapper.Map(deleteEducationInputDto));
+ return new BaseResponse { Code = result ? BusinessStatusCode.Success : BusinessStatusCode.InternalServerError };
}
///
@@ -448,15 +458,11 @@ namespace EOM.TSHotelManagement.Application
///
///
///
- public BaseOutputDto UpdEducation(UpdateEducationInputDto education)
+ public BaseResponse UpdEducation(UpdateEducationInputDto education)
{
- var result = educationRepository.Update(a => new Education()
- {
- EducationName = education.EducationName,
- DataChgUsr = education.DataChgUsr,
- DataChgDate = education.DataChgDate
- }, a => a.EducationNumber == education.EducationNumber);
- return new BaseOutputDto { StatusCode = result ? StatusCodeConstants.Success : StatusCodeConstants.InternalServerError };
+ var entity = EntityMapper.Map(education);
+ var result = educationRepository.Update(entity);
+ return new BaseResponse { Code = result ? BusinessStatusCode.Success : BusinessStatusCode.InternalServerError };
}
#endregion
@@ -471,7 +477,14 @@ namespace EOM.TSHotelManagement.Application
{
var depts = deptRepository.GetList(a => a.IsDelete != 1);
var result = EntityMapper.MapList(depts);
- return new ListOutputDto { listSource = result, total = result.Count };
+ return new ListOutputDto
+ {
+ Data = new PagedData
+ {
+ Items = result,
+ TotalCount = result.Count
+ }
+ };
}
///
@@ -495,6 +508,7 @@ namespace EOM.TSHotelManagement.Application
else
{
depts = deptRepository.AsQueryable().Where(where.ToExpression()).ToList();
+ count = depts.Count;
}
var parentDepartmentNumbers = depts.Where(a => !a.ParentDepartmentNumber.IsNullOrEmpty()).Select(a => a.ParentDepartmentNumber).ToList();
@@ -511,7 +525,14 @@ namespace EOM.TSHotelManagement.Application
source.LeaderName = departmentLeader.IsNullOrEmpty() ? "" : departmentLeader.EmployeeName;
});
var result = EntityMapper.MapList(depts);
- return new ListOutputDto { listSource = result, total = count };
+ return new ListOutputDto
+ {
+ Data = new PagedData
+ {
+ Items = result,
+ TotalCount = count
+ }
+ };
}
///
@@ -520,9 +541,9 @@ namespace EOM.TSHotelManagement.Application
///
public SingleOutputDto SelectDept(ReadDepartmentInputDto dept)
{
- var department = deptRepository.GetSingle(a => a.Id == dept.Id);
+ var department = deptRepository.GetFirst(a => a.Id == dept.Id);
var result = EntityMapper.Map(department);
- return new SingleOutputDto { Source = result };
+ return new SingleOutputDto { Data = result };
}
///
@@ -530,11 +551,11 @@ namespace EOM.TSHotelManagement.Application
///
///
///
- public BaseOutputDto AddDept(CreateDepartmentInputDto dept)
+ public BaseResponse AddDept(CreateDepartmentInputDto dept)
{
var department = EntityMapper.Map(dept);
var result = deptRepository.Insert(department);
- return new BaseOutputDto { StatusCode = result ? StatusCodeConstants.Success : StatusCodeConstants.InternalServerError };
+ return new BaseResponse { Code = result ? BusinessStatusCode.Success : BusinessStatusCode.InternalServerError };
}
///
@@ -542,15 +563,10 @@ namespace EOM.TSHotelManagement.Application
///
///
///
- public BaseOutputDto DelDept(DeleteDepartmentInputDto dept)
+ public BaseResponse DelDept(DeleteDepartmentInputDto dept)
{
- var result = deptRepository.Update(a => new Department()
- {
- IsDelete = dept.IsDelete,
- DataChgUsr = dept.DataChgUsr,
- DataChgDate = dept.DataChgDate
- }, a => a.Id == dept.Id);
- return new BaseOutputDto { StatusCode = result ? StatusCodeConstants.Success : StatusCodeConstants.InternalServerError };
+ var result = deptRepository.SoftDelete(EntityMapper.Map(dept));
+ return new BaseResponse { Code = result ? BusinessStatusCode.Success : BusinessStatusCode.InternalServerError };
}
///
@@ -558,19 +574,11 @@ namespace EOM.TSHotelManagement.Application
///
///
///
- public BaseOutputDto UpdDept(UpdateDepartmentInputDto dept)
+ public BaseResponse UpdDept(UpdateDepartmentInputDto dept)
{
- var result = deptRepository.Update(a => new Department()
- {
- DepartmentName = dept.DepartmentName,
- DepartmentDescription = dept.DepartmentDescription,
- DepartmentLeader = dept.DepartmentLeader,
- ParentDepartmentNumber = dept.ParentDepartmentNumber,
- DepartmentCreationDate = dept.DepartmentCreationDate,
- DataChgUsr = dept.DataChgUsr,
- DataChgDate = dept.DataChgDate
- }, a => a.DepartmentNumber == dept.DepartmentNumber);
- return new BaseOutputDto { StatusCode = result ? StatusCodeConstants.Success : StatusCodeConstants.InternalServerError };
+ var department = EntityMapper.Map(dept);
+ var result = deptRepository.Update(department);
+ return new BaseResponse { Code = result ? BusinessStatusCode.Success : BusinessStatusCode.InternalServerError };
}
#endregion
@@ -585,7 +593,14 @@ namespace EOM.TSHotelManagement.Application
{
var custoTypes = custoTypeRepository.GetList(a => a.IsDelete != 1);
var result = EntityMapper.MapList(custoTypes);
- return new ListOutputDto { listSource = result, total = result.Count };
+ return new ListOutputDto
+ {
+ Data = new PagedData
+ {
+ Items = result,
+ TotalCount = result.Count
+ }
+ };
}
///
@@ -609,10 +624,18 @@ namespace EOM.TSHotelManagement.Application
else
{
custoTypes = custoTypeRepository.AsQueryable().Where(where.ToExpression()).ToList();
+ count = custoTypes.Count;
}
var result = EntityMapper.MapList(custoTypes);
- return new ListOutputDto { listSource = result, total = count };
+ return new ListOutputDto
+ {
+ Data = new PagedData
+ {
+ Items = result,
+ TotalCount = count
+ }
+ };
}
///
@@ -622,9 +645,9 @@ namespace EOM.TSHotelManagement.Application
///
public SingleOutputDto SelectCustoTypeByTypeId(ReadCustoTypeInputDto custoType)
{
- var custoTypeEntity = custoTypeRepository.GetSingle(a => a.CustomerType == custoType.CustomerType && a.IsDelete != 1);
+ var custoTypeEntity = custoTypeRepository.GetFirst(a => a.CustomerType == custoType.CustomerType && a.IsDelete != 1);
var result = EntityMapper.Map(custoTypeEntity);
- return new SingleOutputDto { Source = result };
+ return new SingleOutputDto { Data = result };
}
///
@@ -632,11 +655,11 @@ namespace EOM.TSHotelManagement.Application
///
///
///
- public BaseOutputDto InsertCustoType(CreateCustoTypeInputDto custoType)
+ public BaseResponse InsertCustoType(CreateCustoTypeInputDto custoType)
{
var custoTypeEntity = EntityMapper.Map(custoType);
var result = custoTypeRepository.Insert(custoTypeEntity);
- return new BaseOutputDto { StatusCode = result ? StatusCodeConstants.Success : StatusCodeConstants.InternalServerError };
+ return new BaseResponse { Code = result ? BusinessStatusCode.Success : BusinessStatusCode.InternalServerError };
}
///
@@ -644,14 +667,10 @@ namespace EOM.TSHotelManagement.Application
///
///
///
- public BaseOutputDto DeleteCustoType(DeleteCustoTypeInputDto custoType)
+ public BaseResponse DeleteCustoType(DeleteCustoTypeInputDto custoType)
{
- var result = custoTypeRepository.Update(a => new CustoType()
- {
- IsDelete = 1,
- DataChgUsr = custoType.DataChgUsr
- }, a => a.CustomerType == custoType.CustomerType);
- return new BaseOutputDto { StatusCode = result ? StatusCodeConstants.Success : StatusCodeConstants.InternalServerError };
+ var result = custoTypeRepository.SoftDelete(EntityMapper.Map(custoType));
+ return new BaseResponse { Code = result ? BusinessStatusCode.Success : BusinessStatusCode.InternalServerError };
}
///
@@ -659,16 +678,11 @@ namespace EOM.TSHotelManagement.Application
///
///
///
- public BaseOutputDto UpdateCustoType(UpdateCustoTypeInputDto custoType)
+ public BaseResponse UpdateCustoType(UpdateCustoTypeInputDto custoType)
{
- var result = custoTypeRepository.Update(a => new CustoType()
- {
- CustomerTypeName = custoType.CustomerTypeName,
- Discount = custoType.Discount,
- DataChgUsr = custoType.DataChgUsr,
- DataChgDate = custoType.DataChgDate
- }, a => a.CustomerType == custoType.CustomerType);
- return new BaseOutputDto { StatusCode = result ? StatusCodeConstants.Success : StatusCodeConstants.InternalServerError };
+ var entity = EntityMapper.Map(custoType);
+ var result = custoTypeRepository.Update(entity);
+ return new BaseResponse { Code = result ? BusinessStatusCode.Success : BusinessStatusCode.InternalServerError };
}
#endregion
@@ -683,7 +697,14 @@ namespace EOM.TSHotelManagement.Application
{
var passPortTypes = passPortTypeRepository.GetList(a => a.IsDelete != 1);
var result = EntityMapper.MapList(passPortTypes);
- return new ListOutputDto { listSource = result, total = result.Count };
+ return new ListOutputDto
+ {
+ Data = new PagedData
+ {
+ Items = result,
+ TotalCount = result.Count
+ }
+ };
}
///
@@ -707,10 +728,18 @@ namespace EOM.TSHotelManagement.Application
else
{
passPortTypes = passPortTypeRepository.AsQueryable().Where(where.ToExpression()).ToList();
+ count = passPortTypes.Count;
}
var result = EntityMapper.MapList(passPortTypes);
- return new ListOutputDto { listSource = result, total = count };
+ return new ListOutputDto
+ {
+ Data = new PagedData
+ {
+ Items = result,
+ TotalCount = count
+ }
+ };
}
///
@@ -720,9 +749,9 @@ namespace EOM.TSHotelManagement.Application
///
public SingleOutputDto SelectPassPortTypeByTypeId(ReadPassportTypeInputDto passPortType)
{
- var passPortTypeEntity = passPortTypeRepository.GetSingle(a => a.PassportId == passPortType.PassportId && a.IsDelete != 1);
+ var passPortTypeEntity = passPortTypeRepository.GetFirst(a => a.PassportId == passPortType.PassportId && a.IsDelete != 1);
var result = EntityMapper.Map(passPortTypeEntity);
- return new SingleOutputDto { Source = result };
+ return new SingleOutputDto { Data = result };
}
///
@@ -730,11 +759,11 @@ namespace EOM.TSHotelManagement.Application
///
///
///
- public BaseOutputDto InsertPassPortType(CreatePassportTypeInputDto passPortType)
+ public BaseResponse InsertPassPortType(CreatePassportTypeInputDto passPortType)
{
var passPortTypeEntity = EntityMapper.Map(passPortType);
var result = passPortTypeRepository.Insert(passPortTypeEntity);
- return new BaseOutputDto { StatusCode = result ? StatusCodeConstants.Success : StatusCodeConstants.InternalServerError };
+ return new BaseResponse { Code = result ? BusinessStatusCode.Success : BusinessStatusCode.InternalServerError };
}
///
@@ -742,14 +771,10 @@ namespace EOM.TSHotelManagement.Application
///
///
///
- public BaseOutputDto DeletePassPortType(DeletePassportTypeInputDto portType)
+ public BaseResponse DeletePassPortType(DeletePassportTypeInputDto portType)
{
- var result = passPortTypeRepository.Update(a => new PassportType()
- {
- IsDelete = 1,
- DataChgUsr = portType.DataChgUsr,
- }, a => a.PassportId == portType.PassportId);
- return new BaseOutputDto { StatusCode = result ? StatusCodeConstants.Success : StatusCodeConstants.InternalServerError };
+ var result = passPortTypeRepository.SoftDelete(EntityMapper.Map(portType));
+ return new BaseResponse { Code = result ? BusinessStatusCode.Success : BusinessStatusCode.InternalServerError };
}
///
@@ -757,15 +782,11 @@ namespace EOM.TSHotelManagement.Application
///
///
///
- public BaseOutputDto UpdatePassPortType(UpdatePassportTypeInputDto portType)
+ public BaseResponse UpdatePassPortType(UpdatePassportTypeInputDto portType)
{
- var result = passPortTypeRepository.Update(a => new PassportType()
- {
- PassportName = portType.PassportName,
- DataChgUsr = portType.DataChgUsr,
- DataChgDate = portType.DataChgDate
- }, a => a.PassportId == portType.PassportId);
- return new BaseOutputDto { StatusCode = result ? StatusCodeConstants.Success : StatusCodeConstants.InternalServerError };
+ var entity = EntityMapper.Map(portType);
+ var result = passPortTypeRepository.Update(entity);
+ return new BaseResponse { Code = result ? BusinessStatusCode.Success : BusinessStatusCode.InternalServerError };
}
#endregion
@@ -780,7 +801,14 @@ namespace EOM.TSHotelManagement.Application
{
var gBTypes = goodbadTypeRepository.GetList(a => a.IsDelete != 1);
var result = EntityMapper.MapList(gBTypes);
- return new ListOutputDto { listSource = result, total = result.Count };
+ return new ListOutputDto
+ {
+ Data = new PagedData
+ {
+ Items = result,
+ TotalCount = result.Count
+ }
+ };
}
///
@@ -804,10 +832,18 @@ namespace EOM.TSHotelManagement.Application
else
{
gBTypes = goodbadTypeRepository.AsQueryable().Where(where.ToExpression()).ToList();
+ count = gBTypes.Count;
}
var result = EntityMapper.MapList(gBTypes);
- return new ListOutputDto { listSource = result, total = count };
+ return new ListOutputDto
+ {
+ Data = new PagedData
+ {
+ Items = result,
+ TotalCount = count
+ }
+ };
}
///
@@ -817,9 +853,9 @@ namespace EOM.TSHotelManagement.Application
///
public SingleOutputDto SelectRewardPunishmentTypeByTypeId(ReadRewardPunishmentTypeInputDto gBType)
{
- var gBTypeEntity = goodbadTypeRepository.GetSingle(a => a.RewardPunishmentTypeId == gBType.RewardPunishmentTypeId && a.IsDelete != 1);
+ var gBTypeEntity = goodbadTypeRepository.GetFirst(a => a.RewardPunishmentTypeId == gBType.RewardPunishmentTypeId && a.IsDelete != 1);
var result = EntityMapper.Map(gBTypeEntity);
- return new SingleOutputDto { Source = result };
+ return new SingleOutputDto { Data = result };
}
///
@@ -827,11 +863,11 @@ namespace EOM.TSHotelManagement.Application
///
///
///
- public BaseOutputDto InsertRewardPunishmentType(CreateRewardPunishmentTypeInputDto gBType)
+ public BaseResponse InsertRewardPunishmentType(CreateRewardPunishmentTypeInputDto gBType)
{
var gBTypeEntity = EntityMapper.Map(gBType);
var result = goodbadTypeRepository.Insert(gBTypeEntity);
- return new BaseOutputDto { StatusCode = result ? StatusCodeConstants.Success : StatusCodeConstants.InternalServerError };
+ return new BaseResponse { Code = result ? BusinessStatusCode.Success : BusinessStatusCode.InternalServerError };
}
///
@@ -839,14 +875,10 @@ namespace EOM.TSHotelManagement.Application
///
///
///
- public BaseOutputDto DeleteRewardPunishmentType(DeleteRewardPunishmentTypeInputDto gBType)
+ public BaseResponse DeleteRewardPunishmentType(DeleteRewardPunishmentTypeInputDto gBType)
{
- var result = goodbadTypeRepository.Update(a => new RewardPunishmentType()
- {
- IsDelete = 1,
- DataChgUsr = gBType.DataChgUsr,
- }, a => a.RewardPunishmentTypeId == gBType.RewardPunishmentTypeId);
- return new BaseOutputDto { StatusCode = result ? StatusCodeConstants.Success : StatusCodeConstants.InternalServerError };
+ var result = goodbadTypeRepository.SoftDelete(EntityMapper.Map(gBType));
+ return new BaseResponse { Code = result ? BusinessStatusCode.Success : BusinessStatusCode.InternalServerError };
}
///
@@ -854,15 +886,11 @@ namespace EOM.TSHotelManagement.Application
///
///
///
- public BaseOutputDto UpdateRewardPunishmentType(UpdateRewardPunishmentTypeInputDto gBType)
+ public BaseResponse UpdateRewardPunishmentType(UpdateRewardPunishmentTypeInputDto gBType)
{
- var result = goodbadTypeRepository.Update(a => new RewardPunishmentType()
- {
- RewardPunishmentTypeName = gBType.RewardPunishmentTypeName,
- DataChgUsr = gBType.DataChgUsr,
- DataChgDate = gBType.DataChgDate
- }, a => a.RewardPunishmentTypeId == gBType.RewardPunishmentTypeId);
- return new BaseOutputDto { StatusCode = result ? StatusCodeConstants.Success : StatusCodeConstants.InternalServerError };
+ var entity = EntityMapper.Map(gBType);
+ var result = goodbadTypeRepository.Update(entity);
+ return new BaseResponse { Code = result ? BusinessStatusCode.Success : BusinessStatusCode.InternalServerError };
}
#endregion
@@ -875,7 +903,7 @@ namespace EOM.TSHotelManagement.Application
///
public ListOutputDto SelectAppointmentNoticeTypeAll(ReadAppointmentNoticeTypeInputDto readAppointmentNoticeTypeInputDto)
{
- var listSource = new List();
+ var Data = new List();
var where = Expressionable.Create();
@@ -888,17 +916,24 @@ namespace EOM.TSHotelManagement.Application
if (!readAppointmentNoticeTypeInputDto.IgnorePaging && readAppointmentNoticeTypeInputDto.Page != 0 && readAppointmentNoticeTypeInputDto.PageSize != 0)
{
- listSource = appointmentNoticeTypeRepository.AsQueryable().Where(where.ToExpression())
+ Data = appointmentNoticeTypeRepository.AsQueryable().Where(where.ToExpression())
.ToPageList(readAppointmentNoticeTypeInputDto.Page, readAppointmentNoticeTypeInputDto.PageSize, ref count);
}
else
{
- listSource = appointmentNoticeTypeRepository.AsQueryable().Where(where.ToExpression()).ToList();
+ Data = appointmentNoticeTypeRepository.AsQueryable().Where(where.ToExpression()).ToList();
}
- var result = EntityMapper.MapList(listSource);
+ var result = EntityMapper.MapList(Data);
- return new ListOutputDto { listSource = result, total = count };
+ return new ListOutputDto
+ {
+ Data = new PagedData
+ {
+ Items = result,
+ TotalCount = count
+ }
+ };
}
///
@@ -906,23 +941,29 @@ namespace EOM.TSHotelManagement.Application
///
///
///
- public BaseOutputDto CreateAppointmentNoticeType(CreateAppointmentNoticeTypeInputDto createAppointmentNoticeTypeInputDto)
+ public BaseResponse CreateAppointmentNoticeType(CreateAppointmentNoticeTypeInputDto createAppointmentNoticeTypeInputDto)
{
try
{
if (appointmentNoticeTypeRepository.IsAny(a => a.NoticeTypeNumber == createAppointmentNoticeTypeInputDto.NoticeTypeNumber))
{
- return new BaseOutputDto { StatusCode = StatusCodeConstants.InternalServerError, Message = LocalizationHelper.GetLocalizedString("appointment notice number already exits.", "公告类型编号已存在") };
+ return new BaseResponse { Code = BusinessStatusCode.InternalServerError, Message = LocalizationHelper.GetLocalizedString("appointment notice number already exits.", "公告类型编号已存在") };
+ }
+ var entity = EntityMapper.Map(createAppointmentNoticeTypeInputDto);
+ var result = appointmentNoticeTypeRepository.Insert(entity);
+ if (!result)
+ {
+ LogHelper.LogError(LocalizationHelper.GetLocalizedString("insert appointment notice failed.", "公告类型添加失败"), null);
+ return new BaseResponse { Code = BusinessStatusCode.InternalServerError, Message = LocalizationHelper.GetLocalizedString("insert appointment notice failed.", "公告类型添加失败") };
}
- appointmentNoticeTypeRepository.Insert(EntityMapper.Map(createAppointmentNoticeTypeInputDto));
}
catch (Exception ex)
{
LogHelper.LogError(LocalizationHelper.GetLocalizedString("insert appointment notice failed.", "公告类型添加失败"), ex);
- return new BaseOutputDto { StatusCode = StatusCodeConstants.InternalServerError, Message = LocalizationHelper.GetLocalizedString("insert appointment notice failed.", "公告类型添加失败") };
+ return new BaseResponse { Code = BusinessStatusCode.InternalServerError, Message = LocalizationHelper.GetLocalizedString("insert appointment notice failed.", "公告类型添加失败") };
}
- return new BaseOutputDto { StatusCode = StatusCodeConstants.Success, Message = LocalizationHelper.GetLocalizedString("insert appointment notice successful.", "公告类型添加成功") };
+ return new BaseResponse { Code = BusinessStatusCode.Success, Message = LocalizationHelper.GetLocalizedString("insert appointment notice successful.", "公告类型添加成功") };
}
///
@@ -930,28 +971,23 @@ namespace EOM.TSHotelManagement.Application
///
///
///
- public BaseOutputDto DeleteAppointmentNoticeType(DeleteAppointmentNoticeTypeInputDto deleteAppointmentNoticeTypeInputDto)
+ public BaseResponse DeleteAppointmentNoticeType(DeleteAppointmentNoticeTypeInputDto deleteAppointmentNoticeTypeInputDto)
{
try
{
if (!appointmentNoticeTypeRepository.IsAny(a => a.NoticeTypeNumber == deleteAppointmentNoticeTypeInputDto.NoticeTypeNumber))
{
- return new BaseOutputDto { StatusCode = StatusCodeConstants.InternalServerError, Message = LocalizationHelper.GetLocalizedString("appointment notice number does not already.", "公告类型编号不存在") };
+ return new BaseResponse { Code = BusinessStatusCode.InternalServerError, Message = LocalizationHelper.GetLocalizedString("appointment notice number does not already.", "公告类型编号不存在") };
}
- appointmentNoticeTypeRepository.Update(a => new AppointmentNoticeType
- {
- IsDelete = 1,
- DataChgUsr = deleteAppointmentNoticeTypeInputDto.DataChgUsr,
- DataChgDate = deleteAppointmentNoticeTypeInputDto.DataChgDate
- }, a => a.NoticeTypeNumber == deleteAppointmentNoticeTypeInputDto.NoticeTypeNumber);
+ appointmentNoticeTypeRepository.SoftDelete(EntityMapper.Map(deleteAppointmentNoticeTypeInputDto));
}
catch (Exception ex)
{
LogHelper.LogError(LocalizationHelper.GetLocalizedString("delete appointment notice failed.", "公告类型删除失败"), ex);
- return new BaseOutputDto { StatusCode = StatusCodeConstants.InternalServerError, Message = LocalizationHelper.GetLocalizedString("delete appointment notice failed.", "公告类型删除失败") };
+ return new BaseResponse { Code = BusinessStatusCode.InternalServerError, Message = LocalizationHelper.GetLocalizedString("delete appointment notice failed.", "公告类型删除失败") };
}
- return new BaseOutputDto { StatusCode = StatusCodeConstants.Success, Message = LocalizationHelper.GetLocalizedString("delete appointment notice successful.", "公告类型删除成功") };
+ return new BaseResponse { Code = BusinessStatusCode.Success, Message = LocalizationHelper.GetLocalizedString("delete appointment notice successful.", "公告类型删除成功") };
}
///
@@ -959,23 +995,29 @@ namespace EOM.TSHotelManagement.Application
///
///
///
- public BaseOutputDto UpdateAppointmentNoticeType(UpdateAppointmentNoticeTypeInputDto updateAppointmentNoticeTypeInputDto)
+ public BaseResponse UpdateAppointmentNoticeType(UpdateAppointmentNoticeTypeInputDto updateAppointmentNoticeTypeInputDto)
{
try
{
if (!appointmentNoticeTypeRepository.IsAny(a => a.NoticeTypeNumber == updateAppointmentNoticeTypeInputDto.NoticeTypeNumber))
{
- return new BaseOutputDto { StatusCode = StatusCodeConstants.InternalServerError, Message = LocalizationHelper.GetLocalizedString("appointment notice number does not already.", "公告类型编号不存在") };
+ return new BaseResponse { Code = BusinessStatusCode.InternalServerError, Message = LocalizationHelper.GetLocalizedString("appointment notice number does not already.", "公告类型编号不存在") };
+ }
+ var entity = EntityMapper.Map(updateAppointmentNoticeTypeInputDto);
+ var result = appointmentNoticeTypeRepository.Update(entity);
+ if (!result)
+ {
+ LogHelper.LogError(LocalizationHelper.GetLocalizedString("update appointment notice failed.", "公告类型更新失败"), null);
+ return new BaseResponse { Code = BusinessStatusCode.InternalServerError, Message = LocalizationHelper.GetLocalizedString("update appointment notice failed.", "公告类型更新失败") };
}
- appointmentNoticeTypeRepository.Update(EntityMapper.Map(updateAppointmentNoticeTypeInputDto));
}
catch (Exception ex)
{
LogHelper.LogError(LocalizationHelper.GetLocalizedString("update appointment notice failed.", "公告类型更新失败"), ex);
- return new BaseOutputDto { StatusCode = StatusCodeConstants.InternalServerError, Message = LocalizationHelper.GetLocalizedString("update appointment notice failed.", "公告类型更新失败") };
+ return new BaseResponse { Code = BusinessStatusCode.InternalServerError, Message = LocalizationHelper.GetLocalizedString("update appointment notice failed.", "公告类型更新失败") };
}
- return new BaseOutputDto { StatusCode = StatusCodeConstants.Success, Message = LocalizationHelper.GetLocalizedString("update appointment notice successful.", "公告类型更新成功") };
+ return new BaseResponse { Code = BusinessStatusCode.Success, Message = LocalizationHelper.GetLocalizedString("update appointment notice successful.", "公告类型更新成功") };
}
#endregion
diff --git a/EOM.TSHotelManagement.Application/SystemManagement/Base/IBaseService.cs b/EOM.TSHotelManagement.Application/SystemManagement/Base/IBaseService.cs
index 11097167eac1e80266e11ddcb3d23cdce45b7e87..2ecafd4ef1a208aa0f3b3ee48efaef1f68a4ccfa 100644
--- a/EOM.TSHotelManagement.Application/SystemManagement/Base/IBaseService.cs
+++ b/EOM.TSHotelManagement.Application/SystemManagement/Base/IBaseService.cs
@@ -76,21 +76,21 @@ namespace EOM.TSHotelManagement.Application
///
///
///
- BaseOutputDto AddPosition(CreatePositionInputDto position);
+ BaseResponse AddPosition(CreatePositionInputDto position);
///
/// 删除职位类型
///
///
///
- BaseOutputDto DelPosition(DeletePositionInputDto position);
+ BaseResponse DelPosition(DeletePositionInputDto position);
///
/// 更新职位类型
///
///
///
- BaseOutputDto UpdPosition(UpdatePositionInputDto position);
+ BaseResponse UpdPosition(UpdatePositionInputDto position);
#endregion
@@ -113,21 +113,21 @@ namespace EOM.TSHotelManagement.Application
///
///
///
- BaseOutputDto AddNation(CreateNationInputDto nation);
+ BaseResponse AddNation(CreateNationInputDto nation);
///
/// 删除民族类型
///
///
///
- BaseOutputDto DelNation(DeleteNationInputDto nation);
+ BaseResponse DelNation(DeleteNationInputDto nation);
///
/// 更新民族类型
///
///
///
- BaseOutputDto UpdNation(UpdateNationInputDto nation);
+ BaseResponse UpdNation(UpdateNationInputDto nation);
#endregion
@@ -150,21 +150,21 @@ namespace EOM.TSHotelManagement.Application
///
///
///
- BaseOutputDto AddEducation(CreateEducationInputDto education);
+ BaseResponse AddEducation(CreateEducationInputDto education);
///
/// 删除学历类型
///
///
///
- BaseOutputDto DelEducation(DeleteEducationInputDto education);
+ BaseResponse DelEducation(DeleteEducationInputDto education);
///
/// 更新学历类型
///
///
///
- BaseOutputDto UpdEducation(UpdateEducationInputDto education);
+ BaseResponse UpdEducation(UpdateEducationInputDto education);
#endregion
@@ -193,21 +193,21 @@ namespace EOM.TSHotelManagement.Application
///
///
///
- BaseOutputDto AddDept(CreateDepartmentInputDto dept);
+ BaseResponse AddDept(CreateDepartmentInputDto dept);
///
/// 删除部门类型
///
///
///
- BaseOutputDto DelDept(DeleteDepartmentInputDto dept);
+ BaseResponse DelDept(DeleteDepartmentInputDto dept);
///
/// 更新部门类型
///
///
///
- BaseOutputDto UpdDept(UpdateDepartmentInputDto dept);
+ BaseResponse UpdDept(UpdateDepartmentInputDto dept);
#endregion
@@ -237,21 +237,21 @@ namespace EOM.TSHotelManagement.Application
///
///
///
- BaseOutputDto InsertCustoType(CreateCustoTypeInputDto custoType);
+ BaseResponse InsertCustoType(CreateCustoTypeInputDto custoType);
///
/// 删除客户类型
///
///
///
- BaseOutputDto DeleteCustoType(DeleteCustoTypeInputDto custoType);
+ BaseResponse DeleteCustoType(DeleteCustoTypeInputDto custoType);
///
/// 更新客户类型
///
///
///
- BaseOutputDto UpdateCustoType(UpdateCustoTypeInputDto custoType);
+ BaseResponse UpdateCustoType(UpdateCustoTypeInputDto custoType);
#endregion
@@ -281,21 +281,21 @@ namespace EOM.TSHotelManagement.Application
///
///
///
- BaseOutputDto InsertPassPortType(CreatePassportTypeInputDto passPortType);
+ BaseResponse InsertPassPortType(CreatePassportTypeInputDto passPortType);
///
/// 删除证件类型
///
///
///
- BaseOutputDto DeletePassPortType(DeletePassportTypeInputDto portType);
+ BaseResponse DeletePassPortType(DeletePassportTypeInputDto portType);
///
/// 更新证件类型
///
///
///
- BaseOutputDto UpdatePassPortType(UpdatePassportTypeInputDto portType);
+ BaseResponse UpdatePassPortType(UpdatePassportTypeInputDto portType);
#endregion
@@ -325,21 +325,21 @@ namespace EOM.TSHotelManagement.Application
///
///
///
- BaseOutputDto InsertRewardPunishmentType(CreateRewardPunishmentTypeInputDto gBType);
+ BaseResponse InsertRewardPunishmentType(CreateRewardPunishmentTypeInputDto gBType);
///
/// 删除奖惩类型
///
///
///
- BaseOutputDto DeleteRewardPunishmentType(DeleteRewardPunishmentTypeInputDto gBType);
+ BaseResponse DeleteRewardPunishmentType(DeleteRewardPunishmentTypeInputDto gBType);
///
/// 更新奖惩类型
///
///
///
- BaseOutputDto UpdateRewardPunishmentType(UpdateRewardPunishmentTypeInputDto gBType);
+ BaseResponse UpdateRewardPunishmentType(UpdateRewardPunishmentTypeInputDto gBType);
#endregion
@@ -356,21 +356,21 @@ namespace EOM.TSHotelManagement.Application
///
///
///
- BaseOutputDto CreateAppointmentNoticeType(CreateAppointmentNoticeTypeInputDto createAppointmentNoticeTypeInputDto);
+ BaseResponse CreateAppointmentNoticeType(CreateAppointmentNoticeTypeInputDto createAppointmentNoticeTypeInputDto);
///
/// 删除公告类型
///
///
///
- BaseOutputDto DeleteAppointmentNoticeType(DeleteAppointmentNoticeTypeInputDto deleteAppointmentNoticeTypeInputDto);
+ BaseResponse DeleteAppointmentNoticeType(DeleteAppointmentNoticeTypeInputDto deleteAppointmentNoticeTypeInputDto);
///
/// 更新公告类型
///
///
///
- BaseOutputDto UpdateAppointmentNoticeType(UpdateAppointmentNoticeTypeInputDto updateAppointmentNoticeTypeInputDto);
+ BaseResponse UpdateAppointmentNoticeType(UpdateAppointmentNoticeTypeInputDto updateAppointmentNoticeTypeInputDto);
#endregion
}
diff --git a/EOM.TSHotelManagement.Application/SystemManagement/Menu/IMenuService.cs b/EOM.TSHotelManagement.Application/SystemManagement/Menu/IMenuService.cs
index fb0b88d02b309051b45d770bb4b1dd43c750f36f..2a2329c9c195c3e805495490a5cc05b0ceaafaa2 100644
--- a/EOM.TSHotelManagement.Application/SystemManagement/Menu/IMenuService.cs
+++ b/EOM.TSHotelManagement.Application/SystemManagement/Menu/IMenuService.cs
@@ -22,7 +22,6 @@
*
*/
using EOM.TSHotelManagement.Common.Contract;
-using EOM.TSHotelManagement.Common.Core;
namespace EOM.TSHotelManagement.Application
{
@@ -41,27 +40,27 @@ namespace EOM.TSHotelManagement.Application
/// 构建菜单树
///
///
- List BuildMenuAll(BaseInputDto baseInputDto);
+ ListOutputDto BuildMenuAll(BaseInputDto baseInputDto);
///
/// 插入菜单
///
///
///
- BaseOutputDto InsertMenu(CreateMenuInputDto menu);
+ BaseResponse InsertMenu(CreateMenuInputDto menu);
///
/// 更新菜单
///
///
///
- BaseOutputDto UpdateMenu(UpdateMenuInputDto menu);
+ BaseResponse UpdateMenu(UpdateMenuInputDto menu);
///
/// 删除菜单
///
///
///
- BaseOutputDto DeleteMenu(DeleteMenuInputDto menu);
+ BaseResponse DeleteMenu(DeleteMenuInputDto menu);
}
}
\ No newline at end of file
diff --git a/EOM.TSHotelManagement.Application/SystemManagement/Menu/MenuService.cs b/EOM.TSHotelManagement.Application/SystemManagement/Menu/MenuService.cs
index 9cbeaf4159d82a0e923b1dfff807b1d7322c102f..1affeedcda95e77edea80102f8cc46ce496e41ba 100644
--- a/EOM.TSHotelManagement.Application/SystemManagement/Menu/MenuService.cs
+++ b/EOM.TSHotelManagement.Application/SystemManagement/Menu/MenuService.cs
@@ -60,7 +60,7 @@ namespace EOM.TSHotelManagement.Application
/// 构建菜单树
///
///
- public List BuildMenuAll(BaseInputDto baseInputDto)
+ public ListOutputDto BuildMenuAll(BaseInputDto baseInputDto)
{
var token = baseInputDto.UserToken;
@@ -68,7 +68,7 @@ namespace EOM.TSHotelManagement.Application
List
///
///
- public BaseOutputDto InsertMenu(CreateMenuInputDto menu)
+ public BaseResponse InsertMenu(CreateMenuInputDto menu)
{
try
{
if (menuRepository.IsAny(a => a.Key == menu.Key && a.IsDelete == 0))
{
- return new BaseOutputDto { Message = LocalizationHelper.GetLocalizedString("This menu already exists.", "菜单已存在。"), StatusCode = StatusCodeConstants.InternalServerError };
+ return new BaseResponse { Message = LocalizationHelper.GetLocalizedString("This menu already exists.", "菜单已存在。"), Code = BusinessStatusCode.InternalServerError };
}
menuRepository.Insert(EntityMapper.Map(menu));
}
catch (Exception ex)
{
- return new BaseOutputDto { Message = LocalizationHelper.GetLocalizedString(ex.Message, ex.Message), StatusCode = StatusCodeConstants.InternalServerError };
+ return new BaseResponse { Message = LocalizationHelper.GetLocalizedString(ex.Message, ex.Message), Code = BusinessStatusCode.InternalServerError };
}
- return new BaseOutputDto();
+ return new BaseResponse();
}
///
@@ -139,7 +143,7 @@ namespace EOM.TSHotelManagement.Application
///
///
///
- public BaseOutputDto UpdateMenu(UpdateMenuInputDto menu)
+ public BaseResponse UpdateMenu(UpdateMenuInputDto menu)
{
try
{
@@ -147,9 +151,9 @@ namespace EOM.TSHotelManagement.Application
}
catch (Exception ex)
{
- return new BaseOutputDto { Message = LocalizationHelper.GetLocalizedString(ex.Message, ex.Message), StatusCode = StatusCodeConstants.InternalServerError };
+ return new BaseResponse { Message = LocalizationHelper.GetLocalizedString(ex.Message, ex.Message), Code = BusinessStatusCode.InternalServerError };
}
- return new BaseOutputDto();
+ return new BaseResponse();
}
///
@@ -157,49 +161,90 @@ namespace EOM.TSHotelManagement.Application
///
///
///
- public BaseOutputDto DeleteMenu(DeleteMenuInputDto menu)
+ public BaseResponse DeleteMenu(DeleteMenuInputDto menu)
{
try
{
- menuRepository.Update(EntityMapper.Map(menu));
+ menuRepository.SoftDelete(EntityMapper.Map(menu));
}
catch (Exception ex)
{
- return new BaseOutputDto { Message = LocalizationHelper.GetLocalizedString(ex.Message, ex.Message), StatusCode = StatusCodeConstants.InternalServerError };
+ return new BaseResponse { Message = LocalizationHelper.GetLocalizedString(ex.Message, ex.Message), Code = BusinessStatusCode.InternalServerError };
}
- return new BaseOutputDto();
+ return new BaseResponse();
}
///
/// 递归构建菜单树
///
///
- ///
///
- private List BuildMenuTree(List menus, int? parentId)
+ private ListOutputDto BuildMenuTree(List menus)
{
- List result = new List();
+ try
+ {
+ var menuDict = menus.ToDictionary(m => m.Id);
+ var rootNodes = new List();
+
+ var processedIds = new HashSet();
- var filteredMenus = menus.Where(m => m.Parent == parentId).ToList();
+ foreach (var menu in menus.Where(m => m.Parent == null))
+ {
+ var node = BuildTreeNode(menu, menuDict, processedIds);
+ if (node != null) rootNodes.Add(node);
+ }
- foreach (var menu in filteredMenus)
+ return new ListOutputDto
+ {
+ Code = 0,
+ Message = "菜单树构建成功",
+ Data = new PagedData
+ {
+ Items = rootNodes,
+ TotalCount = rootNodes.Count
+ }
+ };
+ }
+ catch (Exception ex)
{
- MenuViewModel viewModel = new MenuViewModel
+ return new ListOutputDto
{
- Key = menu.Key,
- Title = menu.Title,
- Path = menu.Path,
- Icon = menu.Icon,
- Children = BuildMenuTree(menus, menu.Id)
+ Code = 5001,
+ Message = $"菜单树构建失败: {ex.Message}",
+ Data = null
};
- if (viewModel.Children.Count == 0)
+ }
+ }
+
+ private MenuDto BuildTreeNode(
+ Menu menu,
+ Dictionary menuDict,
+ HashSet processedIds)
+ {
+ processedIds.Add(menu.Id);
+
+ var node = new MenuDto
+ {
+ Key = menu.Key,
+ Title = menu.Title,
+ Path = menu.Path,
+ Icon = menu.Icon,
+ Children = new List()
+ };
+
+ var childMenus = menuDict.Values
+ .Where(m => m.Parent == menu.Id)
+ .ToList();
+
+ foreach (var child in childMenus)
+ {
+ var childNode = BuildTreeNode(child, menuDict, processedIds);
+ if (childNode != null)
{
- viewModel.Children = null;
+ node.Children.Add(childNode);
}
- result.Add(viewModel);
}
-
- return result;
+ return node;
}
}
}
diff --git a/EOM.TSHotelManagement.Application/SystemManagement/Notice/INoticeService.cs b/EOM.TSHotelManagement.Application/SystemManagement/Notice/INoticeService.cs
index a809f0614aada7f18b2ad958ff73e1975616111c..aa8a3584f77096780e1521544be23b559ad0952f 100644
--- a/EOM.TSHotelManagement.Application/SystemManagement/Notice/INoticeService.cs
+++ b/EOM.TSHotelManagement.Application/SystemManagement/Notice/INoticeService.cs
@@ -48,21 +48,21 @@ namespace EOM.TSHotelManagement.Application
///
///
///
- BaseOutputDto InsertNotice(CreateAppointmentNoticeInputDto createAppointmentNoticeInputDto);
+ BaseResponse InsertNotice(CreateAppointmentNoticeInputDto createAppointmentNoticeInputDto);
///
/// 删除公告信息
///
///
///
- BaseOutputDto DeleteNotice(DeleteAppointmentNoticeInputDto deleteAppointmentNoticeInputDto);
+ BaseResponse DeleteNotice(DeleteAppointmentNoticeInputDto deleteAppointmentNoticeInputDto);
///
/// 更新公告信息
///
///
///
- BaseOutputDto UpdateNotice(UpdateAppointmentNoticeInputDto updateAppointmentNoticeInputDto);
+ BaseResponse UpdateNotice(UpdateAppointmentNoticeInputDto updateAppointmentNoticeInputDto);
}
}
\ No newline at end of file
diff --git a/EOM.TSHotelManagement.Application/SystemManagement/Notice/NoticeService.cs b/EOM.TSHotelManagement.Application/SystemManagement/Notice/NoticeService.cs
index 5587894fb7d98df50bb52d5da792f945ac6bc526..1475c7b147e160fa88dbf1c793beae1aaaac2851 100644
--- a/EOM.TSHotelManagement.Application/SystemManagement/Notice/NoticeService.cs
+++ b/EOM.TSHotelManagement.Application/SystemManagement/Notice/NoticeService.cs
@@ -55,7 +55,7 @@ namespace EOM.TSHotelManagement.Application
///
public ListOutputDto SelectNoticeAll(ReadAppointmentNoticeInputDto readAppointmentNoticeInputDto)
{
- List ntc = new List();
+ var ntc = new List();
var where = Expressionable.Create();
if (!string.IsNullOrEmpty(readAppointmentNoticeInputDto.NoticeTheme))
{
@@ -83,13 +83,14 @@ namespace EOM.TSHotelManagement.Application
break;
}
});
-
- var listSource = EntityMapper.MapList(ntc);
-
+ var mapped = EntityMapper.MapList(ntc);
return new ListOutputDto
{
- listSource = listSource,
- total = listSource.Count
+ Data = new PagedData
+ {
+ Items = mapped,
+ TotalCount = count
+ }
};
}
@@ -101,7 +102,7 @@ namespace EOM.TSHotelManagement.Application
public ReadAppointmentNoticeOutputDto SelectNoticeByNoticeNo(ReadAppointmentNoticeInputDto readAppointmentNoticeInputDto)
{
AppointmentNotice notice = new AppointmentNotice();
- notice = noticeRepository.GetSingle(a => a.NoticeNumber == readAppointmentNoticeInputDto.NoticeId);
+ notice = noticeRepository.GetFirst(a => a.NoticeNumber == readAppointmentNoticeInputDto.NoticeId);
switch (notice.NoticeType)
{
case "PersonnelChanges":
@@ -121,17 +122,22 @@ namespace EOM.TSHotelManagement.Application
///
///
///
- public BaseOutputDto InsertNotice(CreateAppointmentNoticeInputDto notice)
+ public BaseResponse InsertNotice(CreateAppointmentNoticeInputDto notice)
{
try
{
- noticeRepository.Insert(EntityMapper.Map(notice));
+ var entity = EntityMapper.Map(notice);
+ var result = noticeRepository.Insert(entity);
+ if (!result)
+ {
+ return new BaseResponse { Message = LocalizationHelper.GetLocalizedString("insert appointment notice failed", "公告添加失败"), Code = BusinessStatusCode.InternalServerError };
+ }
}
catch (Exception ex)
{
- return new BaseOutputDto { Message = LocalizationHelper.GetLocalizedString(ex.Message, ex.Message), StatusCode = StatusCodeConstants.InternalServerError };
+ return new BaseResponse { Message = LocalizationHelper.GetLocalizedString(ex.Message, ex.Message), Code = BusinessStatusCode.InternalServerError };
}
- return new BaseOutputDto();
+ return new BaseResponse();
}
///
@@ -139,18 +145,24 @@ namespace EOM.TSHotelManagement.Application
///
///
///
- public BaseOutputDto DeleteNotice(DeleteAppointmentNoticeInputDto deleteAppointmentNoticeInputDto)
+ public BaseResponse DeleteNotice(DeleteAppointmentNoticeInputDto deleteAppointmentNoticeInputDto)
{
try
{
- noticeRepository.Update(EntityMapper.Map(deleteAppointmentNoticeInputDto));
+ var entity = EntityMapper.Map(deleteAppointmentNoticeInputDto);
+ var result = noticeRepository.SoftDelete(entity);
+ if (!result)
+ {
+ LogHelper.LogError(LocalizationHelper.GetLocalizedString("delete appointment notice failed", "删除公告失败"), null);
+ return new BaseResponse { Message = LocalizationHelper.GetLocalizedString("delete appointment notice failed", "删除公告失败"), Code = BusinessStatusCode.InternalServerError };
+ }
}
catch (Exception ex)
{
LogHelper.LogError(LocalizationHelper.GetLocalizedString("delete appointment notice failed", "删除公告失败"), ex);
- return new BaseOutputDto { Message = LocalizationHelper.GetLocalizedString("delete appointment notice failed", "删除公告失败"), StatusCode = StatusCodeConstants.InternalServerError };
+ return new BaseResponse { Message = LocalizationHelper.GetLocalizedString("delete appointment notice failed", "删除公告失败"), Code = BusinessStatusCode.InternalServerError };
}
- return new BaseOutputDto();
+ return new BaseResponse();
}
///
@@ -158,18 +170,24 @@ namespace EOM.TSHotelManagement.Application
///
///
///
- public BaseOutputDto UpdateNotice(UpdateAppointmentNoticeInputDto updateAppointmentNoticeInputDto)
+ public BaseResponse UpdateNotice(UpdateAppointmentNoticeInputDto updateAppointmentNoticeInputDto)
{
try
{
- noticeRepository.Update(EntityMapper.Map(updateAppointmentNoticeInputDto));
+ var entity = EntityMapper.Map(updateAppointmentNoticeInputDto);
+ var result = noticeRepository.Update(entity);
+ if (!result)
+ {
+ LogHelper.LogError(LocalizationHelper.GetLocalizedString("update appointment notice failed", "更新公告失败"), null);
+ return new BaseResponse { Message = LocalizationHelper.GetLocalizedString("update appointment notice failed", "更新公告失败"), Code = BusinessStatusCode.InternalServerError };
+ }
}
catch (Exception ex)
{
LogHelper.LogError(LocalizationHelper.GetLocalizedString("update appointment notice failed", "更新公告失败"), ex);
- return new BaseOutputDto { Message = LocalizationHelper.GetLocalizedString("update appointment notice failed", "更新公告失败"), StatusCode = StatusCodeConstants.InternalServerError };
+ return new BaseResponse { Message = LocalizationHelper.GetLocalizedString("update appointment notice failed", "更新公告失败"), Code = BusinessStatusCode.InternalServerError };
}
- return new BaseOutputDto();
+ return new BaseResponse();
}
}
diff --git a/EOM.TSHotelManagement.Application/SystemManagement/Role/IRoleAppService.cs b/EOM.TSHotelManagement.Application/SystemManagement/Role/IRoleAppService.cs
index cd241789896d43354ca76d40168bbc407d75c50a..f5052da3e3762d994f1c2d8dabf55f3ba85b384e 100644
--- a/EOM.TSHotelManagement.Application/SystemManagement/Role/IRoleAppService.cs
+++ b/EOM.TSHotelManagement.Application/SystemManagement/Role/IRoleAppService.cs
@@ -18,18 +18,18 @@ namespace EOM.TSHotelManagement.Application
///
///
///
- BaseOutputDto InsertRole(CreateRoleInputDto createRoleInputDto);
+ BaseResponse InsertRole(CreateRoleInputDto createRoleInputDto);
///
/// 更新角色
///
///
///
- BaseOutputDto UpdateRole(UpdateRoleInputDto updateRoleInputDto);
+ BaseResponse UpdateRole(UpdateRoleInputDto updateRoleInputDto);
///
/// 删除角色
///
///
///
- BaseOutputDto DeleteRole(DeleteRoleInputDto deleteRoleInputDto);
+ BaseResponse DeleteRole(DeleteRoleInputDto deleteRoleInputDto);
}
}
diff --git a/EOM.TSHotelManagement.Application/SystemManagement/Role/RoleAppService.cs b/EOM.TSHotelManagement.Application/SystemManagement/Role/RoleAppService.cs
index 3c7a148afaff4f9c9185d3f372f392dd2b72f619..fffe7fdca66594a8206390724eb46716db6ec3ab 100644
--- a/EOM.TSHotelManagement.Application/SystemManagement/Role/RoleAppService.cs
+++ b/EOM.TSHotelManagement.Application/SystemManagement/Role/RoleAppService.cs
@@ -32,17 +32,17 @@ namespace EOM.TSHotelManagement.Application
///
///
///
- public BaseOutputDto DeleteRole(DeleteRoleInputDto deleteRoleInputDto)
+ public BaseResponse DeleteRole(DeleteRoleInputDto deleteRoleInputDto)
{
try
{
- roleRepository.Delete(EntityMapper.Map(deleteRoleInputDto));
+ roleRepository.SoftDelete(EntityMapper.Map(deleteRoleInputDto));
}
catch (Exception)
{
- return new BaseOutputDto(StatusCodeConstants.InternalServerError, LocalizationHelper.GetLocalizedString("Delete Role Error", "删除角色失败"));
+ return new BaseResponse(BusinessStatusCode.InternalServerError, LocalizationHelper.GetLocalizedString("Delete Role Error", "删除角色失败"));
}
- return new BaseOutputDto(StatusCodeConstants.Success, LocalizationHelper.GetLocalizedString("Delete Role Success", "删除角色成功"));
+ return new BaseResponse(BusinessStatusCode.Success, LocalizationHelper.GetLocalizedString("Delete Role Success", "删除角色成功"));
}
///
@@ -83,17 +83,19 @@ namespace EOM.TSHotelManagement.Application
else
{
roles = roleRepository.AsQueryable().Where(where.ToExpression()).ToList();
+ count = roles.Count;
}
var roleList = EntityMapper.MapList(roles);
- var listOutputDto = new ListOutputDto
+ return new ListOutputDto
{
- total = count,
- listSource = roleList
+ Data = new PagedData
+ {
+ Items = roleList,
+ TotalCount = count
+ }
};
-
- return listOutputDto;
}
///
@@ -102,17 +104,22 @@ namespace EOM.TSHotelManagement.Application
///
///
///
- public BaseOutputDto InsertRole(CreateRoleInputDto createRoleInputDto)
+ public BaseResponse InsertRole(CreateRoleInputDto createRoleInputDto)
{
try
{
- roleRepository.Insert(EntityMapper.Map(createRoleInputDto));
+ var entity = EntityMapper.Map(createRoleInputDto);
+ var result = roleRepository.Insert(entity);
+ if (!result)
+ {
+ return new BaseResponse(BusinessStatusCode.InternalServerError, LocalizationHelper.GetLocalizedString("Create Role Error", "创建角色失败"));
+ }
}
catch (Exception)
{
- return new BaseOutputDto(StatusCodeConstants.InternalServerError, LocalizationHelper.GetLocalizedString("Create Role Error", "创建角色失败"));
+ return new BaseResponse(BusinessStatusCode.InternalServerError, LocalizationHelper.GetLocalizedString("Create Role Error", "创建角色失败"));
}
- return new BaseOutputDto(StatusCodeConstants.Success, LocalizationHelper.GetLocalizedString("Create Role Success", "创建角色成功"));
+ return new BaseResponse(BusinessStatusCode.Success, LocalizationHelper.GetLocalizedString("Create Role Success", "创建角色成功"));
}
///
@@ -121,17 +128,22 @@ namespace EOM.TSHotelManagement.Application
///
///
///
- public BaseOutputDto UpdateRole(UpdateRoleInputDto updateRoleInputDto)
+ public BaseResponse UpdateRole(UpdateRoleInputDto updateRoleInputDto)
{
try
{
- roleRepository.Update(EntityMapper.Map(updateRoleInputDto));
+ var entity = EntityMapper.Map(updateRoleInputDto);
+ var result = roleRepository.Update(entity);
+ if (!result)
+ {
+ return new BaseResponse(BusinessStatusCode.InternalServerError, LocalizationHelper.GetLocalizedString("Update Role Error", "更新角色失败"));
+ }
}
catch (Exception)
{
- return new BaseOutputDto(StatusCodeConstants.InternalServerError, LocalizationHelper.GetLocalizedString("Update Role Error", "更新角色失败"));
+ return new BaseResponse(BusinessStatusCode.InternalServerError, LocalizationHelper.GetLocalizedString("Update Role Error", "更新角色失败"));
}
- return new BaseOutputDto(StatusCodeConstants.Success, LocalizationHelper.GetLocalizedString("Update Role Success", "更新角色成功"));
+ return new BaseResponse(BusinessStatusCode.Success, LocalizationHelper.GetLocalizedString("Update Role Success", "更新角色成功"));
}
}
}
diff --git a/EOM.TSHotelManagement.Application/SystemManagement/SupervisionStatistics/ISupervisionStatisticsService.cs b/EOM.TSHotelManagement.Application/SystemManagement/SupervisionStatistics/ISupervisionStatisticsService.cs
index 85bc35e5800bb70664e49f10a66bd859c6a1b0f6..d22f35d396677c2961c7e3537d3c26fad9ab577e 100644
--- a/EOM.TSHotelManagement.Application/SystemManagement/SupervisionStatistics/ISupervisionStatisticsService.cs
+++ b/EOM.TSHotelManagement.Application/SystemManagement/SupervisionStatistics/ISupervisionStatisticsService.cs
@@ -41,20 +41,20 @@ namespace EOM.TSHotelManagement.Application
///
///
///
- BaseOutputDto InsertSupervisionStatistics(CreateSupervisionStatisticsInputDto checkInfo);
+ BaseResponse InsertSupervisionStatistics(CreateSupervisionStatisticsInputDto checkInfo);
///
/// 更新监管统计信息
///
///
///
- BaseOutputDto UpdateSupervisionStatistics(UpdateSupervisionStatisticsInputDto checkInfo);
+ BaseResponse UpdateSupervisionStatistics(UpdateSupervisionStatisticsInputDto checkInfo);
///
/// 删除监管统计信息
///
///
///
- BaseOutputDto DeleteSupervisionStatistics(DeleteSupervisionStatisticsInputDto checkInfo);
+ BaseResponse DeleteSupervisionStatistics(DeleteSupervisionStatisticsInputDto checkInfo);
}
}
\ No newline at end of file
diff --git a/EOM.TSHotelManagement.Application/SystemManagement/SupervisionStatistics/SupervisionStatisticsService.cs b/EOM.TSHotelManagement.Application/SystemManagement/SupervisionStatistics/SupervisionStatisticsService.cs
index 42344a6ae6cbd6edcb13247da81782706832fc90..772e27093d6241aea42d26a0356f393c8d4c609d 100644
--- a/EOM.TSHotelManagement.Application/SystemManagement/SupervisionStatistics/SupervisionStatisticsService.cs
+++ b/EOM.TSHotelManagement.Application/SystemManagement/SupervisionStatistics/SupervisionStatisticsService.cs
@@ -70,12 +70,15 @@ namespace EOM.TSHotelManagement.Application
c.SupervisingDepartmentName = !dept.IsNullOrEmpty() ? dept.DepartmentName : string.Empty;
});
- var listSource = EntityMapper.MapList(cif);
+ var Data = EntityMapper.MapList(cif);
return new ListOutputDto
{
- listSource = listSource,
- total = listSource.Count
+ Data = new PagedData
+ {
+ Items = Data,
+ TotalCount = count
+ }
};
}
@@ -84,7 +87,7 @@ namespace EOM.TSHotelManagement.Application
///
///
///
- public BaseOutputDto InsertSupervisionStatistics(CreateSupervisionStatisticsInputDto checkInfo)
+ public BaseResponse InsertSupervisionStatistics(CreateSupervisionStatisticsInputDto checkInfo)
{
try
{
@@ -92,9 +95,9 @@ namespace EOM.TSHotelManagement.Application
}
catch (Exception ex)
{
- return new BaseOutputDto { Message = LocalizationHelper.GetLocalizedString(ex.Message, ex.Message), StatusCode = StatusCodeConstants.InternalServerError };
+ return new BaseResponse { Message = LocalizationHelper.GetLocalizedString(ex.Message, ex.Message), Code = BusinessStatusCode.InternalServerError };
}
- return new BaseOutputDto();
+ return new BaseResponse();
}
///
@@ -102,12 +105,15 @@ namespace EOM.TSHotelManagement.Application
///
///
///
- public BaseOutputDto UpdateSupervisionStatistics(UpdateSupervisionStatisticsInputDto checkInfo)
+ public BaseResponse UpdateSupervisionStatistics(UpdateSupervisionStatisticsInputDto checkInfo)
{
try
{
- checkInfoRepository.Update(a => new SupervisionStatistics
+ var supervisionStatistics = checkInfoRepository.GetFirst(a => a.StatisticsNumber == checkInfo.StatisticsNumber);
+ checkInfoRepository.Update(new SupervisionStatistics
{
+ Id = supervisionStatistics.Id,
+ StatisticsNumber = supervisionStatistics.StatisticsNumber,
SupervisingDepartment = checkInfo.SupervisingDepartment,
SupervisionLoss = checkInfo.SupervisionLoss,
SupervisionScore = checkInfo.SupervisionScore,
@@ -117,13 +123,13 @@ namespace EOM.TSHotelManagement.Application
IsDelete = 0,
DataChgUsr = checkInfo.DataChgUsr,
DataChgDate = checkInfo.DataChgDate
- }, a => a.StatisticsNumber == checkInfo.StatisticsNumber);
+ });
}
catch (Exception ex)
{
- return new BaseOutputDto { Message = LocalizationHelper.GetLocalizedString(ex.Message, ex.Message), StatusCode = StatusCodeConstants.InternalServerError };
+ return new BaseResponse { Message = LocalizationHelper.GetLocalizedString(ex.Message, ex.Message), Code = BusinessStatusCode.InternalServerError };
}
- return new BaseOutputDto();
+ return new BaseResponse();
}
///
@@ -131,22 +137,24 @@ namespace EOM.TSHotelManagement.Application
///
///
///
- public BaseOutputDto DeleteSupervisionStatistics(DeleteSupervisionStatisticsInputDto checkInfo)
+ public BaseResponse DeleteSupervisionStatistics(DeleteSupervisionStatisticsInputDto checkInfo)
{
try
{
- checkInfoRepository.Update(a => new SupervisionStatistics
+ checkInfoRepository.SoftDelete(new SupervisionStatistics
{
+ StatisticsNumber = checkInfo.StatisticsNumber,
+ Id = checkInfo.Id,
IsDelete = 1,
DataChgUsr = checkInfo.DataChgUsr,
DataChgDate = checkInfo.DataChgDate
- }, a => a.StatisticsNumber == checkInfo.StatisticsNumber);
+ });
}
catch (Exception ex)
{
- return new BaseOutputDto { Message = LocalizationHelper.GetLocalizedString(ex.Message, ex.Message), StatusCode = StatusCodeConstants.InternalServerError };
+ return new BaseResponse { Message = LocalizationHelper.GetLocalizedString(ex.Message, ex.Message), Code = BusinessStatusCode.InternalServerError };
}
- return new BaseOutputDto();
+ return new BaseResponse();
}
}
}
diff --git a/EOM.TSHotelManagement.Application/SystemManagement/VipRule/IVipRuleAppService.cs b/EOM.TSHotelManagement.Application/SystemManagement/VipRule/IVipRuleAppService.cs
index be701985172d514090f79ece3ecbf100605ebdd5..18e18536da5508b9499f42832a1a63b90476c863 100644
--- a/EOM.TSHotelManagement.Application/SystemManagement/VipRule/IVipRuleAppService.cs
+++ b/EOM.TSHotelManagement.Application/SystemManagement/VipRule/IVipRuleAppService.cs
@@ -49,20 +49,20 @@ namespace EOM.TSHotelManagement.Application
///
///
///
- BaseOutputDto AddVipRule(CreateVipLevelRuleInputDto vipRule);
+ BaseResponse AddVipRule(CreateVipLevelRuleInputDto vipRule);
///
/// 删除会员等级规则
///
///
///
- BaseOutputDto DelVipRule(DeleteVipLevelRuleInputDto vipRule);
+ BaseResponse DelVipRule(DeleteVipLevelRuleInputDto vipRule);
///
/// 更新会员等级规则
///
///
///
- BaseOutputDto UpdVipRule(UpdateVipLevelRuleInputDto vipRule);
+ BaseResponse UpdVipRule(UpdateVipLevelRuleInputDto vipRule);
}
}
diff --git a/EOM.TSHotelManagement.Application/SystemManagement/VipRule/VipRuleAppService.cs b/EOM.TSHotelManagement.Application/SystemManagement/VipRule/VipRuleAppService.cs
index 5c2001e95fa70d614f14efb994f806b070c5dc20..6ae5a6c8fc4fff8bfa89a7fddbd42225ec7c98ae 100644
--- a/EOM.TSHotelManagement.Application/SystemManagement/VipRule/VipRuleAppService.cs
+++ b/EOM.TSHotelManagement.Application/SystemManagement/VipRule/VipRuleAppService.cs
@@ -69,22 +69,25 @@ namespace EOM.TSHotelManagement.Application
where = where.And(a => a.IsDelete == readVipLevelRuleInputDto.IsDelete);
}
var count = 0;
- var listSource = vipRuleRepository.AsQueryable().Where(where.ToExpression()).ToPageList(readVipLevelRuleInputDto.Page, readVipLevelRuleInputDto.PageSize, ref count);
+ var Data = vipRuleRepository.AsQueryable().Where(where.ToExpression()).ToPageList(readVipLevelRuleInputDto.Page, readVipLevelRuleInputDto.PageSize, ref count);
var listUserType = custoTypeRepository.GetList(a => a.IsDelete != 1);
- listSource.ForEach(source =>
+ Data.ForEach(source =>
{
var userType = listUserType.SingleOrDefault(a => a.CustomerType == source.VipLevelId);
source.VipLevelName = userType == null ? "" : userType.CustomerTypeName;
});
- var viprules = EntityMapper.MapList(listSource);
+ var viprules = EntityMapper.MapList(Data);
return new ListOutputDto
{
- listSource = viprules,
- total = count
+ Data = new PagedData
+ {
+ Items = viprules,
+ TotalCount = count
+ }
};
}
@@ -97,16 +100,16 @@ namespace EOM.TSHotelManagement.Application
{
VipLevelRule vipRule1 = new VipLevelRule();
- var source = vipRuleRepository.GetSingle(a => a.RuleSerialNumber.Equals(vipRule.RuleSerialNumber));
+ var source = vipRuleRepository.GetFirst(a => a.RuleSerialNumber.Equals(vipRule.RuleSerialNumber));
- var userType = custoTypeRepository.GetSingle(a => a.CustomerType == source.VipLevelId);
+ var userType = custoTypeRepository.GetFirst(a => a.CustomerType == source.VipLevelId);
source.VipLevelName = userType == null ? "" : userType.CustomerTypeName;
var vipLevel = EntityMapper.Map(source);
return new SingleOutputDto
{
- Source = vipLevel
+ Data = vipLevel
};
}
@@ -115,7 +118,7 @@ namespace EOM.TSHotelManagement.Application
///
///
///
- public BaseOutputDto AddVipRule(CreateVipLevelRuleInputDto vipRule)
+ public BaseResponse AddVipRule(CreateVipLevelRuleInputDto vipRule)
{
try
{
@@ -131,9 +134,9 @@ namespace EOM.TSHotelManagement.Application
}
catch (Exception ex)
{
- return new BaseOutputDto { Message = LocalizationHelper.GetLocalizedString(ex.Message, ex.Message), StatusCode = StatusCodeConstants.InternalServerError };
+ return new BaseResponse { Message = LocalizationHelper.GetLocalizedString(ex.Message, ex.Message), Code = BusinessStatusCode.InternalServerError };
}
- return new BaseOutputDto();
+ return new BaseResponse();
}
///
@@ -141,21 +144,23 @@ namespace EOM.TSHotelManagement.Application
///
///
///
- public BaseOutputDto DelVipRule(DeleteVipLevelRuleInputDto vipRule)
+ public BaseResponse DelVipRule(DeleteVipLevelRuleInputDto vipRule)
{
try
{
- vipRuleRepository.Update(a => new VipLevelRule
+ vipRuleRepository.SoftDelete(new VipLevelRule
{
- IsDelete = 1,
+ Id = vipRule.Id,
+ RuleSerialNumber = vipRule.RuleSerialNumber,
+ IsDelete = vipRule.IsDelete,
DataChgUsr = vipRule.DataChgUsr,
- }, a => a.RuleSerialNumber == vipRule.RuleSerialNumber);
+ });
}
catch (Exception ex)
{
- return new BaseOutputDto { Message = LocalizationHelper.GetLocalizedString(ex.Message, ex.Message), StatusCode = StatusCodeConstants.InternalServerError };
+ return new BaseResponse { Message = LocalizationHelper.GetLocalizedString(ex.Message, ex.Message), Code = BusinessStatusCode.InternalServerError };
}
- return new BaseOutputDto();
+ return new BaseResponse();
}
///
@@ -163,24 +168,26 @@ namespace EOM.TSHotelManagement.Application
///
///
///
- public BaseOutputDto UpdVipRule(UpdateVipLevelRuleInputDto vipRule)
+ public BaseResponse UpdVipRule(UpdateVipLevelRuleInputDto vipRule)
{
try
{
- vipRuleRepository.Update(a => new VipLevelRule
+ vipRuleRepository.Update(new VipLevelRule
{
+ Id = vipRule.Id,
+ RuleSerialNumber = vipRule.RuleSerialNumber,
RuleName = vipRule.RuleName,
RuleValue = vipRule.RuleValue,
IsDelete = vipRule.IsDelete,
DataChgUsr = vipRule.DataChgUsr,
DataChgDate = vipRule.DataChgDate
- }, a => a.RuleSerialNumber == vipRule.RuleSerialNumber);
+ });
}
catch (Exception ex)
{
- return new BaseOutputDto { Message = LocalizationHelper.GetLocalizedString(ex.Message, ex.Message), StatusCode = StatusCodeConstants.InternalServerError };
+ return new BaseResponse { Message = LocalizationHelper.GetLocalizedString(ex.Message, ex.Message), Code = BusinessStatusCode.InternalServerError };
}
- return new BaseOutputDto();
+ return new BaseResponse();
}
}
}
diff --git a/EOM.TSHotelManagement.Application/Util/IUtilService.cs b/EOM.TSHotelManagement.Application/Util/IUtilService.cs
index e41e4e4613d983e4c4ed591e0d3fc9c0118ff577..a7e841f3b44709ab1d5b70722794aa588f65e118 100644
--- a/EOM.TSHotelManagement.Application/Util/IUtilService.cs
+++ b/EOM.TSHotelManagement.Application/Util/IUtilService.cs
@@ -19,7 +19,7 @@ namespace EOM.TSHotelManagement.Application
///
///
///
- BaseOutputDto AddLog(CreateOperationLogInputDto opr);
+ BaseResponse AddLog(CreateOperationLogInputDto opr);
///
/// 查询所有操作日志
@@ -38,12 +38,12 @@ namespace EOM.TSHotelManagement.Application
/// 删除指定时间范围的操作日志
///
///
- BaseOutputDto DeleteOperationlogByRange(ReadOperationLogInputDto readOperationLogInputDto);
+ BaseResponse DeleteOperationlogByRange(ReadOperationLogInputDto readOperationLogInputDto);
///
/// 删除操作日志
///
///
- BaseOutputDto DeleteOperationlog(DeleteOperationLogInputDto deleteOperationLogInputDto);
+ BaseResponse DeleteOperationlog(DeleteOperationLogInputDto deleteOperationLogInputDto);
}
}
diff --git a/EOM.TSHotelManagement.Application/Util/UtilService.cs b/EOM.TSHotelManagement.Application/Util/UtilService.cs
index 52d322975458c3e085edfc14e8e27819154355d7..dca2c630ca48430ae6f52be3861c6bf86df0aba2 100644
--- a/EOM.TSHotelManagement.Application/Util/UtilService.cs
+++ b/EOM.TSHotelManagement.Application/Util/UtilService.cs
@@ -27,12 +27,6 @@ namespace EOM.TSHotelManagement.Application
///
private readonly GenericRepository requestLogRepository;
- ///
- ///
- ///
- ///
- ///
- ///
public UtilService(GenericRepository cardCodesRepository, GenericRepository operationLogRepository, GenericRepository requestLogRepository)
{
this.cardCodesRepository = cardCodesRepository;
@@ -50,9 +44,9 @@ namespace EOM.TSHotelManagement.Application
if (!readCardCodeInputDto.IdentityCardNumber.IsNullOrEmpty())
{
var cardid = readCardCodeInputDto.IdentityCardNumber.Substring(0, 6).ToString();
- var cardcodes = cardCodesRepository.GetSingle(a => a.AreaCode == cardid);
+ var cardcodes = cardCodesRepository.GetFirst(a => a.AreaCode == cardid);
var source = EntityMapper.Map(cardcodes);
- return new SingleOutputDto() { Source = source };
+ return new SingleOutputDto() { Data = source };
}
return new SingleOutputDto();
}
@@ -62,17 +56,22 @@ namespace EOM.TSHotelManagement.Application
///
///
///
- public BaseOutputDto AddLog(CreateOperationLogInputDto opr)
+ public BaseResponse AddLog(CreateOperationLogInputDto opr)
{
try
{
- operationLogRepository.Insert(EntityMapper.Map(opr));
+ var log = EntityMapper.Map(opr);
+ var result = operationLogRepository.Insert(log);
+ if (!result)
+ {
+ return new BaseResponse { Message = LocalizationHelper.GetLocalizedString("Add Log Failed", "添加日志失败"), Code = BusinessStatusCode.InternalServerError };
+ }
}
catch (Exception ex)
{
- return new BaseOutputDto { Message = LocalizationHelper.GetLocalizedString(ex.Message, ex.Message), StatusCode = StatusCodeConstants.InternalServerError };
+ return new BaseResponse { Message = LocalizationHelper.GetLocalizedString(ex.Message, ex.Message), Code = BusinessStatusCode.InternalServerError };
}
- return new BaseOutputDto();
+ return new BaseResponse();
}
///
@@ -105,6 +104,7 @@ namespace EOM.TSHotelManagement.Application
else
{
operationLogs = operationLogRepository.AsQueryable().Where(where.ToExpression()).OrderByDescending(a => a.OperationTime).ToList();
+ count = operationLogs.Count;
}
operationLogs.ForEach(source =>
@@ -112,9 +112,16 @@ namespace EOM.TSHotelManagement.Application
source.LogLevelName = source.LogLevel == LogLevel.Normal ? LocalizationHelper.GetLocalizedString("INFO", "常规操作") : source.LogLevel == LogLevel.Warning ? LocalizationHelper.GetLocalizedString("WARNING", "敏感操作") : LocalizationHelper.GetLocalizedString("ERROR", "严重操作");
});
- var listSource = EntityMapper.MapList(operationLogs);
+ var result = EntityMapper.MapList(operationLogs);
- return new ListOutputDto { listSource = listSource, total = count };
+ return new ListOutputDto
+ {
+ Data = new PagedData
+ {
+ Items = result,
+ TotalCount = count
+ }
+ };
}
///
@@ -141,24 +148,32 @@ namespace EOM.TSHotelManagement.Application
else
{
requestLogs = requestLogRepository.AsQueryable().Where(where.ToExpression()).OrderByDescending(a => a.RequestTime).ToList();
+ count = requestLogs.Count;
}
- var listSource = EntityMapper.MapList(requestLogs);
+ var result = EntityMapper.MapList(requestLogs);
- return new ListOutputDto { listSource = listSource, total = count };
+ return new ListOutputDto
+ {
+ Data = new PagedData
+ {
+ Items = result,
+ TotalCount = count
+ }
+ };
}
///
/// 删除指定时间范围的操作日志
///
///
- public BaseOutputDto DeleteOperationlogByRange(ReadOperationLogInputDto readOperationLogInputDto)
+ public BaseResponse DeleteOperationlogByRange(ReadOperationLogInputDto readOperationLogInputDto)
{
try
{
var where = Expressionable.Create();
- if (readOperationLogInputDto.StartTime != DateTime.MinValue && readOperationLogInputDto.EndTime != DateTime.MinValue)
+ if (readOperationLogInputDto.StartTime.HasValue && readOperationLogInputDto.EndTime.HasValue)
{
where = where.And(a => a.OperationTime >= readOperationLogInputDto.StartTime && a.OperationTime <= readOperationLogInputDto.EndTime);
}
@@ -172,28 +187,27 @@ namespace EOM.TSHotelManagement.Application
}
catch (Exception ex)
{
- return new BaseOutputDto { Message = LocalizationHelper.GetLocalizedString(ex.Message, ex.Message), StatusCode = StatusCodeConstants.InternalServerError };
+ return new BaseResponse { Message = LocalizationHelper.GetLocalizedString(ex.Message, ex.Message), Code = BusinessStatusCode.InternalServerError };
}
- return new BaseOutputDto { Message = "操作日志删除成功", StatusCode = StatusCodeConstants.Success };
+ return new BaseResponse { Message = "操作日志删除成功", Code = BusinessStatusCode.Success };
}
///
/// 删除操作日志
///
///
- public BaseOutputDto DeleteOperationlog(DeleteOperationLogInputDto deleteOperationLogInputDto)
+ public BaseResponse DeleteOperationlog(DeleteOperationLogInputDto deleteOperationLogInputDto)
{
var result = operationLogRepository.Delete(a => a.OperationId == deleteOperationLogInputDto.OperationId);
if (result)
{
- return new BaseOutputDto(StatusCodeConstants.Success, LocalizationHelper.GetLocalizedString("Delete Operation Log Success", "操作日志删除成功"));
+ return new BaseResponse(BusinessStatusCode.Success, LocalizationHelper.GetLocalizedString("Delete Operation Log Success", "操作日志删除成功"));
}
else
{
- return new BaseOutputDto(StatusCodeConstants.InternalServerError, LocalizationHelper.GetLocalizedString("Delete Operation Log Failed", "操作日志删除失败"));
+ return new BaseResponse(BusinessStatusCode.InternalServerError, LocalizationHelper.GetLocalizedString("Delete Operation Log Failed", "操作日志删除失败"));
}
}
-
}
}
diff --git a/EOM.TSHotelManagement.Common.Contract/Application/NavBar/Dto/ReadNavBarOutputDto.cs b/EOM.TSHotelManagement.Common.Contract/Application/NavBar/Dto/ReadNavBarOutputDto.cs
index 31a23b662f7de7b63d3359ff0ceb602ae30ce216..8ca1e4d4b3a9d740f4b673ab2ce0ee03c32f7898 100644
--- a/EOM.TSHotelManagement.Common.Contract/Application/NavBar/Dto/ReadNavBarOutputDto.cs
+++ b/EOM.TSHotelManagement.Common.Contract/Application/NavBar/Dto/ReadNavBarOutputDto.cs
@@ -1,6 +1,6 @@
namespace EOM.TSHotelManagement.Common.Contract
{
- public class ReadNavBarOutputDto
+ public class ReadNavBarOutputDto : BaseOutputDto
{
public int Id { get; set; }
public int NavigationBarId { get; set; }
diff --git a/EOM.TSHotelManagement.Common.Contract/BaseDto/BaseAuditDto.cs b/EOM.TSHotelManagement.Common.Contract/BaseDto/BaseAuditDto.cs
new file mode 100644
index 0000000000000000000000000000000000000000..4e30551f51fd0290b5d9407f0cdccea685c75ba3
--- /dev/null
+++ b/EOM.TSHotelManagement.Common.Contract/BaseDto/BaseAuditDto.cs
@@ -0,0 +1,22 @@
+namespace EOM.TSHotelManagement.Common.Contract
+{
+ public class BaseAuditDto : BaseDto
+ {
+ ///
+ /// 资料创建人
+ ///
+ public string DataInsUsr { get; set; }
+ ///
+ /// 资料创建时间
+ ///
+ public DateTime? DataInsDate { get; set; }
+ ///
+ /// 资料更新人
+ ///
+ public string DataChgUsr { get; set; }
+ ///
+ /// 资料更新时间
+ ///
+ public DateTime? DataChgDate { get; set; }
+ }
+}
diff --git a/EOM.TSHotelManagement.Common.Contract/BaseDto/BaseDto.cs b/EOM.TSHotelManagement.Common.Contract/BaseDto/BaseDto.cs
index ee5b8c26b25f40ea0fe178557abb6b2685adadcc..b937dcae65ffd11c1a4450fff59b7a77c0566c76 100644
--- a/EOM.TSHotelManagement.Common.Contract/BaseDto/BaseDto.cs
+++ b/EOM.TSHotelManagement.Common.Contract/BaseDto/BaseDto.cs
@@ -2,6 +2,7 @@
{
public class BaseDto
{
+ public int Id { get; set; }
///
/// Token
///
diff --git a/EOM.TSHotelManagement.Common.Contract/BaseDto/BaseInputDto.cs b/EOM.TSHotelManagement.Common.Contract/BaseDto/BaseInputDto.cs
index fea47ad929401eb38e5d3d8c590c86a1396e391a..c96540f7782558fa713b95a62128592f5a12b52d 100644
--- a/EOM.TSHotelManagement.Common.Contract/BaseDto/BaseInputDto.cs
+++ b/EOM.TSHotelManagement.Common.Contract/BaseDto/BaseInputDto.cs
@@ -1,27 +1,10 @@
namespace EOM.TSHotelManagement.Common.Contract
{
- public class BaseInputDto : BaseDto
+ public class BaseInputDto : BaseAuditDto
{
- public int Id { get; set; }
///
/// 删除标识
///
public int? IsDelete { get; set; } = 0;
- ///
- /// 资料创建人
- ///
- public string DataInsUsr { get; set; }
- ///
- /// 资料创建时间
- ///
- public DateTime? DataInsDate { get; set; }
- ///
- /// 资料更新人
- ///
- public string DataChgUsr { get; set; }
- ///
- /// 资料更新时间
- ///
- public DateTime? DataChgDate { get; set; }
}
}
diff --git a/EOM.TSHotelManagement.Common.Contract/BaseDto/BaseOutputDto.cs b/EOM.TSHotelManagement.Common.Contract/BaseDto/BaseOutputDto.cs
index be52c5ce178cf5d4c05418a0455e48ff53ad73bb..b3557f3e9da5ad722be1b72f9c8df75ce14364f3 100644
--- a/EOM.TSHotelManagement.Common.Contract/BaseDto/BaseOutputDto.cs
+++ b/EOM.TSHotelManagement.Common.Contract/BaseDto/BaseOutputDto.cs
@@ -1,37 +1,6 @@
-using EOM.TSHotelManagement.Common.Util;
-
-namespace EOM.TSHotelManagement.Common.Contract
+namespace EOM.TSHotelManagement.Common.Contract
{
- public class BaseOutputDto
+ public class BaseOutputDto : BaseAuditDto
{
- ///
- /// 状态码,例如 200 表示成功,500 表示服务器错误,400 表示客户端错误等
- ///
- public int StatusCode { get; set; } = StatusCodeConstants.Success;
-
- ///
- /// 返回消息,用于描述请求结果
- ///
- public string Message { get; set; } = LocalizationHelper.GetLocalizedString("Success", "成功");
-
- ///
- ///
- ///
- public BaseOutputDto()
- {
- StatusCode = 200;
- Message = LocalizationHelper.GetLocalizedString("Success", "成功");
- }
-
- ///
- /// 带状态码和消息的构造函数
- ///
- /// 状态码
- /// 消息
- public BaseOutputDto(int statusCode, string message)
- {
- StatusCode = statusCode;
- Message = message;
- }
}
}
diff --git a/EOM.TSHotelManagement.Common.Contract/BaseDto/BaseResponse.cs b/EOM.TSHotelManagement.Common.Contract/BaseDto/BaseResponse.cs
new file mode 100644
index 0000000000000000000000000000000000000000..248acb2ed0951f258d7a5637f0d54081cd6c3f11
--- /dev/null
+++ b/EOM.TSHotelManagement.Common.Contract/BaseDto/BaseResponse.cs
@@ -0,0 +1,39 @@
+using EOM.TSHotelManagement.Common.Util;
+
+namespace EOM.TSHotelManagement.Common.Contract
+{
+ public class BaseResponse
+ {
+ public bool Success => Code == 0;
+
+ ///
+ /// 状态码,例如 0 表示成功
+ ///
+ public int Code { get; set; } = 0;
+
+ ///
+ /// 返回消息,用于描述请求结果
+ ///
+ public string Message { get; set; } = LocalizationHelper.GetLocalizedString("Success", "成功");
+
+ ///
+ ///
+ ///
+ public BaseResponse()
+ {
+ Code = 0;
+ Message = LocalizationHelper.GetLocalizedString("Success", "成功");
+ }
+
+ ///
+ /// 带状态码和消息的构造函数
+ ///
+ /// 状态码
+ /// 消息
+ public BaseResponse(int statusCode, string message)
+ {
+ Code = statusCode;
+ Message = message;
+ }
+ }
+}
diff --git a/EOM.TSHotelManagement.Common.Contract/BaseDto/StatusCodeConstants.cs b/EOM.TSHotelManagement.Common.Contract/BaseDto/BusinessStatusCode.cs
similarity index 67%
rename from EOM.TSHotelManagement.Common.Contract/BaseDto/StatusCodeConstants.cs
rename to EOM.TSHotelManagement.Common.Contract/BaseDto/BusinessStatusCode.cs
index 1ebed1e83dfae4ade9e29c13c9ed5390778f25e8..a9698ab56f0c433c40ccd8475c4c2137ebb95db8 100644
--- a/EOM.TSHotelManagement.Common.Contract/BaseDto/StatusCodeConstants.cs
+++ b/EOM.TSHotelManagement.Common.Contract/BaseDto/BusinessStatusCode.cs
@@ -1,105 +1,105 @@
namespace EOM.TSHotelManagement.Common.Contract
{
- public static class StatusCodeConstants
+ public static class BusinessStatusCode
{
// 2xx Success
///
/// 请求成功
///
- public const int Success = 200;
+ public const int Success = 0;
///
/// 创建成功(常用于 POST 请求)
///
- public const int Created = 201;
+ public const int Created = 1201;
///
/// 已接受(请求已接收但未处理完成)
///
- public const int Accepted = 202;
+ public const int Accepted = 1202;
///
/// 无内容(响应体为空)
///
- public const int NoContent = 204;
+ public const int NoContent = 1204;
// 3xx Redirection
///
/// 永久重定向
///
- public const int MovedPermanently = 301;
+ public const int MovedPermanently = 1301;
///
/// 临时重定向
///
- public const int Found = 302;
+ public const int Found = 1302;
///
/// 查看其他地址(常用于 POST 后重定向)
///
- public const int SeeOther = 303;
+ public const int SeeOther = 1303;
///
/// 资源未修改(缓存用)
///
- public const int NotModified = 304;
+ public const int NotModified = 1304;
// 4xx Client Errors
///
/// 错误请求(参数或格式错误)
///
- public const int BadRequest = 400;
+ public const int BadRequest = 1400;
///
/// 未授权(身份验证失败)
///
- public const int Unauthorized = 401;
+ public const int Unauthorized = 1401;
///
/// 禁止访问(无权限)
///
- public const int Forbidden = 403;
+ public const int Forbidden = 1403;
///
/// 未找到资源
///
- public const int NotFound = 404;
+ public const int NotFound = 1404;
///
/// 方法不允许(如 GET 接口用 POST 访问)
///
- public const int MethodNotAllowed = 405;
+ public const int MethodNotAllowed = 1405;
///
/// 请求超时
///
- public const int RequestTimeout = 408;
+ public const int RequestTimeout = 1408;
///
/// 资源冲突(如重复提交)
///
- public const int Conflict = 409;
+ public const int Conflict = 1409;
// 5xx Server Errors
///
/// 服务器内部错误
///
- public const int InternalServerError = 500;
+ public const int InternalServerError = 1500;
///
/// 网关错误(上游服务异常)
///
- public const int BadGateway = 502;
+ public const int BadGateway = 1502;
///
/// 服务不可用(维护或过载)
///
- public const int ServiceUnavailable = 503;
+ public const int ServiceUnavailable = 1503;
///
/// 网关超时(上游服务响应超时)
///
- public const int GatewayTimeout = 504;
+ public const int GatewayTimeout = 1504;
}
}
diff --git a/EOM.TSHotelManagement.Common.Contract/BaseDto/ListOutputDto.cs b/EOM.TSHotelManagement.Common.Contract/BaseDto/ListOutputDto.cs
index 4455a60490409e9f871f9eca0902bfdb21739215..0d782365ba2c4b4e833db158f8f9c702eaa24fa9 100644
--- a/EOM.TSHotelManagement.Common.Contract/BaseDto/ListOutputDto.cs
+++ b/EOM.TSHotelManagement.Common.Contract/BaseDto/ListOutputDto.cs
@@ -26,16 +26,11 @@ namespace EOM.TSHotelManagement.Common.Contract
///
/// 带总数的列表输出Dto
///
- public class ListOutputDto : BaseOutputDto
+ public class ListOutputDto : BaseResponse
{
///
/// 数据源
///
- public List listSource { get; set; }
-
- ///
- /// 总数
- ///
- public int total { get; set; } = 0;
+ public PagedData Data { get; set; }
}
}
\ No newline at end of file
diff --git a/EOM.TSHotelManagement.Common.Core/SystemManagement/MenuViewModel.cs b/EOM.TSHotelManagement.Common.Contract/BaseDto/MenuDto.cs
similarity index 71%
rename from EOM.TSHotelManagement.Common.Core/SystemManagement/MenuViewModel.cs
rename to EOM.TSHotelManagement.Common.Contract/BaseDto/MenuDto.cs
index fac79c6d13e6bfb8e31e85af43d56c7665f4b803..62312295c42e5744f02b4e60a0cc5f950967dfaa 100644
--- a/EOM.TSHotelManagement.Common.Core/SystemManagement/MenuViewModel.cs
+++ b/EOM.TSHotelManagement.Common.Contract/BaseDto/MenuDto.cs
@@ -1,11 +1,9 @@
-using System.Collections.Generic;
-
-namespace EOM.TSHotelManagement.Common.Core
+namespace EOM.TSHotelManagement.Common.Contract
{
///
- /// 菜单视图模型 (Menu View Model)
+ /// 菜单
///
- public class MenuViewModel
+ public class MenuDto
{
///
/// 菜单主键 (Menu Key)
@@ -30,6 +28,6 @@ namespace EOM.TSHotelManagement.Common.Core
///
/// 子菜单 (Child Menus)
///
- public List Children { get; set; } = new List();
+ public List Children { get; set; } = new List();
}
}
diff --git a/EOM.TSHotelManagement.Common.Contract/BaseDto/PagedData.cs b/EOM.TSHotelManagement.Common.Contract/BaseDto/PagedData.cs
new file mode 100644
index 0000000000000000000000000000000000000000..22e47f1bfc4f74f5895e2639e9beadd5b4b0c57b
--- /dev/null
+++ b/EOM.TSHotelManagement.Common.Contract/BaseDto/PagedData.cs
@@ -0,0 +1,8 @@
+namespace EOM.TSHotelManagement.Common.Contract
+{
+ public class PagedData
+ {
+ public List Items { get; set; }
+ public int TotalCount { get; set; }
+ }
+}
diff --git a/EOM.TSHotelManagement.Common.Contract/BaseDto/SingleOutputDto.cs b/EOM.TSHotelManagement.Common.Contract/BaseDto/SingleOutputDto.cs
index ce2acaa3db88e6b9a611acf6fa8d1f7973d51793..8511d97ffbb466cfc9eddbc20fdedabb98d582b8 100644
--- a/EOM.TSHotelManagement.Common.Contract/BaseDto/SingleOutputDto.cs
+++ b/EOM.TSHotelManagement.Common.Contract/BaseDto/SingleOutputDto.cs
@@ -1,10 +1,10 @@
namespace EOM.TSHotelManagement.Common.Contract
{
- public class SingleOutputDto : BaseOutputDto
+ public class SingleOutputDto : BaseResponse
{
///
/// 数据源
///
- public T Source { get; set; }
+ public T Data { get; set; }
}
}
diff --git a/EOM.TSHotelManagement.Common.Contract/Business/Asset/Dto/Asset/ReadAssetOutputDto.cs b/EOM.TSHotelManagement.Common.Contract/Business/Asset/Dto/Asset/ReadAssetOutputDto.cs
index f46b34b20e47966701b347df5e95acfc4b9067d8..a39f3f80622c6490c39ac5dc0799bd906fa729aa 100644
--- a/EOM.TSHotelManagement.Common.Contract/Business/Asset/Dto/Asset/ReadAssetOutputDto.cs
+++ b/EOM.TSHotelManagement.Common.Contract/Business/Asset/Dto/Asset/ReadAssetOutputDto.cs
@@ -1,6 +1,6 @@
namespace EOM.TSHotelManagement.Common.Contract
{
- public class ReadAssetOutputDto
+ public class ReadAssetOutputDto : BaseOutputDto
{
public int Id { get; set; }
public string AssetNumber { get; set; }
diff --git a/EOM.TSHotelManagement.Common.Contract/Business/Customer/Dto/CustoType/ReadCustoTypeOutputDto.cs b/EOM.TSHotelManagement.Common.Contract/Business/Customer/Dto/CustoType/ReadCustoTypeOutputDto.cs
index 40b03324fad126eeda5241dfb677cfa63c58ff42..cf5423e3d8920fd7eb29bd4c9569ddec57743fc2 100644
--- a/EOM.TSHotelManagement.Common.Contract/Business/Customer/Dto/CustoType/ReadCustoTypeOutputDto.cs
+++ b/EOM.TSHotelManagement.Common.Contract/Business/Customer/Dto/CustoType/ReadCustoTypeOutputDto.cs
@@ -1,6 +1,6 @@
namespace EOM.TSHotelManagement.Common.Contract
{
- public class ReadCustoTypeOutputDto
+ public class ReadCustoTypeOutputDto : BaseOutputDto
{
public int Id { get; set; }
public int CustomerType { get; set; }
diff --git a/EOM.TSHotelManagement.Common.Contract/Business/Customer/Dto/Customer/ReadCustomerOutputDto.cs b/EOM.TSHotelManagement.Common.Contract/Business/Customer/Dto/Customer/ReadCustomerOutputDto.cs
index e299e7b74b5c541498c7e88a43798054f3a58ea7..5166172afe90d1fd5894e96a4fea143fb5f1a4d4 100644
--- a/EOM.TSHotelManagement.Common.Contract/Business/Customer/Dto/Customer/ReadCustomerOutputDto.cs
+++ b/EOM.TSHotelManagement.Common.Contract/Business/Customer/Dto/Customer/ReadCustomerOutputDto.cs
@@ -3,7 +3,7 @@ using EOM.TSHotelManagement.Common.Util;
namespace EOM.TSHotelManagement.Common.Contract
{
- public class ReadCustomerOutputDto
+ public class ReadCustomerOutputDto : BaseOutputDto
{
[UIDisplay("", true, false)]
public int Id { get; set; }
diff --git a/EOM.TSHotelManagement.Common.Contract/Business/Customer/Dto/CustomerAccount/ReadCustomerAccountInputDto.cs b/EOM.TSHotelManagement.Common.Contract/Business/Customer/Dto/CustomerAccount/ReadCustomerAccountInputDto.cs
index 2785a7ef4510d96b2813be3caa3cdfd0873dbb62..0e1635e21ec32c610c7362d13df9d68268f48d74 100644
--- a/EOM.TSHotelManagement.Common.Contract/Business/Customer/Dto/CustomerAccount/ReadCustomerAccountInputDto.cs
+++ b/EOM.TSHotelManagement.Common.Contract/Business/Customer/Dto/CustomerAccount/ReadCustomerAccountInputDto.cs
@@ -1,12 +1,6 @@
-using System;
-using System.Collections.Generic;
-using System.Linq;
-using System.Text;
-using System.Threading.Tasks;
-
-namespace EOM.TSHotelManagement.Common.Contract
+namespace EOM.TSHotelManagement.Common.Contract
{
- public class ReadCustomerAccountInputDto:BaseInputDto
+ public class ReadCustomerAccountInputDto : BaseInputDto
{
///
/// 账号 (Account)
diff --git a/EOM.TSHotelManagement.Common.Contract/Business/Customer/Dto/CustomerAccount/ReadCustomerAccountOutputDto.cs b/EOM.TSHotelManagement.Common.Contract/Business/Customer/Dto/CustomerAccount/ReadCustomerAccountOutputDto.cs
index 9d5ce93046bc24ea54e8435ed7d093585c7dc7be..74a829b7e569c9410faa2e9821c30cd232c0a1a9 100644
--- a/EOM.TSHotelManagement.Common.Contract/Business/Customer/Dto/CustomerAccount/ReadCustomerAccountOutputDto.cs
+++ b/EOM.TSHotelManagement.Common.Contract/Business/Customer/Dto/CustomerAccount/ReadCustomerAccountOutputDto.cs
@@ -1,12 +1,6 @@
-using System;
-using System.Collections.Generic;
-using System.Linq;
-using System.Text;
-using System.Threading.Tasks;
-
-namespace EOM.TSHotelManagement.Common.Contract
+namespace EOM.TSHotelManagement.Common.Contract
{
- public class ReadCustomerAccountOutputDto:BaseDto
+ public class ReadCustomerAccountOutputDto : BaseOutputDto
{
///
/// 账号 (Account)
diff --git a/EOM.TSHotelManagement.Common.Contract/Business/Customer/Dto/GenderType/ReadGenderTypeOutputDto.cs b/EOM.TSHotelManagement.Common.Contract/Business/Customer/Dto/GenderType/ReadGenderTypeOutputDto.cs
index 4db59c8960bea24a5483fa82cdb5565d371ae4d4..71aef2f72c4920020e52152fae5e6dafb63bccec 100644
--- a/EOM.TSHotelManagement.Common.Contract/Business/Customer/Dto/GenderType/ReadGenderTypeOutputDto.cs
+++ b/EOM.TSHotelManagement.Common.Contract/Business/Customer/Dto/GenderType/ReadGenderTypeOutputDto.cs
@@ -1,6 +1,6 @@
namespace EOM.TSHotelManagement.Common.Contract
{
- public class ReadGenderTypeOutputDto
+ public class ReadGenderTypeOutputDto : BaseOutputDto
{
public int Id { get; set; }
public string Name { get; set; }
diff --git a/EOM.TSHotelManagement.Common.Contract/Business/Customer/Dto/PassportType/ReadPassportTypeOutputDto.cs b/EOM.TSHotelManagement.Common.Contract/Business/Customer/Dto/PassportType/ReadPassportTypeOutputDto.cs
index cbb29c2d6ded5b1218c365591130a755643a5faf..a7e24ad3d9a723f490a0b1397941575471e975d4 100644
--- a/EOM.TSHotelManagement.Common.Contract/Business/Customer/Dto/PassportType/ReadPassportTypeOutputDto.cs
+++ b/EOM.TSHotelManagement.Common.Contract/Business/Customer/Dto/PassportType/ReadPassportTypeOutputDto.cs
@@ -1,6 +1,6 @@
namespace EOM.TSHotelManagement.Common.Contract
{
- public class ReadPassportTypeOutputDto
+ public class ReadPassportTypeOutputDto : BaseOutputDto
{
public int Id { get; set; }
public int PassportId { get; set; }
diff --git a/EOM.TSHotelManagement.Common.Contract/Business/EnergyManagement/Dto/ReadEnergyManagementOutputDto.cs b/EOM.TSHotelManagement.Common.Contract/Business/EnergyManagement/Dto/ReadEnergyManagementOutputDto.cs
index d39719f6e2b7c6f3007c428efd03360f3968d2ae..87c289fc549df1fada68b9d06819baa744e9e2a4 100644
--- a/EOM.TSHotelManagement.Common.Contract/Business/EnergyManagement/Dto/ReadEnergyManagementOutputDto.cs
+++ b/EOM.TSHotelManagement.Common.Contract/Business/EnergyManagement/Dto/ReadEnergyManagementOutputDto.cs
@@ -2,7 +2,7 @@ using EOM.TSHotelManagement.Common.Util;
namespace EOM.TSHotelManagement.Common.Contract
{
- public class ReadEnergyManagementOutputDto
+ public class ReadEnergyManagementOutputDto : BaseOutputDto
{
public int Id { get; set; }
public string InformationId { get; set; }
diff --git a/EOM.TSHotelManagement.Common.Contract/Business/News/Dto/AddNewsInputDto.cs b/EOM.TSHotelManagement.Common.Contract/Business/News/Dto/AddNewsInputDto.cs
index 172639d135539d872f836362553affb809106d4e..3812f2865183a525718003c92a36c0fe5b42e536 100644
--- a/EOM.TSHotelManagement.Common.Contract/Business/News/Dto/AddNewsInputDto.cs
+++ b/EOM.TSHotelManagement.Common.Contract/Business/News/Dto/AddNewsInputDto.cs
@@ -1,6 +1,6 @@
namespace EOM.TSHotelManagement.Common.Contract
{
- public class AddNewsInputDto: BaseInputDto
+ public class AddNewsInputDto : BaseInputDto
{
public string NewId { get; set; }
public string NewsTitle { get; set; }
diff --git a/EOM.TSHotelManagement.Common.Contract/Business/News/Dto/DeleteNewsInputDto.cs b/EOM.TSHotelManagement.Common.Contract/Business/News/Dto/DeleteNewsInputDto.cs
index 3f76f5d1327607b450f06fbeafe1dea310731be8..7a34586a0099aae28f49029f32e07415a1b363b2 100644
--- a/EOM.TSHotelManagement.Common.Contract/Business/News/Dto/DeleteNewsInputDto.cs
+++ b/EOM.TSHotelManagement.Common.Contract/Business/News/Dto/DeleteNewsInputDto.cs
@@ -1,6 +1,6 @@
namespace EOM.TSHotelManagement.Common.Contract
{
- public class DeleteNewsInputDto: BaseInputDto
+ public class DeleteNewsInputDto : BaseInputDto
{
public string NewId { get; set; }
public string NewsTitle { get; set; }
diff --git a/EOM.TSHotelManagement.Common.Contract/Business/News/Dto/ReadNewsInputDto.cs b/EOM.TSHotelManagement.Common.Contract/Business/News/Dto/ReadNewsInputDto.cs
index ac07640daabe20b60a6e80879a6e2fd4f379ddec..9553087bae4955d75562fdfd8e4e7f2d82095e3d 100644
--- a/EOM.TSHotelManagement.Common.Contract/Business/News/Dto/ReadNewsInputDto.cs
+++ b/EOM.TSHotelManagement.Common.Contract/Business/News/Dto/ReadNewsInputDto.cs
@@ -1,6 +1,6 @@
namespace EOM.TSHotelManagement.Common.Contract
{
- public class ReadNewsInputDto:ListInputDto
+ public class ReadNewsInputDto : ListInputDto
{
public string NewId { get; set; }
public string NewsTitle { get; set; }
diff --git a/EOM.TSHotelManagement.Common.Contract/Business/News/Dto/ReadNewsOuputDto.cs b/EOM.TSHotelManagement.Common.Contract/Business/News/Dto/ReadNewsOuputDto.cs
index 40af968701da0d83306c5cd1317db85aca1b2be3..4a2ea22124f4688c2ea56efb213286eadda3c2a7 100644
--- a/EOM.TSHotelManagement.Common.Contract/Business/News/Dto/ReadNewsOuputDto.cs
+++ b/EOM.TSHotelManagement.Common.Contract/Business/News/Dto/ReadNewsOuputDto.cs
@@ -1,6 +1,6 @@
namespace EOM.TSHotelManagement.Common.Contract
{
- public class ReadNewsOuputDto:BaseDto
+ public class ReadNewsOuputDto : BaseDto
{
public int Id { get; set; }
public string NewId { get; set; }
diff --git a/EOM.TSHotelManagement.Common.Contract/Business/News/Dto/UpdateNewsInputDto.cs b/EOM.TSHotelManagement.Common.Contract/Business/News/Dto/UpdateNewsInputDto.cs
index 0f395348c1d8b7ebdfd31a8c2985cf0f0101a2a0..bbf96d33ddf98644b9151f3140b9eb158663da90 100644
--- a/EOM.TSHotelManagement.Common.Contract/Business/News/Dto/UpdateNewsInputDto.cs
+++ b/EOM.TSHotelManagement.Common.Contract/Business/News/Dto/UpdateNewsInputDto.cs
@@ -1,6 +1,6 @@
namespace EOM.TSHotelManagement.Common.Contract
{
- public class UpdateNewsInputDto: BaseInputDto
+ public class UpdateNewsInputDto : BaseInputDto
{
public string NewId { get; set; }
public string NewsTitle { get; set; }
diff --git a/EOM.TSHotelManagement.Common.Contract/Business/PromotionContent/Dto/ReadPromotionContentOutputDto.cs b/EOM.TSHotelManagement.Common.Contract/Business/PromotionContent/Dto/ReadPromotionContentOutputDto.cs
index 13fdc675000dfd4e0ffa8eadf1d9a8ee3fcaab6c..2906b5a0af6a472fbd0c490cfcf73bc96db983b0 100644
--- a/EOM.TSHotelManagement.Common.Contract/Business/PromotionContent/Dto/ReadPromotionContentOutputDto.cs
+++ b/EOM.TSHotelManagement.Common.Contract/Business/PromotionContent/Dto/ReadPromotionContentOutputDto.cs
@@ -1,6 +1,6 @@
namespace EOM.TSHotelManagement.Common.Contract
{
- public class ReadPromotionContentOutputDto
+ public class ReadPromotionContentOutputDto : BaseOutputDto
{
public int Id { get; set; }
public string PromotionContentNumber { get; set; }
diff --git a/EOM.TSHotelManagement.Common.Contract/Business/Reser/Dto/ReadReserOutputDto.cs b/EOM.TSHotelManagement.Common.Contract/Business/Reser/Dto/ReadReserOutputDto.cs
index d3f7f373d46438cc736b696cfb26ec3f24d6593a..b36b8dcbda3e6bbf4721a4d7cc768d30cc06962b 100644
--- a/EOM.TSHotelManagement.Common.Contract/Business/Reser/Dto/ReadReserOutputDto.cs
+++ b/EOM.TSHotelManagement.Common.Contract/Business/Reser/Dto/ReadReserOutputDto.cs
@@ -2,7 +2,7 @@ using EOM.TSHotelManagement.Common.Util;
namespace EOM.TSHotelManagement.Common.Contract
{
- public class ReadReserOutputDto
+ public class ReadReserOutputDto : BaseOutputDto
{
public int Id { get; set; }
[UIDisplay("ԤԼ")]
diff --git a/EOM.TSHotelManagement.Common.Contract/Business/Room/Dto/Room/ReadRoomOutputDto.cs b/EOM.TSHotelManagement.Common.Contract/Business/Room/Dto/Room/ReadRoomOutputDto.cs
index 6c6b49ef4e4b6ca1b2aa9dc2a47a61522d4898b4..af301169f7cb5876111676b336d836e9a596e732 100644
--- a/EOM.TSHotelManagement.Common.Contract/Business/Room/Dto/Room/ReadRoomOutputDto.cs
+++ b/EOM.TSHotelManagement.Common.Contract/Business/Room/Dto/Room/ReadRoomOutputDto.cs
@@ -1,6 +1,6 @@
namespace EOM.TSHotelManagement.Common.Contract
{
- public class ReadRoomOutputDto
+ public class ReadRoomOutputDto : BaseOutputDto
{
public int Id { get; set; }
public string RoomNumber { get; set; }
diff --git a/EOM.TSHotelManagement.Common.Contract/Business/Room/Dto/RoomState/ReadRoomStateOutputDto.cs b/EOM.TSHotelManagement.Common.Contract/Business/Room/Dto/RoomState/ReadRoomStateOutputDto.cs
index d9d96daaa6967e64e2a8c79318429ef522894819..a24222a04ca0193b2774354e547b4010fdefef3a 100644
--- a/EOM.TSHotelManagement.Common.Contract/Business/Room/Dto/RoomState/ReadRoomStateOutputDto.cs
+++ b/EOM.TSHotelManagement.Common.Contract/Business/Room/Dto/RoomState/ReadRoomStateOutputDto.cs
@@ -1,6 +1,6 @@
namespace EOM.TSHotelManagement.Common.Contract
{
- public class ReadRoomStateOutputDto
+ public class ReadRoomStateOutputDto : BaseOutputDto
{
public int RoomStateId { get; set; }
public string RoomStateName { get; set; }
diff --git a/EOM.TSHotelManagement.Common.Contract/Business/Room/Dto/RoomType/ReadRoomTypeOutputDto.cs b/EOM.TSHotelManagement.Common.Contract/Business/Room/Dto/RoomType/ReadRoomTypeOutputDto.cs
index 7d19e71510daaa7d0e3759f7c945ee9dd7c38fc6..3bca11a484766eacc5d1877d32201d003d751b82 100644
--- a/EOM.TSHotelManagement.Common.Contract/Business/Room/Dto/RoomType/ReadRoomTypeOutputDto.cs
+++ b/EOM.TSHotelManagement.Common.Contract/Business/Room/Dto/RoomType/ReadRoomTypeOutputDto.cs
@@ -1,6 +1,6 @@
namespace EOM.TSHotelManagement.Common.Contract
{
- public class ReadRoomTypeOutputDto
+ public class ReadRoomTypeOutputDto : BaseOutputDto
{
public int Id { get; set; }
public int RoomTypeId { get; set; }
diff --git a/EOM.TSHotelManagement.Common.Contract/Business/Sellthing/Dto/DeleteSellThingInputDto.cs b/EOM.TSHotelManagement.Common.Contract/Business/Sellthing/Dto/DeleteSellThingInputDto.cs
index 24b5e590942f7fa8dc332fed1fd47a4e6f52382c..171681da9753b58c1f8e34eb67d58e87d974ed7a 100644
--- a/EOM.TSHotelManagement.Common.Contract/Business/Sellthing/Dto/DeleteSellThingInputDto.cs
+++ b/EOM.TSHotelManagement.Common.Contract/Business/Sellthing/Dto/DeleteSellThingInputDto.cs
@@ -2,8 +2,6 @@ namespace EOM.TSHotelManagement.Common.Contract
{
public class DeleteSellThingInputDto : BaseInputDto
{
- public string RoomNumber { get; set; }
- public string CustomerNumber { get; set; }
public string ProductNumber { get; set; }
public string ProductName { get; set; }
public decimal ProductPrice { get; set; }
diff --git a/EOM.TSHotelManagement.Common.Contract/Business/Sellthing/Dto/ReadSellThingOutputDto.cs b/EOM.TSHotelManagement.Common.Contract/Business/Sellthing/Dto/ReadSellThingOutputDto.cs
index 0b8a1c58eb6b919f997ed6e3c2057ad0a3be2068..28631278f1f8b29ee158d5b93c94c867f2cc3a96 100644
--- a/EOM.TSHotelManagement.Common.Contract/Business/Sellthing/Dto/ReadSellThingOutputDto.cs
+++ b/EOM.TSHotelManagement.Common.Contract/Business/Sellthing/Dto/ReadSellThingOutputDto.cs
@@ -2,7 +2,7 @@ using EOM.TSHotelManagement.Common.Util;
namespace EOM.TSHotelManagement.Common.Contract
{
- public class ReadSellThingOutputDto
+ public class ReadSellThingOutputDto : BaseOutputDto
{
public int Id { get; set; }
[UIDisplay("Ʒ")]
diff --git a/EOM.TSHotelManagement.Common.Contract/Business/Spend/Dto/Spend/ReadSpendOutputDto.cs b/EOM.TSHotelManagement.Common.Contract/Business/Spend/Dto/Spend/ReadSpendOutputDto.cs
index 854a559332c19208da9dd8d3828ab26eabecdeb0..ae09f7fdea4d271954191151e6ccf2009dd00cdd 100644
--- a/EOM.TSHotelManagement.Common.Contract/Business/Spend/Dto/Spend/ReadSpendOutputDto.cs
+++ b/EOM.TSHotelManagement.Common.Contract/Business/Spend/Dto/Spend/ReadSpendOutputDto.cs
@@ -2,7 +2,7 @@ using EOM.TSHotelManagement.Common.Util;
namespace EOM.TSHotelManagement.Common.Contract
{
- public class ReadSpendOutputDto
+ public class ReadSpendOutputDto : BaseOutputDto
{
public int Id { get; set; }
[UIDisplay("ѱ", false, false)]
diff --git a/EOM.TSHotelManagement.Common.Contract/EOM.TSHotelManagement.Common.Contract.csproj b/EOM.TSHotelManagement.Common.Contract/EOM.TSHotelManagement.Common.Contract.csproj
index abdeb0444a971e5a190fff651da6073c339b1075..52e15758c38f6bb8dfb07e9f4e6f308c87765c0e 100644
--- a/EOM.TSHotelManagement.Common.Contract/EOM.TSHotelManagement.Common.Contract.csproj
+++ b/EOM.TSHotelManagement.Common.Contract/EOM.TSHotelManagement.Common.Contract.csproj
@@ -5,6 +5,7 @@
enable
enable
True
+ AnyCPU;x64
diff --git a/EOM.TSHotelManagement.Common.Contract/Employee/Dto/Employee/ReadEmployeeOutputDto.cs b/EOM.TSHotelManagement.Common.Contract/Employee/Dto/Employee/ReadEmployeeOutputDto.cs
index adbb6d1037f0546b1bbe043cc3a94719a43e6bc2..fdbb950f3dbfa770a6702c29f52003a1517e921c 100644
--- a/EOM.TSHotelManagement.Common.Contract/Employee/Dto/Employee/ReadEmployeeOutputDto.cs
+++ b/EOM.TSHotelManagement.Common.Contract/Employee/Dto/Employee/ReadEmployeeOutputDto.cs
@@ -1,9 +1,8 @@
namespace EOM.TSHotelManagement.Common.Contract
{
- public class ReadEmployeeOutputDto : BaseDto
+ public class ReadEmployeeOutputDto : BaseOutputDto
{
- public int Id { get; set; }
public string EmployeeId { get; set; }
public string EmployeeName { get; set; }
public int Gender { get; set; }
diff --git a/EOM.TSHotelManagement.Common.Contract/Employee/Dto/EmployeeCheck/ReadEmployeeCheckOutputDto.cs b/EOM.TSHotelManagement.Common.Contract/Employee/Dto/EmployeeCheck/ReadEmployeeCheckOutputDto.cs
index 5230b06f4b7cdb3a9c2b95864435e203e5439dbc..9db2be1aa3f0a339707fd0f484df2d400966c9ac 100644
--- a/EOM.TSHotelManagement.Common.Contract/Employee/Dto/EmployeeCheck/ReadEmployeeCheckOutputDto.cs
+++ b/EOM.TSHotelManagement.Common.Contract/Employee/Dto/EmployeeCheck/ReadEmployeeCheckOutputDto.cs
@@ -1,14 +1,15 @@
namespace EOM.TSHotelManagement.Common.Contract
{
- public class ReadEmployeeCheckOutputDto
+ public class ReadEmployeeCheckOutputDto : BaseOutputDto
{
- public int Id { get; set; }
public string EmployeeId { get; set; }
public DateTime CheckTime { get; set; }
public string CheckStatus { get; set; }
public string CheckMethod { get; set; }
- public bool IsChecked { get; set; }
+ public bool MorningChecked { get; set; }
+
+ public bool EveningChecked { get; set; }
public int CheckDay { get; set; }
}
}
diff --git a/EOM.TSHotelManagement.Common.Contract/Employee/Dto/EmployeeHistory/ReadEmployeeHistoryOutputDto.cs b/EOM.TSHotelManagement.Common.Contract/Employee/Dto/EmployeeHistory/ReadEmployeeHistoryOutputDto.cs
index df39b386bb5be29035aac78c4a47a3668cbe049f..8d949b478d9547083c9f6a4df62fb9e62ac5da11 100644
--- a/EOM.TSHotelManagement.Common.Contract/Employee/Dto/EmployeeHistory/ReadEmployeeHistoryOutputDto.cs
+++ b/EOM.TSHotelManagement.Common.Contract/Employee/Dto/EmployeeHistory/ReadEmployeeHistoryOutputDto.cs
@@ -1,8 +1,7 @@
namespace EOM.TSHotelManagement.Common.Contract
{
- public class ReadEmployeeHistoryOutputDto
+ public class ReadEmployeeHistoryOutputDto : BaseOutputDto
{
- public int Id { get; set; }
public string EmployeeId { get; set; }
public DateTime StartDate { get; set; }
public DateTime EndDate { get; set; }
diff --git a/EOM.TSHotelManagement.Common.Contract/Employee/Dto/EmployeePhoto/ReadEmployeePhotoOutputDto.cs b/EOM.TSHotelManagement.Common.Contract/Employee/Dto/EmployeePhoto/ReadEmployeePhotoOutputDto.cs
index 082123022ab7cd3731492f8f4a45d83f40194ad2..89d10881daf48d789d1407198a32a71f6ad4fc27 100644
--- a/EOM.TSHotelManagement.Common.Contract/Employee/Dto/EmployeePhoto/ReadEmployeePhotoOutputDto.cs
+++ b/EOM.TSHotelManagement.Common.Contract/Employee/Dto/EmployeePhoto/ReadEmployeePhotoOutputDto.cs
@@ -1,8 +1,7 @@
namespace EOM.TSHotelManagement.Common.Contract
{
- public class ReadEmployeePhotoOutputDto
+ public class ReadEmployeePhotoOutputDto : BaseOutputDto
{
- public int Id { get; set; }
public int PhotoId { get; set; }
public string EmployeeId { get; set; }
public string PhotoPath { get; set; }
diff --git a/EOM.TSHotelManagement.Common.Contract/Employee/Dto/EmployeeRewardPunishment/ReadEmployeeRewardPunishmentOutputDto.cs b/EOM.TSHotelManagement.Common.Contract/Employee/Dto/EmployeeRewardPunishment/ReadEmployeeRewardPunishmentOutputDto.cs
index 0c669f50591684e1c961a9d057067565cbb698f4..80a7ba3690ef7e48fdafaaddbd5896afa05161ed 100644
--- a/EOM.TSHotelManagement.Common.Contract/Employee/Dto/EmployeeRewardPunishment/ReadEmployeeRewardPunishmentOutputDto.cs
+++ b/EOM.TSHotelManagement.Common.Contract/Employee/Dto/EmployeeRewardPunishment/ReadEmployeeRewardPunishmentOutputDto.cs
@@ -1,9 +1,8 @@
namespace EOM.TSHotelManagement.Common.Contract
{
- public class ReadEmployeeRewardPunishmentOutputDto
+ public class ReadEmployeeRewardPunishmentOutputDto : BaseOutputDto
{
- public int Id { get; set; }
public string EmployeeId { get; set; }
public DateTime RewardPunishmentTime { get; set; }
public int RewardPunishmentType { get; set; }
diff --git a/EOM.TSHotelManagement.Common.Contract/Employee/Dto/RewardPunishmentType/ReadRewardPunishmentTypeOutputDto.cs b/EOM.TSHotelManagement.Common.Contract/Employee/Dto/RewardPunishmentType/ReadRewardPunishmentTypeOutputDto.cs
index bc3bf0b95ec09e7d768cc665b5804193cfd41a00..042ea873611e88ef17fb55aa3561207af610ad3c 100644
--- a/EOM.TSHotelManagement.Common.Contract/Employee/Dto/RewardPunishmentType/ReadRewardPunishmentTypeOutputDto.cs
+++ b/EOM.TSHotelManagement.Common.Contract/Employee/Dto/RewardPunishmentType/ReadRewardPunishmentTypeOutputDto.cs
@@ -1,8 +1,7 @@
namespace EOM.TSHotelManagement.Common.Contract
{
- public class ReadRewardPunishmentTypeOutputDto
+ public class ReadRewardPunishmentTypeOutputDto : BaseOutputDto
{
- public int Id { get; set; }
public int GBTypeId { get; set; }
public string GBTypeName { get; set; }
}
diff --git a/EOM.TSHotelManagement.Common.Contract/SystemManagement/Dto/Administrator/ReadAdministratorOutputDto.cs b/EOM.TSHotelManagement.Common.Contract/SystemManagement/Dto/Administrator/ReadAdministratorOutputDto.cs
index dd33d406d671e84c279338313e0a375695b7f399..1e6ab2696749e27236e5b00111120b42e2b628c7 100644
--- a/EOM.TSHotelManagement.Common.Contract/SystemManagement/Dto/Administrator/ReadAdministratorOutputDto.cs
+++ b/EOM.TSHotelManagement.Common.Contract/SystemManagement/Dto/Administrator/ReadAdministratorOutputDto.cs
@@ -1,8 +1,7 @@
namespace EOM.TSHotelManagement.Common.Contract
{
- public class ReadAdministratorOutputDto : BaseDto
+ public class ReadAdministratorOutputDto : BaseOutputDto
{
- public int Id { get; set; }
public string Number { get; set; }
public string Account { get; set; }
public string Password { get; set; }
diff --git a/EOM.TSHotelManagement.Common.Contract/SystemManagement/Dto/AdministratorType/DeleteAdministratorTypeInputDto.cs b/EOM.TSHotelManagement.Common.Contract/SystemManagement/Dto/AdministratorType/DeleteAdministratorTypeInputDto.cs
index 381cdc1afd188e29d3d598f067e6d8cf4471115c..3deabac7e3f7e4a1820d8aa2f797bac8298d79a6 100644
--- a/EOM.TSHotelManagement.Common.Contract/SystemManagement/Dto/AdministratorType/DeleteAdministratorTypeInputDto.cs
+++ b/EOM.TSHotelManagement.Common.Contract/SystemManagement/Dto/AdministratorType/DeleteAdministratorTypeInputDto.cs
@@ -2,7 +2,7 @@ namespace EOM.TSHotelManagement.Common.Contract
{
public class DeleteAdministratorTypeInputDto : BaseInputDto
{
- public int Id { get; set; }
+ public string TypeId { get; set; }
}
}
diff --git a/EOM.TSHotelManagement.Common.Contract/SystemManagement/Dto/AdministratorType/ReadAdministratorTypeOutputDto.cs b/EOM.TSHotelManagement.Common.Contract/SystemManagement/Dto/AdministratorType/ReadAdministratorTypeOutputDto.cs
index f810717e64f7eda95e4ad8f9e0eb3b3c1bf94c6c..dbeb9ee0b9b76fab65e9a76a30e676c80193ce54 100644
--- a/EOM.TSHotelManagement.Common.Contract/SystemManagement/Dto/AdministratorType/ReadAdministratorTypeOutputDto.cs
+++ b/EOM.TSHotelManagement.Common.Contract/SystemManagement/Dto/AdministratorType/ReadAdministratorTypeOutputDto.cs
@@ -1,8 +1,7 @@
namespace EOM.TSHotelManagement.Common.Contract
{
- public class ReadAdministratorTypeOutputDto
+ public class ReadAdministratorTypeOutputDto : BaseOutputDto
{
- public int Id { get; set; }
public string TypeId { get; set; }
public string TypeName { get; set; }
}
diff --git a/EOM.TSHotelManagement.Common.Contract/SystemManagement/Dto/AppointmentNotice/ReadAppointmentNoticeOutputDto.cs b/EOM.TSHotelManagement.Common.Contract/SystemManagement/Dto/AppointmentNotice/ReadAppointmentNoticeOutputDto.cs
index 64aae89d182fffdf70c9f9092e2cbaac9545c6b6..36596af99172eca3a31ceb958339327d6ac0a0c7 100644
--- a/EOM.TSHotelManagement.Common.Contract/SystemManagement/Dto/AppointmentNotice/ReadAppointmentNoticeOutputDto.cs
+++ b/EOM.TSHotelManagement.Common.Contract/SystemManagement/Dto/AppointmentNotice/ReadAppointmentNoticeOutputDto.cs
@@ -1,8 +1,7 @@
namespace EOM.TSHotelManagement.Common.Contract
{
- public class ReadAppointmentNoticeOutputDto
+ public class ReadAppointmentNoticeOutputDto : BaseOutputDto
{
- public int Id { get; set; }
public string NoticeId { get; set; }
public string NoticeTheme { get; set; }
public string NoticeType { get; set; }
diff --git a/EOM.TSHotelManagement.Common.Contract/SystemManagement/Dto/AppointmentNoticeType/ReadAppointmentNoticeTypeOutputDto.cs b/EOM.TSHotelManagement.Common.Contract/SystemManagement/Dto/AppointmentNoticeType/ReadAppointmentNoticeTypeOutputDto.cs
index a84ce05e8bc7bb48e75cf6e5d9d40766f955f179..dd6fbb93d8441c444348794bfaeca0df615b8221 100644
--- a/EOM.TSHotelManagement.Common.Contract/SystemManagement/Dto/AppointmentNoticeType/ReadAppointmentNoticeTypeOutputDto.cs
+++ b/EOM.TSHotelManagement.Common.Contract/SystemManagement/Dto/AppointmentNoticeType/ReadAppointmentNoticeTypeOutputDto.cs
@@ -1,11 +1,7 @@
namespace EOM.TSHotelManagement.Common.Contract
{
- public class ReadAppointmentNoticeTypeOutputDto
+ public class ReadAppointmentNoticeTypeOutputDto : BaseOutputDto
{
- ///
- /// ID
- ///
- public int Id { get; set; }
///
/// 公告类型编号 (AppointmentNotice Type Number)
///
diff --git a/EOM.TSHotelManagement.Common.Contract/SystemManagement/Dto/Department/ReadDepartmentOutputDto.cs b/EOM.TSHotelManagement.Common.Contract/SystemManagement/Dto/Department/ReadDepartmentOutputDto.cs
index ac030be055dbf6b4f3158444800908fedf080790..dd9722c9872b9e965108690ac0e6a5098a8ac0cc 100644
--- a/EOM.TSHotelManagement.Common.Contract/SystemManagement/Dto/Department/ReadDepartmentOutputDto.cs
+++ b/EOM.TSHotelManagement.Common.Contract/SystemManagement/Dto/Department/ReadDepartmentOutputDto.cs
@@ -1,8 +1,7 @@
namespace EOM.TSHotelManagement.Common.Contract
{
- public class ReadDepartmentOutputDto
+ public class ReadDepartmentOutputDto : BaseOutputDto
{
- public int Id { get; set; }
public string DepartmentNumber { get; set; }
public string DepartmentName { get; set; }
public string DepartmentDescription { get; set; }
diff --git a/EOM.TSHotelManagement.Common.Contract/SystemManagement/Dto/Department/UpdateDepartmentInputDto.cs b/EOM.TSHotelManagement.Common.Contract/SystemManagement/Dto/Department/UpdateDepartmentInputDto.cs
index 1b951faac1b4d0f6fcdee741abd8395673d12663..79af88ae23cb4e34e8474335eadf3f6b9e5146b2 100644
--- a/EOM.TSHotelManagement.Common.Contract/SystemManagement/Dto/Department/UpdateDepartmentInputDto.cs
+++ b/EOM.TSHotelManagement.Common.Contract/SystemManagement/Dto/Department/UpdateDepartmentInputDto.cs
@@ -2,7 +2,6 @@ namespace EOM.TSHotelManagement.Common.Contract
{
public class UpdateDepartmentInputDto : BaseInputDto
{
- public int Id { get; set; }
public string DepartmentNumber { get; set; }
public string DepartmentName { get; set; }
public string DepartmentDescription { get; set; }
diff --git a/EOM.TSHotelManagement.Common.Contract/SystemManagement/Dto/Menu/ReadMenuOutputDto.cs b/EOM.TSHotelManagement.Common.Contract/SystemManagement/Dto/Menu/ReadMenuOutputDto.cs
index d1c0ac666416700e486c7c01c166f5936501cc86..12213dad87e2d8546bc2c02d144233d72f0c30e5 100644
--- a/EOM.TSHotelManagement.Common.Contract/SystemManagement/Dto/Menu/ReadMenuOutputDto.cs
+++ b/EOM.TSHotelManagement.Common.Contract/SystemManagement/Dto/Menu/ReadMenuOutputDto.cs
@@ -1,8 +1,7 @@
namespace EOM.TSHotelManagement.Common.Contract
{
- public class ReadMenuOutputDto
+ public class ReadMenuOutputDto : BaseOutputDto
{
- public int Id { get; set; }
public string Key { get; set; }
public string Title { get; set; }
public string Path { get; set; }
diff --git a/EOM.TSHotelManagement.Common.Contract/SystemManagement/Dto/Module/CreateModuleInputDto.cs b/EOM.TSHotelManagement.Common.Contract/SystemManagement/Dto/Module/CreateModuleInputDto.cs
deleted file mode 100644
index a057872e123bdaa19bbda2bf48adf4d1f86e2231..0000000000000000000000000000000000000000
--- a/EOM.TSHotelManagement.Common.Contract/SystemManagement/Dto/Module/CreateModuleInputDto.cs
+++ /dev/null
@@ -1,10 +0,0 @@
-namespace EOM.TSHotelManagement.Common.Contract
-{
- public class CreateModuleInputDto : BaseInputDto
- {
- public string ModuleName { get; set; }
- public string ModuleDescription { get; set; }
- }
-}
-
-
diff --git a/EOM.TSHotelManagement.Common.Contract/SystemManagement/Dto/Module/DeleteModuleInputDto.cs b/EOM.TSHotelManagement.Common.Contract/SystemManagement/Dto/Module/DeleteModuleInputDto.cs
deleted file mode 100644
index 6c7514dd9c5ef80d8bbd478996a53e7e51edd938..0000000000000000000000000000000000000000
--- a/EOM.TSHotelManagement.Common.Contract/SystemManagement/Dto/Module/DeleteModuleInputDto.cs
+++ /dev/null
@@ -1,10 +0,0 @@
-namespace EOM.TSHotelManagement.Common.Contract
-{
- public class DeleteModuleInputDto : BaseInputDto
- {
- public int ModuleId { get; set; }
- }
-}
-
-
-
diff --git a/EOM.TSHotelManagement.Common.Contract/SystemManagement/Dto/Module/ReadModuleInputDto.cs b/EOM.TSHotelManagement.Common.Contract/SystemManagement/Dto/Module/ReadModuleInputDto.cs
deleted file mode 100644
index 023e4a61088a5a530d389db7f8573fbd628eadda..0000000000000000000000000000000000000000
--- a/EOM.TSHotelManagement.Common.Contract/SystemManagement/Dto/Module/ReadModuleInputDto.cs
+++ /dev/null
@@ -1,9 +0,0 @@
-namespace EOM.TSHotelManagement.Common.Contract
-{
- public class ReadModuleInputDto : ListInputDto
- {
- public int ModuleId { get; set; }
- }
-}
-
-
diff --git a/EOM.TSHotelManagement.Common.Contract/SystemManagement/Dto/Module/ReadModuleOutputDto.cs b/EOM.TSHotelManagement.Common.Contract/SystemManagement/Dto/Module/ReadModuleOutputDto.cs
deleted file mode 100644
index f416f6438a8a0248a95dacf0725e0a9ba9fec73e..0000000000000000000000000000000000000000
--- a/EOM.TSHotelManagement.Common.Contract/SystemManagement/Dto/Module/ReadModuleOutputDto.cs
+++ /dev/null
@@ -1,12 +0,0 @@
-namespace EOM.TSHotelManagement.Common.Contract
-{
- public class ReadModuleOutputDto
- {
- public int Id { get; set; }
- public int ModuleId { get; set; }
- public string ModuleName { get; set; }
- public string ModuleDescription { get; set; }
- }
-}
-
-
diff --git a/EOM.TSHotelManagement.Common.Contract/SystemManagement/Dto/Module/UpdateModuleInputDto.cs b/EOM.TSHotelManagement.Common.Contract/SystemManagement/Dto/Module/UpdateModuleInputDto.cs
deleted file mode 100644
index 8a7210a32c9a5b7f2000697a26a1490c4d519651..0000000000000000000000000000000000000000
--- a/EOM.TSHotelManagement.Common.Contract/SystemManagement/Dto/Module/UpdateModuleInputDto.cs
+++ /dev/null
@@ -1,12 +0,0 @@
-namespace EOM.TSHotelManagement.Common.Contract
-{
- public class UpdateModuleInputDto : BaseInputDto
- {
- public int ModuleId { get; set; }
- public string ModuleName { get; set; }
- public string ModuleDescription { get; set; }
- }
-}
-
-
-
diff --git a/EOM.TSHotelManagement.Common.Contract/SystemManagement/Dto/ModulePermission/CreateModulePermissionInputDto.cs b/EOM.TSHotelManagement.Common.Contract/SystemManagement/Dto/ModulePermission/CreateModulePermissionInputDto.cs
deleted file mode 100644
index 8e64ba67020c87c57b8f494819f1bf805023bc74..0000000000000000000000000000000000000000
--- a/EOM.TSHotelManagement.Common.Contract/SystemManagement/Dto/ModulePermission/CreateModulePermissionInputDto.cs
+++ /dev/null
@@ -1,12 +0,0 @@
-namespace EOM.TSHotelManagement.Common.Contract
-{
- public class CreateModulePermissionInputDto : BaseInputDto
- {
- public int ModuleId { get; set; }
- public string PermissionName { get; set; }
- public string PermissionDescription { get; set; }
- }
-}
-
-
-
diff --git a/EOM.TSHotelManagement.Common.Contract/SystemManagement/Dto/ModulePermission/DeleteModulePermissionInputDto.cs b/EOM.TSHotelManagement.Common.Contract/SystemManagement/Dto/ModulePermission/DeleteModulePermissionInputDto.cs
deleted file mode 100644
index d43fc6f277f900db9c7e4eb6beea78d81843e54e..0000000000000000000000000000000000000000
--- a/EOM.TSHotelManagement.Common.Contract/SystemManagement/Dto/ModulePermission/DeleteModulePermissionInputDto.cs
+++ /dev/null
@@ -1,11 +0,0 @@
-namespace EOM.TSHotelManagement.Common.Contract
-{
- public class DeleteModulePermissionInputDto : BaseInputDto
- {
- public int PermissionId { get; set; }
- public string AdministratorAccount { get; set; }
- }
-}
-
-
-
diff --git a/EOM.TSHotelManagement.Common.Contract/SystemManagement/Dto/ModulePermission/ReadModulePermissionInputDto.cs b/EOM.TSHotelManagement.Common.Contract/SystemManagement/Dto/ModulePermission/ReadModulePermissionInputDto.cs
deleted file mode 100644
index 81cb27f60357387c271481c6f652a49bdf673b13..0000000000000000000000000000000000000000
--- a/EOM.TSHotelManagement.Common.Contract/SystemManagement/Dto/ModulePermission/ReadModulePermissionInputDto.cs
+++ /dev/null
@@ -1,11 +0,0 @@
-namespace EOM.TSHotelManagement.Common.Contract
-{
- public class ReadModulePermissionInputDto : ListInputDto
- {
- public int PermissionId { get; set; }
- public string Account { get; set; }
- }
-}
-
-
-
diff --git a/EOM.TSHotelManagement.Common.Contract/SystemManagement/Dto/ModulePermission/ReadModulePermissionOutputDto.cs b/EOM.TSHotelManagement.Common.Contract/SystemManagement/Dto/ModulePermission/ReadModulePermissionOutputDto.cs
deleted file mode 100644
index 5f819b1f5a8abf27eddbc205c32f2b6cb01abaf5..0000000000000000000000000000000000000000
--- a/EOM.TSHotelManagement.Common.Contract/SystemManagement/Dto/ModulePermission/ReadModulePermissionOutputDto.cs
+++ /dev/null
@@ -1,29 +0,0 @@
-namespace EOM.TSHotelManagement.Common.Contract
-{
- public class ReadModulePermissionOutputDto
- {
- public int Id { get; set; }
- ///
- /// ģID (Module ID)
- ///
- public int ModuleId { get; set; }
-
- ///
- /// Ա˺ (Administrator Account)
- ///
- public string AdministratorAccount { get; set; }
-
- ///
- /// ģ (Module Name)
- ///
- public string ModuleName { get; set; }
-
- ///
- /// Ƿ (Is Enabled)
- ///
- public int ModuleEnabled { get; set; }
- }
-}
-
-
-
diff --git a/EOM.TSHotelManagement.Common.Contract/SystemManagement/Dto/ModulePermission/UpdateModulePermissionInputDto.cs b/EOM.TSHotelManagement.Common.Contract/SystemManagement/Dto/ModulePermission/UpdateModulePermissionInputDto.cs
deleted file mode 100644
index 439b75b38aa1938903e50302ab6c90265b5fc6f5..0000000000000000000000000000000000000000
--- a/EOM.TSHotelManagement.Common.Contract/SystemManagement/Dto/ModulePermission/UpdateModulePermissionInputDto.cs
+++ /dev/null
@@ -1,13 +0,0 @@
-namespace EOM.TSHotelManagement.Common.Contract
-{
- public class UpdateModulePermissionInputDto : BaseInputDto
- {
- public int PermissionId { get; set; }
- public int ModuleId { get; set; }
- public string PermissionName { get; set; }
- public string PermissionDescription { get; set; }
- }
-}
-
-
-
diff --git a/EOM.TSHotelManagement.Common.Contract/SystemManagement/Dto/Nation/ReadNationOutputDto.cs b/EOM.TSHotelManagement.Common.Contract/SystemManagement/Dto/Nation/ReadNationOutputDto.cs
index 0e0d788e15c1de406db4950d058ac3e0ae95a72b..dfa7f51e376227319ae8c67fb2a1f528e4435fb1 100644
--- a/EOM.TSHotelManagement.Common.Contract/SystemManagement/Dto/Nation/ReadNationOutputDto.cs
+++ b/EOM.TSHotelManagement.Common.Contract/SystemManagement/Dto/Nation/ReadNationOutputDto.cs
@@ -1,8 +1,7 @@
namespace EOM.TSHotelManagement.Common.Contract
{
- public class ReadNationOutputDto
+ public class ReadNationOutputDto : BaseOutputDto
{
- public int Id { get; set; }
public string NationNumber { get; set; }
public string NationName { get; set; }
}
diff --git a/EOM.TSHotelManagement.Common.Contract/SystemManagement/Dto/Position/ReadPositionOutputDto.cs b/EOM.TSHotelManagement.Common.Contract/SystemManagement/Dto/Position/ReadPositionOutputDto.cs
index dc7f24b94aa8053d2756bcc8f07cc3c9b0a87834..5708caaf7a6eacf2430f19d287a42c417396daf3 100644
--- a/EOM.TSHotelManagement.Common.Contract/SystemManagement/Dto/Position/ReadPositionOutputDto.cs
+++ b/EOM.TSHotelManagement.Common.Contract/SystemManagement/Dto/Position/ReadPositionOutputDto.cs
@@ -1,8 +1,7 @@
namespace EOM.TSHotelManagement.Common.Contract
{
- public class ReadPositionOutputDto
+ public class ReadPositionOutputDto : BaseOutputDto
{
- public int Id { get; set; }
public string PositionNumber { get; set; }
public string PositionName { get; set; }
}
diff --git a/EOM.TSHotelManagement.Common.Contract/SystemManagement/Dto/Qualification/ReadEducationOutputDto.cs b/EOM.TSHotelManagement.Common.Contract/SystemManagement/Dto/Qualification/ReadEducationOutputDto.cs
index 7fb20b5dbd264f5e5f23b501e91399d62dc2775c..2600f67033f556cf836a1b7d64774f1fc3c17957 100644
--- a/EOM.TSHotelManagement.Common.Contract/SystemManagement/Dto/Qualification/ReadEducationOutputDto.cs
+++ b/EOM.TSHotelManagement.Common.Contract/SystemManagement/Dto/Qualification/ReadEducationOutputDto.cs
@@ -1,8 +1,7 @@
namespace EOM.TSHotelManagement.Common.Contract
{
- public class ReadEducationOutputDto
+ public class ReadEducationOutputDto : BaseOutputDto
{
- public int Id { get; set; }
public string EducationNumber { get; set; }
public string EducationName { get; set; }
}
diff --git a/EOM.TSHotelManagement.Common.Contract/SystemManagement/Dto/Role/ReadRoleOutputDto.cs b/EOM.TSHotelManagement.Common.Contract/SystemManagement/Dto/Role/ReadRoleOutputDto.cs
index a641af763b7f52235441c9c5c0f4eb78bfc29d4d..3da4e1e65b04472fbb45563e08c6bed673bcc758 100644
--- a/EOM.TSHotelManagement.Common.Contract/SystemManagement/Dto/Role/ReadRoleOutputDto.cs
+++ b/EOM.TSHotelManagement.Common.Contract/SystemManagement/Dto/Role/ReadRoleOutputDto.cs
@@ -1,8 +1,7 @@
namespace EOM.TSHotelManagement.Common.Contract
{
- public class ReadRoleOutputDto
+ public class ReadRoleOutputDto : BaseOutputDto
{
- public int Id { get; set; }
///
/// ע:ɫ
/// Ĭֵ:
diff --git a/EOM.TSHotelManagement.Common.Contract/SystemManagement/Dto/SupervisionStatistics/ReadSupervisionStatisticsOutputDto.cs b/EOM.TSHotelManagement.Common.Contract/SystemManagement/Dto/SupervisionStatistics/ReadSupervisionStatisticsOutputDto.cs
index 36018456529d4b5bea317228c1d347f5281c7978..7a6172c695973b4fbec84f25ccc013749051da35 100644
--- a/EOM.TSHotelManagement.Common.Contract/SystemManagement/Dto/SupervisionStatistics/ReadSupervisionStatisticsOutputDto.cs
+++ b/EOM.TSHotelManagement.Common.Contract/SystemManagement/Dto/SupervisionStatistics/ReadSupervisionStatisticsOutputDto.cs
@@ -1,8 +1,7 @@
namespace EOM.TSHotelManagement.Common.Contract
{
- public class ReadSupervisionStatisticsOutputDto
+ public class ReadSupervisionStatisticsOutputDto : BaseOutputDto
{
- public int Id { get; set; }
public string StatisticsNumber { get; set; }
public string SupervisingDepartment { get; set; }
public string SupervisingDepartmentName { get; set; }
diff --git a/EOM.TSHotelManagement.Common.Contract/SystemManagement/Dto/SystemInformation/ReadSystemInformationOutputDto.cs b/EOM.TSHotelManagement.Common.Contract/SystemManagement/Dto/SystemInformation/ReadSystemInformationOutputDto.cs
index 3afb115ad7f4ff6432d4f683039b9fad6d43f262..dcbabe2ef5f04b6bfe69e87b461beb58c65dfba0 100644
--- a/EOM.TSHotelManagement.Common.Contract/SystemManagement/Dto/SystemInformation/ReadSystemInformationOutputDto.cs
+++ b/EOM.TSHotelManagement.Common.Contract/SystemManagement/Dto/SystemInformation/ReadSystemInformationOutputDto.cs
@@ -1,8 +1,7 @@
namespace EOM.TSHotelManagement.Common.Contract
{
- public class ReadSystemInformationOutputDto
+ public class ReadSystemInformationOutputDto : BaseOutputDto
{
- public int Id { get; set; }
public int UrlNumber { get; set; }
public string UrlAddress { get; set; }
}
diff --git a/EOM.TSHotelManagement.Common.Contract/SystemManagement/Dto/VipLevelRule/ReadVipLevelRuleOutputDto.cs b/EOM.TSHotelManagement.Common.Contract/SystemManagement/Dto/VipLevelRule/ReadVipLevelRuleOutputDto.cs
index 1f3a26af1326d07c6cd9d88c19eaa781e42e8cf4..8e2cfea55db62dc5ae72ed02b40371f2c7272e57 100644
--- a/EOM.TSHotelManagement.Common.Contract/SystemManagement/Dto/VipLevelRule/ReadVipLevelRuleOutputDto.cs
+++ b/EOM.TSHotelManagement.Common.Contract/SystemManagement/Dto/VipLevelRule/ReadVipLevelRuleOutputDto.cs
@@ -2,7 +2,6 @@ namespace EOM.TSHotelManagement.Common.Contract
{
public class ReadVipLevelRuleOutputDto : BaseOutputDto
{
- public int Id { get; set; }
public string RuleSerialNumber { get; set; }
diff --git a/EOM.TSHotelManagement.Common.Contract/Util/Dto/ApplicationVersion/ReadApplicationVersionOutputDto.cs b/EOM.TSHotelManagement.Common.Contract/Util/Dto/ApplicationVersion/ReadApplicationVersionOutputDto.cs
index 6e518dfe8bcfbf2e4cd49f2de65e24e8d53b1630..fe01132f30ca509543fba272f17457e0c08788eb 100644
--- a/EOM.TSHotelManagement.Common.Contract/Util/Dto/ApplicationVersion/ReadApplicationVersionOutputDto.cs
+++ b/EOM.TSHotelManagement.Common.Contract/Util/Dto/ApplicationVersion/ReadApplicationVersionOutputDto.cs
@@ -1,8 +1,7 @@
namespace EOM.TSHotelManagement.Common.Contract
{
- public class ReadApplicationVersionOutputDto
+ public class ReadApplicationVersionOutputDto : BaseOutputDto
{
- public int Id { get; set; }
public int ApplicationVersionId { get; set; }
public string VersionNumber { get; set; }
public string VersionDescription { get; set; }
diff --git a/EOM.TSHotelManagement.Common.Contract/Util/Dto/CardCode/ReadCardCodeOutputDto.cs b/EOM.TSHotelManagement.Common.Contract/Util/Dto/CardCode/ReadCardCodeOutputDto.cs
index d7e18deae4396d26d42a1b0cfd08fdefa4328502..7e42cd3b84cef02483b66a361b3420c5e4d132b5 100644
--- a/EOM.TSHotelManagement.Common.Contract/Util/Dto/CardCode/ReadCardCodeOutputDto.cs
+++ b/EOM.TSHotelManagement.Common.Contract/Util/Dto/CardCode/ReadCardCodeOutputDto.cs
@@ -1,8 +1,7 @@
namespace EOM.TSHotelManagement.Common.Contract
{
- public class ReadCardCodeOutputDto
+ public class ReadCardCodeOutputDto : BaseOutputDto
{
- public long Id { get; set; }
public string Province { get; set; }
diff --git a/EOM.TSHotelManagement.Common.Contract/Util/Dto/Dashboard/BusinessStatisticsOutputDto.cs b/EOM.TSHotelManagement.Common.Contract/Util/Dto/Dashboard/BusinessStatisticsOutputDto.cs
index 939a55a48330dc2864a7997fd72c04c4a54b7aba..12bdb3a6ca957abdf58206683b55191092d82312 100644
--- a/EOM.TSHotelManagement.Common.Contract/Util/Dto/Dashboard/BusinessStatisticsOutputDto.cs
+++ b/EOM.TSHotelManagement.Common.Contract/Util/Dto/Dashboard/BusinessStatisticsOutputDto.cs
@@ -2,7 +2,7 @@
namespace EOM.TSHotelManagement.Common.Contract
{
- public class BusinessStatisticsOutputDto : BaseOutputDto
+ public class BusinessStatisticsOutputDto : BaseResponse
{
[JsonPropertyName("genderRatio")]
public TempGenderRatio GenderRatio { get; set; }
diff --git a/EOM.TSHotelManagement.Common.Contract/Util/Dto/Dashboard/HumanResourcesOutputDto.cs b/EOM.TSHotelManagement.Common.Contract/Util/Dto/Dashboard/HumanResourcesOutputDto.cs
index a6349aa9292613b1c0bf06d97c39118c29efd677..2c5273e4de92b4d3541543dc8420fada4c034aad 100644
--- a/EOM.TSHotelManagement.Common.Contract/Util/Dto/Dashboard/HumanResourcesOutputDto.cs
+++ b/EOM.TSHotelManagement.Common.Contract/Util/Dto/Dashboard/HumanResourcesOutputDto.cs
@@ -3,7 +3,7 @@ using System.Text.Json.Serialization;
namespace EOM.TSHotelManagement.Common.Contract
{
- public class HumanResourcesOutputDto : BaseOutputDto
+ public class HumanResourcesOutputDto : BaseResponse
{
[JsonPropertyName("totalEmployees")]
public int TotalEmployees { get; set; }
diff --git a/EOM.TSHotelManagement.Common.Contract/Util/Dto/Dashboard/LogisticsDataOutputDto.cs b/EOM.TSHotelManagement.Common.Contract/Util/Dto/Dashboard/LogisticsDataOutputDto.cs
index 0620d613adacde539d88e223f1a27a35b4177368..3e7ca879064b332d19e974266dbef40bd533476c 100644
--- a/EOM.TSHotelManagement.Common.Contract/Util/Dto/Dashboard/LogisticsDataOutputDto.cs
+++ b/EOM.TSHotelManagement.Common.Contract/Util/Dto/Dashboard/LogisticsDataOutputDto.cs
@@ -2,7 +2,7 @@
namespace EOM.TSHotelManagement.Common.Contract
{
- public class LogisticsDataOutputDto : BaseOutputDto
+ public class LogisticsDataOutputDto : BaseResponse
{
[JsonPropertyName("totalProducts")]
public int TotalProducts { get; set; }
diff --git a/EOM.TSHotelManagement.Common.Contract/Util/Dto/Dashboard/RoomStatisticsOutputDto.cs b/EOM.TSHotelManagement.Common.Contract/Util/Dto/Dashboard/RoomStatisticsOutputDto.cs
index b3c93d429bd4ee8c8f66d3ef92cf70e74cf68fdf..cc7f24e4e29e1495a71a4e96956457376f9e891e 100644
--- a/EOM.TSHotelManagement.Common.Contract/Util/Dto/Dashboard/RoomStatisticsOutputDto.cs
+++ b/EOM.TSHotelManagement.Common.Contract/Util/Dto/Dashboard/RoomStatisticsOutputDto.cs
@@ -3,7 +3,7 @@ using System.Text.Json.Serialization;
namespace EOM.TSHotelManagement.Common.Contract
{
- public class RoomStatisticsOutputDto : BaseOutputDto
+ public class RoomStatisticsOutputDto : BaseResponse
{
[JsonPropertyName("status")]
public TempRoomStatus Status { get; set; }
diff --git a/EOM.TSHotelManagement.Common.Contract/Util/Dto/OperationLog/ReadOperationLogInputDto.cs b/EOM.TSHotelManagement.Common.Contract/Util/Dto/OperationLog/ReadOperationLogInputDto.cs
index 24944714058025b76e24188dfdf919ad19abecef..c04f8e448f0d40c9d003f34abbc6480245b47cc8 100644
--- a/EOM.TSHotelManagement.Common.Contract/Util/Dto/OperationLog/ReadOperationLogInputDto.cs
+++ b/EOM.TSHotelManagement.Common.Contract/Util/Dto/OperationLog/ReadOperationLogInputDto.cs
@@ -6,8 +6,8 @@ namespace EOM.TSHotelManagement.Common.Contract
public string OperationId { get; set; }
public int? LogLevel { get; set; }
- public DateTime StartTime { get; set; }
- public DateTime EndTime { get; set; }
+ public DateTime? StartTime { get; set; }
+ public DateTime? EndTime { get; set; }
}
}
diff --git a/EOM.TSHotelManagement.Common.Contract/Util/Dto/OperationLog/ReadOperationLogOutputDto.cs b/EOM.TSHotelManagement.Common.Contract/Util/Dto/OperationLog/ReadOperationLogOutputDto.cs
index eb5cbbb29f71b4b5b5cbb30f22d2b51a0a6b9a4e..9a0d9ce63aaa1531eb24f0d2652aabc5b1e4d218 100644
--- a/EOM.TSHotelManagement.Common.Contract/Util/Dto/OperationLog/ReadOperationLogOutputDto.cs
+++ b/EOM.TSHotelManagement.Common.Contract/Util/Dto/OperationLog/ReadOperationLogOutputDto.cs
@@ -2,9 +2,8 @@ using EOM.TSHotelManagement.Common.Core;
namespace EOM.TSHotelManagement.Common.Contract
{
- public class ReadOperationLogOutputDto
+ public class ReadOperationLogOutputDto : BaseOutputDto
{
- public int Id { get; set; }
public string OperationId { get; set; }
public DateTime OperationTime { get; set; }
public string LogContent { get; set; }
diff --git a/EOM.TSHotelManagement.Common.Contract/Util/Dto/RequestLog/ReadRequestLogInputDto.cs b/EOM.TSHotelManagement.Common.Contract/Util/Dto/RequestLog/ReadRequestLogInputDto.cs
index f91d41581391d52d089f29b76b71b7e23ed2f6dd..6d9d2155866ec149d51483a8c8be61feaa1c6082 100644
--- a/EOM.TSHotelManagement.Common.Contract/Util/Dto/RequestLog/ReadRequestLogInputDto.cs
+++ b/EOM.TSHotelManagement.Common.Contract/Util/Dto/RequestLog/ReadRequestLogInputDto.cs
@@ -1,12 +1,6 @@
-using System;
-using System.Collections.Generic;
-using System.Linq;
-using System.Text;
-using System.Threading.Tasks;
-
-namespace EOM.TSHotelManagement.Common.Contract
+namespace EOM.TSHotelManagement.Common.Contract
{
- public class ReadRequestLogInputDto:ListInputDto
+ public class ReadRequestLogInputDto : ListInputDto
{
}
diff --git a/EOM.TSHotelManagement.Common.Contract/Util/Dto/RequestLog/ReadRequestLogOutputDto.cs b/EOM.TSHotelManagement.Common.Contract/Util/Dto/RequestLog/ReadRequestLogOutputDto.cs
index 8554a6bb6134e708d65ec6d666923bdebb6c8f4a..2b4bcf345934565f76a56011096d2e91e6f41692 100644
--- a/EOM.TSHotelManagement.Common.Contract/Util/Dto/RequestLog/ReadRequestLogOutputDto.cs
+++ b/EOM.TSHotelManagement.Common.Contract/Util/Dto/RequestLog/ReadRequestLogOutputDto.cs
@@ -1,18 +1,7 @@
-using SqlSugar;
-using System;
-using System.Collections.Generic;
-using System.Linq;
-using System.Text;
-using System.Threading.Tasks;
-
-namespace EOM.TSHotelManagement.Common.Contract
+namespace EOM.TSHotelManagement.Common.Contract
{
- public class ReadRequestLogOutputDto
+ public class ReadRequestLogOutputDto : BaseOutputDto
{
- ///
- /// 编号 (ID)
- ///
- public int Id { get; set; }
///
/// 请求路径 (URL Path)
diff --git a/EOM.TSHotelManagement.Common.Core/BaseEntity.cs b/EOM.TSHotelManagement.Common.Core/BaseEntity.cs
index 9868eeb6252ba0e0376200c193fe59c9b0f1addc..8e5e8fdbac1f4f5c06f43ff991bf7efb94ed1510 100644
--- a/EOM.TSHotelManagement.Common.Core/BaseEntity.cs
+++ b/EOM.TSHotelManagement.Common.Core/BaseEntity.cs
@@ -17,7 +17,7 @@ namespace EOM.TSHotelManagement.Common.Core
///
/// 资料创建时间
///
- [SqlSugar.SugarColumn(ColumnName = "datains_date", IsOnlyIgnoreUpdate = true, InsertServerTime = true, IsNullable = true)]
+ [SqlSugar.SugarColumn(ColumnName = "datains_date", IsOnlyIgnoreUpdate = true, IsNullable = true)]
public DateTime? DataInsDate { get; set; }
///
/// 资料更新人
@@ -27,7 +27,7 @@ namespace EOM.TSHotelManagement.Common.Core
///
/// 资料更新时间
///
- [SqlSugar.SugarColumn(ColumnName = "datachg_date", IsOnlyIgnoreInsert = true, InsertServerTime = true, IsNullable = true)]
+ [SqlSugar.SugarColumn(ColumnName = "datachg_date", IsOnlyIgnoreInsert = true, IsNullable = true)]
public DateTime? DataChgDate { get; set; }
///
/// Token
diff --git a/EOM.TSHotelManagement.Common.Core/Business/Customer/CustomerAccount.cs b/EOM.TSHotelManagement.Common.Core/Business/Customer/CustomerAccount.cs
index 03b71d8c18b9ca9809ea8b34dff1f0fc4af7ab29..c8be1af9d0b859f322619f8da49a6d7d2cedf751 100644
--- a/EOM.TSHotelManagement.Common.Core/Business/Customer/CustomerAccount.cs
+++ b/EOM.TSHotelManagement.Common.Core/Business/Customer/CustomerAccount.cs
@@ -1,9 +1,4 @@
using System;
-using System.Collections.Generic;
-using System.ComponentModel.DataAnnotations.Schema;
-using System.Linq;
-using System.Text;
-using System.Threading.Tasks;
namespace EOM.TSHotelManagement.Common.Core
{
diff --git a/EOM.TSHotelManagement.Common.Core/Business/News/News.cs b/EOM.TSHotelManagement.Common.Core/Business/News/News.cs
index 20af3db6d9a6e941298bb25a654fce73237ce947..5d3327ffcb0f370f0715acc13ee8e6feb86329fc 100644
--- a/EOM.TSHotelManagement.Common.Core/Business/News/News.cs
+++ b/EOM.TSHotelManagement.Common.Core/Business/News/News.cs
@@ -1,8 +1,4 @@
using System;
-using System.Collections.Generic;
-using System.Linq;
-using System.Text;
-using System.Threading.Tasks;
namespace EOM.TSHotelManagement.Common.Core
{
diff --git a/EOM.TSHotelManagement.Common.Core/Business/News/NewsStatus.cs b/EOM.TSHotelManagement.Common.Core/Business/News/NewsStatus.cs
index 95e51839da40732f5f55d8751eb27b3ab7a3baae..6d4a49e1ab979f287d1192c10885ddb984ddc698 100644
--- a/EOM.TSHotelManagement.Common.Core/Business/News/NewsStatus.cs
+++ b/EOM.TSHotelManagement.Common.Core/Business/News/NewsStatus.cs
@@ -1,9 +1,4 @@
-using System;
-using System.Collections.Generic;
-using System.ComponentModel;
-using System.Linq;
-using System.Text;
-using System.Threading.Tasks;
+using System.ComponentModel;
namespace EOM.TSHotelManagement.Common.Core
{
diff --git a/EOM.TSHotelManagement.Common.Core/Business/News/NewsType.cs b/EOM.TSHotelManagement.Common.Core/Business/News/NewsType.cs
index 9aab8db5f84029887097981e027c6860c21e8ad6..7e5d92f694be3156db50c0cc3e58d7e9b2821557 100644
--- a/EOM.TSHotelManagement.Common.Core/Business/News/NewsType.cs
+++ b/EOM.TSHotelManagement.Common.Core/Business/News/NewsType.cs
@@ -1,9 +1,4 @@
-using System;
-using System.Collections.Generic;
-using System.ComponentModel;
-using System.Linq;
-using System.Text;
-using System.Threading.Tasks;
+using System.ComponentModel;
namespace EOM.TSHotelManagement.Common.Core.Business
{
diff --git a/EOM.TSHotelManagement.Common.Core/Business/Room/Room.cs b/EOM.TSHotelManagement.Common.Core/Business/Room/Room.cs
index 55e61e6a2a8827360171d83fbceef3fc3f40e757..8ee2e47755ce678ece707d26e1a479bba1e1c86b 100644
--- a/EOM.TSHotelManagement.Common.Core/Business/Room/Room.cs
+++ b/EOM.TSHotelManagement.Common.Core/Business/Room/Room.cs
@@ -50,7 +50,7 @@ namespace EOM.TSHotelManagement.Common.Core
IsNullable = false,
Length = 128
)]
- [NeedValid] // 假设此特性用于业务验证
+ [NeedValid]
public string RoomNumber { get; set; }
///
diff --git a/EOM.TSHotelManagement.Common.Core/EOM.TSHotelManagement.Common.Core.csproj b/EOM.TSHotelManagement.Common.Core/EOM.TSHotelManagement.Common.Core.csproj
index 1c3bb57c9644b7efa8e041eb101fd47ea2e2475e..866569c4ebd12722971cba3bb9040a6f119b38fb 100644
--- a/EOM.TSHotelManagement.Common.Core/EOM.TSHotelManagement.Common.Core.csproj
+++ b/EOM.TSHotelManagement.Common.Core/EOM.TSHotelManagement.Common.Core.csproj
@@ -3,6 +3,7 @@
net8.0
True
+ AnyCPU;x64
diff --git a/EOM.TSHotelManagement.Common.Util/EOM.TSHotelManagement.Common.Util.csproj b/EOM.TSHotelManagement.Common.Util/EOM.TSHotelManagement.Common.Util.csproj
index 0a5cfb39be540a68f64b0bb27e66b905b7b25cee..a885042cab99fe552f2e6e4f1d878dd347899132 100644
--- a/EOM.TSHotelManagement.Common.Util/EOM.TSHotelManagement.Common.Util.csproj
+++ b/EOM.TSHotelManagement.Common.Util/EOM.TSHotelManagement.Common.Util.csproj
@@ -2,6 +2,7 @@
net8.0
+ AnyCPU;x64
diff --git a/EOM.TSHotelManagement.Common.Util/GenerateJWT/JWTHelper.cs b/EOM.TSHotelManagement.Common.Util/GenerateJWT/JWTHelper.cs
index 227a7afc3b85f58cb89d670dba7fb7a372d91c72..8aef43ef451ec63a8ac0f7499699f7da55b70f24 100644
--- a/EOM.TSHotelManagement.Common.Util/GenerateJWT/JWTHelper.cs
+++ b/EOM.TSHotelManagement.Common.Util/GenerateJWT/JWTHelper.cs
@@ -42,9 +42,7 @@ namespace EOM.TSHotelManagement.Common.Util
Expires = DateTime.Now.AddMinutes(expiryMinutes),
SigningCredentials = new SigningCredentials(
new SymmetricSecurityKey(key),
- SecurityAlgorithms.HmacSha256Signature),
- Audience = jwtConfig.Audience,
- Issuer = jwtConfig.Issuer
+ SecurityAlgorithms.HmacSha256Signature)
};
var token = tokenHandler.CreateToken(tokenDescriptor);
@@ -61,13 +59,10 @@ namespace EOM.TSHotelManagement.Common.Util
var validationParameters = new TokenValidationParameters
{
- ValidateIssuer = true,
- ValidIssuer = jwtConfig.Issuer,
- ValidateAudience = true,
- ValidAudience = jwtConfig.Audience,
- ValidateLifetime = true,
IssuerSigningKey = new SymmetricSecurityKey(Encoding.UTF8.GetBytes(jwtConfig.Key)),
- ValidateIssuerSigningKey = true,
+ ValidateIssuerSigningKey = false,
+ ValidateIssuer = false,
+ ValidateAudience = false,
NameClaimType = ClaimTypes.Name,
RoleClaimType = ClaimTypes.Role,
ClockSkew = TimeSpan.Zero
diff --git a/EOM.TSHotelManagement.Common.Util/Helper/EntityMapper.cs b/EOM.TSHotelManagement.Common.Util/Helper/EntityMapper.cs
index 38b55d2d785e0550a4889759afda5f4b33960a5f..41b4b2222e656408c9ecbf99c331d39494f9b6b3 100644
--- a/EOM.TSHotelManagement.Common.Util/Helper/EntityMapper.cs
+++ b/EOM.TSHotelManagement.Common.Util/Helper/EntityMapper.cs
@@ -10,10 +10,6 @@ namespace EOM.TSHotelManagement.Common.Util
///
/// ӳ䵥ʵ
///
- /// Դ
- /// Ŀ
- /// Դ
- /// Ŀ
public static TDestination Map(TSource source)
where TDestination : new()
{
@@ -37,7 +33,30 @@ namespace EOM.TSHotelManagement.Common.Util
if (destinationProperty == null || !destinationProperty.CanWrite) continue;
var sourceValue = sourceProperty.GetValue(source);
- if (sourceValue == null) continue;
+
+ if (sourceValue is DateOnly dateOnlyValue &&
+ destinationProperty.PropertyType == typeof(DateTime?))
+ {
+ if (dateOnlyValue == DateOnly.MinValue || dateOnlyValue == new DateOnly(1900, 1, 1))
+ {
+ destinationProperty.SetValue(destination, null);
+ }
+ else
+ {
+ destinationProperty.SetValue(destination, dateOnlyValue.ToDateTime(TimeOnly.MinValue));
+ }
+ continue;
+ }
+
+ if (sourceValue == null)
+ {
+ if (destinationProperty.PropertyType.IsValueType &&
+ Nullable.GetUnderlyingType(destinationProperty.PropertyType) != null)
+ {
+ destinationProperty.SetValue(destination, null);
+ }
+ continue;
+ }
if (NeedConversion(sourceProperty.PropertyType, destinationProperty.PropertyType))
{
@@ -51,103 +70,191 @@ namespace EOM.TSHotelManagement.Common.Util
}
///
- /// Զת
+ /// ת
///
- ///
- ///
- ///
- ///
private static object SmartConvert(object value, Type targetType)
{
- var underlyingTargetType = Nullable.GetUnderlyingType(targetType) ?? targetType;
-
if (value is DateOnly dateOnly)
{
- return HandleDateOnlyConversion(dateOnly, underlyingTargetType);
+ return HandleDateOnlyConversion(dateOnly, targetType);
}
if (value is DateTime dateTime)
{
- return HandleDateTimeConversion(dateTime, underlyingTargetType);
+ return HandleDateTimeConversion(dateTime, targetType);
}
if (value is string dateString)
{
- return HandleStringConversion(dateString, underlyingTargetType);
+ return HandleStringConversion(dateString, targetType);
+ }
+
+ if (IsMinValue(value))
+ {
+ return ConvertMinValueToNull(value, targetType);
}
try
{
- return Convert.ChangeType(value, underlyingTargetType);
+ return Convert.ChangeType(value, targetType);
}
catch (InvalidCastException)
{
+ var underlyingType = Nullable.GetUnderlyingType(targetType);
+ if (underlyingType != null)
+ {
+ try
+ {
+ return Convert.ChangeType(value, underlyingType);
+ }
+ catch
+ {
+
+ }
+ }
+
throw new InvalidOperationException(
$"Cannot convert {value.GetType()} to {targetType}");
}
}
- private static object HandleDateOnlyConversion(DateOnly dateOnly, Type targetType)
+ ///
+ /// ǷΪСֵ
+ ///
+ private static bool IsMinValue(object value)
{
- return targetType switch
+ return value switch
{
- _ when targetType == typeof(DateTime) => dateOnly.ToDateTime(TimeOnly.MinValue),
- _ when targetType == typeof(DateTimeOffset) => new DateTimeOffset(dateOnly.ToDateTime(TimeOnly.MinValue)),
- _ when targetType == typeof(string) => dateOnly.ToString("yyyy-MM-dd"),
- _ when targetType == typeof(DateOnly) => dateOnly,
- _ => throw new InvalidCastException($"Unsupported DateOnly conversion to {targetType}")
+ DateTime dt => dt == DateTime.MinValue || dt == new DateTime(1900, 1, 1),
+ DateOnly d => d == DateOnly.MinValue || d == new DateOnly(1900, 1, 1),
+ DateTimeOffset dto => dto == DateTimeOffset.MinValue || dto == new DateTimeOffset(1900, 1, 1, 0, 0, 0, TimeSpan.Zero),
+ _ => false
};
}
+ ///
+ /// СֵתΪֵ
+ ///
+ private static object ConvertMinValueToNull(object value, Type targetType)
+ {
+ if (Nullable.GetUnderlyingType(targetType) != null)
+ {
+ return null;
+ }
+
+ if (targetType == typeof(string))
+ {
+ return string.Empty;
+ }
+
+ return value;
+ }
+
+ ///
+ /// DateOnly ת
+ ///
+ private static object HandleDateOnlyConversion(DateOnly dateOnly, Type targetType)
+ {
+ if (IsMinValue(dateOnly))
+ {
+ return ConvertMinValueToNull(dateOnly, targetType);
+ }
+
+ var underlyingType = Nullable.GetUnderlyingType(targetType) ?? targetType;
+
+ switch (underlyingType.Name)
+ {
+ case nameof(DateTime):
+ return dateOnly.ToDateTime(TimeOnly.MinValue);
+
+ case nameof(DateTimeOffset):
+ return new DateTimeOffset(dateOnly.ToDateTime(TimeOnly.MinValue));
+
+ case nameof(String):
+ return dateOnly.ToString("yyyy-MM-dd");
+
+ case nameof(DateOnly):
+ return dateOnly;
+
+ default:
+ throw new InvalidCastException($"Unsupported DateOnly conversion to {targetType}");
+ }
+ }
+
+ ///
+ /// DateTime ת
+ ///
private static object HandleDateTimeConversion(DateTime dateTime, Type targetType)
{
- return targetType switch
+ if (IsMinValue(dateTime))
{
- _ when targetType == typeof(DateOnly) => DateOnly.FromDateTime(dateTime),
- _ when targetType == typeof(DateTimeOffset) => new DateTimeOffset(dateTime),
- _ when targetType == typeof(string) => dateTime.ToString("yyyy-MM-dd HH:mm:ss"),
- _ => dateTime // ֱӷԭʼֵ
- };
+ return ConvertMinValueToNull(dateTime, targetType);
+ }
+
+ var underlyingType = Nullable.GetUnderlyingType(targetType) ?? targetType;
+
+ switch (underlyingType.Name)
+ {
+ case nameof(DateOnly):
+ return DateOnly.FromDateTime(dateTime);
+
+ case nameof(DateTimeOffset):
+ return new DateTimeOffset(dateTime);
+
+ case nameof(String):
+ return dateTime.ToString("yyyy-MM-dd HH:mm:ss");
+
+ case nameof(DateTime):
+ return dateTime;
+
+ default:
+ return dateTime;
+ }
}
+ ///
+ /// ַת
+ ///
private static object HandleStringConversion(string dateString, Type targetType)
{
if (DateTime.TryParse(dateString, out DateTime dt))
{
- return targetType switch
- {
- _ when targetType == typeof(DateOnly) => DateOnly.FromDateTime(dt),
- _ when targetType == typeof(DateTime) => dt,
- _ => dt
- };
+ return HandleDateTimeConversion(dt, targetType);
}
+
+ if (DateOnly.TryParse(dateString, out DateOnly d))
+ {
+ return HandleDateOnlyConversion(d, targetType);
+ }
+
+ if (string.IsNullOrWhiteSpace(dateString))
+ {
+ return ConvertMinValueToNull(DateTime.MinValue, targetType);
+ }
+
throw new FormatException($"Invalid date string: {dateString}");
}
///
- /// ת
+ /// жǷҪת
///
- ///
- ///
- ///
private static bool NeedConversion(Type sourceType, Type targetType)
{
var underlyingSource = Nullable.GetUnderlyingType(sourceType) ?? sourceType;
var underlyingTarget = Nullable.GetUnderlyingType(targetType) ?? targetType;
- return underlyingSource != underlyingTarget;
+
+ if (underlyingSource == underlyingTarget) return false;
+
+ return true;
}
///
/// ӳʵб
///
- /// Դ
- /// Ŀ
- /// Դб
- /// Ŀб
public static List MapList(List sourceList)
where TDestination : new()
{
return sourceList?.Select(Map).ToList();
}
}
-}
+}
\ No newline at end of file
diff --git a/EOM.TSHotelManagement.Common.Util/Helper/MailHelper.cs b/EOM.TSHotelManagement.Common.Util/Helper/MailHelper.cs
index 9a8eeb1bb06a1715756205d15152a5f2fd7d6f22..7458df5ab2918fe5f6534b0c5a217f444b5e836a 100644
--- a/EOM.TSHotelManagement.Common.Util/Helper/MailHelper.cs
+++ b/EOM.TSHotelManagement.Common.Util/Helper/MailHelper.cs
@@ -19,7 +19,7 @@ namespace EOM.TSHotelManagement.Common.Util
this.mailConfigFactory = mailConfigFactory;
}
- public void SendMail(
+ public bool SendMail(
List toEmails,
string subject,
string body,
@@ -28,6 +28,11 @@ namespace EOM.TSHotelManagement.Common.Util
List attachments = null,
bool isBodyHtml = true)
{
+ if (!IsMailConfigValid())
+ {
+ return false;
+ }
+
var mailConfig = mailConfigFactory.GetMailConfig();
var message = new MimeMessage();
@@ -63,6 +68,8 @@ namespace EOM.TSHotelManagement.Common.Util
client.Authenticate(mailConfig.UserName, mailConfig.Password);
client.Send(message);
+
+ return true;
}
catch (AuthenticationException ex)
{
@@ -84,6 +91,50 @@ namespace EOM.TSHotelManagement.Common.Util
#region Private Methods
+ private bool IsMailConfigValid()
+ {
+ try
+ {
+ var config = mailConfigFactory.GetMailConfig();
+
+ if (config == null)
+ {
+ return false;
+ }
+
+ if (string.IsNullOrWhiteSpace(config.Host))
+ {
+ return false;
+ }
+
+ if (config.Port <= 0 || config.Port > 65535)
+ {
+ return false;
+ }
+
+ if (string.IsNullOrWhiteSpace(config.UserName))
+ {
+ return false;
+ }
+
+ if (string.IsNullOrWhiteSpace(config.Password))
+ {
+ return false;
+ }
+
+ if (string.IsNullOrWhiteSpace(config.DisplayName))
+ {
+ return false;
+ }
+
+ return true;
+ }
+ catch (Exception)
+ {
+ return false;
+ }
+ }
+
private void AddRecipients(InternetAddressList list, List emails)
{
emails?.Where(email => !string.IsNullOrWhiteSpace(email))
diff --git a/EOM.TSHotelManagement.Shared/Interfaces/ISqlSugarClientFactory.cs b/EOM.TSHotelManagement.EntityFramework/Connector/ISqlSugarClientConnector.cs
similarity index 50%
rename from EOM.TSHotelManagement.Shared/Interfaces/ISqlSugarClientFactory.cs
rename to EOM.TSHotelManagement.EntityFramework/Connector/ISqlSugarClientConnector.cs
index edb0d382b1ce6e799485839c1c81a8e464c95437..0b7c36975bbb182538ac6b3c625a3f91224bca7e 100644
--- a/EOM.TSHotelManagement.Shared/Interfaces/ISqlSugarClientFactory.cs
+++ b/EOM.TSHotelManagement.EntityFramework/Connector/ISqlSugarClientConnector.cs
@@ -1,8 +1,8 @@
using SqlSugar;
-namespace EOM.TSHotelManagement.Shared
+namespace EOM.TSHotelManagement.EntityFramework
{
- public interface ISqlSugarClientFactory
+ public interface ISqlSugarClientConnector
{
ISqlSugarClient CreateClient(string dbName = null);
}
diff --git a/EOM.TSHotelManagement.WebApi/Factory/SqlSugarClientFactory.cs b/EOM.TSHotelManagement.EntityFramework/Connector/SqlSugarClientConnector.cs
similarity index 57%
rename from EOM.TSHotelManagement.WebApi/Factory/SqlSugarClientFactory.cs
rename to EOM.TSHotelManagement.EntityFramework/Connector/SqlSugarClientConnector.cs
index a552ec9a725c13f984866f7799c85de12f44da95..92d7e94e447409bdfbb337bef7ba1207114b575c 100644
--- a/EOM.TSHotelManagement.WebApi/Factory/SqlSugarClientFactory.cs
+++ b/EOM.TSHotelManagement.EntityFramework/Connector/SqlSugarClientConnector.cs
@@ -1,16 +1,14 @@
using EOM.TSHotelManagement.Shared;
-using EOM.TSHotelManagement.WebApi.Constant;
using Microsoft.Extensions.Configuration;
using SqlSugar;
-using System;
-namespace EOM.TSHotelManagement.WebApi
+namespace EOM.TSHotelManagement.EntityFramework
{
- public class SqlSugarClientFactory : ISqlSugarClientFactory
+ public class SqlSugarClientConnector : ISqlSugarClientConnector
{
private readonly IConfiguration _configuration;
- public SqlSugarClientFactory(IConfiguration configuration)
+ public SqlSugarClientConnector(IConfiguration configuration)
{
_configuration = configuration;
}
@@ -18,17 +16,17 @@ namespace EOM.TSHotelManagement.WebApi
public ISqlSugarClient CreateClient(string dbName = null)
{
// 读取默认数据库名称
- dbName ??= _configuration[DatabaseConstants.DefaultDatabase];
+ dbName ??= _configuration[SystemConstants.DefaultDatabase];
string connectionString;
- if (Environment.GetEnvironmentVariable(DatabaseConstants.DockerEnv) != null)
+ if (Environment.GetEnvironmentVariable(SystemConstants.DockerEnv) != null)
{
- connectionString = Environment.GetEnvironmentVariable(DatabaseConstants.DefaultDatabase) switch
+ connectionString = Environment.GetEnvironmentVariable(SystemConstants.DefaultDatabase) switch
{
- DatabaseConstants.PgSql => Environment.GetEnvironmentVariable($"{DatabaseConstants.PgSql}ConnectStr"), //Test passed
- DatabaseConstants.MySql => Environment.GetEnvironmentVariable($"{DatabaseConstants.MySql}ConnectStr"), //Test passed
- DatabaseConstants.SqlServer => Environment.GetEnvironmentVariable($"{DatabaseConstants.SqlServer}ConnectStr"), //Test passed
- DatabaseConstants.Oracle => Environment.GetEnvironmentVariable($"{DatabaseConstants.Oracle}ConnectStr"), //Please manually test
- DatabaseConstants.MariaDB => Environment.GetEnvironmentVariable($"{DatabaseConstants.MariaDB}ConnectStr"), //Test passed
+ SystemConstants.PgSql => Environment.GetEnvironmentVariable($"{SystemConstants.PgSql}ConnectStr"), //Test passed
+ SystemConstants.MySql => Environment.GetEnvironmentVariable($"{SystemConstants.MySql}ConnectStr"), //Test passed
+ SystemConstants.SqlServer => Environment.GetEnvironmentVariable($"{SystemConstants.SqlServer}ConnectStr"), //Test passed
+ SystemConstants.Oracle => Environment.GetEnvironmentVariable($"{SystemConstants.Oracle}ConnectStr"), //Please manually test
+ SystemConstants.MariaDB => Environment.GetEnvironmentVariable($"{SystemConstants.MariaDB}ConnectStr"), //Test passed
_ => throw new ArgumentException("Unsupported database", nameof(dbName)),
};
}
@@ -55,7 +53,7 @@ namespace EOM.TSHotelManagement.WebApi
{
PgSqlIsAutoToLower = true,
PgSqlIsAutoToLowerCodeFirst = true,
- DisableMillisecond = true
+ DisableMillisecond = true,
};
break;
case DbType.SqlServer:
@@ -74,11 +72,11 @@ namespace EOM.TSHotelManagement.WebApi
{
return dbName switch
{
- DatabaseConstants.PgSql => DbType.PostgreSQL,
- DatabaseConstants.MySql => DbType.MySql,
- DatabaseConstants.Oracle => DbType.Oracle,
- DatabaseConstants.SqlServer => DbType.SqlServer,
- DatabaseConstants.MariaDB => DbType.MySqlConnector,
+ SystemConstants.PgSql => DbType.PostgreSQL,
+ SystemConstants.MySql => DbType.MySql,
+ SystemConstants.Oracle => DbType.Oracle,
+ SystemConstants.SqlServer => DbType.SqlServer,
+ SystemConstants.MariaDB => DbType.MySqlConnector,
_ => throw new ArgumentException("Unsupported database", nameof(dbName))
};
}
diff --git a/EOM.TSHotelManagement.WebApi/MigrationConfig/InitializeConfig.cs b/EOM.TSHotelManagement.EntityFramework/DatabaseInitializer/DatabaseInitializer.cs
similarity index 89%
rename from EOM.TSHotelManagement.WebApi/MigrationConfig/InitializeConfig.cs
rename to EOM.TSHotelManagement.EntityFramework/DatabaseInitializer/DatabaseInitializer.cs
index 9f34fd71af27125b98eb5d14ef73b9447c93e215..baee303d9ee41155364940c6adaac2d5dff9d7eb 100644
--- a/EOM.TSHotelManagement.WebApi/MigrationConfig/InitializeConfig.cs
+++ b/EOM.TSHotelManagement.EntityFramework/DatabaseInitializer/DatabaseInitializer.cs
@@ -1,42 +1,36 @@
-using EOM.TSHotelManagement.Common.Core;
+using EOM.TSHotelManagement.Common.Core;
using EOM.TSHotelManagement.Migration;
using EOM.TSHotelManagement.Shared;
-using EOM.TSHotelManagement.WebApi.Constant;
-using Microsoft.AspNetCore.Builder;
using Microsoft.Data.SqlClient;
using Microsoft.Extensions.Configuration;
-using Microsoft.Extensions.DependencyInjection;
-using Microsoft.Extensions.Logging;
using MySqlConnector;
using Npgsql;
using Oracle.ManagedDataAccess.Client;
using SqlSugar;
-using System;
-using System.Collections.Generic;
-using System.Linq;
-namespace EOM.TSHotelManagement.WebApi
+namespace EOM.TSHotelManagement.EntityFramework
{
- public class InitializeConfig
+ public class DatabaseInitializer : IDatabaseInitializer
{
- private readonly IConfiguration config;
-
- public InitializeConfig(IConfiguration configuration)
+ private readonly ISqlSugarClient _client;
+ private readonly ISqlSugarClientConnector _connector;
+ private readonly IConfiguration _configuration;
+ public DatabaseInitializer(ISqlSugarClient client, ISqlSugarClientConnector connector, IConfiguration configuration)
{
- config = configuration;
+ _client = client;
+ _connector = connector;
+ _configuration = configuration;
}
#region initlize database
- public void InitializeDatabase(IApplicationBuilder app)
+ public void InitializeDatabase()
{
- using var scope = app.ApplicationServices.CreateScope();
- var logger = scope.ServiceProvider.GetRequiredService>();
- var config = scope.ServiceProvider.GetRequiredService();
- var factory = scope.ServiceProvider.GetRequiredService();
+ var config = _configuration;
+ var factory = _connector;
try
{
- var dbName = config[DatabaseConstants.DefaultDatabase] ?? DatabaseConstants.MariaDB;
+ var dbName = config[SystemConstants.DefaultDatabase] ?? SystemConstants.MariaDB;
var dbSettings = GetDatabaseSettings(config, dbName);
using (var masterDb = CreateMasterConnection(config, dbName, dbSettings.DbType))
@@ -101,7 +95,7 @@ namespace EOM.TSHotelManagement.WebApi
private (string Database, DbType DbType) GetDatabaseSettings(IConfiguration config, string dbName)
{
- var dbType = SqlSugarClientFactory.GetDbType(dbName);
+ var dbType = GetDbType(dbName);
var connectionString = GetConnectionString(config, dbName);
switch (dbType)
@@ -183,7 +177,7 @@ namespace EOM.TSHotelManagement.WebApi
private string GetConnectionString(IConfiguration config, string dbName)
{
- if (Environment.GetEnvironmentVariable(DatabaseConstants.DockerEnv) != null)
+ if (Environment.GetEnvironmentVariable(SystemConstants.DockerEnv) != null)
{
return Environment.GetEnvironmentVariable($"{dbName}ConnectStr")
?? throw new ArgumentException($"Environment variable {dbName}ConnectStr not found");
@@ -335,10 +329,23 @@ namespace EOM.TSHotelManagement.WebApi
finally
{
Console.WriteLine("Database data initialization completed");
- Console.WriteLine($"administrator account:admin");
- Console.WriteLine($"administrator password:admin");
+ Console.WriteLine($"administrator accountadmin");
+ Console.WriteLine($"administrator passwordadmin");
}
}
+
+ public static DbType GetDbType(string dbName)
+ {
+ return dbName switch
+ {
+ SystemConstants.PgSql => DbType.PostgreSQL,
+ SystemConstants.MySql => DbType.MySql,
+ SystemConstants.Oracle => DbType.Oracle,
+ SystemConstants.SqlServer => DbType.SqlServer,
+ SystemConstants.MariaDB => DbType.MySqlConnector,
+ _ => throw new ArgumentException("Unsupported database", nameof(dbName))
+ };
+ }
#endregion
}
}
diff --git a/EOM.TSHotelManagement.EntityFramework/DatabaseInitializer/IDatabaseInitializer.cs b/EOM.TSHotelManagement.EntityFramework/DatabaseInitializer/IDatabaseInitializer.cs
new file mode 100644
index 0000000000000000000000000000000000000000..9dd316dcb4fa9526ec7c0e3f3e54f21060fac3bf
--- /dev/null
+++ b/EOM.TSHotelManagement.EntityFramework/DatabaseInitializer/IDatabaseInitializer.cs
@@ -0,0 +1,8 @@
+
+namespace EOM.TSHotelManagement.EntityFramework
+{
+ public interface IDatabaseInitializer
+ {
+ void InitializeDatabase();
+ }
+}
diff --git a/EOM.TSHotelManagement.EntityFramework/EOM.TSHotelManagement.EntityFramework.csproj b/EOM.TSHotelManagement.EntityFramework/EOM.TSHotelManagement.EntityFramework.csproj
index 6f5a89c927d7b0cce5c3f20228a8884b20d2ee7f..9251206fc0d20e7e516528351294bc5d87dc01e7 100644
--- a/EOM.TSHotelManagement.EntityFramework/EOM.TSHotelManagement.EntityFramework.csproj
+++ b/EOM.TSHotelManagement.EntityFramework/EOM.TSHotelManagement.EntityFramework.csproj
@@ -4,18 +4,22 @@
net8.0
enable
disable
+ AnyCPU;x64
+
-
+
+
+
diff --git a/EOM.TSHotelManagement.EntityFramework/Repository/GenericRepository.cs b/EOM.TSHotelManagement.EntityFramework/Repository/GenericRepository.cs
index 01a9fe4ddb4db862eb601804579759dee7416afd..0c7cdfeb8e611de09ee716ca11622e58f938a357 100644
--- a/EOM.TSHotelManagement.EntityFramework/Repository/GenericRepository.cs
+++ b/EOM.TSHotelManagement.EntityFramework/Repository/GenericRepository.cs
@@ -1,12 +1,90 @@
-using SqlSugar;
+using EOM.TSHotelManagement.Common.Core;
+using EOM.TSHotelManagement.Common.Util;
+using Microsoft.AspNetCore.Http;
+using SqlSugar;
namespace EOM.TSHotelManagement.EntityFramework
{
public class GenericRepository : SimpleClient where T : class, new()
{
- public GenericRepository(ISqlSugarClient client) : base(client)
+
+ ///
+ /// HTTP上下文访问器
+ ///
+ private readonly IHttpContextAccessor _httpContextAccessor;
+
+ private readonly JWTHelper _jWTHelper;
+
+ public GenericRepository(ISqlSugarClient client, IHttpContextAccessor httpContextAccessor, JWTHelper jWTHelper) : base(client)
+ {
+ base.Context = client;
+ _httpContextAccessor = httpContextAccessor;
+ _jWTHelper = jWTHelper;
+ }
+
+ private string GetCurrentUser()
+ {
+ try
+ {
+ var authHeader = _httpContextAccessor?.HttpContext?.Request?.Headers["Authorization"];
+ if (string.IsNullOrEmpty(authHeader)) return "System";
+
+ var token = authHeader.ToString().Replace("Bearer ", "", StringComparison.OrdinalIgnoreCase);
+
+ return _jWTHelper.GetSerialNumber(token);
+ }
+ catch
+ {
+ return "System";
+ }
+ }
+
+ public override bool Insert(T entity)
+ {
+ if (entity is BaseEntity baseEntity)
+ {
+ var currentUser = GetCurrentUser();
+ baseEntity.DataInsDate = DateTime.Now;
+ baseEntity.DataInsUsr = currentUser;
+ }
+ return base.Insert(entity);
+ }
+
+ public override bool Update(T entity)
+ {
+ if (entity is BaseEntity baseEntity)
+ {
+ var currentUser = GetCurrentUser();
+ baseEntity.DataChgDate = DateTime.Now;
+ baseEntity.DataChgUsr = currentUser;
+ }
+ return base.Context.Updateable(entity).IgnoreColumns(ignoreAllNullColumns: true, false, true).ExecuteCommand() > 0;
+ }
+
+ public override bool UpdateRange(List updateObjs)
+ {
+ foreach (var entity in updateObjs)
+ {
+ if (entity is BaseEntity baseEntity)
+ {
+ var currentUser = GetCurrentUser();
+ baseEntity.DataChgDate = DateTime.Now;
+ baseEntity.DataChgUsr = currentUser;
+ }
+ }
+
+ return base.Context.Updateable(updateObjs).IgnoreColumns(ignoreAllNullColumns: true, false, true).ExecuteCommand() > 0;
+ }
+
+ public bool SoftDelete(T entity)
{
- base.Context.Aop.OnError = (ex) => { };
+ if (entity is BaseEntity baseEntity)
+ {
+ var currentUser = GetCurrentUser();
+ baseEntity.DataChgDate = DateTime.Now;
+ baseEntity.DataChgUsr = currentUser;
+ }
+ return base.Context.Updateable(entity).IgnoreColumns(ignoreAllNullColumns: true, false, true).ExecuteCommand() > 0;
}
}
}
diff --git a/EOM.TSHotelManagement.Migration/EOM.TSHotelManagement.Migration.csproj b/EOM.TSHotelManagement.Migration/EOM.TSHotelManagement.Migration.csproj
index 030f286a54825876bb916ce0f7d0aa43a4a572f2..60d2bc782d8e9112c0cc1faaab23038be7efacda 100644
--- a/EOM.TSHotelManagement.Migration/EOM.TSHotelManagement.Migration.csproj
+++ b/EOM.TSHotelManagement.Migration/EOM.TSHotelManagement.Migration.csproj
@@ -4,12 +4,9 @@
net8.0
enable
enable
+ AnyCPU;x64
-
-
-
-
diff --git a/EOM.TSHotelManagement.Migration/EntityBuilder.cs b/EOM.TSHotelManagement.Migration/EntityBuilder.cs
index 04f688c74b166982470c8d73aacb53e6ce13d242..65be0a2b621b3a363c67441d81f0610e1ef3187f 100644
--- a/EOM.TSHotelManagement.Migration/EntityBuilder.cs
+++ b/EOM.TSHotelManagement.Migration/EntityBuilder.cs
@@ -43,7 +43,8 @@ namespace EOM.TSHotelManagement.Migration
typeof(SystemInformation),
typeof(UserRole),
typeof(VipLevelRule),
- typeof(RequestLog)
+ typeof(RequestLog),
+ typeof(News)
};
private readonly List
///
///
+ [AllowAnonymous]
[HttpGet]
- public SingleOutputDto News([FromQuery]ReadNewsInputDto readNewsInputDto)
+ public SingleOutputDto News([FromQuery] ReadNewsInputDto readNewsInputDto)
{
return newsService.News(readNewsInputDto);
}
@@ -38,7 +40,7 @@ namespace EOM.TSHotelManagement.WebApi
///
///
[HttpPost]
- public BaseOutputDto AddNews([FromBody] AddNewsInputDto addNewsInputDto)
+ public BaseResponse AddNews([FromBody] AddNewsInputDto addNewsInputDto)
{
return newsService.AddNews(addNewsInputDto);
}
@@ -48,7 +50,7 @@ namespace EOM.TSHotelManagement.WebApi
///
///
[HttpPost]
- public BaseOutputDto UpdateNews([FromBody] UpdateNewsInputDto updateNewsInputDto)
+ public BaseResponse UpdateNews([FromBody] UpdateNewsInputDto updateNewsInputDto)
{
return newsService.UpdateNews(updateNewsInputDto);
}
@@ -58,7 +60,7 @@ namespace EOM.TSHotelManagement.WebApi
///
///
[HttpPost]
- public BaseOutputDto DeleteNews([FromBody]DeleteNewsInputDto deleteNewsInputDto)
+ public BaseResponse DeleteNews([FromBody] DeleteNewsInputDto deleteNewsInputDto)
{
return newsService.DeleteNews(deleteNewsInputDto);
}
diff --git a/EOM.TSHotelManagement.WebApi/Controllers/Business/PromotionContent/PromotionContentController.cs b/EOM.TSHotelManagement.WebApi/Controllers/Business/PromotionContent/PromotionContentController.cs
index fb5dbcdf47f8825c52ead94ea13694b6267b248e..782c1d9b2efbec003cc878e9277a5759caaffb6a 100644
--- a/EOM.TSHotelManagement.WebApi/Controllers/Business/PromotionContent/PromotionContentController.cs
+++ b/EOM.TSHotelManagement.WebApi/Controllers/Business/PromotionContent/PromotionContentController.cs
@@ -49,7 +49,7 @@ namespace EOM.TSHotelManagement.WebApi.Controllers
///
///
[HttpPost]
- public BaseOutputDto AddPromotionContent([FromBody] CreatePromotionContentInputDto createPromotionContentInputDto)
+ public BaseResponse AddPromotionContent([FromBody] CreatePromotionContentInputDto createPromotionContentInputDto)
{
return fontsService.AddPromotionContent(createPromotionContentInputDto);
}
@@ -60,7 +60,7 @@ namespace EOM.TSHotelManagement.WebApi.Controllers
///
///
[HttpPost]
- public BaseOutputDto DeletePromotionContent([FromBody] DeletePromotionContentInputDto deletePromotionContentInputDto)
+ public BaseResponse DeletePromotionContent([FromBody] DeletePromotionContentInputDto deletePromotionContentInputDto)
{
return fontsService.DeletePromotionContent(deletePromotionContentInputDto);
}
@@ -71,7 +71,7 @@ namespace EOM.TSHotelManagement.WebApi.Controllers
///
///
[HttpPost]
- public BaseOutputDto UpdatePromotionContent([FromBody] UpdatePromotionContentInputDto updatePromotionContentInputDto)
+ public BaseResponse UpdatePromotionContent([FromBody] UpdatePromotionContentInputDto updatePromotionContentInputDto)
{
return fontsService.UpdatePromotionContent(updatePromotionContentInputDto);
}
diff --git a/EOM.TSHotelManagement.WebApi/Controllers/Business/Reser/ReserController.cs b/EOM.TSHotelManagement.WebApi/Controllers/Business/Reser/ReserController.cs
index f65a5fd182f589bdea2291e2df696625948bb752..85c0894842d7fb8dae9130065e1b46326392b189 100644
--- a/EOM.TSHotelManagement.WebApi/Controllers/Business/Reser/ReserController.cs
+++ b/EOM.TSHotelManagement.WebApi/Controllers/Business/Reser/ReserController.cs
@@ -50,7 +50,7 @@ namespace EOM.TSHotelManagement.WebApi.Controllers
///
///
[HttpPost]
- public BaseOutputDto DeleteReserInfo([FromBody] DeleteReserInputDto reser)
+ public BaseResponse DeleteReserInfo([FromBody] DeleteReserInputDto reser)
{
return reserService.DeleteReserInfo(reser);
}
@@ -61,7 +61,7 @@ namespace EOM.TSHotelManagement.WebApi.Controllers
///
///
[HttpPost]
- public BaseOutputDto UpdateReserInfo([FromBody] UpdateReserInputDto r)
+ public BaseResponse UpdateReserInfo([FromBody] UpdateReserInputDto r)
{
return reserService.UpdateReserInfo(r);
}
@@ -72,7 +72,7 @@ namespace EOM.TSHotelManagement.WebApi.Controllers
///
///
[HttpPost]
- public BaseOutputDto InserReserInfo([FromBody] CreateReserInputDto r)
+ public BaseResponse InserReserInfo([FromBody] CreateReserInputDto r)
{
return reserService.InserReserInfo(r);
}
diff --git a/EOM.TSHotelManagement.WebApi/Controllers/Business/Room/RoomController.cs b/EOM.TSHotelManagement.WebApi/Controllers/Business/Room/RoomController.cs
index 4bd2f0cdf79b9c2f987c0d93ce3801307e7f0240..5ef1fd0bfbf746df10cab2fc5bc84798f77d03fa 100644
--- a/EOM.TSHotelManagement.WebApi/Controllers/Business/Room/RoomController.cs
+++ b/EOM.TSHotelManagement.WebApi/Controllers/Business/Room/RoomController.cs
@@ -86,7 +86,7 @@ namespace EOM.TSHotelManagement.WebApi.Controllers
///
///
[HttpPost]
- public BaseOutputDto UpdateRoomInfo([FromBody] UpdateRoomInputDto inputDto)
+ public BaseResponse UpdateRoomInfo([FromBody] UpdateRoomInputDto inputDto)
{
return roomService.UpdateRoomInfo(inputDto);
}
@@ -97,7 +97,7 @@ namespace EOM.TSHotelManagement.WebApi.Controllers
///
///
[HttpPost]
- public BaseOutputDto UpdateRoomInfoWithReser([FromBody] UpdateRoomInputDto inputDto)
+ public BaseResponse UpdateRoomInfoWithReser([FromBody] UpdateRoomInputDto inputDto)
{
return roomService.UpdateRoomInfoWithReser(inputDto);
}
@@ -169,7 +169,7 @@ namespace EOM.TSHotelManagement.WebApi.Controllers
///
///
[HttpPost]
- public BaseOutputDto UpdateRoomStateByRoomNo([FromBody] UpdateRoomInputDto inputDto)
+ public BaseResponse UpdateRoomStateByRoomNo([FromBody] UpdateRoomInputDto inputDto)
{
return roomService.UpdateRoomStateByRoomNo(inputDto);
}
@@ -180,7 +180,7 @@ namespace EOM.TSHotelManagement.WebApi.Controllers
///
///
[HttpPost]
- public BaseOutputDto InsertRoom([FromBody] CreateRoomInputDto inputDto)
+ public BaseResponse InsertRoom([FromBody] CreateRoomInputDto inputDto)
{
return roomService.InsertRoom(inputDto);
}
@@ -191,7 +191,7 @@ namespace EOM.TSHotelManagement.WebApi.Controllers
///
///
[HttpPost]
- public BaseOutputDto UpdateRoom([FromBody] UpdateRoomInputDto inputDto)
+ public BaseResponse UpdateRoom([FromBody] UpdateRoomInputDto inputDto)
{
return roomService.UpdateRoom(inputDto);
}
@@ -202,7 +202,7 @@ namespace EOM.TSHotelManagement.WebApi.Controllers
///
///
[HttpPost]
- public BaseOutputDto DeleteRoom([FromBody] DeleteRoomInputDto inputDto)
+ public BaseResponse DeleteRoom([FromBody] DeleteRoomInputDto inputDto)
{
return roomService.DeleteRoom(inputDto);
}
@@ -213,7 +213,7 @@ namespace EOM.TSHotelManagement.WebApi.Controllers
///
///
[HttpPost]
- public BaseOutputDto TransferRoom([FromBody] TransferRoomDto transferRoomDto)
+ public BaseResponse TransferRoom([FromBody] TransferRoomDto transferRoomDto)
{
return roomService.TransferRoom(transferRoomDto);
}
@@ -224,7 +224,7 @@ namespace EOM.TSHotelManagement.WebApi.Controllers
///
///
[HttpPost]
- public BaseOutputDto CheckoutRoom([FromBody] CheckoutRoomDto checkoutRoomDto)
+ public BaseResponse CheckoutRoom([FromBody] CheckoutRoomDto checkoutRoomDto)
{
return roomService.CheckoutRoom(checkoutRoomDto);
}
@@ -235,7 +235,7 @@ namespace EOM.TSHotelManagement.WebApi.Controllers
///
///
[HttpPost]
- public BaseOutputDto CheckinRoomByReservation([FromBody] CheckinRoomByReservationDto checkinRoomByReservationDto)
+ public BaseResponse CheckinRoomByReservation([FromBody] CheckinRoomByReservationDto checkinRoomByReservationDto)
{
return roomService.CheckinRoomByReservation(checkinRoomByReservationDto);
}
diff --git a/EOM.TSHotelManagement.WebApi/Controllers/Business/Room/RoomTypeController.cs b/EOM.TSHotelManagement.WebApi/Controllers/Business/Room/RoomTypeController.cs
index af0aa50965b5991cba7a73587796f786898aad02..711402413ef905abb5e62c13e12d8df9121fe554 100644
--- a/EOM.TSHotelManagement.WebApi/Controllers/Business/Room/RoomTypeController.cs
+++ b/EOM.TSHotelManagement.WebApi/Controllers/Business/Room/RoomTypeController.cs
@@ -44,7 +44,7 @@ namespace EOM.TSHotelManagement.WebApi.Controllers
///
///
[HttpPost]
- public BaseOutputDto InsertRoomType([FromBody] CreateRoomTypeInputDto inputDto)
+ public BaseResponse InsertRoomType([FromBody] CreateRoomTypeInputDto inputDto)
{
return roomTypeService.InsertRoomType(inputDto);
}
@@ -55,7 +55,7 @@ namespace EOM.TSHotelManagement.WebApi.Controllers
///
///
[HttpPost]
- public BaseOutputDto UpdateRoomType([FromBody] UpdateRoomTypeInputDto inputDto)
+ public BaseResponse UpdateRoomType([FromBody] UpdateRoomTypeInputDto inputDto)
{
return roomTypeService.UpdateRoomType(inputDto);
}
@@ -66,7 +66,7 @@ namespace EOM.TSHotelManagement.WebApi.Controllers
///
///
[HttpPost]
- public BaseOutputDto DeleteRoomType([FromBody] DeleteRoomTypeInputDto inputDto)
+ public BaseResponse DeleteRoomType([FromBody] DeleteRoomTypeInputDto inputDto)
{
return roomTypeService.DeleteRoomType(inputDto);
}
diff --git a/EOM.TSHotelManagement.WebApi/Controllers/Business/Sellthing/SellthingController.cs b/EOM.TSHotelManagement.WebApi/Controllers/Business/Sellthing/SellthingController.cs
index 81453cbf452872acba3a752ab11bc2d47cfb99a5..2965edf0cf79ee0412160380ae692984d7521ab1 100644
--- a/EOM.TSHotelManagement.WebApi/Controllers/Business/Sellthing/SellthingController.cs
+++ b/EOM.TSHotelManagement.WebApi/Controllers/Business/Sellthing/SellthingController.cs
@@ -33,7 +33,7 @@ namespace EOM.TSHotelManagement.WebApi.Controllers
///
///
[HttpPost]
- public BaseOutputDto UpdateSellThing([FromBody] UpdateSellThingInputDto updateSellThingInputDto)
+ public BaseResponse UpdateSellThing([FromBody] UpdateSellThingInputDto updateSellThingInputDto)
{
return sellService.UpdateSellThing(updateSellThingInputDto);
}
@@ -44,7 +44,7 @@ namespace EOM.TSHotelManagement.WebApi.Controllers
///
///
[HttpPost]
- public BaseOutputDto UpdateSellthingInfo([FromBody] UpdateSellThingInputDto sellThing)
+ public BaseResponse UpdateSellthingInfo([FromBody] UpdateSellThingInputDto sellThing)
{
return sellService.UpdateSellthingInfo(sellThing);
}
@@ -55,7 +55,7 @@ namespace EOM.TSHotelManagement.WebApi.Controllers
///
///
[HttpPost]
- public BaseOutputDto DeleteSellthing([FromQuery] DeleteSellThingInputDto deleteSellThingInputDto)
+ public BaseResponse DeleteSellthing([FromBody] DeleteSellThingInputDto deleteSellThingInputDto)
{
return sellService.DeleteSellthing(deleteSellThingInputDto);
}
@@ -77,7 +77,7 @@ namespace EOM.TSHotelManagement.WebApi.Controllers
///
///
[HttpPost]
- public BaseOutputDto InsertSellThing([FromBody] CreateSellThingInputDto st)
+ public BaseResponse InsertSellThing([FromBody] CreateSellThingInputDto st)
{
return sellService.InsertSellThing(st);
}
diff --git a/EOM.TSHotelManagement.WebApi/Controllers/Business/Spend/SpendController.cs b/EOM.TSHotelManagement.WebApi/Controllers/Business/Spend/SpendController.cs
index 8a60c3ecd6e06fc55f01d04fe1fdcfb5eda470ed..e944c83a6a7b419f0dd8c09b65eb1a07df07dbad 100644
--- a/EOM.TSHotelManagement.WebApi/Controllers/Business/Spend/SpendController.cs
+++ b/EOM.TSHotelManagement.WebApi/Controllers/Business/Spend/SpendController.cs
@@ -65,7 +65,7 @@ namespace EOM.TSHotelManagement.WebApi.Controllers
///
///
[HttpPost]
- public BaseOutputDto UndoCustomerSpend([FromBody] UpdateSpendInputDto updateSpendInputDto)
+ public BaseResponse UndoCustomerSpend([FromBody] UpdateSpendInputDto updateSpendInputDto)
{
return spendService.UndoCustomerSpend(updateSpendInputDto);
}
@@ -76,7 +76,7 @@ namespace EOM.TSHotelManagement.WebApi.Controllers
///
///
[HttpPost]
- public BaseOutputDto AddCustomerSpend([FromBody] AddCustomerSpendInputDto addCustomerSpendInputDto)
+ public BaseResponse AddCustomerSpend([FromBody] AddCustomerSpendInputDto addCustomerSpendInputDto)
{
return spendService.AddCustomerSpend(addCustomerSpendInputDto);
}
@@ -87,9 +87,9 @@ namespace EOM.TSHotelManagement.WebApi.Controllers
///
///
[HttpPost]
- public BaseOutputDto UpdSpenInfo([FromBody] UpdateSpendInputDto inputDto)
+ public BaseResponse UpdSpendInfo([FromBody] UpdateSpendInputDto inputDto)
{
- return spendService.UpdSpenInfo(inputDto);
+ return spendService.UpdSpendInfo(inputDto);
}
}
}
diff --git a/EOM.TSHotelManagement.WebApi/Controllers/Employee/Check/EmployeeCheckController.cs b/EOM.TSHotelManagement.WebApi/Controllers/Employee/Check/EmployeeCheckController.cs
index 6686a293bed646268796b13878486f9a67715652..b3d84672f20a77ef145c2e5cf29a7d2f5ff27ce8 100644
--- a/EOM.TSHotelManagement.WebApi/Controllers/Employee/Check/EmployeeCheckController.cs
+++ b/EOM.TSHotelManagement.WebApi/Controllers/Employee/Check/EmployeeCheckController.cs
@@ -55,7 +55,7 @@ namespace EOM.TSHotelManagement.WebApi.Controllers
///
///
[HttpPost]
- public BaseOutputDto AddCheckInfo([FromBody] CreateEmployeeCheckInputDto workerCheck)
+ public BaseResponse AddCheckInfo([FromBody] CreateEmployeeCheckInputDto workerCheck)
{
return workerCheckService.AddCheckInfo(workerCheck);
}
diff --git a/EOM.TSHotelManagement.WebApi/Controllers/Employee/EmployeeController.cs b/EOM.TSHotelManagement.WebApi/Controllers/Employee/EmployeeController.cs
index 736bcab9ecd8e3105d87225a2cb4e8a4104a13d3..922ecdcc4b638d0203c7e30a4da9ec827d4fd581 100644
--- a/EOM.TSHotelManagement.WebApi/Controllers/Employee/EmployeeController.cs
+++ b/EOM.TSHotelManagement.WebApi/Controllers/Employee/EmployeeController.cs
@@ -23,7 +23,7 @@ namespace EOM.TSHotelManagement.WebApi.Controllers
///
///
[HttpPost]
- public BaseOutputDto UpdateEmployee([FromBody] UpdateEmployeeInputDto worker)
+ public BaseResponse UpdateEmployee([FromBody] UpdateEmployeeInputDto worker)
{
return workerService.UpdateEmployee(worker);
}
@@ -34,7 +34,7 @@ namespace EOM.TSHotelManagement.WebApi.Controllers
///
///
[HttpPost]
- public BaseOutputDto ManagerEmployeeAccount([FromBody] UpdateEmployeeInputDto worker)
+ public BaseResponse ManagerEmployeeAccount([FromBody] UpdateEmployeeInputDto worker)
{
return workerService.ManagerEmployeeAccount(worker);
}
@@ -45,7 +45,7 @@ namespace EOM.TSHotelManagement.WebApi.Controllers
///
///
[HttpPost]
- public BaseOutputDto AddEmployee([FromBody] CreateEmployeeInputDto worker)
+ public BaseResponse AddEmployee([FromBody] CreateEmployeeInputDto worker)
{
return workerService.AddEmployee(worker);
}
@@ -90,7 +90,7 @@ namespace EOM.TSHotelManagement.WebApi.Controllers
///
///
[HttpPost]
- public BaseOutputDto UpdateEmployeeAccountPassword([FromBody] UpdateEmployeeInputDto updateEmployeeInputDto)
+ public BaseResponse UpdateEmployeeAccountPassword([FromBody] UpdateEmployeeInputDto updateEmployeeInputDto)
{
return workerService.UpdateEmployeeAccountPassword(updateEmployeeInputDto);
}
@@ -100,7 +100,7 @@ namespace EOM.TSHotelManagement.WebApi.Controllers
///
///
[HttpPost]
- public BaseOutputDto ResetEmployeeAccountPassword([FromBody] UpdateEmployeeInputDto updateEmployeeInputDto)
+ public BaseResponse ResetEmployeeAccountPassword([FromBody] UpdateEmployeeInputDto updateEmployeeInputDto)
{
return workerService.ResetEmployeeAccountPassword(updateEmployeeInputDto);
}
diff --git a/EOM.TSHotelManagement.WebApi/Controllers/Employee/History/EmployeeHistoryController.cs b/EOM.TSHotelManagement.WebApi/Controllers/Employee/History/EmployeeHistoryController.cs
index af883fa35239342ce634b9cd78f56e63a78c73bc..c6e7e887cf416308f71d98e1f9fe43f900f6b5ff 100644
--- a/EOM.TSHotelManagement.WebApi/Controllers/Employee/History/EmployeeHistoryController.cs
+++ b/EOM.TSHotelManagement.WebApi/Controllers/Employee/History/EmployeeHistoryController.cs
@@ -22,7 +22,7 @@ namespace EOM.TSHotelManagement.WebApi.Controllers
///
///
[HttpPost]
- public BaseOutputDto AddHistoryByEmployeeId([FromBody] CreateEmployeeHistoryInputDto workerHistory)
+ public BaseResponse AddHistoryByEmployeeId([FromBody] CreateEmployeeHistoryInputDto workerHistory)
{
return workerHistoryService.AddHistoryByEmployeeId(workerHistory);
}
diff --git a/EOM.TSHotelManagement.WebApi/Controllers/Employee/Photo/EmployeePhotoController.cs b/EOM.TSHotelManagement.WebApi/Controllers/Employee/Photo/EmployeePhotoController.cs
index 04656961c83b553b3a548be8b0e07e024a140271..8421cf9b8f91d80bb6746cdf9eed747bf8779a0d 100644
--- a/EOM.TSHotelManagement.WebApi/Controllers/Employee/Photo/EmployeePhotoController.cs
+++ b/EOM.TSHotelManagement.WebApi/Controllers/Employee/Photo/EmployeePhotoController.cs
@@ -46,7 +46,7 @@ namespace EOM.TSHotelManagement.WebApi.Controllers
///
///
[HttpPost]
- public BaseOutputDto DeleteWorkerPhoto([FromBody] DeleteEmployeePhotoInputDto inputDto)
+ public BaseResponse DeleteWorkerPhoto([FromBody] DeleteEmployeePhotoInputDto inputDto)
{
return workerPicService.DeleteWorkerPhoto(inputDto);
}
@@ -57,7 +57,7 @@ namespace EOM.TSHotelManagement.WebApi.Controllers
///
///
[HttpPost]
- public BaseOutputDto UpdateWorkerPhoto([FromBody] UpdateEmployeePhotoInputDto inputDto)
+ public BaseResponse UpdateWorkerPhoto([FromBody] UpdateEmployeePhotoInputDto inputDto)
{
return workerPicService.UpdateWorkerPhoto(inputDto);
}
diff --git a/EOM.TSHotelManagement.WebApi/Controllers/Employee/RewardPunishment/RewardPunishmentController.cs b/EOM.TSHotelManagement.WebApi/Controllers/Employee/RewardPunishment/RewardPunishmentController.cs
index 4148dca9cb1255f8724bcdfdb40aa0f31b9f396b..6b3847dda5cfd2b8687cbca7c707156b4eba237a 100644
--- a/EOM.TSHotelManagement.WebApi/Controllers/Employee/RewardPunishment/RewardPunishmentController.cs
+++ b/EOM.TSHotelManagement.WebApi/Controllers/Employee/RewardPunishment/RewardPunishmentController.cs
@@ -29,7 +29,7 @@ namespace EOM.TSHotelManagement.WebApi.Controllers
///
///
[HttpPost]
- public BaseOutputDto AddRewardPunishment([FromBody] CreateEmployeeRewardPunishmentInputDto goodBad)
+ public BaseResponse AddRewardPunishment([FromBody] CreateEmployeeRewardPunishmentInputDto goodBad)
{
return workerGoodBadService.AddRewardPunishment(goodBad);
}
diff --git a/EOM.TSHotelManagement.WebApi/Controllers/SystemManagement/Administrator/AdminController.cs b/EOM.TSHotelManagement.WebApi/Controllers/SystemManagement/Administrator/AdminController.cs
index fe6479398aa0036d2f1d3211ab9b2651b14cb30e..f2a1b61e1e4f7b62b55e4e3982f700891279893a 100644
--- a/EOM.TSHotelManagement.WebApi/Controllers/SystemManagement/Administrator/AdminController.cs
+++ b/EOM.TSHotelManagement.WebApi/Controllers/SystemManagement/Administrator/AdminController.cs
@@ -52,7 +52,7 @@ namespace EOM.TSHotelManagement.WebApi.Controllers
///
///
[HttpPost]
- public BaseOutputDto AddAdmin([FromBody] CreateAdministratorInputDto admin)
+ public BaseResponse AddAdmin([FromBody] CreateAdministratorInputDto admin)
{
return adminService.AddAdmin(admin);
}
@@ -63,7 +63,7 @@ namespace EOM.TSHotelManagement.WebApi.Controllers
///
///
[HttpPost]
- public BaseOutputDto UpdAdmin([FromBody] UpdateAdministratorInputDto updateAdministratorInputDto)
+ public BaseResponse UpdAdmin([FromBody] UpdateAdministratorInputDto updateAdministratorInputDto)
{
return adminService.UpdAdmin(updateAdministratorInputDto);
}
@@ -74,7 +74,7 @@ namespace EOM.TSHotelManagement.WebApi.Controllers
///
///
[HttpPost]
- public BaseOutputDto DelAdmin([FromBody] DeleteAdministratorInputDto deleteAdministratorInputDto)
+ public BaseResponse DelAdmin([FromBody] DeleteAdministratorInputDto deleteAdministratorInputDto)
{
return adminService.DelAdmin(deleteAdministratorInputDto);
}
@@ -95,7 +95,7 @@ namespace EOM.TSHotelManagement.WebApi.Controllers
///
///
[HttpPost]
- public BaseOutputDto AddAdminType([FromBody] CreateAdministratorTypeInputDto createAdministratorTypeInputDto)
+ public BaseResponse AddAdminType([FromBody] CreateAdministratorTypeInputDto createAdministratorTypeInputDto)
{
return adminService.AddAdminType(createAdministratorTypeInputDto);
}
@@ -106,7 +106,7 @@ namespace EOM.TSHotelManagement.WebApi.Controllers
///
///
[HttpPost]
- public BaseOutputDto UpdAdminType([FromBody] UpdateAdministratorTypeInputDto updateAdministratorTypeInputDto)
+ public BaseResponse UpdAdminType([FromBody] UpdateAdministratorTypeInputDto updateAdministratorTypeInputDto)
{
return adminService.UpdAdminType(updateAdministratorTypeInputDto);
}
@@ -117,7 +117,7 @@ namespace EOM.TSHotelManagement.WebApi.Controllers
///
///
[HttpPost]
- public BaseOutputDto DelAdminType([FromBody] DeleteAdministratorTypeInputDto deleteAdministratorTypeInputDto)
+ public BaseResponse DelAdminType([FromBody] DeleteAdministratorTypeInputDto deleteAdministratorTypeInputDto)
{
return adminService.DelAdminType(deleteAdministratorTypeInputDto);
}
diff --git a/EOM.TSHotelManagement.WebApi/Controllers/SystemManagement/Base/BaseController.cs b/EOM.TSHotelManagement.WebApi/Controllers/SystemManagement/Base/BaseController.cs
index 0d7a80bfeeefad71068f03d236e23386e2843726..666d01876fe42bbda24c3de58c6bcddf4d4a8729 100644
--- a/EOM.TSHotelManagement.WebApi/Controllers/SystemManagement/Base/BaseController.cs
+++ b/EOM.TSHotelManagement.WebApi/Controllers/SystemManagement/Base/BaseController.cs
@@ -66,19 +66,19 @@ namespace EOM.TSHotelManagement.WebApi.Controllers
}
[HttpPost]
- public BaseOutputDto AddPosition([FromBody] CreatePositionInputDto position)
+ public BaseResponse AddPosition([FromBody] CreatePositionInputDto position)
{
return baseService.AddPosition(position);
}
[HttpPost]
- public BaseOutputDto DelPosition([FromBody] DeletePositionInputDto position)
+ public BaseResponse DelPosition([FromBody] DeletePositionInputDto position)
{
return baseService.DelPosition(position);
}
[HttpPost]
- public BaseOutputDto UpdPosition([FromBody] UpdatePositionInputDto position)
+ public BaseResponse UpdPosition([FromBody] UpdatePositionInputDto position)
{
return baseService.UpdPosition(position);
}
@@ -100,19 +100,19 @@ namespace EOM.TSHotelManagement.WebApi.Controllers
}
[HttpPost]
- public BaseOutputDto AddNation([FromBody] CreateNationInputDto nation)
+ public BaseResponse AddNation([FromBody] CreateNationInputDto nation)
{
return baseService.AddNation(nation);
}
[HttpPost]
- public BaseOutputDto DelNation([FromBody] DeleteNationInputDto nation)
+ public BaseResponse DelNation([FromBody] DeleteNationInputDto nation)
{
return baseService.DelNation(nation);
}
[HttpPost]
- public BaseOutputDto UpdNation([FromBody] UpdateNationInputDto nation)
+ public BaseResponse UpdNation([FromBody] UpdateNationInputDto nation)
{
return baseService.UpdNation(nation);
}
@@ -134,19 +134,19 @@ namespace EOM.TSHotelManagement.WebApi.Controllers
}
[HttpPost]
- public BaseOutputDto AddEducation([FromBody] CreateEducationInputDto education)
+ public BaseResponse AddEducation([FromBody] CreateEducationInputDto education)
{
return baseService.AddEducation(education);
}
[HttpPost]
- public BaseOutputDto DelEducation([FromBody] DeleteEducationInputDto education)
+ public BaseResponse DelEducation([FromBody] DeleteEducationInputDto education)
{
return baseService.DelEducation(education);
}
[HttpPost]
- public BaseOutputDto UpdEducation([FromBody] UpdateEducationInputDto education)
+ public BaseResponse UpdEducation([FromBody] UpdateEducationInputDto education)
{
return baseService.UpdEducation(education);
}
@@ -174,19 +174,19 @@ namespace EOM.TSHotelManagement.WebApi.Controllers
}
[HttpPost]
- public BaseOutputDto AddDept([FromBody] CreateDepartmentInputDto dept)
+ public BaseResponse AddDept([FromBody] CreateDepartmentInputDto dept)
{
return baseService.AddDept(dept);
}
[HttpPost]
- public BaseOutputDto DelDept([FromBody] DeleteDepartmentInputDto dept)
+ public BaseResponse DelDept([FromBody] DeleteDepartmentInputDto dept)
{
return baseService.DelDept(dept);
}
[HttpPost]
- public BaseOutputDto UpdDept([FromBody] UpdateDepartmentInputDto dept)
+ public BaseResponse UpdDept([FromBody] UpdateDepartmentInputDto dept)
{
return baseService.UpdDept(dept);
}
@@ -214,19 +214,19 @@ namespace EOM.TSHotelManagement.WebApi.Controllers
}
[HttpPost]
- public BaseOutputDto InsertCustoType([FromBody] CreateCustoTypeInputDto custoType)
+ public BaseResponse InsertCustoType([FromBody] CreateCustoTypeInputDto custoType)
{
return baseService.InsertCustoType(custoType);
}
[HttpPost]
- public BaseOutputDto DeleteCustoType([FromBody] DeleteCustoTypeInputDto custoType)
+ public BaseResponse DeleteCustoType([FromBody] DeleteCustoTypeInputDto custoType)
{
return baseService.DeleteCustoType(custoType);
}
[HttpPost]
- public BaseOutputDto UpdateCustoType([FromBody] UpdateCustoTypeInputDto custoType)
+ public BaseResponse UpdateCustoType([FromBody] UpdateCustoTypeInputDto custoType)
{
return baseService.UpdateCustoType(custoType);
}
@@ -254,19 +254,19 @@ namespace EOM.TSHotelManagement.WebApi.Controllers
}
[HttpPost]
- public BaseOutputDto InsertPassPortType([FromBody] CreatePassportTypeInputDto passPortType)
+ public BaseResponse InsertPassPortType([FromBody] CreatePassportTypeInputDto passPortType)
{
return baseService.InsertPassPortType(passPortType);
}
[HttpPost]
- public BaseOutputDto DeletePassPortType([FromBody] DeletePassportTypeInputDto portType)
+ public BaseResponse DeletePassPortType([FromBody] DeletePassportTypeInputDto portType)
{
return baseService.DeletePassPortType(portType);
}
[HttpPost]
- public BaseOutputDto UpdatePassPortType([FromBody] UpdatePassportTypeInputDto portType)
+ public BaseResponse UpdatePassPortType([FromBody] UpdatePassportTypeInputDto portType)
{
return baseService.UpdatePassPortType(portType);
}
@@ -294,19 +294,19 @@ namespace EOM.TSHotelManagement.WebApi.Controllers
}
[HttpPost]
- public BaseOutputDto InsertRewardPunishmentType([FromBody] CreateRewardPunishmentTypeInputDto createRewardPunishmentTypeInputDto)
+ public BaseResponse InsertRewardPunishmentType([FromBody] CreateRewardPunishmentTypeInputDto createRewardPunishmentTypeInputDto)
{
return baseService.InsertRewardPunishmentType(createRewardPunishmentTypeInputDto);
}
[HttpPost]
- public BaseOutputDto DeleteRewardPunishmentType([FromBody] DeleteRewardPunishmentTypeInputDto deleteRewardPunishmentTypeInputDto)
+ public BaseResponse DeleteRewardPunishmentType([FromBody] DeleteRewardPunishmentTypeInputDto deleteRewardPunishmentTypeInputDto)
{
return baseService.DeleteRewardPunishmentType(deleteRewardPunishmentTypeInputDto);
}
[HttpPost]
- public BaseOutputDto UpdateRewardPunishmentType([FromBody] UpdateRewardPunishmentTypeInputDto updateRewardPunishmentTypeInputDto)
+ public BaseResponse UpdateRewardPunishmentType([FromBody] UpdateRewardPunishmentTypeInputDto updateRewardPunishmentTypeInputDto)
{
return baseService.UpdateRewardPunishmentType(updateRewardPunishmentTypeInputDto);
}
@@ -331,7 +331,7 @@ namespace EOM.TSHotelManagement.WebApi.Controllers
///
///
[HttpPost]
- public BaseOutputDto CreateAppointmentNoticeType([FromBody] CreateAppointmentNoticeTypeInputDto createAppointmentNoticeTypeInputDto)
+ public BaseResponse CreateAppointmentNoticeType([FromBody] CreateAppointmentNoticeTypeInputDto createAppointmentNoticeTypeInputDto)
{
return baseService.CreateAppointmentNoticeType(createAppointmentNoticeTypeInputDto);
}
@@ -342,7 +342,7 @@ namespace EOM.TSHotelManagement.WebApi.Controllers
///
///
[HttpPost]
- public BaseOutputDto DeleteAppointmentNoticeType([FromBody] DeleteAppointmentNoticeTypeInputDto deleteAppointmentNoticeTypeInputDto)
+ public BaseResponse DeleteAppointmentNoticeType([FromBody] DeleteAppointmentNoticeTypeInputDto deleteAppointmentNoticeTypeInputDto)
{
return baseService.DeleteAppointmentNoticeType(deleteAppointmentNoticeTypeInputDto);
}
@@ -353,7 +353,7 @@ namespace EOM.TSHotelManagement.WebApi.Controllers
///
///
[HttpPost]
- public BaseOutputDto UpdateAppointmentNoticeType([FromBody] UpdateAppointmentNoticeTypeInputDto updateAppointmentNoticeTypeInputDto)
+ public BaseResponse UpdateAppointmentNoticeType([FromBody] UpdateAppointmentNoticeTypeInputDto updateAppointmentNoticeTypeInputDto)
{
return baseService.UpdateAppointmentNoticeType(updateAppointmentNoticeTypeInputDto);
}
diff --git a/EOM.TSHotelManagement.WebApi/Controllers/SystemManagement/Menu/MenuController.cs b/EOM.TSHotelManagement.WebApi/Controllers/SystemManagement/Menu/MenuController.cs
index 55f754436b32bfeb46029411905fc4e80b838abb..941a9e6937f6530b88fe0e76d9950e83b271c961 100644
--- a/EOM.TSHotelManagement.WebApi/Controllers/SystemManagement/Menu/MenuController.cs
+++ b/EOM.TSHotelManagement.WebApi/Controllers/SystemManagement/Menu/MenuController.cs
@@ -1,8 +1,6 @@
using EOM.TSHotelManagement.Application;
using EOM.TSHotelManagement.Common.Contract;
-using EOM.TSHotelManagement.Common.Core;
using Microsoft.AspNetCore.Mvc;
-using System.Collections.Generic;
namespace EOM.TSHotelManagement.WebApi.Controllers
{
@@ -33,7 +31,7 @@ namespace EOM.TSHotelManagement.WebApi.Controllers
///
///
[HttpPost]
- public List BuildMenuAll([FromBody] BaseInputDto baseInputDto)
+ public ListOutputDto BuildMenuAll([FromBody] BaseInputDto baseInputDto)
{
return menuService.BuildMenuAll(baseInputDto);
}
@@ -44,7 +42,7 @@ namespace EOM.TSHotelManagement.WebApi.Controllers
///
///
[HttpPost]
- public BaseOutputDto InsertMenu([FromBody] CreateMenuInputDto menu)
+ public BaseResponse InsertMenu([FromBody] CreateMenuInputDto menu)
{
return menuService.InsertMenu(menu);
}
@@ -55,7 +53,7 @@ namespace EOM.TSHotelManagement.WebApi.Controllers
///
///
[HttpPost]
- public BaseOutputDto UpdateMenu([FromBody] UpdateMenuInputDto menu)
+ public BaseResponse UpdateMenu([FromBody] UpdateMenuInputDto menu)
{
return menuService.UpdateMenu(menu);
}
@@ -66,7 +64,7 @@ namespace EOM.TSHotelManagement.WebApi.Controllers
///
///
[HttpPost]
- public BaseOutputDto DeleteMenu([FromBody] DeleteMenuInputDto menu)
+ public BaseResponse DeleteMenu([FromBody] DeleteMenuInputDto menu)
{
return menuService.DeleteMenu(menu);
}
diff --git a/EOM.TSHotelManagement.WebApi/Controllers/SystemManagement/Notice/NoticeController.cs b/EOM.TSHotelManagement.WebApi/Controllers/SystemManagement/Notice/NoticeController.cs
index ed3187404ae5ab2fb2082caaf5e2fde765354172..583158da4f40c2bb18909db5217ac692255c72a2 100644
--- a/EOM.TSHotelManagement.WebApi/Controllers/SystemManagement/Notice/NoticeController.cs
+++ b/EOM.TSHotelManagement.WebApi/Controllers/SystemManagement/Notice/NoticeController.cs
@@ -47,7 +47,7 @@ namespace EOM.TSHotelManagement.WebApi.Controllers
///
///
[HttpPost]
- public BaseOutputDto InsertNotice([FromBody] CreateAppointmentNoticeInputDto inputDto)
+ public BaseResponse InsertNotice([FromBody] CreateAppointmentNoticeInputDto inputDto)
{
return noticeService.InsertNotice(inputDto);
}
diff --git a/EOM.TSHotelManagement.WebApi/Controllers/SystemManagement/Role/RoleController.cs b/EOM.TSHotelManagement.WebApi/Controllers/SystemManagement/Role/RoleController.cs
index 17e3989bdda29a19de289749b3d5191c91b8e64e..c9b7cae2f9abff1e62ab2b9d5e47f7e74388dc61 100644
--- a/EOM.TSHotelManagement.WebApi/Controllers/SystemManagement/Role/RoleController.cs
+++ b/EOM.TSHotelManagement.WebApi/Controllers/SystemManagement/Role/RoleController.cs
@@ -30,7 +30,7 @@ namespace EOM.TSHotelManagement.WebApi.Controllers
///
///
[HttpPost]
- public BaseOutputDto InsertRole([FromBody] CreateRoleInputDto createRoleInputDto)
+ public BaseResponse InsertRole([FromBody] CreateRoleInputDto createRoleInputDto)
{
return _roleAppService.InsertRole(createRoleInputDto);
}
@@ -41,7 +41,7 @@ namespace EOM.TSHotelManagement.WebApi.Controllers
///
///
[HttpPost]
- public BaseOutputDto UpdateRole([FromBody] UpdateRoleInputDto updateRoleInputDto)
+ public BaseResponse UpdateRole([FromBody] UpdateRoleInputDto updateRoleInputDto)
{
return _roleAppService.UpdateRole(updateRoleInputDto);
}
@@ -52,7 +52,7 @@ namespace EOM.TSHotelManagement.WebApi.Controllers
///
///
[HttpPost]
- public BaseOutputDto DeleteRole([FromBody] DeleteRoleInputDto deleteRoleInputDto)
+ public BaseResponse DeleteRole([FromBody] DeleteRoleInputDto deleteRoleInputDto)
{
return _roleAppService.DeleteRole(deleteRoleInputDto);
}
diff --git a/EOM.TSHotelManagement.WebApi/Controllers/SystemManagement/SupervisionStatistics/SupervisionStatisticsController.cs b/EOM.TSHotelManagement.WebApi/Controllers/SystemManagement/SupervisionStatistics/SupervisionStatisticsController.cs
index 00e4808cb02af0722847de916f19b440e2b1c624..1fb4fec85bf3ab8286efe616a69fda2cf1e9d2ae 100644
--- a/EOM.TSHotelManagement.WebApi/Controllers/SystemManagement/SupervisionStatistics/SupervisionStatisticsController.cs
+++ b/EOM.TSHotelManagement.WebApi/Controllers/SystemManagement/SupervisionStatistics/SupervisionStatisticsController.cs
@@ -33,7 +33,7 @@ namespace EOM.TSHotelManagement.WebApi.Controllers
///
///
[HttpPost]
- public BaseOutputDto InsertSupervisionStatistics([FromBody] CreateSupervisionStatisticsInputDto inputDto)
+ public BaseResponse InsertSupervisionStatistics([FromBody] CreateSupervisionStatisticsInputDto inputDto)
{
return checkInfoService.InsertSupervisionStatistics(inputDto);
}
@@ -44,7 +44,7 @@ namespace EOM.TSHotelManagement.WebApi.Controllers
///
///
[HttpPost]
- public BaseOutputDto UpdateSupervisionStatistics([FromBody] UpdateSupervisionStatisticsInputDto inputDto)
+ public BaseResponse UpdateSupervisionStatistics([FromBody] UpdateSupervisionStatisticsInputDto inputDto)
{
return checkInfoService.UpdateSupervisionStatistics(inputDto);
}
@@ -55,7 +55,7 @@ namespace EOM.TSHotelManagement.WebApi.Controllers
///
///
[HttpPost]
- public BaseOutputDto DeleteSupervisionStatistics([FromBody] DeleteSupervisionStatisticsInputDto inputDto)
+ public BaseResponse DeleteSupervisionStatistics([FromBody] DeleteSupervisionStatisticsInputDto inputDto)
{
return checkInfoService.DeleteSupervisionStatistics(inputDto);
}
diff --git a/EOM.TSHotelManagement.WebApi/Controllers/SystemManagement/VipRule/VipRuleController.cs b/EOM.TSHotelManagement.WebApi/Controllers/SystemManagement/VipRule/VipRuleController.cs
index 0d8f6003c062dd707ea61ef6a8811071bc07161a..205a1f504441c004d802f5b5977ae21114b63d0d 100644
--- a/EOM.TSHotelManagement.WebApi/Controllers/SystemManagement/VipRule/VipRuleController.cs
+++ b/EOM.TSHotelManagement.WebApi/Controllers/SystemManagement/VipRule/VipRuleController.cs
@@ -44,7 +44,7 @@ namespace EOM.TSHotelManagement.WebApi.Controllers
///
///
[HttpPost]
- public BaseOutputDto AddVipRule([FromBody] CreateVipLevelRuleInputDto inputDto)
+ public BaseResponse AddVipRule([FromBody] CreateVipLevelRuleInputDto inputDto)
{
return vipRuleAppService.AddVipRule(inputDto);
}
@@ -55,7 +55,7 @@ namespace EOM.TSHotelManagement.WebApi.Controllers
///
///
[HttpPost]
- public BaseOutputDto DelVipRule([FromBody] DeleteVipLevelRuleInputDto inputDto)
+ public BaseResponse DelVipRule([FromBody] DeleteVipLevelRuleInputDto inputDto)
{
return vipRuleAppService.DelVipRule(inputDto);
}
@@ -66,7 +66,7 @@ namespace EOM.TSHotelManagement.WebApi.Controllers
///
///
[HttpPost]
- public BaseOutputDto UpdVipRule([FromBody] UpdateVipLevelRuleInputDto inputDto)
+ public BaseResponse UpdVipRule([FromBody] UpdateVipLevelRuleInputDto inputDto)
{
return vipRuleAppService.UpdVipRule(inputDto);
}
diff --git a/EOM.TSHotelManagement.WebApi/Controllers/Util/UtilityController.cs b/EOM.TSHotelManagement.WebApi/Controllers/Util/UtilityController.cs
index b52e06b71d9d645167a43a6041066cbbee6eaf23..29d05c24eee2eddcae63966cc426d116ad17ab26 100644
--- a/EOM.TSHotelManagement.WebApi/Controllers/Util/UtilityController.cs
+++ b/EOM.TSHotelManagement.WebApi/Controllers/Util/UtilityController.cs
@@ -1,6 +1,5 @@
using EOM.TSHotelManagement.Application;
using EOM.TSHotelManagement.Common.Contract;
-using Microsoft.AspNetCore.Authorization;
using Microsoft.AspNetCore.Mvc;
namespace EOM.TSHotelManagement.WebApi.Controllers
@@ -34,7 +33,7 @@ namespace EOM.TSHotelManagement.WebApi.Controllers
///
///
[HttpPost]
- public BaseOutputDto AddLog([FromBody] CreateOperationLogInputDto opr)
+ public BaseResponse AddLog([FromBody] CreateOperationLogInputDto opr)
{
return utilService.AddLog(opr);
}
@@ -66,7 +65,7 @@ namespace EOM.TSHotelManagement.WebApi.Controllers
///
///
[HttpPost]
- public BaseOutputDto DeleteOperationlogByRange([FromBody] ReadOperationLogInputDto readOperationLogInputDto)
+ public BaseResponse DeleteOperationlogByRange([FromBody] ReadOperationLogInputDto readOperationLogInputDto)
{
return utilService.DeleteOperationlogByRange(readOperationLogInputDto);
}
@@ -77,7 +76,7 @@ namespace EOM.TSHotelManagement.WebApi.Controllers
///
///
[HttpPost]
- public BaseOutputDto DeleteOperationlog([FromBody] DeleteOperationLogInputDto deleteOperationLogInputDto)
+ public BaseResponse DeleteOperationlog([FromBody] DeleteOperationLogInputDto deleteOperationLogInputDto)
{
return utilService.DeleteOperationlog(deleteOperationLogInputDto);
}
diff --git a/EOM.TSHotelManagement.WebApi/EOM.TSHotelManagement.WebApi.csproj b/EOM.TSHotelManagement.WebApi/EOM.TSHotelManagement.WebApi.csproj
index f219ab65272f1c01b439421c4832e0997701ae49..6a750efcf01dda8bf38c2071f998debc746d867c 100644
--- a/EOM.TSHotelManagement.WebApi/EOM.TSHotelManagement.WebApi.csproj
+++ b/EOM.TSHotelManagement.WebApi/EOM.TSHotelManagement.WebApi.csproj
@@ -6,6 +6,7 @@
True
Linux
false
+ AnyCPU;x64
@@ -16,16 +17,27 @@
True
+
+
+
+ Off
+ 1701;1702;1591;
+ True
+
+
False
+
+ False
+
+
-
-
+
diff --git a/EOM.TSHotelManagement.WebApi/Extension/DateOnlyJsonConverter.cs b/EOM.TSHotelManagement.WebApi/Extension/DateOnlyJsonConverter.cs
new file mode 100644
index 0000000000000000000000000000000000000000..1dcce1dce02278466234fe5236bf58799299a5c3
--- /dev/null
+++ b/EOM.TSHotelManagement.WebApi/Extension/DateOnlyJsonConverter.cs
@@ -0,0 +1,27 @@
+using System;
+using System.Text.Json;
+using System.Text.Json.Serialization;
+
+namespace EOM.TSHotelManagement.WebApi
+{
+ public class DateOnlyJsonConverter : JsonConverter
+ {
+ private const string DateFormat = "yyyy-MM-dd";
+
+ public override DateOnly Read(
+ ref Utf8JsonReader reader,
+ Type typeToConvert,
+ JsonSerializerOptions options)
+ {
+ return DateOnly.Parse(reader.GetString());
+ }
+
+ public override void Write(
+ Utf8JsonWriter writer,
+ DateOnly value,
+ JsonSerializerOptions options)
+ {
+ writer.WriteStringValue(value.ToString(DateFormat));
+ }
+ }
+}
diff --git a/EOM.TSHotelManagement.WebApi/Extension/MvcOptionsExtensions.cs b/EOM.TSHotelManagement.WebApi/Extension/MvcOptionsExtensions.cs
index a94a57975c9277b48ac0e1acf17c3775237ad3fc..3f4ba5012250dd33e6068855746e844c4d5b07f1 100644
--- a/EOM.TSHotelManagement.WebApi/Extension/MvcOptionsExtensions.cs
+++ b/EOM.TSHotelManagement.WebApi/Extension/MvcOptionsExtensions.cs
@@ -16,7 +16,7 @@ namespace EOM.TSHotelManagement.WebApi
public static void UseCentralRoutePrefix(this MvcOptions opts, IRouteTemplateProvider routeAttribute)
{
// 添加我们自定义 实现IApplicationModelConvention的RouteConvention
- opts.Conventions.Insert(0, new RouteConvention(routeAttribute));
+ opts.Conventions.Insert(0, new RouteExtension(routeAttribute));
}
}
}
diff --git a/EOM.TSHotelManagement.WebApi/Extension/RouteConvention.cs b/EOM.TSHotelManagement.WebApi/Extension/RouteExtension.cs
similarity index 93%
rename from EOM.TSHotelManagement.WebApi/Extension/RouteConvention.cs
rename to EOM.TSHotelManagement.WebApi/Extension/RouteExtension.cs
index 3aa73aa12ed1efc9f7d1318bc809533114960f94..fd270fd797c146d3c180e7deeb0d472ee378386f 100644
--- a/EOM.TSHotelManagement.WebApi/Extension/RouteConvention.cs
+++ b/EOM.TSHotelManagement.WebApi/Extension/RouteExtension.cs
@@ -7,7 +7,7 @@ namespace EOM.TSHotelManagement.WebApi
///
/// 全局路由前缀配置
///
- public class RouteConvention : IApplicationModelConvention
+ public class RouteExtension : IApplicationModelConvention
{
///
/// 定义一个路由前缀变量
@@ -18,7 +18,7 @@ namespace EOM.TSHotelManagement.WebApi
/// 调用时传入指定的路由前缀
///
///
- public RouteConvention(IRouteTemplateProvider routeTemplateProvider)
+ public RouteExtension(IRouteTemplateProvider routeTemplateProvider)
{
_centralPrefix = new AttributeRouteModel(routeTemplateProvider);
}
diff --git a/EOM.TSHotelManagement.WebApi/Factory/JwtConfigFactory.cs b/EOM.TSHotelManagement.WebApi/Factory/JwtConfigFactory.cs
index e70013a1dc3e5b31facaee6900ff76a91e9d4203..d8ab921705b84038a67340179b2e486eeac6a8e0 100644
--- a/EOM.TSHotelManagement.WebApi/Factory/JwtConfigFactory.cs
+++ b/EOM.TSHotelManagement.WebApi/Factory/JwtConfigFactory.cs
@@ -17,8 +17,6 @@ namespace EOM.TSHotelManagement.WebApi
var jwtConfig = new JwtConfig
{
Key = _configuration["Jwt:Key"],
- Issuer = _configuration["Jwt:Issuer"],
- Audience = _configuration["Jwt:Audience"],
ExpiryMinutes = int.Parse(_configuration["Jwt:ExpiryMinutes"])
};
return jwtConfig;
diff --git a/EOM.TSHotelManagement.WebApi/Filter/AuthorizeAllControllersConvention.cs b/EOM.TSHotelManagement.WebApi/Filters/AuthorizeAllControllersConvention.cs
similarity index 96%
rename from EOM.TSHotelManagement.WebApi/Filter/AuthorizeAllControllersConvention.cs
rename to EOM.TSHotelManagement.WebApi/Filters/AuthorizeAllControllersConvention.cs
index c98f4c73efef3de7b43da91b0442c87d3b1c0092..948a982f1562917af49db8aa1162f4e19b2edc9b 100644
--- a/EOM.TSHotelManagement.WebApi/Filter/AuthorizeAllControllersConvention.cs
+++ b/EOM.TSHotelManagement.WebApi/Filters/AuthorizeAllControllersConvention.cs
@@ -3,7 +3,7 @@ using Microsoft.AspNetCore.Mvc.ApplicationModels;
using Microsoft.AspNetCore.Mvc.Authorization;
using System.Linq;
-namespace EOM.TSHotelManagement.WebApi.Filter
+namespace EOM.TSHotelManagement.WebApi.Filters
{
public class AuthorizeAllControllersConvention : IApplicationModelConvention
{
diff --git a/EOM.TSHotelManagement.WebApi/Filter/RequestLoggingMiddleware.cs b/EOM.TSHotelManagement.WebApi/Filters/RequestLoggingMiddleware.cs
similarity index 77%
rename from EOM.TSHotelManagement.WebApi/Filter/RequestLoggingMiddleware.cs
rename to EOM.TSHotelManagement.WebApi/Filters/RequestLoggingMiddleware.cs
index d13b6dee72b78dd7d3d104bc0578a0dadf7c4c75..8c2b7ac300e0b9d792f6ebda0629a409b491e13a 100644
--- a/EOM.TSHotelManagement.WebApi/Filter/RequestLoggingMiddleware.cs
+++ b/EOM.TSHotelManagement.WebApi/Filters/RequestLoggingMiddleware.cs
@@ -7,6 +7,7 @@ using Microsoft.Extensions.Logging;
using System;
using System.Diagnostics;
using System.IO;
+using System.Linq;
using System.Text;
using System.Text.Json;
using System.Threading.Tasks;
@@ -54,7 +55,7 @@ public class RequestLoggingMiddleware
{
Path = context.Request.Path,
Method = context.Request.Method,
- ClientIP = context.Connection.RemoteIpAddress?.ToString(),
+ ClientIP = GetClientIp(context),
Parameters = requestParameters,
UserAgent = context.Request.Headers["User-Agent"].ToString(),
UserName = context.User.Identity?.Name ?? "Anonymous",
@@ -181,4 +182,54 @@ public class RequestLoggingMiddleware
return "Unable to read request body";
}
}
+
+ private string GetClientIp(HttpContext context)
+ {
+ var xForwardedFor = context.Request.Headers["X-Forwarded-For"].FirstOrDefault();
+ if (!string.IsNullOrEmpty(xForwardedFor))
+ {
+ var ips = xForwardedFor.Split(',', StringSplitOptions.RemoveEmptyEntries);
+ foreach (var ip in ips)
+ {
+ var cleanIp = ip.Trim();
+ if (!IsLocalIp(cleanIp))
+ {
+ return cleanIp;
+ }
+ }
+ return ips.FirstOrDefault()?.Trim() ?? string.Empty;
+ }
+
+ var xRealIp = context.Request.Headers["X-Real-IP"].FirstOrDefault();
+ if (!string.IsNullOrEmpty(xRealIp) && !IsLocalIp(xRealIp))
+ {
+ return xRealIp.Trim();
+ }
+
+ return context.Connection.RemoteIpAddress?.ToString();
+ }
+
+ private bool IsLocalIp(string ip)
+ {
+ return ip == "::1" ||
+ ip == "127.0.0.1" ||
+ ip.StartsWith("192.168.") ||
+ ip.StartsWith("10.") ||
+ ip.StartsWith("172.16.") ||
+ ip.StartsWith("172.17.") ||
+ ip.StartsWith("172.18.") ||
+ ip.StartsWith("172.19.") ||
+ ip.StartsWith("172.20.") ||
+ ip.StartsWith("172.21.") ||
+ ip.StartsWith("172.22.") ||
+ ip.StartsWith("172.23.") ||
+ ip.StartsWith("172.24.") ||
+ ip.StartsWith("172.25.") ||
+ ip.StartsWith("172.26.") ||
+ ip.StartsWith("172.27.") ||
+ ip.StartsWith("172.28.") ||
+ ip.StartsWith("172.29.") ||
+ ip.StartsWith("172.30.") ||
+ ip.StartsWith("172.31.");
+ }
}
\ No newline at end of file
diff --git a/EOM.TSHotelManagement.WebApi/Startup.cs b/EOM.TSHotelManagement.WebApi/Startup.cs
index 84cc004b32ec29f655a0f6bbff6c3b2f65546db6..3fcf99c62c6932ad10e535087957912b6ea2153a 100644
--- a/EOM.TSHotelManagement.WebApi/Startup.cs
+++ b/EOM.TSHotelManagement.WebApi/Startup.cs
@@ -2,7 +2,7 @@ using Autofac;
using EOM.TSHotelManagement.Common.Util;
using EOM.TSHotelManagement.EntityFramework;
using EOM.TSHotelManagement.Shared;
-using EOM.TSHotelManagement.WebApi.Filter;
+using EOM.TSHotelManagement.WebApi.Filters;
using Microsoft.AspNetCore.Authentication.JwtBearer;
using Microsoft.AspNetCore.Builder;
using Microsoft.AspNetCore.DataProtection;
@@ -13,44 +13,87 @@ using Microsoft.Extensions.Configuration;
using Microsoft.Extensions.DependencyInjection;
using Microsoft.Extensions.Hosting;
using Microsoft.IdentityModel.Tokens;
-using Microsoft.OpenApi.Models;
-using Newtonsoft.Json.Serialization;
using SqlSugar;
using System;
using System.IO;
using System.Reflection;
using System.Text;
+using System.Text.Json.Serialization;
namespace EOM.TSHotelManagement.WebApi
{
public class Startup
{
private readonly IConfiguration _configuration;
+ private static readonly string[] origins = [
+ "http://localhost:5173",
+ "http://localhost:5174",
+ "https://tshotel.oscode.top"
+ ];
public Startup(IConfiguration configuration)
{
_configuration = configuration;
}
- // This method gets called by the runtime. Use this method to add services to the container.
public void ConfigureServices(IServiceCollection services)
{
- // DataProtection
- if (Environment.GetEnvironmentVariable("ASPNETCORE_ENVIRONMENT") == "docker")
+ ConfigureDataProtection(services);
+ RegisterSingletonServices(services);
+ ConfigureAuthentication(services);
+ ConfigureControllers(services);
+ ConfigureSwagger(services);
+ ConfigureCors(services);
+ ConfigureHttpContextAccessor(services);
+ ConfigureXForward(services);
+ }
+
+ public void Configure(IApplicationBuilder app, IWebHostEnvironment env)
+ {
+ ConfigureEnvironment(app, env);
+ ConfigureMiddlewares(app);
+ InitializeDatabase(app);
+ ConfigureEndpoints(app);
+ ConfigureSwaggerUI(app);
+ }
+
+ #region Private Helper Methods
+
+ private void ConfigureDataProtection(IServiceCollection services)
+ {
+ if (Environment.GetEnvironmentVariable(SystemConstants.Env) == SystemConstants.Docker)
{
services.AddDataProtection()
- .PersistKeysToFileSystem(new DirectoryInfo("/app/keys"))
- .SetApplicationName("TSHotelManagementSystem");
+ .PersistKeysToFileSystem(new DirectoryInfo("/app/keys"))
+ .SetApplicationName("TSHotelManagementSystem");
}
else
{
services.AddDataProtection().SetApplicationName("TSHotelManagementSystem");
}
+ }
+
+ private void ConfigureXForward(IServiceCollection services)
+ {
+ services.Configure(options =>
+ {
+ options.ForwardedHeaders = ForwardedHeaders.XForwardedFor |
+ ForwardedHeaders.XForwardedProto;
+ options.KnownNetworks.Clear();
+ options.KnownProxies.Clear();
+ });
+ }
+
+ private void RegisterSingletonServices(IServiceCollection services)
+ {
services.AddSingleton();
services.AddSingleton();
services.AddSingleton();
+ }
+ private void ConfigureAuthentication(IServiceCollection services)
+ {
services.AddAuthentication(options =>
{
options.DefaultAuthenticateScheme = JwtBearerDefaults.AuthenticationScheme;
@@ -59,118 +102,98 @@ namespace EOM.TSHotelManagement.WebApi
{
options.TokenValidationParameters = new TokenValidationParameters
{
- ValidateIssuer = true,
- ValidateAudience = true,
- ValidateLifetime = true,
ValidateIssuerSigningKey = true,
- ValidIssuer = _configuration["Jwt:Issuer"],
- ValidAudience = _configuration["Jwt:Audience"],
+ ValidateIssuer = false,
+ ValidateAudience = false,
IssuerSigningKey = new SymmetricSecurityKey(Encoding.UTF8.GetBytes(_configuration["Jwt:Key"]))
};
});
services.AddAuthorization(options =>
{
- // һΪApiAccessIJ
options.AddPolicy("ApiAccess", policy =>
{
policy.AuthenticationSchemes.Add("Bearer");
policy.RequireAuthenticatedUser();
});
-
- // ʹ涨ġApiAccessΪĬϲ
options.DefaultPolicy = options.GetPolicy("ApiAccess");
});
+ }
-
+ private void ConfigureControllers(IServiceCollection services)
+ {
services.AddControllers(options =>
{
options.Conventions.Add(new AuthorizeAllControllersConvention());
options.RespectBrowserAcceptHeader = true;
- }).AddNewtonsoftJson(opt =>
+ }).AddJsonOptions(options =>
{
- //ʱʽӦ
- //opt.SerializerSettings.DateFormatString = "yyyy-MM-dd HH:mm:ss";
- opt.SerializerSettings.ContractResolver = new DefaultContractResolver();
+ options.JsonSerializerOptions.PropertyNamingPolicy = null;
+ options.JsonSerializerOptions.DictionaryKeyPolicy = null;
+
+ options.JsonSerializerOptions.ReferenceHandler = ReferenceHandler.IgnoreCycles;
+ options.JsonSerializerOptions.Converters.Add(new DateOnlyJsonConverter());
});
- #region ȫ·
- //ڸǰûض·ǰǰ
+ // ȫ·
services.AddMvc(opt =>
- {
- opt.UseCentralRoutePrefix(new RouteAttribute("api/[controller]/[action]"));
- });
- #endregion
+ opt.UseCentralRoutePrefix(new RouteAttribute("api/[controller]/[action]")));
+ }
+
+ private void ConfigureHttpContextAccessor(IServiceCollection services)
+ {
+ services.AddHttpContextAccessor();
+ }
- #region עSwagger
- services.AddSwaggerGen(s =>
+ private void ConfigureSwagger(IServiceCollection services)
+ {
+ services.AddOpenApiDocument(config =>
{
- #region ע Swagger
- s.SwaggerDoc("v1", new OpenApiInfo()
- {
- Title = "EOM.TSHotelManagement.Web", //Swaggerĵ
- Version = "version-1.0.0", //Swaggerĵİ汾
- Description = "Api Document", //Swaggerĵ
- License = new OpenApiLicense()
- {
- Name = "MIT",
- Url = new Uri("https://mit-license.org/")
- }, //SwaggerĵĿԴȨЭ
- TermsOfService = new Uri("https://www.oscode.top/"), //Swaggerĵķ֧ҳ
- Contact = new OpenApiContact
- {
- Name = "Easy-Open-Meta",
- Email = "eom-official@oscode.top",
- Url = new Uri("https://www.oscode.top/")
- }
- });
- //ȡͬ¸ֲxmlעͣһȡҵ㡢ʵͽӿڲ㼴
- s.IncludeXmlComments(AppContext.BaseDirectory + "EOM.TSHotelManagement.Application.xml");
- s.IncludeXmlComments(AppContext.BaseDirectory + "EOM.TSHotelManagement.Common.Core.xml");
- s.IncludeXmlComments(AppContext.BaseDirectory + "EOM.TSHotelManagement.WebApi.xml");
- #endregion
-
- #region ʽʱ
- //s.IncludeXmlComments("EOM.TSHotelManagement.Application.xml");
- //s.IncludeXmlComments("EOM.TSHotelManagement.Core.xml");
- //s.IncludeXmlComments("EOM.TSHotelManagement.WebApi.xml");
- #endregion
+ config.Title = "EOM.TSHotelManagement.Web";
+ config.Version = "v1";
+ config.DocumentName = "v1";
});
- #endregion
+ }
+ private void ConfigureCors(IServiceCollection services)
+ {
services.AddCors(options =>
{
options.AddPolicy("MyCorsPolicy", policy =>
{
- policy.WithOrigins(new string[] {
- "http://localhost:5173",
- "http://localhost:5174",
- "https://tshotel.oscode.top"
- })
- .AllowAnyMethod()
- .AllowAnyHeader()
- .AllowCredentials()
- .SetPreflightMaxAge(TimeSpan.FromMinutes(10));
+ policy.WithOrigins(origins)
+ .AllowAnyMethod()
+ .AllowAnyHeader()
+ .AllowCredentials()
+ .SetPreflightMaxAge(TimeSpan.FromMinutes(10));
});
});
-
}
- // This method gets called by the runtime. Use this method to configure the HTTP request pipeline.
- public void Configure(IApplicationBuilder app, IWebHostEnvironment env)
+ private void InitializeDatabase(IApplicationBuilder app)
{
try
{
- new InitializeConfig(_configuration).InitializeDatabase(app);
+ app.ApplicationServices.GetService()?.InitializeDatabase();
}
catch (Exception ex)
{
- Console.WriteLine(LocalizationHelper.GetLocalizedString($"Database initialization failed: {ex.Message}. " +
- "Please manually initialize the database or fix the error and retry.", $"ݿʼʧܣ{ex.Message}ִֶгʼԡ "));
- throw new Exception(LocalizationHelper.GetLocalizedString($"Database initialization failed: {ex.Message}. " +
- "Please manually initialize the database or fix the error and retry.", $"ݿʼʧܣ{ex.Message}ִֶгʼԡ "));
+ var message = LocalizationHelper.GetLocalizedString(
+ $"Database initialization failed: {ex.Message}. Please manually initialize or fix the error.",
+ $"ݿʼʧܣ{ex.Message}ֶʼ");
+ Console.WriteLine(message);
+ throw new Exception(message);
+ }
+ finally
+ {
+ Console.WriteLine(LocalizationHelper.GetLocalizedString(
+ "Database initialization completed.",
+ "ݿʼɡ"));
}
+ }
+ private void ConfigureEnvironment(IApplicationBuilder app, IWebHostEnvironment env)
+ {
if (env.IsDevelopment())
{
app.UseDeveloperExceptionPage();
@@ -180,34 +203,37 @@ namespace EOM.TSHotelManagement.WebApi
{
ForwardedHeaders = ForwardedHeaders.XForwardedFor | ForwardedHeaders.XForwardedProto
});
+ }
+ private void ConfigureMiddlewares(IApplicationBuilder app)
+ {
+ app.UseForwardedHeaders();
app.UseRouting();
-
app.UseCors("MyCorsPolicy");
-
app.UseAuthentication();
-
app.UseAuthorization();
-
app.UseRequestLogging();
+ }
+ private void ConfigureEndpoints(IApplicationBuilder app)
+ {
app.UseEndpoints(endpoints =>
{
endpoints.MapControllers();
- endpoints.MapGet("/version", () =>
- $"Software Version: {Environment.GetEnvironmentVariable("SoftwareVersion") ?? "Unknown"}");
- });
-
- #region ʹSwaggerм
- app.UseSwagger();
- app.UseSwaggerUI(s =>
- {
- s.SwaggerEndpoint("/swagger/v1/swagger.json", "EOM.TSHotelManagement Api Document");
+ endpoints.MapGet("api/version", () =>
+ $"Software Version: {Environment.GetEnvironmentVariable("SoftwareVersion") ?? "Local Mode"}");
});
- #endregion
+ }
+ private void ConfigureSwaggerUI(IApplicationBuilder app)
+ {
+ app.UseOpenApi();
+ app.UseSwaggerUi();
+ app.UseReDoc();
}
+ #endregion
+
///
/// AutoFac
///
@@ -217,17 +243,15 @@ namespace EOM.TSHotelManagement.WebApi
#region AutoFac IOC,ʵע
try
{
- builder.RegisterType()
- .As()
- .SingleInstance();
+ builder.Register(c =>
+ {
+ var factory = c.Resolve();
+ return factory.CreateClient();
+ }).As().InstancePerLifetimeScope();
- builder.Register(c => c.Resolve().CreateClient())
- .As()
- .InstancePerLifetimeScope();
+ builder.RegisterType().As().InstancePerLifetimeScope();
- builder.RegisterGeneric(typeof(GenericRepository<>))
- .AsSelf()
- .InstancePerLifetimeScope();
+ builder.RegisterType().As().SingleInstance();
builder.RegisterType()
.InstancePerDependency();
@@ -237,6 +261,8 @@ namespace EOM.TSHotelManagement.WebApi
builder.RegisterType().AsSelf().InstancePerLifetimeScope();
builder.RegisterType().AsSelf().InstancePerLifetimeScope();
+ builder.RegisterGeneric(typeof(GenericRepository<>)).AsSelf().InstancePerLifetimeScope();
+
//ע
var assemblyService = Assembly.LoadFrom(Path.Combine(AppContext.BaseDirectory, "EOM.TSHotelManagement.Application.dll"));
builder.RegisterAssemblyTypes(assemblyService)
diff --git a/EOM.TSHotelManagement.WebApi/appsettings.json b/EOM.TSHotelManagement.WebApi/appsettings.json
index 8a1cbee7b99d29ae936deef2e7eea6793f467fa8..f334974050d442535013bf2653dec3062d188d99 100644
--- a/EOM.TSHotelManagement.WebApi/appsettings.json
+++ b/EOM.TSHotelManagement.WebApi/appsettings.json
@@ -17,8 +17,6 @@
"AllowedHosts": "*",
"Jwt": {
"Key": "",
- "Issuer": "",
- "Audience": "",
"ExpiryMinutes": 20
},
"Mail": {
diff --git a/build.ps1 b/build.ps1
index b456e7b5462b0eee00dffc3e3504f3216af34411..759dc74a697675248a84962b4266f63ac5c7f4a3 100644
--- a/build.ps1
+++ b/build.ps1
@@ -35,6 +35,22 @@ docker build `
-t "$imageName`:$timestampedVersion" `
-t "$imageName`:latest" .
+# 5. 导出镜像到当前文件夹
+# 创建导出目录(如果不存在)
+$exportDir = "docker-images"
+if (-not (Test-Path $exportDir)) {
+ New-Item -ItemType Directory -Path $exportDir | Out-Null
+}
+
+# 导出带时间戳的版本
+$exportFileName = "tshotel-management-system-api_$($timestampedVersion).tar"
+Write-Host "Exporting image to $exportDir\$exportFileName"
+docker save -o "$exportDir\$exportFileName" "$imageName`:$timestampedVersion"
+
+# 计算导出文件大小
+$fileSize = (Get-Item "$exportDir\$exportFileName").Length / 1MB
+$fileSize = [Math]::Round($fileSize, 2)
+
# 5. 可选的推送命令
# docker push "$imageName`:$baseVersion"
# docker push "$imageName`:$timestampedVersion"
@@ -45,6 +61,7 @@ Write-Host "Build completed:"
Write-Host " - Base version: $baseVersion"
Write-Host " - Timestamped version: $timestampedVersion"
Write-Host " - Latest"
+Write-Host " - Exported to: $exportDir\$exportFileName ($fileSize MB)"
Write-Host "Build complete. Press any key to exit..."
[void][System.Console]::ReadKey($true)