Browse Source

Generate CRUD for the booking module

pull/157/head
gdlcf88 4 years ago
parent
commit
1044ff21b3
  1. 2
      plugins/Booking/src/EasyAbp.EShop.Plugins.Booking.Application.Contracts/EasyAbp/EShop/Plugins/Booking/EShopPluginsBookingRemoteServiceConsts.cs
  2. 12
      plugins/Booking/src/EasyAbp.EShop.Plugins.Booking.Application.Contracts/EasyAbp/EShop/Plugins/Booking/Permissions/BookingPermissionDefinitionProvider.cs
  3. 18
      plugins/Booking/src/EasyAbp.EShop.Plugins.Booking.Application.Contracts/EasyAbp/EShop/Plugins/Booking/Permissions/BookingPermissions.cs
  4. 25
      plugins/Booking/src/EasyAbp.EShop.Plugins.Booking.Application.Contracts/EasyAbp/EShop/Plugins/Booking/ProductAssetCategories/Dtos/CreateProductAssetCategoryDto.cs
  5. 15
      plugins/Booking/src/EasyAbp.EShop.Plugins.Booking.Application.Contracts/EasyAbp/EShop/Plugins/Booking/ProductAssetCategories/Dtos/CreateProductAssetCategoryPeriodDto.cs
  6. 26
      plugins/Booking/src/EasyAbp.EShop.Plugins.Booking.Application.Contracts/EasyAbp/EShop/Plugins/Booking/ProductAssetCategories/Dtos/ProductAssetCategoryDto.cs
  7. 13
      plugins/Booking/src/EasyAbp.EShop.Plugins.Booking.Application.Contracts/EasyAbp/EShop/Plugins/Booking/ProductAssetCategories/Dtos/ProductAssetCategoryPeriodDto.cs
  8. 17
      plugins/Booking/src/EasyAbp.EShop.Plugins.Booking.Application.Contracts/EasyAbp/EShop/Plugins/Booking/ProductAssetCategories/Dtos/UpdateProductAssetCategoryDto.cs
  9. 13
      plugins/Booking/src/EasyAbp.EShop.Plugins.Booking.Application.Contracts/EasyAbp/EShop/Plugins/Booking/ProductAssetCategories/Dtos/UpdateProductAssetCategoryPeriodDto.cs
  10. 23
      plugins/Booking/src/EasyAbp.EShop.Plugins.Booking.Application.Contracts/EasyAbp/EShop/Plugins/Booking/ProductAssetCategories/IProductAssetCategoryAppService.cs
  11. 24
      plugins/Booking/src/EasyAbp.EShop.Plugins.Booking.Application.Contracts/EasyAbp/EShop/Plugins/Booking/ProductAssets/Dtos/CreateProductAssetDto.cs
  12. 14
      plugins/Booking/src/EasyAbp.EShop.Plugins.Booking.Application.Contracts/EasyAbp/EShop/Plugins/Booking/ProductAssets/Dtos/CreateProductAssetPeriodDto.cs
  13. 26
      plugins/Booking/src/EasyAbp.EShop.Plugins.Booking.Application.Contracts/EasyAbp/EShop/Plugins/Booking/ProductAssets/Dtos/ProductAssetDto.cs
  14. 13
      plugins/Booking/src/EasyAbp.EShop.Plugins.Booking.Application.Contracts/EasyAbp/EShop/Plugins/Booking/ProductAssets/Dtos/ProductAssetPeriodDto.cs
  15. 18
      plugins/Booking/src/EasyAbp.EShop.Plugins.Booking.Application.Contracts/EasyAbp/EShop/Plugins/Booking/ProductAssets/Dtos/UpdateProductAssetDto.cs
  16. 12
      plugins/Booking/src/EasyAbp.EShop.Plugins.Booking.Application.Contracts/EasyAbp/EShop/Plugins/Booking/ProductAssets/Dtos/UpdateProductAssetPeriodDto.cs
  17. 23
      plugins/Booking/src/EasyAbp.EShop.Plugins.Booking.Application.Contracts/EasyAbp/EShop/Plugins/Booking/ProductAssets/IProductAssetAppService.cs
  18. 23
      plugins/Booking/src/EasyAbp.EShop.Plugins.Booking.Application/EasyAbp/EShop/Plugins/Booking/BookingApplicationAutoMapperProfile.cs
  19. 67
      plugins/Booking/src/EasyAbp.EShop.Plugins.Booking.Application/EasyAbp/EShop/Plugins/Booking/ProductAssetCategories/ProductAssetCategoryAppService.cs
  20. 67
      plugins/Booking/src/EasyAbp.EShop.Plugins.Booking.Application/EasyAbp/EShop/Plugins/Booking/ProductAssets/ProductAssetAppService.cs
  21. 7
      plugins/Booking/src/EasyAbp.EShop.Plugins.Booking.Domain.Shared/EasyAbp/EShop/Plugins/Booking/BookingConsts.cs
  22. 3
      plugins/Booking/src/EasyAbp.EShop.Plugins.Booking.Domain.Shared/EasyAbp/EShop/Plugins/Booking/BookingErrorCodes.cs
  23. 51
      plugins/Booking/src/EasyAbp.EShop.Plugins.Booking.Domain.Shared/EasyAbp/EShop/Plugins/Booking/Localization/en.json
  24. 51
      plugins/Booking/src/EasyAbp.EShop.Plugins.Booking.Domain.Shared/EasyAbp/EShop/Plugins/Booking/Localization/zh-Hans.json
  25. 51
      plugins/Booking/src/EasyAbp.EShop.Plugins.Booking.Domain.Shared/EasyAbp/EShop/Plugins/Booking/Localization/zh-Hant.json
  26. 9
      plugins/Booking/src/EasyAbp.EShop.Plugins.Booking.Domain/EasyAbp/EShop/Plugins/Booking/ProductAssetCategories/IProductAssetCategoryRepository.cs
  27. 58
      plugins/Booking/src/EasyAbp.EShop.Plugins.Booking.Domain/EasyAbp/EShop/Plugins/Booking/ProductAssetCategories/ProductAssetCategory.cs
  28. 16
      plugins/Booking/src/EasyAbp.EShop.Plugins.Booking.Domain/EasyAbp/EShop/Plugins/Booking/ProductAssetCategories/ProductAssetCategoryPeriod.cs
  29. 9
      plugins/Booking/src/EasyAbp.EShop.Plugins.Booking.Domain/EasyAbp/EShop/Plugins/Booking/ProductAssets/IProductAssetRepository.cs
  30. 75
      plugins/Booking/src/EasyAbp.EShop.Plugins.Booking.Domain/EasyAbp/EShop/Plugins/Booking/ProductAssets/ProductAsset.cs
  31. 16
      plugins/Booking/src/EasyAbp.EShop.Plugins.Booking.Domain/EasyAbp/EShop/Plugins/Booking/ProductAssets/ProductAssetPeriod.cs
  32. 12
      plugins/Booking/src/EasyAbp.EShop.Plugins.Booking.Domain/EasyAbp/EShop/Plugins/Booking/Shared/DuplicatePeriodException.cs
  33. 12
      plugins/Booking/src/EasyAbp.EShop.Plugins.Booking.Domain/EasyAbp/EShop/Plugins/Booking/Shared/PeriodNotFoundException.cs
  34. 8
      plugins/Booking/src/EasyAbp.EShop.Plugins.Booking.EntityFrameworkCore/EasyAbp/EShop/Plugins/Booking/EntityFrameworkCore/BookingDbContext.cs
  35. 41
      plugins/Booking/src/EasyAbp.EShop.Plugins.Booking.EntityFrameworkCore/EasyAbp/EShop/Plugins/Booking/EntityFrameworkCore/BookingDbContextModelCreatingExtensions.cs
  36. 6
      plugins/Booking/src/EasyAbp.EShop.Plugins.Booking.EntityFrameworkCore/EasyAbp/EShop/Plugins/Booking/EntityFrameworkCore/EShopPluginsBookingEntityFrameworkCoreModule.cs
  37. 9
      plugins/Booking/src/EasyAbp.EShop.Plugins.Booking.EntityFrameworkCore/EasyAbp/EShop/Plugins/Booking/EntityFrameworkCore/IBookingDbContext.cs
  38. 18
      plugins/Booking/src/EasyAbp.EShop.Plugins.Booking.EntityFrameworkCore/EasyAbp/EShop/Plugins/Booking/ProductAssetCategories/ProductAssetCategoryEfCoreQuerableExtensions.cs
  39. 21
      plugins/Booking/src/EasyAbp.EShop.Plugins.Booking.EntityFrameworkCore/EasyAbp/EShop/Plugins/Booking/ProductAssetCategories/ProductAssetCategoryRepository.cs
  40. 18
      plugins/Booking/src/EasyAbp.EShop.Plugins.Booking.EntityFrameworkCore/EasyAbp/EShop/Plugins/Booking/ProductAssets/ProductAssetEfCoreQuerableExtensions.cs
  41. 21
      plugins/Booking/src/EasyAbp.EShop.Plugins.Booking.EntityFrameworkCore/EasyAbp/EShop/Plugins/Booking/ProductAssets/ProductAssetRepository.cs
  42. 2
      plugins/Booking/src/EasyAbp.EShop.Plugins.Booking.HttpApi.Client/EasyAbp/EShop/Plugins/Booking/EShopPluginsBookingHttpApiClientModule.cs
  43. 2
      plugins/Booking/src/EasyAbp.EShop.Plugins.Booking.HttpApi/EasyAbp/EShop/Plugins/Booking/BookingController.cs
  44. 78
      plugins/Booking/src/EasyAbp.EShop.Plugins.Booking.HttpApi/EasyAbp/EShop/Plugins/Booking/ProductAssetCategories/ProductAssetCategoryController.cs
  45. 77
      plugins/Booking/src/EasyAbp.EShop.Plugins.Booking.HttpApi/EasyAbp/EShop/Plugins/Booking/ProductAssets/ProductAssetController.cs
  46. 27
      plugins/Booking/src/EasyAbp.EShop.Plugins.Booking.Web/BookingWebAutoMapperProfile.cs
  47. 36
      plugins/Booking/src/EasyAbp.EShop.Plugins.Booking.Web/Menus/BookingMenuContributor.cs
  48. 6
      plugins/Booking/src/EasyAbp.EShop.Plugins.Booking.Web/Menus/BookingMenus.cs
  49. 18
      plugins/Booking/src/EasyAbp.EShop.Plugins.Booking.Web/Pages/EShop/Plugins/Booking/ProductAssetCategories/ProductAssetCategory/CreateModal.cshtml
  50. 28
      plugins/Booking/src/EasyAbp.EShop.Plugins.Booking.Web/Pages/EShop/Plugins/Booking/ProductAssetCategories/ProductAssetCategory/CreateModal.cshtml.cs
  51. 19
      plugins/Booking/src/EasyAbp.EShop.Plugins.Booking.Web/Pages/EShop/Plugins/Booking/ProductAssetCategories/ProductAssetCategory/EditModal.cshtml
  52. 39
      plugins/Booking/src/EasyAbp.EShop.Plugins.Booking.Web/Pages/EShop/Plugins/Booking/ProductAssetCategories/ProductAssetCategory/EditModal.cshtml.cs
  53. 48
      plugins/Booking/src/EasyAbp.EShop.Plugins.Booking.Web/Pages/EShop/Plugins/Booking/ProductAssetCategories/ProductAssetCategory/Index.cshtml
  54. 12
      plugins/Booking/src/EasyAbp.EShop.Plugins.Booking.Web/Pages/EShop/Plugins/Booking/ProductAssetCategories/ProductAssetCategory/Index.cshtml.cs
  55. 30
      plugins/Booking/src/EasyAbp.EShop.Plugins.Booking.Web/Pages/EShop/Plugins/Booking/ProductAssetCategories/ProductAssetCategory/ViewModels/CreateProductAssetCategoryViewModel.cs
  56. 18
      plugins/Booking/src/EasyAbp.EShop.Plugins.Booking.Web/Pages/EShop/Plugins/Booking/ProductAssetCategories/ProductAssetCategory/ViewModels/EditProductAssetCategoryViewModel.cs
  57. 0
      plugins/Booking/src/EasyAbp.EShop.Plugins.Booking.Web/Pages/EShop/Plugins/Booking/ProductAssetCategories/ProductAssetCategory/index.css
  58. 96
      plugins/Booking/src/EasyAbp.EShop.Plugins.Booking.Web/Pages/EShop/Plugins/Booking/ProductAssetCategories/ProductAssetCategory/index.js
  59. 19
      plugins/Booking/src/EasyAbp.EShop.Plugins.Booking.Web/Pages/EShop/Plugins/Booking/ProductAssetCategories/ProductAssetCategoryPeriod/CreateModal.cshtml
  60. 33
      plugins/Booking/src/EasyAbp.EShop.Plugins.Booking.Web/Pages/EShop/Plugins/Booking/ProductAssetCategories/ProductAssetCategoryPeriod/CreateModal.cshtml.cs
  61. 20
      plugins/Booking/src/EasyAbp.EShop.Plugins.Booking.Web/Pages/EShop/Plugins/Booking/ProductAssetCategories/ProductAssetCategoryPeriod/EditModal.cshtml
  62. 45
      plugins/Booking/src/EasyAbp.EShop.Plugins.Booking.Web/Pages/EShop/Plugins/Booking/ProductAssetCategories/ProductAssetCategoryPeriod/EditModal.cshtml.cs
  63. 52
      plugins/Booking/src/EasyAbp.EShop.Plugins.Booking.Web/Pages/EShop/Plugins/Booking/ProductAssetCategories/ProductAssetCategoryPeriod/Index.cshtml
  64. 17
      plugins/Booking/src/EasyAbp.EShop.Plugins.Booking.Web/Pages/EShop/Plugins/Booking/ProductAssetCategories/ProductAssetCategoryPeriod/Index.cshtml.cs
  65. 15
      plugins/Booking/src/EasyAbp.EShop.Plugins.Booking.Web/Pages/EShop/Plugins/Booking/ProductAssetCategories/ProductAssetCategoryPeriod/ViewModels/CreateProductAssetCategoryPeriodViewModel.cs
  66. 12
      plugins/Booking/src/EasyAbp.EShop.Plugins.Booking.Web/Pages/EShop/Plugins/Booking/ProductAssetCategories/ProductAssetCategoryPeriod/ViewModels/EditProductAssetCategoryPeriodViewModel.cs
  67. 0
      plugins/Booking/src/EasyAbp.EShop.Plugins.Booking.Web/Pages/EShop/Plugins/Booking/ProductAssetCategories/ProductAssetCategoryPeriod/index.css
  68. 80
      plugins/Booking/src/EasyAbp.EShop.Plugins.Booking.Web/Pages/EShop/Plugins/Booking/ProductAssetCategories/ProductAssetCategoryPeriod/index.js
  69. 18
      plugins/Booking/src/EasyAbp.EShop.Plugins.Booking.Web/Pages/EShop/Plugins/Booking/ProductAssets/ProductAsset/CreateModal.cshtml
  70. 28
      plugins/Booking/src/EasyAbp.EShop.Plugins.Booking.Web/Pages/EShop/Plugins/Booking/ProductAssets/ProductAsset/CreateModal.cshtml.cs
  71. 19
      plugins/Booking/src/EasyAbp.EShop.Plugins.Booking.Web/Pages/EShop/Plugins/Booking/ProductAssets/ProductAsset/EditModal.cshtml
  72. 39
      plugins/Booking/src/EasyAbp.EShop.Plugins.Booking.Web/Pages/EShop/Plugins/Booking/ProductAssets/ProductAsset/EditModal.cshtml.cs
  73. 48
      plugins/Booking/src/EasyAbp.EShop.Plugins.Booking.Web/Pages/EShop/Plugins/Booking/ProductAssets/ProductAsset/Index.cshtml
  74. 12
      plugins/Booking/src/EasyAbp.EShop.Plugins.Booking.Web/Pages/EShop/Plugins/Booking/ProductAssets/ProductAsset/Index.cshtml.cs
  75. 31
      plugins/Booking/src/EasyAbp.EShop.Plugins.Booking.Web/Pages/EShop/Plugins/Booking/ProductAssets/ProductAsset/ViewModels/CreateProductAssetViewModel.cs
  76. 19
      plugins/Booking/src/EasyAbp.EShop.Plugins.Booking.Web/Pages/EShop/Plugins/Booking/ProductAssets/ProductAsset/ViewModels/EditProductAssetViewModel.cs
  77. 0
      plugins/Booking/src/EasyAbp.EShop.Plugins.Booking.Web/Pages/EShop/Plugins/Booking/ProductAssets/ProductAsset/index.css
  78. 96
      plugins/Booking/src/EasyAbp.EShop.Plugins.Booking.Web/Pages/EShop/Plugins/Booking/ProductAssets/ProductAsset/index.js
  79. 19
      plugins/Booking/src/EasyAbp.EShop.Plugins.Booking.Web/Pages/EShop/Plugins/Booking/ProductAssets/ProductAssetPeriod/CreateModal.cshtml
  80. 33
      plugins/Booking/src/EasyAbp.EShop.Plugins.Booking.Web/Pages/EShop/Plugins/Booking/ProductAssets/ProductAssetPeriod/CreateModal.cshtml.cs
  81. 20
      plugins/Booking/src/EasyAbp.EShop.Plugins.Booking.Web/Pages/EShop/Plugins/Booking/ProductAssets/ProductAssetPeriod/EditModal.cshtml
  82. 45
      plugins/Booking/src/EasyAbp.EShop.Plugins.Booking.Web/Pages/EShop/Plugins/Booking/ProductAssets/ProductAssetPeriod/EditModal.cshtml.cs
  83. 52
      plugins/Booking/src/EasyAbp.EShop.Plugins.Booking.Web/Pages/EShop/Plugins/Booking/ProductAssets/ProductAssetPeriod/Index.cshtml
  84. 17
      plugins/Booking/src/EasyAbp.EShop.Plugins.Booking.Web/Pages/EShop/Plugins/Booking/ProductAssets/ProductAssetPeriod/Index.cshtml.cs
  85. 16
      plugins/Booking/src/EasyAbp.EShop.Plugins.Booking.Web/Pages/EShop/Plugins/Booking/ProductAssets/ProductAssetPeriod/ViewModels/CreateProductAssetPeriodViewModel.cs
  86. 13
      plugins/Booking/src/EasyAbp.EShop.Plugins.Booking.Web/Pages/EShop/Plugins/Booking/ProductAssets/ProductAssetPeriod/ViewModels/EditProductAssetPeriodViewModel.cs
  87. 0
      plugins/Booking/src/EasyAbp.EShop.Plugins.Booking.Web/Pages/EShop/Plugins/Booking/ProductAssets/ProductAssetPeriod/index.css
  88. 80
      plugins/Booking/src/EasyAbp.EShop.Plugins.Booking.Web/Pages/EShop/Plugins/Booking/ProductAssets/ProductAssetPeriod/index.js
  89. 28
      plugins/Booking/test/EasyAbp.EShop.Plugins.Booking.Application.Tests/ProductAssetCategories/ProductAssetCategoryAppServiceTests.cs
  90. 28
      plugins/Booking/test/EasyAbp.EShop.Plugins.Booking.Application.Tests/ProductAssets/ProductAssetAppServiceTests.cs
  91. 25
      plugins/Booking/test/EasyAbp.EShop.Plugins.Booking.Domain.Tests/ProductAssetCategories/ProductAssetCategoryDomainTests.cs
  92. 25
      plugins/Booking/test/EasyAbp.EShop.Plugins.Booking.Domain.Tests/ProductAssets/ProductAssetDomainTests.cs
  93. 33
      plugins/Booking/test/EasyAbp.EShop.Plugins.Booking.EntityFrameworkCore.Tests/EntityFrameworkCore/ProductAssetCategories/ProductAssetCategoryRepositoryTests.cs
  94. 33
      plugins/Booking/test/EasyAbp.EShop.Plugins.Booking.EntityFrameworkCore.Tests/EntityFrameworkCore/ProductAssets/ProductAssetRepositoryTests.cs
  95. 1
      samples/EShopSample/aspnet-core/src/EShopSample.Application.Contracts/EShopSample.Application.Contracts.csproj
  96. 2
      samples/EShopSample/aspnet-core/src/EShopSample.Application.Contracts/EShopSampleApplicationContractsModule.cs
  97. 1
      samples/EShopSample/aspnet-core/src/EShopSample.Application/EShopSample.Application.csproj
  98. 2
      samples/EShopSample/aspnet-core/src/EShopSample.Application/EShopSampleApplicationModule.cs
  99. 1
      samples/EShopSample/aspnet-core/src/EShopSample.Domain.Shared/EShopSample.Domain.Shared.csproj
  100. 2
      samples/EShopSample/aspnet-core/src/EShopSample.Domain.Shared/EShopSampleDomainSharedModule.cs

2
plugins/Booking/src/EasyAbp.EShop.Plugins.Booking.Application.Contracts/EasyAbp/EShop/Plugins/Booking/BookingRemoteServiceConsts.cs → plugins/Booking/src/EasyAbp.EShop.Plugins.Booking.Application.Contracts/EasyAbp/EShop/Plugins/Booking/EShopPluginsBookingRemoteServiceConsts.cs

@ -1,6 +1,6 @@
namespace EasyAbp.EShop.Plugins.Booking;
public class BookingRemoteServiceConsts
public class EShopPluginsBookingRemoteServiceConsts
{
public const string RemoteServiceName = "EasyAbpEShopPluginsBooking";

12
plugins/Booking/src/EasyAbp.EShop.Plugins.Booking.Application.Contracts/EasyAbp/EShop/Plugins/Booking/Permissions/BookingPermissionDefinitionProvider.cs

@ -1,4 +1,4 @@
using EasyAbp.EShop.Plugins.Booking.Localization;
using EasyAbp.EShop.Plugins.Booking.Localization;
using Volo.Abp.Authorization.Permissions;
using Volo.Abp.Localization;
@ -9,6 +9,16 @@ public class BookingPermissionDefinitionProvider : PermissionDefinitionProvider
public override void Define(IPermissionDefinitionContext context)
{
var myGroup = context.AddGroup(BookingPermissions.GroupName, L("Permission:Booking"));
var productAssetPermission = myGroup.AddPermission(BookingPermissions.ProductAsset.Default, L("Permission:ProductAsset"));
productAssetPermission.AddChild(BookingPermissions.ProductAsset.Create, L("Permission:Create"));
productAssetPermission.AddChild(BookingPermissions.ProductAsset.Update, L("Permission:Update"));
productAssetPermission.AddChild(BookingPermissions.ProductAsset.Delete, L("Permission:Delete"));
var productAssetCategoryPermission = myGroup.AddPermission(BookingPermissions.ProductAssetCategory.Default, L("Permission:ProductAssetCategory"));
productAssetCategoryPermission.AddChild(BookingPermissions.ProductAssetCategory.Create, L("Permission:Create"));
productAssetCategoryPermission.AddChild(BookingPermissions.ProductAssetCategory.Update, L("Permission:Update"));
productAssetCategoryPermission.AddChild(BookingPermissions.ProductAssetCategory.Delete, L("Permission:Delete"));
}
private static LocalizableString L(string name)

18
plugins/Booking/src/EasyAbp.EShop.Plugins.Booking.Application.Contracts/EasyAbp/EShop/Plugins/Booking/Permissions/BookingPermissions.cs

@ -1,4 +1,4 @@
using Volo.Abp.Reflection;
using Volo.Abp.Reflection;
namespace EasyAbp.EShop.Plugins.Booking.Permissions;
@ -10,4 +10,20 @@ public class BookingPermissions
{
return ReflectionHelper.GetPublicConstantsRecursively(typeof(BookingPermissions));
}
public class ProductAsset
{
public const string Default = GroupName + ".ProductAsset";
public const string Update = Default + ".Update";
public const string Create = Default + ".Create";
public const string Delete = Default + ".Delete";
}
public class ProductAssetCategory
{
public const string Default = GroupName + ".ProductAssetCategory";
public const string Update = Default + ".Update";
public const string Create = Default + ".Create";
public const string Delete = Default + ".Delete";
}
}

25
plugins/Booking/src/EasyAbp.EShop.Plugins.Booking.Application.Contracts/EasyAbp/EShop/Plugins/Booking/ProductAssetCategories/Dtos/CreateProductAssetCategoryDto.cs

@ -0,0 +1,25 @@
using System;
using System.ComponentModel;
using System.ComponentModel.DataAnnotations;
namespace EasyAbp.EShop.Plugins.Booking.ProductAssetCategories.Dtos
{
[Serializable]
public class CreateProductAssetCategoryDto
{
public Guid ProductId { get; set; }
public Guid ProductSkuId { get; set; }
public Guid AssetCategoryId { get; set; }
public Guid PeriodSchemeId { get; set; }
public DateTime FromTime { get; set; }
public DateTime? ToTime { get; set; }
[Range(BookingConsts.MinimumPrice, BookingConsts.MaximumPrice)]
public decimal? Price { get; set; }
}
}

15
plugins/Booking/src/EasyAbp.EShop.Plugins.Booking.Application.Contracts/EasyAbp/EShop/Plugins/Booking/ProductAssetCategories/Dtos/CreateProductAssetCategoryPeriodDto.cs

@ -0,0 +1,15 @@
using System;
using System.ComponentModel;
using System.ComponentModel.DataAnnotations;
namespace EasyAbp.EShop.Plugins.Booking.ProductAssetCategories.Dtos
{
[Serializable]
public class CreateProductAssetCategoryPeriodDto
{
public Guid PeriodId { get; set; }
[Range(BookingConsts.MinimumPrice, BookingConsts.MaximumPrice)]
public decimal Price { get; set; }
}
}

26
plugins/Booking/src/EasyAbp.EShop.Plugins.Booking.Application.Contracts/EasyAbp/EShop/Plugins/Booking/ProductAssetCategories/Dtos/ProductAssetCategoryDto.cs

@ -0,0 +1,26 @@
using System;
using System.Collections.Generic;
using Volo.Abp.Application.Dtos;
namespace EasyAbp.EShop.Plugins.Booking.ProductAssetCategories.Dtos
{
[Serializable]
public class ProductAssetCategoryDto : AuditedEntityDto<Guid>
{
public Guid ProductId { get; set; }
public Guid ProductSkuId { get; set; }
public Guid AssetCategoryId { get; set; }
public Guid PeriodSchemeId { get; set; }
public DateTime FromTime { get; set; }
public DateTime? ToTime { get; set; }
public decimal? Price { get; set; }
public List<ProductAssetCategoryPeriodDto> Periods { get; set; }
}
}

13
plugins/Booking/src/EasyAbp.EShop.Plugins.Booking.Application.Contracts/EasyAbp/EShop/Plugins/Booking/ProductAssetCategories/Dtos/ProductAssetCategoryPeriodDto.cs

@ -0,0 +1,13 @@
using System;
using Volo.Abp.Application.Dtos;
namespace EasyAbp.EShop.Plugins.Booking.ProductAssetCategories.Dtos
{
[Serializable]
public class ProductAssetCategoryPeriodDto : EntityDto<Guid>
{
public Guid PeriodId { get; set; }
public decimal Price { get; set; }
}
}

17
plugins/Booking/src/EasyAbp.EShop.Plugins.Booking.Application.Contracts/EasyAbp/EShop/Plugins/Booking/ProductAssetCategories/Dtos/UpdateProductAssetCategoryDto.cs

@ -0,0 +1,17 @@
using System;
using System.ComponentModel;
using System.ComponentModel.DataAnnotations;
namespace EasyAbp.EShop.Plugins.Booking.ProductAssetCategories.Dtos
{
[Serializable]
public class UpdateProductAssetCategoryDto
{
public DateTime FromTime { get; set; }
public DateTime? ToTime { get; set; }
[Range(BookingConsts.MinimumPrice, BookingConsts.MaximumPrice)]
public decimal? Price { get; set; }
}
}

13
plugins/Booking/src/EasyAbp.EShop.Plugins.Booking.Application.Contracts/EasyAbp/EShop/Plugins/Booking/ProductAssetCategories/Dtos/UpdateProductAssetCategoryPeriodDto.cs

@ -0,0 +1,13 @@
using System;
using System.ComponentModel;
using System.ComponentModel.DataAnnotations;
namespace EasyAbp.EShop.Plugins.Booking.ProductAssetCategories.Dtos
{
[Serializable]
public class UpdateProductAssetCategoryPeriodDto
{
[Range(BookingConsts.MinimumPrice, BookingConsts.MaximumPrice)]
public decimal Price { get; set; }
}
}

23
plugins/Booking/src/EasyAbp.EShop.Plugins.Booking.Application.Contracts/EasyAbp/EShop/Plugins/Booking/ProductAssetCategories/IProductAssetCategoryAppService.cs

@ -0,0 +1,23 @@
using System;
using System.Threading.Tasks;
using EasyAbp.EShop.Plugins.Booking.ProductAssetCategories.Dtos;
using Volo.Abp.Application.Dtos;
using Volo.Abp.Application.Services;
namespace EasyAbp.EShop.Plugins.Booking.ProductAssetCategories
{
public interface IProductAssetCategoryAppService :
ICrudAppService<
ProductAssetCategoryDto,
Guid,
PagedAndSortedResultRequestDto,
CreateProductAssetCategoryDto,
UpdateProductAssetCategoryDto>
{
Task<ProductAssetCategoryDto> CreatePeriodAsync(Guid productAssetCategoryId, CreateProductAssetCategoryPeriodDto input);
Task<ProductAssetCategoryDto> UpdatePeriodAsync(Guid productAssetCategoryId, Guid periodId, UpdateProductAssetCategoryPeriodDto input);
Task<ProductAssetCategoryDto> DeletePeriodAsync(Guid productAssetCategoryId, Guid periodId);
}
}

24
plugins/Booking/src/EasyAbp.EShop.Plugins.Booking.Application.Contracts/EasyAbp/EShop/Plugins/Booking/ProductAssets/Dtos/CreateProductAssetDto.cs

@ -0,0 +1,24 @@
using System;
using System.ComponentModel.DataAnnotations;
namespace EasyAbp.EShop.Plugins.Booking.ProductAssets.Dtos
{
[Serializable]
public class CreateProductAssetDto
{
public Guid ProductId { get; set; }
public Guid ProductSkuId { get; set; }
public Guid AssetId { get; set; }
public Guid PeriodSchemeId { get; set; }
public DateTime FromTime { get; set; }
public DateTime? ToTime { get; set; }
[Range(BookingConsts.MinimumPrice, BookingConsts.MaximumPrice)]
public decimal? Price { get; set; }
}
}

14
plugins/Booking/src/EasyAbp.EShop.Plugins.Booking.Application.Contracts/EasyAbp/EShop/Plugins/Booking/ProductAssets/Dtos/CreateProductAssetPeriodDto.cs

@ -0,0 +1,14 @@
using System;
using System.ComponentModel.DataAnnotations;
namespace EasyAbp.EShop.Plugins.Booking.ProductAssets.Dtos
{
[Serializable]
public class CreateProductAssetPeriodDto
{
public Guid PeriodId { get; set; }
[Range(BookingConsts.MinimumPrice, BookingConsts.MaximumPrice)]
public decimal Price { get; set; }
}
}

26
plugins/Booking/src/EasyAbp.EShop.Plugins.Booking.Application.Contracts/EasyAbp/EShop/Plugins/Booking/ProductAssets/Dtos/ProductAssetDto.cs

@ -0,0 +1,26 @@
using System;
using System.Collections.Generic;
using Volo.Abp.Application.Dtos;
namespace EasyAbp.EShop.Plugins.Booking.ProductAssets.Dtos
{
[Serializable]
public class ProductAssetDto : AuditedEntityDto<Guid>
{
public Guid ProductId { get; set; }
public Guid ProductSkuId { get; set; }
public Guid AssetId { get; set; }
public Guid PeriodSchemeId { get; set; }
public DateTime FromTime { get; set; }
public DateTime? ToTime { get; set; }
public decimal? Price { get; set; }
public List<ProductAssetPeriodDto> Periods { get; set; }
}
}

13
plugins/Booking/src/EasyAbp.EShop.Plugins.Booking.Application.Contracts/EasyAbp/EShop/Plugins/Booking/ProductAssets/Dtos/ProductAssetPeriodDto.cs

@ -0,0 +1,13 @@
using System;
using Volo.Abp.Application.Dtos;
namespace EasyAbp.EShop.Plugins.Booking.ProductAssets.Dtos
{
[Serializable]
public class ProductAssetPeriodDto : EntityDto<Guid>
{
public Guid PeriodId { get; set; }
public decimal Price { get; set; }
}
}

18
plugins/Booking/src/EasyAbp.EShop.Plugins.Booking.Application.Contracts/EasyAbp/EShop/Plugins/Booking/ProductAssets/Dtos/UpdateProductAssetDto.cs

@ -0,0 +1,18 @@
using System;
using System.Collections.Generic;
using System.ComponentModel;
using System.ComponentModel.DataAnnotations;
namespace EasyAbp.EShop.Plugins.Booking.ProductAssets.Dtos
{
[Serializable]
public class UpdateProductAssetDto
{
public DateTime FromTime { get; set; }
public DateTime? ToTime { get; set; }
[Range(BookingConsts.MinimumPrice, BookingConsts.MaximumPrice)]
public decimal? Price { get; set; }
}
}

12
plugins/Booking/src/EasyAbp.EShop.Plugins.Booking.Application.Contracts/EasyAbp/EShop/Plugins/Booking/ProductAssets/Dtos/UpdateProductAssetPeriodDto.cs

@ -0,0 +1,12 @@
using System;
using System.ComponentModel.DataAnnotations;
namespace EasyAbp.EShop.Plugins.Booking.ProductAssets.Dtos
{
[Serializable]
public class UpdateProductAssetPeriodDto
{
[Range(BookingConsts.MinimumPrice, BookingConsts.MaximumPrice)]
public decimal Price { get; set; }
}
}

23
plugins/Booking/src/EasyAbp.EShop.Plugins.Booking.Application.Contracts/EasyAbp/EShop/Plugins/Booking/ProductAssets/IProductAssetAppService.cs

@ -0,0 +1,23 @@
using System;
using System.Threading.Tasks;
using EasyAbp.EShop.Plugins.Booking.ProductAssets.Dtos;
using Volo.Abp.Application.Dtos;
using Volo.Abp.Application.Services;
namespace EasyAbp.EShop.Plugins.Booking.ProductAssets
{
public interface IProductAssetAppService :
ICrudAppService<
ProductAssetDto,
Guid,
PagedAndSortedResultRequestDto,
CreateProductAssetDto,
UpdateProductAssetDto>
{
Task<ProductAssetDto> CreatePeriodAsync(Guid productAssetId, CreateProductAssetPeriodDto input);
Task<ProductAssetDto> UpdatePeriodAsync(Guid productAssetId, Guid periodId, UpdateProductAssetPeriodDto input);
Task<ProductAssetDto> DeletePeriodAsync(Guid productAssetId, Guid periodId);
}
}

23
plugins/Booking/src/EasyAbp.EShop.Plugins.Booking.Application/EasyAbp/EShop/Plugins/Booking/BookingApplicationAutoMapperProfile.cs

@ -1,4 +1,8 @@
using AutoMapper;
using EasyAbp.EShop.Plugins.Booking.ProductAssets;
using EasyAbp.EShop.Plugins.Booking.ProductAssets.Dtos;
using EasyAbp.EShop.Plugins.Booking.ProductAssetCategories;
using EasyAbp.EShop.Plugins.Booking.ProductAssetCategories.Dtos;
using AutoMapper;
namespace EasyAbp.EShop.Plugins.Booking;
@ -9,5 +13,20 @@ public class BookingApplicationAutoMapperProfile : Profile
/* You can configure your AutoMapper mapping configuration here.
* Alternatively, you can split your mapping configurations
* into multiple profile classes for a better organization. */
CreateMap<ProductAsset, ProductAssetDto>();
CreateMap<CreateProductAssetDto, ProductAsset>(MemberList.Source);
CreateMap<UpdateProductAssetDto, ProductAsset>(MemberList.Source);
CreateMap<ProductAssetPeriod, ProductAssetPeriodDto>();
CreateMap<CreateProductAssetPeriodDto, ProductAssetPeriod>(MemberList.Source);
CreateMap<UpdateProductAssetPeriodDto, ProductAssetPeriod>(MemberList.Source);
CreateMap<ProductAssetCategory, ProductAssetCategoryDto>();
CreateMap<CreateProductAssetCategoryDto, ProductAssetCategory>(MemberList.Source);
CreateMap<UpdateProductAssetCategoryDto, ProductAssetCategory>(MemberList.Source);
CreateMap<ProductAssetCategoryPeriod, ProductAssetCategoryPeriodDto>();
CreateMap<CreateProductAssetCategoryPeriodDto, ProductAssetCategoryPeriod>(MemberList.Source);
CreateMap<UpdateProductAssetCategoryPeriodDto, ProductAssetCategoryPeriod>(MemberList.Source);
}
}
}

67
plugins/Booking/src/EasyAbp.EShop.Plugins.Booking.Application/EasyAbp/EShop/Plugins/Booking/ProductAssetCategories/ProductAssetCategoryAppService.cs

@ -0,0 +1,67 @@
using System;
using System.Threading.Tasks;
using EasyAbp.EShop.Plugins.Booking.Permissions;
using EasyAbp.EShop.Plugins.Booking.ProductAssetCategories.Dtos;
using Volo.Abp.Application.Dtos;
using Volo.Abp.Application.Services;
namespace EasyAbp.EShop.Plugins.Booking.ProductAssetCategories
{
public class ProductAssetCategoryAppService : CrudAppService<ProductAssetCategory, ProductAssetCategoryDto, Guid, PagedAndSortedResultRequestDto, CreateProductAssetCategoryDto, UpdateProductAssetCategoryDto>,
IProductAssetCategoryAppService
{
protected override string GetPolicyName { get; set; } = BookingPermissions.ProductAssetCategory.Default;
protected override string GetListPolicyName { get; set; } = BookingPermissions.ProductAssetCategory.Default;
protected override string CreatePolicyName { get; set; } = BookingPermissions.ProductAssetCategory.Create;
protected override string UpdatePolicyName { get; set; } = BookingPermissions.ProductAssetCategory.Update;
protected override string DeletePolicyName { get; set; } = BookingPermissions.ProductAssetCategory.Delete;
private readonly IProductAssetCategoryRepository _repository;
public ProductAssetCategoryAppService(IProductAssetCategoryRepository repository) : base(repository)
{
_repository = repository;
}
public virtual async Task<ProductAssetCategoryDto> CreatePeriodAsync(Guid productAssetCategoryId, CreateProductAssetCategoryPeriodDto input)
{
await CheckUpdatePolicyAsync();
var productAsset = await GetEntityByIdAsync(productAssetCategoryId);
productAsset.AddPeriod(ObjectMapper.Map<CreateProductAssetCategoryPeriodDto, ProductAssetCategoryPeriod>(input));
await _repository.UpdateAsync(productAsset, true);
return await MapToGetOutputDtoAsync(productAsset);
}
public virtual async Task<ProductAssetCategoryDto> UpdatePeriodAsync(Guid productAssetCategoryId, Guid periodId, UpdateProductAssetCategoryPeriodDto input)
{
await CheckUpdatePolicyAsync();
var productAsset = await GetEntityByIdAsync(productAssetCategoryId);
var productAssetCategoryPeriod = productAsset.GetPeriod(periodId);
ObjectMapper.Map(input, productAssetCategoryPeriod);
await _repository.UpdateAsync(productAsset, true);
return await MapToGetOutputDtoAsync(productAsset);
}
public virtual async Task<ProductAssetCategoryDto> DeletePeriodAsync(Guid productAssetCategoryId, Guid periodId)
{
await CheckUpdatePolicyAsync();
var productAsset = await GetEntityByIdAsync(productAssetCategoryId);
productAsset.RemovePeriod(periodId);
await _repository.UpdateAsync(productAsset, true);
return await MapToGetOutputDtoAsync(productAsset);
}
}
}

67
plugins/Booking/src/EasyAbp.EShop.Plugins.Booking.Application/EasyAbp/EShop/Plugins/Booking/ProductAssets/ProductAssetAppService.cs

@ -0,0 +1,67 @@
using System;
using System.Threading.Tasks;
using EasyAbp.EShop.Plugins.Booking.Permissions;
using EasyAbp.EShop.Plugins.Booking.ProductAssets.Dtos;
using Volo.Abp.Application.Dtos;
using Volo.Abp.Application.Services;
namespace EasyAbp.EShop.Plugins.Booking.ProductAssets
{
public class ProductAssetAppService : CrudAppService<ProductAsset, ProductAssetDto, Guid, PagedAndSortedResultRequestDto, CreateProductAssetDto, UpdateProductAssetDto>,
IProductAssetAppService
{
protected override string GetPolicyName { get; set; } = BookingPermissions.ProductAsset.Default;
protected override string GetListPolicyName { get; set; } = BookingPermissions.ProductAsset.Default;
protected override string CreatePolicyName { get; set; } = BookingPermissions.ProductAsset.Create;
protected override string UpdatePolicyName { get; set; } = BookingPermissions.ProductAsset.Update;
protected override string DeletePolicyName { get; set; } = BookingPermissions.ProductAsset.Delete;
private readonly IProductAssetRepository _repository;
public ProductAssetAppService(IProductAssetRepository repository) : base(repository)
{
_repository = repository;
}
public virtual async Task<ProductAssetDto> CreatePeriodAsync(Guid productAssetId, CreateProductAssetPeriodDto input)
{
await CheckUpdatePolicyAsync();
var productAsset = await GetEntityByIdAsync(productAssetId);
productAsset.AddPeriod(ObjectMapper.Map<CreateProductAssetPeriodDto, ProductAssetPeriod>(input));
await _repository.UpdateAsync(productAsset, true);
return await MapToGetOutputDtoAsync(productAsset);
}
public virtual async Task<ProductAssetDto> UpdatePeriodAsync(Guid productAssetId, Guid periodId, UpdateProductAssetPeriodDto input)
{
await CheckUpdatePolicyAsync();
var productAsset = await GetEntityByIdAsync(productAssetId);
var productAssetPeriod = productAsset.GetPeriod(periodId);
ObjectMapper.Map(input, productAssetPeriod);
await _repository.UpdateAsync(productAsset, true);
return await MapToGetOutputDtoAsync(productAsset);
}
public virtual async Task<ProductAssetDto> DeletePeriodAsync(Guid productAssetId, Guid periodId)
{
await CheckUpdatePolicyAsync();
var productAsset = await GetEntityByIdAsync(productAssetId);
productAsset.RemovePeriod(periodId);
await _repository.UpdateAsync(productAsset, true);
return await MapToGetOutputDtoAsync(productAsset);
}
}
}

7
plugins/Booking/src/EasyAbp.EShop.Plugins.Booking.Domain.Shared/EasyAbp/EShop/Plugins/Booking/BookingConsts.cs

@ -0,0 +1,7 @@
namespace EasyAbp.EShop.Plugins.Booking;
public class BookingConsts
{
public const double MinimumPrice = 0f;
public const double MaximumPrice = 999999999999.99999999f;
}

3
plugins/Booking/src/EasyAbp.EShop.Plugins.Booking.Domain.Shared/EasyAbp/EShop/Plugins/Booking/BookingErrorCodes.cs

@ -2,5 +2,6 @@
public static class BookingErrorCodes
{
//Add your business exception error codes here...
public const string PeriodNotFound = "EasyAbp.EShop.Plugins.Booking:PeriodNotFound";
public const string DuplicatePeriod = "EasyAbp.EShop.Plugins.Booking:DuplicatePeriod";
}

51
plugins/Booking/src/EasyAbp.EShop.Plugins.Booking.Domain.Shared/EasyAbp/EShop/Plugins/Booking/Localization/en.json

@ -1,7 +1,54 @@
{
"culture": "en",
"texts": {
"MyAccount": "My account",
"SamplePageMessage": "A sample page for the Booking module"
"Menu:Booking": "Booking business",
"Permission:ProductAsset": "Asset prices",
"Permission:Create": "Create",
"Permission:Update": "Update",
"Permission:Delete": "Delete",
"Menu:ProductAsset": "Asset prices",
"ProductAsset": "Asset prices",
"ProductAssetProductId": "Product ID",
"ProductAssetProductSkuId": "Product SKU ID",
"ProductAssetAssetId": "Asset ID",
"ProductAssetPeriodSchemeId": "Period Scheme ID",
"ProductAssetFromTime": "From time",
"ProductAssetToTime": "To time",
"ProductAssetPrice": "Price",
"ProductAssetPeriods": "Period prices",
"CreateProductAsset": "New",
"EditProductAsset": "Edit",
"ProductAssetDeletionConfirmationMessage": "Are you sure to delete the product asset {0}?",
"SuccessfullyDeleted": "Successfully deleted",
"Menu:ProductAssetPeriod": "Asset period prices",
"ProductAssetPeriod": "Asset period prices",
"ProductAssetPeriodPeriodId": "Period ID",
"ProductAssetPeriodPrice": "Price",
"CreateProductAssetPeriod": "New",
"EditProductAssetPeriod": "Edit",
"ProductAssetPeriodDeletionConfirmationMessage": "Are you sure to delete the product asset period {0}?",
"Permission:ProductAssetCategory": "Asset category prices",
"Menu:ProductAssetCategory": "Asset category prices",
"ProductAssetCategory": "Asset category prices",
"ProductAssetCategoryProductId": "Product ID",
"ProductAssetCategoryProductSkuId": "Product SKU ID",
"ProductAssetCategoryAssetCategoryId": "Asset Category ID",
"ProductAssetCategoryPeriodSchemeId": "Period Scheme ID",
"ProductAssetCategoryFromTime": "From time",
"ProductAssetCategoryToTime": "To time",
"ProductAssetCategoryPrice": "Price",
"ProductAssetCategoryPeriods": "Period prices",
"CreateProductAssetCategory": "New",
"EditProductAssetCategory": "Edit",
"ProductAssetCategoryDeletionConfirmationMessage": "Are you sure to delete the product asset category {0}?",
"Menu:ProductAssetCategoryPeriod": "Asset category period prices",
"ProductAssetCategoryPeriod": "Asset category period prices",
"ProductAssetCategoryPeriodPeriodId": "Period ID",
"ProductAssetCategoryPeriodPrice": "Price",
"CreateProductAssetCategoryPeriod": "New",
"EditProductAssetCategoryPeriod": "Edit",
"ProductAssetCategoryPeriodDeletionConfirmationMessage": "Are you sure to delete the product asset category period {0}?",
"EasyAbp.EShop.Plugins.Booking:PeriodNotFound": "Period {id} not found.",
"EasyAbp.EShop.Plugins.Booking:DuplicatePeriod": "Period {id} exists."
}
}

51
plugins/Booking/src/EasyAbp.EShop.Plugins.Booking.Domain.Shared/EasyAbp/EShop/Plugins/Booking/Localization/zh-Hans.json

@ -1,7 +1,54 @@
{
"culture": "zh-Hans",
"texts": {
"MyAccount": "我的账户",
"SamplePageMessage": "Booking模块的示例页面"
"Menu:Booking": "预约业务",
"Permission:ProductAsset": "资产价格",
"Permission:Create": "新建",
"Permission:Update": "更新",
"Permission:Delete": "删除",
"Menu:ProductAsset": "资产价格",
"ProductAsset": "资产价格",
"ProductAssetProductId": "产品 ID",
"ProductAssetProductSkuId": "产品 SKU ID",
"ProductAssetAssetId": "资产 ID",
"ProductAssetPeriodSchemeId": "时段方案 ID",
"ProductAssetFromTime": "生效时间",
"ProductAssetToTime": "结束时间",
"ProductAssetPrice": "价格",
"ProductAssetPeriods": "时段价格",
"CreateProductAsset": "新建",
"EditProductAsset": "编辑",
"ProductAssetDeletionConfirmationMessage": "确认删除资产价格 {0}?",
"SuccessfullyDeleted": "删除成功",
"Menu:ProductAssetPeriod": "资产时段价格",
"ProductAssetPeriod": "资产时段价格",
"ProductAssetPeriodPeriodId": "时段 ID",
"ProductAssetPeriodPrice": "价格",
"CreateProductAssetPeriod": "新建",
"EditProductAssetPeriod": "编辑",
"ProductAssetPeriodDeletionConfirmationMessage": "确认删除资产时段价格 {0}?",
"Permission:ProductAssetCategory": "资产类目价格",
"Menu:ProductAssetCategory": "资产类目价格",
"ProductAssetCategory": "资产类目价格",
"ProductAssetCategoryProductId": "产品 ID",
"ProductAssetCategoryProductSkuId": "产品 SKU ID",
"ProductAssetCategoryAssetCategoryId": "资产目录 ID",
"ProductAssetCategoryPeriodSchemeId": "时段方案 ID",
"ProductAssetCategoryFromTime": "生效时间",
"ProductAssetCategoryToTime": "结束时间",
"ProductAssetCategoryPrice": "价格",
"ProductAssetCategoryPeriods": "时段价格",
"CreateProductAssetCategory": "新建",
"EditProductAssetCategory": "编辑",
"ProductAssetCategoryDeletionConfirmationMessage": "确认删除资产类目价格 {0}?",
"Menu:ProductAssetCategoryPeriod": "资产类目时段价格",
"ProductAssetCategoryPeriod": "资产类目时段价格",
"ProductAssetCategoryPeriodPeriodId": "时段 ID",
"ProductAssetCategoryPeriodPrice": "价格",
"CreateProductAssetCategoryPeriod": "新建",
"EditProductAssetCategoryPeriod": "编辑",
"ProductAssetCategoryPeriodDeletionConfirmationMessage": "确认删除资产类目时段价格 {0}?",
"EasyAbp.EShop.Plugins.Booking:PeriodNotFound": "时段 {id} 不存在。",
"EasyAbp.EShop.Plugins.Booking:DuplicatePeriod": "时段 {id} 已存在。"
}
}

51
plugins/Booking/src/EasyAbp.EShop.Plugins.Booking.Domain.Shared/EasyAbp/EShop/Plugins/Booking/Localization/zh-Hant.json

@ -1,7 +1,54 @@
{
"culture": "zh-Hant",
"texts": {
"MyAccount": "我的賬戶",
"SamplePageMessage": "Booking 模塊的示例頁面"
"Menu:Booking": "預約業務",
"Permission:ProductAsset": "資產價格",
"Permission:Create": "新建",
"Permission:Update": "更新",
"Permission:Delete": "刪除",
"Menu:ProductAsset": "資產價格",
"ProductAsset": "資產價格",
"ProductAssetProductId": "產品 ID",
"ProductAssetProductSkuId": "產品 SKU ID",
"ProductAssetAssetId": "資產 ID",
"ProductAssetPeriodSchemeId": "時段方案 ID",
"ProductAssetFromTime": "生效時間",
"ProductAssetToTime": "結束時間",
"ProductAssetPrice": "價格",
"ProductAssetPeriods": "時段價格",
"CreateProductAsset": "新建",
"EditProductAsset": "編輯",
"ProductAssetDeletionConfirmationMessage": "確認刪除資產價格 {0}?",
"SuccessfullyDeleted": "刪除成功",
"Menu:ProductAssetPeriod": "資產時段價格",
"ProductAssetPeriod": "資產時段價格",
"ProductAssetPeriodPeriodId": "時段 ID",
"ProductAssetPeriodPrice": "價格",
"CreateProductAssetPeriod": "新建",
"EditProductAssetPeriod": "編輯",
"ProductAssetPeriodDeletionConfirmationMessage": "確認刪除資產時段價格 {0}?",
"Permission:ProductAssetCategory": "資產類目價格",
"Menu:ProductAssetCategory": "資產類目價格",
"ProductAssetCategory": "資產類目價格",
"ProductAssetCategoryProductId": "產品 ID",
"ProductAssetCategoryProductSkuId": "產品 SKU ID",
"ProductAssetCategoryAssetCategoryId": "資產目錄 ID",
"ProductAssetCategoryPeriodSchemeId": "時段方案 ID",
"ProductAssetCategoryFromTime": "生效時間",
"ProductAssetCategoryToTime": "結束時間",
"ProductAssetCategoryPrice": "價格",
"ProductAssetCategoryPeriods": "時段價格",
"CreateProductAssetCategory": "新建",
"EditProductAssetCategory": "編輯",
"ProductAssetCategoryDeletionConfirmationMessage": "確認刪除資產類目價格 {0}?",
"Menu:ProductAssetCategoryPeriod": "資產類目時段價格",
"ProductAssetCategoryPeriod": "資產類目時段價格",
"ProductAssetCategoryPeriodPeriodId": "時段 ID",
"ProductAssetCategoryPeriodPrice": "價格",
"CreateProductAssetCategoryPeriod": "新建",
"EditProductAssetCategoryPeriod": "編輯",
"ProductAssetCategoryPeriodDeletionConfirmationMessage": "確認刪除資產類目時段價格 {0}?",
"EasyAbp.EShop.Plugins.Booking:PeriodNotFound": "時段 {id} 不存在。",
"EasyAbp.EShop.Plugins.Booking:DuplicatePeriod": "時段 {id} 已存在。"
}
}

9
plugins/Booking/src/EasyAbp.EShop.Plugins.Booking.Domain/EasyAbp/EShop/Plugins/Booking/ProductAssetCategories/IProductAssetCategoryRepository.cs

@ -0,0 +1,9 @@
using System;
using Volo.Abp.Domain.Repositories;
namespace EasyAbp.EShop.Plugins.Booking.ProductAssetCategories
{
public interface IProductAssetCategoryRepository : IRepository<ProductAssetCategory, Guid>
{
}
}

58
plugins/Booking/src/EasyAbp.EShop.Plugins.Booking.Domain/EasyAbp/EShop/Plugins/Booking/ProductAssetCategories/ProductAssetCategory.cs

@ -1,5 +1,7 @@
using System;
using System.Collections.Generic;
using System.Linq;
using EasyAbp.EShop.Plugins.Booking.Shared;
using Volo.Abp.Domain.Entities.Auditing;
using Volo.Abp.MultiTenancy;
@ -43,4 +45,58 @@ public class ProductAssetCategory : AuditedAggregateRoot<Guid>, IMultiTenant
/// Customize prices for specified periods.
/// </summary>
public List<ProductAssetCategoryPeriod> Periods { get; protected set; }
}
protected ProductAssetCategory()
{
Periods = new List<ProductAssetCategoryPeriod>();
}
public ProductAssetCategory(
Guid id,
Guid? tenantId,
Guid productId,
Guid productSkuId,
Guid assetCategoryId,
Guid periodSchemeId,
DateTime fromTime,
DateTime? toTime,
decimal? price,
List<ProductAssetCategoryPeriod> periods
) : base(id)
{
TenantId = tenantId;
ProductId = productId;
ProductSkuId = productSkuId;
AssetCategoryId = assetCategoryId;
PeriodSchemeId = periodSchemeId;
FromTime = fromTime;
ToTime = toTime;
Price = price;
Periods = periods ?? new List<ProductAssetCategoryPeriod>();
}
public void AddPeriod(ProductAssetCategoryPeriod productAssetCategoryPeriod)
{
if (FindPeriod(productAssetCategoryPeriod.PeriodId) is not null)
{
throw new DuplicatePeriodException(productAssetCategoryPeriod.PeriodId);
}
Periods.Add(productAssetCategoryPeriod);
}
public void RemovePeriod(Guid periodId)
{
Periods.Remove(GetPeriod(periodId));
}
public ProductAssetCategoryPeriod GetPeriod(Guid periodId)
{
return FindPeriod(periodId) ?? throw new PeriodNotFoundException(periodId);
}
public ProductAssetCategoryPeriod FindPeriod(Guid periodId)
{
return Periods.FirstOrDefault(x => x.PeriodId == periodId);
}
}

16
plugins/Booking/src/EasyAbp.EShop.Plugins.Booking.Domain/EasyAbp/EShop/Plugins/Booking/ProductAssetCategories/ProductAssetCategoryPeriod.cs

@ -8,4 +8,18 @@ public class ProductAssetCategoryPeriod : Entity<Guid>
public virtual Guid PeriodId { get; protected set; }
public virtual decimal Price { get; protected set; }
}
protected ProductAssetCategoryPeriod()
{
}
public ProductAssetCategoryPeriod(
Guid id,
Guid periodId,
decimal price
) : base(id)
{
PeriodId = periodId;
Price = price;
}
}

9
plugins/Booking/src/EasyAbp.EShop.Plugins.Booking.Domain/EasyAbp/EShop/Plugins/Booking/ProductAssets/IProductAssetRepository.cs

@ -0,0 +1,9 @@
using System;
using Volo.Abp.Domain.Repositories;
namespace EasyAbp.EShop.Plugins.Booking.ProductAssets
{
public interface IProductAssetRepository : IRepository<ProductAsset, Guid>
{
}
}

75
plugins/Booking/src/EasyAbp.EShop.Plugins.Booking.Domain/EasyAbp/EShop/Plugins/Booking/ProductAssets/ProductAsset.cs

@ -1,6 +1,8 @@
using System;
using System.Collections.Generic;
using System.Linq;
using EasyAbp.EShop.Plugins.Booking.ProductAssetCategories;
using EasyAbp.EShop.Plugins.Booking.Shared;
using Volo.Abp.Domain.Entities.Auditing;
using Volo.Abp.MultiTenancy;
@ -15,34 +17,89 @@ namespace EasyAbp.EShop.Plugins.Booking.ProductAssets;
public class ProductAsset : AuditedAggregateRoot<Guid>, IMultiTenant
{
public virtual Guid? TenantId { get; protected set; }
public virtual Guid ProductId { get; protected set; }
public virtual Guid ProductSkuId { get; protected set; }
public virtual Guid AssetId { get; protected set; }
public virtual Guid PeriodSchemeId { get; protected set; }
/// <summary>
/// When will this mapping start taking effect.
/// </summary>
public virtual DateTime FromTime { get; protected set; }
/// <summary>
/// When will this mapping stop taking effect.
/// Setting to <c>null</c> means until forever.
/// </summary>
public virtual DateTime? ToTime { get; protected set; }
/// <summary>
/// Price for any period.
/// Fall back to the price of ProductSku if <c>null</c>.
/// </summary>
public virtual decimal? Price { get; protected set; }
/// <summary>
/// Customize prices for specified periods.
/// </summary>
public List<ProductAssetPeriod> Periods { get; protected set; }
}
protected ProductAsset()
{
Periods = new List<ProductAssetPeriod>();
}
public ProductAsset(
Guid id,
Guid? tenantId,
Guid productId,
Guid productSkuId,
Guid assetId,
Guid periodSchemeId,
DateTime fromTime,
DateTime? toTime,
decimal? price,
List<ProductAssetPeriod> periods
) : base(id)
{
TenantId = tenantId;
ProductId = productId;
ProductSkuId = productSkuId;
AssetId = assetId;
PeriodSchemeId = periodSchemeId;
FromTime = fromTime;
ToTime = toTime;
Price = price;
Periods = periods ?? new List<ProductAssetPeriod>();
}
public void AddPeriod(ProductAssetPeriod productAssetPeriod)
{
if (FindPeriod(productAssetPeriod.PeriodId) is not null)
{
throw new DuplicatePeriodException(productAssetPeriod.PeriodId);
}
Periods.Add(productAssetPeriod);
}
public void RemovePeriod(Guid periodId)
{
Periods.Remove(GetPeriod(periodId));
}
public ProductAssetPeriod GetPeriod(Guid periodId)
{
return FindPeriod(periodId) ?? throw new PeriodNotFoundException(periodId);
}
public ProductAssetPeriod FindPeriod(Guid periodId)
{
return Periods.FirstOrDefault(x => x.PeriodId == periodId);
}
}

16
plugins/Booking/src/EasyAbp.EShop.Plugins.Booking.Domain/EasyAbp/EShop/Plugins/Booking/ProductAssets/ProductAssetPeriod.cs

@ -8,4 +8,18 @@ public class ProductAssetPeriod : Entity<Guid>
public virtual Guid PeriodId { get; protected set; }
public virtual decimal Price { get; protected set; }
}
protected ProductAssetPeriod()
{
}
public ProductAssetPeriod(
Guid id,
Guid periodId,
decimal price
) : base(id)
{
PeriodId = periodId;
Price = price;
}
}

12
plugins/Booking/src/EasyAbp.EShop.Plugins.Booking.Domain/EasyAbp/EShop/Plugins/Booking/Shared/DuplicatePeriodException.cs

@ -0,0 +1,12 @@
using System;
using Volo.Abp;
namespace EasyAbp.EShop.Plugins.Booking.Shared;
public class DuplicatePeriodException : BusinessException
{
public DuplicatePeriodException(Guid id) : base(BookingErrorCodes.DuplicatePeriod)
{
WithData(nameof(id), id);
}
}

12
plugins/Booking/src/EasyAbp.EShop.Plugins.Booking.Domain/EasyAbp/EShop/Plugins/Booking/Shared/PeriodNotFoundException.cs

@ -0,0 +1,12 @@
using System;
using Volo.Abp;
namespace EasyAbp.EShop.Plugins.Booking.Shared;
public class PeriodNotFoundException : BusinessException
{
public PeriodNotFoundException(Guid id) : base(BookingErrorCodes.PeriodNotFound)
{
WithData(nameof(id), id);
}
}

8
plugins/Booking/src/EasyAbp.EShop.Plugins.Booking.EntityFrameworkCore/EasyAbp/EShop/Plugins/Booking/EntityFrameworkCore/BookingDbContext.cs

@ -1,6 +1,8 @@
using Microsoft.EntityFrameworkCore;
using Microsoft.EntityFrameworkCore;
using Volo.Abp.Data;
using Volo.Abp.EntityFrameworkCore;
using EasyAbp.EShop.Plugins.Booking.ProductAssets;
using EasyAbp.EShop.Plugins.Booking.ProductAssetCategories;
namespace EasyAbp.EShop.Plugins.Booking.EntityFrameworkCore;
@ -10,6 +12,10 @@ public class BookingDbContext : AbpDbContext<BookingDbContext>, IBookingDbContex
/* Add DbSet for each Aggregate Root here. Example:
* public DbSet<Question> Questions { get; set; }
*/
public DbSet<ProductAsset> ProductAssets { get; set; }
public DbSet<ProductAssetPeriod> ProductAssetPeriods { get; set; }
public DbSet<ProductAssetCategoryPeriod> ProductAssetCategoryPeriods { get; set; }
public DbSet<ProductAssetCategory> ProductAssetCategories { get; set; }
public BookingDbContext(DbContextOptions<BookingDbContext> options)
: base(options)

41
plugins/Booking/src/EasyAbp.EShop.Plugins.Booking.EntityFrameworkCore/EasyAbp/EShop/Plugins/Booking/EntityFrameworkCore/BookingDbContextModelCreatingExtensions.cs

@ -1,5 +1,8 @@
using Microsoft.EntityFrameworkCore;
using EasyAbp.EShop.Plugins.Booking.ProductAssetCategories;
using EasyAbp.EShop.Plugins.Booking.ProductAssets;
using Microsoft.EntityFrameworkCore;
using Volo.Abp;
using Volo.Abp.EntityFrameworkCore.Modeling;
namespace EasyAbp.EShop.Plugins.Booking.EntityFrameworkCore;
@ -29,5 +32,41 @@ public static class BookingDbContextModelCreatingExtensions
b.HasIndex(q => q.CreationTime);
});
*/
builder.Entity<ProductAsset>(b =>
{
b.ToTable(BookingDbProperties.DbTablePrefix + "ProductAssets", BookingDbProperties.DbSchema);
b.ConfigureByConvention();
/* Configure more properties here */
b.Property(x => x.Price).HasColumnType("decimal(20,8)");
});
builder.Entity<ProductAssetPeriod>(b =>
{
b.ToTable(BookingDbProperties.DbTablePrefix + "ProductAssetPeriods", BookingDbProperties.DbSchema);
b.ConfigureByConvention();
/* Configure more properties here */
b.Property(x => x.Price).HasColumnType("decimal(20,8)");
});
builder.Entity<ProductAssetCategoryPeriod>(b =>
{
b.ToTable(BookingDbProperties.DbTablePrefix + "ProductAssetCategoryPeriods", BookingDbProperties.DbSchema);
b.ConfigureByConvention();
/* Configure more properties here */
b.Property(x => x.Price).HasColumnType("decimal(20,8)");
});
builder.Entity<ProductAssetCategory>(b =>
{
b.ToTable(BookingDbProperties.DbTablePrefix + "ProductAssetCategories", BookingDbProperties.DbSchema);
b.ConfigureByConvention();
/* Configure more properties here */
b.Property(x => x.Price).HasColumnType("decimal(20,8)");
});
}
}

6
plugins/Booking/src/EasyAbp.EShop.Plugins.Booking.EntityFrameworkCore/EasyAbp/EShop/Plugins/Booking/EntityFrameworkCore/EShopPluginsBookingEntityFrameworkCoreModule.cs

@ -1,4 +1,6 @@
using Microsoft.Extensions.DependencyInjection;
using EasyAbp.EShop.Plugins.Booking.ProductAssetCategories;
using EasyAbp.EShop.Plugins.Booking.ProductAssets;
using Microsoft.Extensions.DependencyInjection;
using Volo.Abp.EntityFrameworkCore;
using Volo.Abp.Modularity;
@ -17,6 +19,8 @@ public class EShopPluginsBookingEntityFrameworkCoreModule : AbpModule
/* Add custom repositories here. Example:
* options.AddRepository<Question, EfCoreQuestionRepository>();
*/
options.AddRepository<ProductAsset, ProductAssetRepository>();
options.AddRepository<ProductAssetCategory, ProductAssetCategoryRepository>();
});
}
}

9
plugins/Booking/src/EasyAbp.EShop.Plugins.Booking.EntityFrameworkCore/EasyAbp/EShop/Plugins/Booking/EntityFrameworkCore/IBookingDbContext.cs

@ -1,5 +1,8 @@
using Volo.Abp.Data;
using Microsoft.EntityFrameworkCore;
using Volo.Abp.Data;
using Volo.Abp.EntityFrameworkCore;
using EasyAbp.EShop.Plugins.Booking.ProductAssets;
using EasyAbp.EShop.Plugins.Booking.ProductAssetCategories;
namespace EasyAbp.EShop.Plugins.Booking.EntityFrameworkCore;
@ -9,4 +12,8 @@ public interface IBookingDbContext : IEfCoreDbContext
/* Add DbSet for each Aggregate Root here. Example:
* DbSet<Question> Questions { get; }
*/
DbSet<ProductAsset> ProductAssets { get; set; }
DbSet<ProductAssetPeriod> ProductAssetPeriods { get; set; }
DbSet<ProductAssetCategoryPeriod> ProductAssetCategoryPeriods { get; set; }
DbSet<ProductAssetCategory> ProductAssetCategories { get; set; }
}

18
plugins/Booking/src/EasyAbp.EShop.Plugins.Booking.EntityFrameworkCore/EasyAbp/EShop/Plugins/Booking/ProductAssetCategories/ProductAssetCategoryEfCoreQuerableExtensions.cs

@ -0,0 +1,18 @@
using System.Linq;
using Microsoft.EntityFrameworkCore;
namespace EasyAbp.EShop.Plugins.Booking.ProductAssetCategories
{
public static class ProductAssetCategoryEfCoreQueryableExtensions
{
public static IQueryable<ProductAssetCategory> IncludeDetails(this IQueryable<ProductAssetCategory> queryable, bool include = true)
{
if (!include)
{
return queryable;
}
return queryable.Include(x => x.Periods);
}
}
}

21
plugins/Booking/src/EasyAbp.EShop.Plugins.Booking.EntityFrameworkCore/EasyAbp/EShop/Plugins/Booking/ProductAssetCategories/ProductAssetCategoryRepository.cs

@ -0,0 +1,21 @@
using System;
using System.Linq;
using System.Threading.Tasks;
using EasyAbp.EShop.Plugins.Booking.EntityFrameworkCore;
using Volo.Abp.Domain.Repositories.EntityFrameworkCore;
using Volo.Abp.EntityFrameworkCore;
namespace EasyAbp.EShop.Plugins.Booking.ProductAssetCategories
{
public class ProductAssetCategoryRepository : EfCoreRepository<IBookingDbContext, ProductAssetCategory, Guid>, IProductAssetCategoryRepository
{
public ProductAssetCategoryRepository(IDbContextProvider<IBookingDbContext> dbContextProvider) : base(dbContextProvider)
{
}
public override async Task<IQueryable<ProductAssetCategory>> WithDetailsAsync()
{
return (await GetQueryableAsync()).IncludeDetails();
}
}
}

18
plugins/Booking/src/EasyAbp.EShop.Plugins.Booking.EntityFrameworkCore/EasyAbp/EShop/Plugins/Booking/ProductAssets/ProductAssetEfCoreQuerableExtensions.cs

@ -0,0 +1,18 @@
using System.Linq;
using Microsoft.EntityFrameworkCore;
namespace EasyAbp.EShop.Plugins.Booking.ProductAssets
{
public static class ProductAssetEfCoreQueryableExtensions
{
public static IQueryable<ProductAsset> IncludeDetails(this IQueryable<ProductAsset> queryable, bool include = true)
{
if (!include)
{
return queryable;
}
return queryable.Include(x => x.Periods);
}
}
}

21
plugins/Booking/src/EasyAbp.EShop.Plugins.Booking.EntityFrameworkCore/EasyAbp/EShop/Plugins/Booking/ProductAssets/ProductAssetRepository.cs

@ -0,0 +1,21 @@
using System;
using System.Linq;
using System.Threading.Tasks;
using EasyAbp.EShop.Plugins.Booking.EntityFrameworkCore;
using Volo.Abp.Domain.Repositories.EntityFrameworkCore;
using Volo.Abp.EntityFrameworkCore;
namespace EasyAbp.EShop.Plugins.Booking.ProductAssets
{
public class ProductAssetRepository : EfCoreRepository<IBookingDbContext, ProductAsset, Guid>, IProductAssetRepository
{
public ProductAssetRepository(IDbContextProvider<IBookingDbContext> dbContextProvider) : base(dbContextProvider)
{
}
public override async Task<IQueryable<ProductAsset>> WithDetailsAsync()
{
return (await GetQueryableAsync()).IncludeDetails();
}
}
}

2
plugins/Booking/src/EasyAbp.EShop.Plugins.Booking.HttpApi.Client/EasyAbp/EShop/Plugins/Booking/EShopPluginsBookingHttpApiClientModule.cs

@ -14,7 +14,7 @@ public class EShopPluginsBookingHttpApiClientModule : AbpModule
{
context.Services.AddHttpClientProxies(
typeof(EShopPluginsBookingApplicationContractsModule).Assembly,
BookingRemoteServiceConsts.RemoteServiceName
EShopPluginsBookingRemoteServiceConsts.RemoteServiceName
);
Configure<AbpVirtualFileSystemOptions>(options =>

2
plugins/Booking/src/EasyAbp.EShop.Plugins.Booking.HttpApi/EasyAbp/EShop/Plugins/Booking/BookingController.cs

@ -4,7 +4,7 @@ using Volo.Abp.AspNetCore.Mvc;
namespace EasyAbp.EShop.Plugins.Booking;
[Area(BookingRemoteServiceConsts.ModuleName)]
[Area(EShopPluginsBookingRemoteServiceConsts.ModuleName)]
public abstract class BookingController : AbpControllerBase
{
protected BookingController()

78
plugins/Booking/src/EasyAbp.EShop.Plugins.Booking.HttpApi/EasyAbp/EShop/Plugins/Booking/ProductAssetCategories/ProductAssetCategoryController.cs

@ -0,0 +1,78 @@
using System;
using EasyAbp.EShop.Plugins.Booking.ProductAssetCategories.Dtos;
using Volo.Abp.Application.Dtos;
using System.Threading.Tasks;
using Microsoft.AspNetCore.Mvc;
using Volo.Abp;
using Volo.Abp.Application.Dtos;
namespace EasyAbp.EShop.Plugins.Booking.ProductAssetCategories
{
[RemoteService(Name = EShopPluginsBookingRemoteServiceConsts.RemoteServiceName)]
[Route("/api/e-shop/plugins/booking/product-asset-category")]
public class ProductAssetCategoryController : BookingController, IProductAssetCategoryAppService
{
private readonly IProductAssetCategoryAppService _service;
public ProductAssetCategoryController(IProductAssetCategoryAppService service)
{
_service = service;
}
[HttpPost]
[Route("period/{productAssetCategoryId}")]
public virtual Task<ProductAssetCategoryDto> CreatePeriodAsync(Guid productAssetCategoryId, CreateProductAssetCategoryPeriodDto input)
{
return _service.CreatePeriodAsync(productAssetCategoryId, input);
}
[HttpPut]
[Route("period")]
public virtual Task<ProductAssetCategoryDto> UpdatePeriodAsync(Guid productAssetCategoryId, Guid periodId, UpdateProductAssetCategoryPeriodDto input)
{
return _service.UpdatePeriodAsync(productAssetCategoryId, periodId, input);
}
[HttpDelete]
[Route("period")]
public virtual Task<ProductAssetCategoryDto> DeletePeriodAsync(Guid productAssetCategoryId, Guid periodId)
{
return _service.DeletePeriodAsync(productAssetCategoryId, periodId);
}
[HttpPost]
[Route("")]
public virtual Task<ProductAssetCategoryDto> CreateAsync(CreateProductAssetCategoryDto input)
{
return _service.CreateAsync(input);
}
[HttpPut]
[Route("{id}")]
public virtual Task<ProductAssetCategoryDto> UpdateAsync(Guid id, UpdateProductAssetCategoryDto input)
{
return _service.UpdateAsync(id, input);
}
[HttpDelete]
[Route("{id}")]
public virtual Task DeleteAsync(Guid id)
{
return _service.DeleteAsync(id);
}
[HttpGet]
[Route("{id}")]
public virtual Task<ProductAssetCategoryDto> GetAsync(Guid id)
{
return _service.GetAsync(id);
}
[HttpGet]
[Route("")]
public virtual Task<PagedResultDto<ProductAssetCategoryDto>> GetListAsync(PagedAndSortedResultRequestDto input)
{
return _service.GetListAsync(input);
}
}
}

77
plugins/Booking/src/EasyAbp.EShop.Plugins.Booking.HttpApi/EasyAbp/EShop/Plugins/Booking/ProductAssets/ProductAssetController.cs

@ -0,0 +1,77 @@
using System;
using EasyAbp.EShop.Plugins.Booking.ProductAssets.Dtos;
using Volo.Abp.Application.Dtos;
using System.Threading.Tasks;
using Microsoft.AspNetCore.Mvc;
using Volo.Abp;
namespace EasyAbp.EShop.Plugins.Booking.ProductAssets
{
[RemoteService(Name = EShopPluginsBookingRemoteServiceConsts.RemoteServiceName)]
[Route("/api/e-shop/plugins/booking/product-asset")]
public class ProductAssetController : BookingController, IProductAssetAppService
{
private readonly IProductAssetAppService _service;
public ProductAssetController(IProductAssetAppService service)
{
_service = service;
}
[HttpPost]
[Route("period/{productAssetId}")]
public virtual Task<ProductAssetDto> CreatePeriodAsync(Guid productAssetId, CreateProductAssetPeriodDto input)
{
return _service.CreatePeriodAsync(productAssetId, input);
}
[HttpPut]
[Route("period")]
public virtual Task<ProductAssetDto> UpdatePeriodAsync(Guid productAssetId, Guid periodId, UpdateProductAssetPeriodDto input)
{
return _service.UpdatePeriodAsync(productAssetId, periodId, input);
}
[HttpDelete]
[Route("period")]
public virtual Task<ProductAssetDto> DeletePeriodAsync(Guid productAssetId, Guid periodId)
{
return _service.DeletePeriodAsync(productAssetId, periodId);
}
[HttpPost]
[Route("")]
public virtual Task<ProductAssetDto> CreateAsync(CreateProductAssetDto input)
{
return _service.CreateAsync(input);
}
[HttpPut]
[Route("{id}")]
public virtual Task<ProductAssetDto> UpdateAsync(Guid id, UpdateProductAssetDto input)
{
return _service.UpdateAsync(id, input);
}
[HttpDelete]
[Route("{id}")]
public virtual Task DeleteAsync(Guid id)
{
return _service.DeleteAsync(id);
}
[HttpGet]
[Route("{id}")]
public virtual Task<ProductAssetDto> GetAsync(Guid id)
{
return _service.GetAsync(id);
}
[HttpGet]
[Route("")]
public virtual Task<PagedResultDto<ProductAssetDto>> GetListAsync(PagedAndSortedResultRequestDto input)
{
return _service.GetListAsync(input);
}
}
}

27
plugins/Booking/src/EasyAbp.EShop.Plugins.Booking.Web/BookingWebAutoMapperProfile.cs

@ -1,4 +1,12 @@
using AutoMapper;
using EasyAbp.EShop.Plugins.Booking.ProductAssets.Dtos;
using EasyAbp.EShop.Plugins.Booking.Web.Pages.EShop.Plugins.Booking.ProductAssets.ProductAsset.ViewModels;
using EasyAbp.EShop.Plugins.Booking.ProductAssets.Dtos;
using EasyAbp.EShop.Plugins.Booking.Web.Pages.EShop.Plugins.Booking.ProductAssets.ProductAssetPeriod.ViewModels;
using EasyAbp.EShop.Plugins.Booking.ProductAssetCategories.Dtos;
using EasyAbp.EShop.Plugins.Booking.ProductAssetCategories.Dtos;
using AutoMapper;
using EasyAbp.EShop.Plugins.Booking.Web.Pages.EShop.Plugins.Booking.ProductAssetCategories.ProductAssetCategory.ViewModels;
using EasyAbp.EShop.Plugins.Booking.Web.Pages.EShop.Plugins.Booking.ProductAssetCategories.ProductAssetCategoryPeriod.ViewModels;
namespace EasyAbp.EShop.Plugins.Booking.Web;
@ -9,5 +17,20 @@ public class BookingWebAutoMapperProfile : Profile
/* You can configure your AutoMapper mapping configuration here.
* Alternatively, you can split your mapping configurations
* into multiple profile classes for a better organization. */
CreateMap<ProductAssetDto, EditProductAssetViewModel>();
CreateMap<CreateProductAssetViewModel, CreateProductAssetDto>();
CreateMap<EditProductAssetViewModel, UpdateProductAssetDto>();
CreateMap<ProductAssetPeriodDto, EditProductAssetPeriodViewModel>();
CreateMap<CreateProductAssetPeriodViewModel, CreateProductAssetPeriodDto>();
CreateMap<EditProductAssetPeriodViewModel, UpdateProductAssetPeriodDto>();
CreateMap<ProductAssetCategoryDto, EditProductAssetCategoryViewModel>();
CreateMap<CreateProductAssetCategoryViewModel, CreateProductAssetCategoryDto>();
CreateMap<EditProductAssetCategoryViewModel, UpdateProductAssetCategoryDto>();
CreateMap<ProductAssetCategoryPeriodDto, EditProductAssetCategoryPeriodViewModel>();
CreateMap<CreateProductAssetCategoryPeriodViewModel, CreateProductAssetCategoryPeriodDto>();
CreateMap<EditProductAssetCategoryPeriodViewModel, UpdateProductAssetCategoryPeriodDto>();
}
}
}

36
plugins/Booking/src/EasyAbp.EShop.Plugins.Booking.Web/Menus/BookingMenuContributor.cs

@ -1,4 +1,7 @@
using System.Threading.Tasks;
using System.Collections.Generic;
using System.Threading.Tasks;
using EasyAbp.EShop.Plugins.Booking.Localization;
using EasyAbp.EShop.Plugins.Booking.Permissions;
using Volo.Abp.UI.Navigation;
namespace EasyAbp.EShop.Plugins.Booking.Web.Menus;
@ -13,11 +16,36 @@ public class BookingMenuContributor : IMenuContributor
}
}
private Task ConfigureMainMenuAsync(MenuConfigurationContext context)
private async Task ConfigureMainMenuAsync(MenuConfigurationContext context)
{
var l = context.GetLocalizer<BookingResource>();
//Add main menu items.
context.Menu.AddItem(new ApplicationMenuItem(BookingMenus.Prefix, displayName: "Booking", "~/Booking", icon: "fa fa-globe"));
var bookingMenuItem = new ApplicationMenuItem(BookingMenus.Prefix, l["Menu:Booking"]);
return Task.CompletedTask;
if (await context.IsGrantedAsync(BookingPermissions.ProductAsset.Default))
{
bookingMenuItem.AddItem(
new ApplicationMenuItem(BookingMenus.ProductAsset, l["Menu:ProductAsset"],
"~/EShop/Plugins/Booking/ProductAssets/ProductAsset")
);
}
if (await context.IsGrantedAsync(BookingPermissions.ProductAssetCategory.Default))
{
bookingMenuItem.AddItem(
new ApplicationMenuItem(BookingMenus.ProductAssetCategory, l["Menu:ProductAssetCategory"],
"~/EShop/Plugins/Booking/ProductAssetCategories/ProductAssetCategory")
);
}
if (!bookingMenuItem.Items.IsNullOrEmpty())
{
var eShopMenuItem = context.Menu.Items.GetOrAdd(i => i.Name == BookingMenus.ModuleGroupPrefix,
() => new ApplicationMenuItem(BookingMenus.ModuleGroupPrefix, l["Menu:EasyAbpEShop"]));
eShopMenuItem.Items.Add(bookingMenuItem);
}
}
}

6
plugins/Booking/src/EasyAbp.EShop.Plugins.Booking.Web/Menus/BookingMenus.cs

@ -2,9 +2,13 @@
public class BookingMenus
{
public const string Prefix = "EasyAbp.EShop.Plugins.Booking";
public const string ModuleGroupPrefix = "EasyAbp.EShop";
public const string Prefix = ModuleGroupPrefix + ".Plugins.Booking";
//Add your menu items here...
//public const string Home = Prefix + ".MyNewMenuItem";
public const string ProductAsset = Prefix + ".ProductAsset";
public const string ProductAssetCategory = Prefix + ".ProductAssetCategory";
}

18
plugins/Booking/src/EasyAbp.EShop.Plugins.Booking.Web/Pages/EShop/Plugins/Booking/ProductAssetCategories/ProductAssetCategory/CreateModal.cshtml

@ -0,0 +1,18 @@
@page
@using Microsoft.AspNetCore.Mvc.Localization
@using Volo.Abp.AspNetCore.Mvc.UI.Bootstrap.TagHelpers.Modal;
@using EasyAbp.EShop.Plugins.Booking.Localization
@inject IHtmlLocalizer<BookingResource> L
@model EasyAbp.EShop.Plugins.Booking.Web.Pages.EShop.Plugins.Booking.ProductAssetCategories.ProductAssetCategory.CreateModalModel
@{
Layout = null;
}
<abp-dynamic-form abp-model="ViewModel" data-ajaxForm="true" asp-page="CreateModal">
<abp-modal>
<abp-modal-header title="@L["CreateProductAssetCategory"].Value"></abp-modal-header>
<abp-modal-body>
<abp-form-content />
</abp-modal-body>
<abp-modal-footer buttons="@(AbpModalButtons.Cancel|AbpModalButtons.Save)"></abp-modal-footer>
</abp-modal>
</abp-dynamic-form>

28
plugins/Booking/src/EasyAbp.EShop.Plugins.Booking.Web/Pages/EShop/Plugins/Booking/ProductAssetCategories/ProductAssetCategory/CreateModal.cshtml.cs

@ -0,0 +1,28 @@
using System.Threading.Tasks;
using Microsoft.AspNetCore.Mvc;
using EasyAbp.EShop.Plugins.Booking.ProductAssetCategories;
using EasyAbp.EShop.Plugins.Booking.ProductAssetCategories.Dtos;
using EasyAbp.EShop.Plugins.Booking.Web.Pages.EShop.Plugins.Booking.ProductAssetCategories.ProductAssetCategory.ViewModels;
namespace EasyAbp.EShop.Plugins.Booking.Web.Pages.EShop.Plugins.Booking.ProductAssetCategories.ProductAssetCategory
{
public class CreateModalModel : BookingPageModel
{
[BindProperty]
public CreateProductAssetCategoryViewModel ViewModel { get; set; }
private readonly IProductAssetCategoryAppService _service;
public CreateModalModel(IProductAssetCategoryAppService service)
{
_service = service;
}
public virtual async Task<IActionResult> OnPostAsync()
{
var dto = ObjectMapper.Map<CreateProductAssetCategoryViewModel, CreateProductAssetCategoryDto>(ViewModel);
await _service.CreateAsync(dto);
return NoContent();
}
}
}

19
plugins/Booking/src/EasyAbp.EShop.Plugins.Booking.Web/Pages/EShop/Plugins/Booking/ProductAssetCategories/ProductAssetCategory/EditModal.cshtml

@ -0,0 +1,19 @@
@page
@using EasyAbp.EShop.Plugins.Booking.Localization
@using Microsoft.AspNetCore.Mvc.Localization
@using Volo.Abp.AspNetCore.Mvc.UI.Bootstrap.TagHelpers.Modal;
@inject IHtmlLocalizer<BookingResource> L
@model EasyAbp.EShop.Plugins.Booking.Web.Pages.EShop.Plugins.Booking.ProductAssetCategories.ProductAssetCategory.EditModalModel
@{
Layout = null;
}
<abp-dynamic-form abp-model="ViewModel" data-ajaxForm="true" asp-page="EditModal">
<abp-modal>
<abp-modal-header title="@L["EditProductAssetCategory"].Value"></abp-modal-header>
<abp-modal-body>
<abp-input asp-for="Id" />
<abp-form-content />
</abp-modal-body>
<abp-modal-footer buttons="@(AbpModalButtons.Cancel|AbpModalButtons.Save)"></abp-modal-footer>
</abp-modal>
</abp-dynamic-form>

39
plugins/Booking/src/EasyAbp.EShop.Plugins.Booking.Web/Pages/EShop/Plugins/Booking/ProductAssetCategories/ProductAssetCategory/EditModal.cshtml.cs

@ -0,0 +1,39 @@
using System;
using System.Threading.Tasks;
using Microsoft.AspNetCore.Mvc;
using EasyAbp.EShop.Plugins.Booking.ProductAssetCategories;
using EasyAbp.EShop.Plugins.Booking.ProductAssetCategories.Dtos;
using EasyAbp.EShop.Plugins.Booking.Web.Pages.EShop.Plugins.Booking.ProductAssetCategories.ProductAssetCategory.ViewModels;
namespace EasyAbp.EShop.Plugins.Booking.Web.Pages.EShop.Plugins.Booking.ProductAssetCategories.ProductAssetCategory
{
public class EditModalModel : BookingPageModel
{
[HiddenInput]
[BindProperty(SupportsGet = true)]
public Guid Id { get; set; }
[BindProperty]
public EditProductAssetCategoryViewModel ViewModel { get; set; }
private readonly IProductAssetCategoryAppService _service;
public EditModalModel(IProductAssetCategoryAppService service)
{
_service = service;
}
public virtual async Task OnGetAsync()
{
var dto = await _service.GetAsync(Id);
ViewModel = ObjectMapper.Map<ProductAssetCategoryDto, EditProductAssetCategoryViewModel>(dto);
}
public virtual async Task<IActionResult> OnPostAsync()
{
var dto = ObjectMapper.Map<EditProductAssetCategoryViewModel, UpdateProductAssetCategoryDto>(ViewModel);
await _service.UpdateAsync(Id, dto);
return NoContent();
}
}
}

48
plugins/Booking/src/EasyAbp.EShop.Plugins.Booking.Web/Pages/EShop/Plugins/Booking/ProductAssetCategories/ProductAssetCategory/Index.cshtml

@ -0,0 +1,48 @@
@page
@using EasyAbp.EShop.Plugins.Booking.Permissions
@using Microsoft.AspNetCore.Authorization
@using Microsoft.AspNetCore.Mvc.Localization
@using Volo.Abp.AspNetCore.Mvc.UI.Layout
@using EasyAbp.EShop.Plugins.Booking.Web.Pages.EShop.Plugins.Booking.ProductAssetCategories.ProductAssetCategory
@using EasyAbp.EShop.Plugins.Booking.Localization
@using EasyAbp.EShop.Plugins.Booking.Web.Menus
@model IndexModel
@inject IPageLayout PageLayout
@inject IHtmlLocalizer<BookingResource> L
@inject IAuthorizationService Authorization
@{
PageLayout.Content.Title = L["ProductAssetCategory"].Value;
PageLayout.Content.BreadCrumb.Add(L["Menu:ProductAssetCategory"].Value);
PageLayout.Content.MenuItemName = BookingMenus.ProductAssetCategory;
}
@section scripts
{
<abp-script src="/Pages/EShop/Plugins/Booking/ProductAssetCategories/ProductAssetCategory/index.js" />
}
@section styles
{
<abp-style src="/Pages/EShop/Plugins/Booking/ProductAssetCategories/ProductAssetCategory/index.css"/>
}
<abp-card>
<abp-card-header>
<abp-row>
<abp-column size-md="_6">
<abp-card-title>@L["ProductAssetCategory"]</abp-card-title>
</abp-column>
<abp-column size-md="_6" class="text-end">
@if (await Authorization.IsGrantedAsync(BookingPermissions.ProductAssetCategory.Create))
{
<abp-button id="NewProductAssetCategoryButton"
text="@L["CreateProductAssetCategory"].Value"
icon="plus"
button-type="Primary" />
}
</abp-column>
</abp-row>
</abp-card-header>
<abp-card-body>
<abp-table striped-rows="true" id="ProductAssetCategoryTable" class="nowrap"/>
</abp-card-body>
</abp-card>

12
plugins/Booking/src/EasyAbp.EShop.Plugins.Booking.Web/Pages/EShop/Plugins/Booking/ProductAssetCategories/ProductAssetCategory/Index.cshtml.cs

@ -0,0 +1,12 @@
using System.Threading.Tasks;
namespace EasyAbp.EShop.Plugins.Booking.Web.Pages.EShop.Plugins.Booking.ProductAssetCategories.ProductAssetCategory
{
public class IndexModel : BookingPageModel
{
public virtual async Task OnGetAsync()
{
await Task.CompletedTask;
}
}
}

30
plugins/Booking/src/EasyAbp.EShop.Plugins.Booking.Web/Pages/EShop/Plugins/Booking/ProductAssetCategories/ProductAssetCategory/ViewModels/CreateProductAssetCategoryViewModel.cs

@ -0,0 +1,30 @@
using System;
using System.ComponentModel.DataAnnotations;
namespace EasyAbp.EShop.Plugins.Booking.Web.Pages.EShop.Plugins.Booking.ProductAssetCategories.ProductAssetCategory.ViewModels
{
public class CreateProductAssetCategoryViewModel
{
[Display(Name = "ProductAssetCategoryProductId")]
public Guid ProductId { get; set; }
[Display(Name = "ProductAssetCategoryProductSkuId")]
public Guid ProductSkuId { get; set; }
[Display(Name = "ProductAssetCategoryAssetCategoryId")]
public Guid AssetCategoryId { get; set; }
[Display(Name = "ProductAssetCategoryPeriodSchemeId")]
public Guid PeriodSchemeId { get; set; }
[Display(Name = "ProductAssetCategoryFromTime")]
public DateTime FromTime { get; set; }
[Display(Name = "ProductAssetCategoryToTime")]
public DateTime? ToTime { get; set; }
[Display(Name = "ProductAssetCategoryPrice")]
[Range(BookingConsts.MinimumPrice, BookingConsts.MaximumPrice)]
public decimal? Price { get; set; }
}
}

18
plugins/Booking/src/EasyAbp.EShop.Plugins.Booking.Web/Pages/EShop/Plugins/Booking/ProductAssetCategories/ProductAssetCategory/ViewModels/EditProductAssetCategoryViewModel.cs

@ -0,0 +1,18 @@
using System;
using System.ComponentModel.DataAnnotations;
namespace EasyAbp.EShop.Plugins.Booking.Web.Pages.EShop.Plugins.Booking.ProductAssetCategories.ProductAssetCategory.ViewModels
{
public class EditProductAssetCategoryViewModel
{
[Display(Name = "ProductAssetCategoryFromTime")]
public DateTime FromTime { get; set; }
[Display(Name = "ProductAssetCategoryToTime")]
public DateTime? ToTime { get; set; }
[Display(Name = "ProductAssetCategoryPrice")]
[Range(BookingConsts.MinimumPrice, BookingConsts.MaximumPrice)]
public decimal? Price { get; set; }
}
}

0
plugins/Booking/src/EasyAbp.EShop.Plugins.Booking.Web/Pages/EShop/Plugins/Booking/ProductAssetCategories/ProductAssetCategory/index.css

96
plugins/Booking/src/EasyAbp.EShop.Plugins.Booking.Web/Pages/EShop/Plugins/Booking/ProductAssetCategories/ProductAssetCategory/index.js

@ -0,0 +1,96 @@
$(function () {
var l = abp.localization.getResource('EasyAbpEShopPluginsBooking');
var service = easyAbp.eShop.plugins.booking.productAssetCategories.productAssetCategory;
var createModal = new abp.ModalManager(abp.appPath + 'EShop/Plugins/Booking/ProductAssetCategories/ProductAssetCategory/CreateModal');
var editModal = new abp.ModalManager(abp.appPath + 'EShop/Plugins/Booking/ProductAssetCategories/ProductAssetCategory/EditModal');
var dataTable = $('#ProductAssetCategoryTable').DataTable(abp.libs.datatables.normalizeConfiguration({
processing: true,
serverSide: true,
paging: true,
searching: false,
autoWidth: false,
scrollCollapse: true,
order: [[0, "asc"]],
ajax: abp.libs.datatables.createAjax(service.getList),
columnDefs: [
{
rowAction: {
items:
[
{
text: l('ProductAssetCategoryPeriods'),
action: function (data) {
document.location.href = abp.appPath + 'EShop/Plugins/Booking/ProductAssetCategories/ProductAssetCategoryPeriod?ProductAssetCategoryId=' + data.record.id;
}
},
{
text: l('Edit'),
visible: abp.auth.isGranted('EasyAbp.EShop.Plugins.Booking.ProductAssetCategory.Update'),
action: function (data) {
editModal.open({ id: data.record.id });
}
},
{
text: l('Delete'),
visible: abp.auth.isGranted('EasyAbp.EShop.Plugins.Booking.ProductAssetCategory.Delete'),
confirmMessage: function (data) {
return l('ProductAssetCategoryDeletionConfirmationMessage', data.record.id);
},
action: function (data) {
service.delete(data.record.id)
.then(function () {
abp.notify.info(l('SuccessfullyDeleted'));
dataTable.ajax.reload();
});
}
}
]
}
},
{
title: l('ProductAssetCategoryAssetCategoryId'),
data: "assetCategoryId"
},
{
title: l('ProductAssetCategoryPrice'),
data: "price"
},
{
title: l('ProductAssetCategoryPeriodSchemeId'),
data: "periodSchemeId"
},
{
title: l('ProductAssetCategoryFromTime'),
data: "fromTime"
},
{
title: l('ProductAssetCategoryToTime'),
data: "toTime"
},
{
title: l('ProductAssetCategoryProductId'),
data: "productId"
},
{
title: l('ProductAssetCategoryProductSkuId'),
data: "productSkuId"
},
]
}));
createModal.onResult(function () {
dataTable.ajax.reload();
});
editModal.onResult(function () {
dataTable.ajax.reload();
});
$('#NewProductAssetCategoryButton').click(function (e) {
e.preventDefault();
createModal.open();
});
});

19
plugins/Booking/src/EasyAbp.EShop.Plugins.Booking.Web/Pages/EShop/Plugins/Booking/ProductAssetCategories/ProductAssetCategoryPeriod/CreateModal.cshtml

@ -0,0 +1,19 @@
@page
@using Microsoft.AspNetCore.Mvc.Localization
@using Volo.Abp.AspNetCore.Mvc.UI.Bootstrap.TagHelpers.Modal;
@using EasyAbp.EShop.Plugins.Booking.Localization
@inject IHtmlLocalizer<BookingResource> L
@model EasyAbp.EShop.Plugins.Booking.Web.Pages.EShop.Plugins.Booking.ProductAssetCategories.ProductAssetCategoryPeriod.CreateModalModel
@{
Layout = null;
}
<abp-dynamic-form abp-model="ViewModel" data-ajaxForm="true" asp-page="CreateModal">
<abp-modal>
<abp-modal-header title="@L["CreateProductAssetCategoryPeriod"].Value"></abp-modal-header>
<abp-modal-body>
<abp-input asp-for="ProductAssetCategoryId" />
<abp-form-content />
</abp-modal-body>
<abp-modal-footer buttons="@(AbpModalButtons.Cancel|AbpModalButtons.Save)"></abp-modal-footer>
</abp-modal>
</abp-dynamic-form>

33
plugins/Booking/src/EasyAbp.EShop.Plugins.Booking.Web/Pages/EShop/Plugins/Booking/ProductAssetCategories/ProductAssetCategoryPeriod/CreateModal.cshtml.cs

@ -0,0 +1,33 @@
using System;
using System.Threading.Tasks;
using EasyAbp.EShop.Plugins.Booking.ProductAssetCategories;
using EasyAbp.EShop.Plugins.Booking.ProductAssetCategories.Dtos;
using EasyAbp.EShop.Plugins.Booking.Web.Pages.EShop.Plugins.Booking.ProductAssetCategories.ProductAssetCategoryPeriod.ViewModels;
using Microsoft.AspNetCore.Mvc;
namespace EasyAbp.EShop.Plugins.Booking.Web.Pages.EShop.Plugins.Booking.ProductAssetCategories.ProductAssetCategoryPeriod
{
public class CreateModalModel : BookingPageModel
{
[HiddenInput]
[BindProperty(SupportsGet = true)]
public Guid ProductAssetCategoryId { get; set; }
[BindProperty]
public CreateProductAssetCategoryPeriodViewModel ViewModel { get; set; }
private readonly IProductAssetCategoryAppService _service;
public CreateModalModel(IProductAssetCategoryAppService service)
{
_service = service;
}
public virtual async Task<IActionResult> OnPostAsync()
{
var dto = ObjectMapper.Map<CreateProductAssetCategoryPeriodViewModel, CreateProductAssetCategoryPeriodDto>(ViewModel);
await _service.CreatePeriodAsync(ProductAssetCategoryId, dto);
return NoContent();
}
}
}

20
plugins/Booking/src/EasyAbp.EShop.Plugins.Booking.Web/Pages/EShop/Plugins/Booking/ProductAssetCategories/ProductAssetCategoryPeriod/EditModal.cshtml

@ -0,0 +1,20 @@
@page
@using EasyAbp.EShop.Plugins.Booking.Localization
@using Microsoft.AspNetCore.Mvc.Localization
@using Volo.Abp.AspNetCore.Mvc.UI.Bootstrap.TagHelpers.Modal;
@inject IHtmlLocalizer<BookingResource> L
@model EasyAbp.EShop.Plugins.Booking.Web.Pages.EShop.Plugins.Booking.ProductAssetCategories.ProductAssetCategoryPeriod.EditModalModel
@{
Layout = null;
}
<abp-dynamic-form abp-model="ViewModel" data-ajaxForm="true" asp-page="EditModal">
<abp-modal>
<abp-modal-header title="@L["EditProductAssetCategoryPeriod"].Value"></abp-modal-header>
<abp-modal-body>
<abp-input asp-for="ProductAssetCategoryId" />
<abp-input asp-for="PeriodId" />
<abp-form-content />
</abp-modal-body>
<abp-modal-footer buttons="@(AbpModalButtons.Cancel|AbpModalButtons.Save)"></abp-modal-footer>
</abp-modal>
</abp-dynamic-form>

45
plugins/Booking/src/EasyAbp.EShop.Plugins.Booking.Web/Pages/EShop/Plugins/Booking/ProductAssetCategories/ProductAssetCategoryPeriod/EditModal.cshtml.cs

@ -0,0 +1,45 @@
using System;
using System.Linq;
using System.Threading.Tasks;
using EasyAbp.EShop.Plugins.Booking.ProductAssetCategories;
using EasyAbp.EShop.Plugins.Booking.ProductAssetCategories.Dtos;
using EasyAbp.EShop.Plugins.Booking.Web.Pages.EShop.Plugins.Booking.ProductAssetCategories.ProductAssetCategoryPeriod.ViewModels;
using Microsoft.AspNetCore.Mvc;
namespace EasyAbp.EShop.Plugins.Booking.Web.Pages.EShop.Plugins.Booking.ProductAssetCategories.ProductAssetCategoryPeriod
{
public class EditModalModel : BookingPageModel
{
[HiddenInput]
[BindProperty(SupportsGet = true)]
public Guid ProductAssetCategoryId { get; set; }
[HiddenInput]
[BindProperty(SupportsGet = true)]
public Guid PeriodId { get; set; }
[BindProperty]
public EditProductAssetCategoryPeriodViewModel ViewModel { get; set; }
private readonly IProductAssetCategoryAppService _service;
public EditModalModel(IProductAssetCategoryAppService service)
{
_service = service;
}
public virtual async Task OnGetAsync()
{
var dto = await _service.GetAsync(ProductAssetCategoryId);
ViewModel = ObjectMapper.Map<ProductAssetCategoryPeriodDto, EditProductAssetCategoryPeriodViewModel>(
dto.Periods.Single(x => x.PeriodId == PeriodId));
}
public virtual async Task<IActionResult> OnPostAsync()
{
var dto = ObjectMapper.Map<EditProductAssetCategoryPeriodViewModel, UpdateProductAssetCategoryPeriodDto>(ViewModel);
await _service.UpdatePeriodAsync(ProductAssetCategoryId, PeriodId, dto);
return NoContent();
}
}
}

52
plugins/Booking/src/EasyAbp.EShop.Plugins.Booking.Web/Pages/EShop/Plugins/Booking/ProductAssetCategories/ProductAssetCategoryPeriod/Index.cshtml

@ -0,0 +1,52 @@
@page
@using Microsoft.AspNetCore.Authorization
@using Microsoft.AspNetCore.Mvc.Localization
@using Volo.Abp.AspNetCore.Mvc.UI.Layout
@using EasyAbp.EShop.Plugins.Booking.Web.Pages.EShop.Plugins.Booking.ProductAssetCategories.ProductAssetCategoryPeriod
@using EasyAbp.EShop.Plugins.Booking.Localization
@using EasyAbp.EShop.Plugins.Booking.Permissions
@using EasyAbp.EShop.Plugins.Booking.Web.Menus
@model IndexModel
@inject IPageLayout PageLayout
@inject IHtmlLocalizer<BookingResource> L
@inject IAuthorizationService Authorization
@{
PageLayout.Content.Title = L["ProductAssetCategoryPeriod"].Value;
PageLayout.Content.BreadCrumb.Add(L["Menu:ProductAssetCategoryPeriod"].Value);
PageLayout.Content.MenuItemName = BookingMenus.ProductAssetCategory;
}
@section scripts
{
<abp-script src="/Pages/EShop/Plugins/Booking/ProductAssetCategories/ProductAssetCategoryPeriod/index.js" />
}
@section styles
{
<abp-style src="/Pages/EShop/Plugins/Booking/ProductAssetCategories/ProductAssetCategoryPeriod/index.css"/>
}
<script>
let productAssetCategoryId = '@Model.ProductAssetCategoryId';
</script>
<abp-card>
<abp-card-header>
<abp-row>
<abp-column size-md="_6">
<abp-card-title>@L["ProductAssetCategoryPeriod"]</abp-card-title>
</abp-column>
<abp-column size-md="_6" class="text-end">
@if (await Authorization.IsGrantedAsync(BookingPermissions.ProductAssetCategory.Update))
{
<abp-button id="NewProductAssetCategoryPeriodButton"
text="@L["CreateProductAssetCategoryPeriod"].Value"
icon="plus"
button-type="Primary"/>
}
</abp-column>
</abp-row>
</abp-card-header>
<abp-card-body>
<abp-table striped-rows="true" id="ProductAssetCategoryPeriodTable" class="nowrap"/>
</abp-card-body>
</abp-card>

17
plugins/Booking/src/EasyAbp.EShop.Plugins.Booking.Web/Pages/EShop/Plugins/Booking/ProductAssetCategories/ProductAssetCategoryPeriod/Index.cshtml.cs

@ -0,0 +1,17 @@
using System;
using System.Threading.Tasks;
using Microsoft.AspNetCore.Mvc;
namespace EasyAbp.EShop.Plugins.Booking.Web.Pages.EShop.Plugins.Booking.ProductAssetCategories.ProductAssetCategoryPeriod
{
public class IndexModel : BookingPageModel
{
[BindProperty(SupportsGet = true)]
public Guid ProductAssetCategoryId { get; set; }
public virtual async Task OnGetAsync()
{
await Task.CompletedTask;
}
}
}

15
plugins/Booking/src/EasyAbp.EShop.Plugins.Booking.Web/Pages/EShop/Plugins/Booking/ProductAssetCategories/ProductAssetCategoryPeriod/ViewModels/CreateProductAssetCategoryPeriodViewModel.cs

@ -0,0 +1,15 @@
using System;
using System.ComponentModel.DataAnnotations;
namespace EasyAbp.EShop.Plugins.Booking.Web.Pages.EShop.Plugins.Booking.ProductAssetCategories.ProductAssetCategoryPeriod.ViewModels
{
public class CreateProductAssetCategoryPeriodViewModel
{
[Display(Name = "ProductAssetCategoryPeriodPeriodId")]
public Guid PeriodId { get; set; }
[Display(Name = "ProductAssetCategoryPeriodPrice")]
[Range(BookingConsts.MinimumPrice, BookingConsts.MaximumPrice)]
public decimal Price { get; set; }
}
}

12
plugins/Booking/src/EasyAbp.EShop.Plugins.Booking.Web/Pages/EShop/Plugins/Booking/ProductAssetCategories/ProductAssetCategoryPeriod/ViewModels/EditProductAssetCategoryPeriodViewModel.cs

@ -0,0 +1,12 @@
using System;
using System.ComponentModel.DataAnnotations;
namespace EasyAbp.EShop.Plugins.Booking.Web.Pages.EShop.Plugins.Booking.ProductAssetCategories.ProductAssetCategoryPeriod.ViewModels
{
public class EditProductAssetCategoryPeriodViewModel
{
[Display(Name = "ProductAssetCategoryPeriodPrice")]
[Range(BookingConsts.MinimumPrice, BookingConsts.MaximumPrice)]
public decimal Price { get; set; }
}
}

0
plugins/Booking/src/EasyAbp.EShop.Plugins.Booking.Web/Pages/EShop/Plugins/Booking/ProductAssetCategories/ProductAssetCategoryPeriod/index.css

80
plugins/Booking/src/EasyAbp.EShop.Plugins.Booking.Web/Pages/EShop/Plugins/Booking/ProductAssetCategories/ProductAssetCategoryPeriod/index.js

@ -0,0 +1,80 @@
$(function () {
var l = abp.localization.getResource('EasyAbpEShopPluginsBooking');
var service = easyAbp.eShop.plugins.booking.productAssetCategories.productAssetCategory;
var createModal = new abp.ModalManager(abp.appPath + 'EShop/Plugins/Booking/ProductAssetCategories/ProductAssetCategoryPeriod/CreateModal');
var editModal = new abp.ModalManager(abp.appPath + 'EShop/Plugins/Booking/ProductAssetCategories/ProductAssetCategoryPeriod/EditModal');
var dataTable = $('#ProductAssetCategoryPeriodTable').DataTable(abp.libs.datatables.normalizeConfiguration({
processing: true,
serverSide: true,
paging: true,
searching: false,
autoWidth: false,
scrollCollapse: true,
order: [[0, "asc"]],
ajax: function (requestData, callback, settings) {
if (callback) {
service.get(productAssetCategoryId).then(function (result) {
callback({
recordsTotal: result.periods.length,
recordsFiltered: result.periods.length,
data: result.periods
});
});
}
},
columnDefs: [
{
rowAction: {
items:
[
{
text: l('Edit'),
visible: abp.auth.isGranted('EasyAbp.EShop.Plugins.Booking.ProductAssetCategory.Update'),
action: function (data) {
editModal.open({ productAssetCategoryId: productAssetCategoryId, periodId: data.record.periodId });
}
},
{
text: l('Delete'),
visible: abp.auth.isGranted('EasyAbp.EShop.Plugins.Booking.ProductAssetCategory.Update'),
confirmMessage: function (data) {
return l('ProductAssetCategoryPeriodDeletionConfirmationMessage', data.record.periodId);
},
action: function (data) {
service.deletePeriod(productAssetCategoryId, data.record.periodId)
.then(function () {
abp.notify.info(l('SuccessfullyDeleted'));
dataTable.ajax.reload();
});
}
}
]
}
},
{
title: l('ProductAssetCategoryPeriodPeriodId'),
data: "periodId"
},
{
title: l('ProductAssetCategoryPeriodPrice'),
data: "price"
},
]
}));
createModal.onResult(function () {
dataTable.ajax.reload();
});
editModal.onResult(function () {
dataTable.ajax.reload();
});
$('#NewProductAssetCategoryPeriodButton').click(function (e) {
e.preventDefault();
createModal.open({ productAssetCategoryId: productAssetCategoryId });
});
});

18
plugins/Booking/src/EasyAbp.EShop.Plugins.Booking.Web/Pages/EShop/Plugins/Booking/ProductAssets/ProductAsset/CreateModal.cshtml

@ -0,0 +1,18 @@
@page
@using Microsoft.AspNetCore.Mvc.Localization
@using Volo.Abp.AspNetCore.Mvc.UI.Bootstrap.TagHelpers.Modal;
@using EasyAbp.EShop.Plugins.Booking.Localization
@inject IHtmlLocalizer<BookingResource> L
@model EasyAbp.EShop.Plugins.Booking.Web.Pages.EShop.Plugins.Booking.ProductAssets.ProductAsset.CreateModalModel
@{
Layout = null;
}
<abp-dynamic-form abp-model="ViewModel" data-ajaxForm="true" asp-page="CreateModal">
<abp-modal>
<abp-modal-header title="@L["CreateProductAsset"].Value"></abp-modal-header>
<abp-modal-body>
<abp-form-content />
</abp-modal-body>
<abp-modal-footer buttons="@(AbpModalButtons.Cancel|AbpModalButtons.Save)"></abp-modal-footer>
</abp-modal>
</abp-dynamic-form>

28
plugins/Booking/src/EasyAbp.EShop.Plugins.Booking.Web/Pages/EShop/Plugins/Booking/ProductAssets/ProductAsset/CreateModal.cshtml.cs

@ -0,0 +1,28 @@
using System.Threading.Tasks;
using Microsoft.AspNetCore.Mvc;
using EasyAbp.EShop.Plugins.Booking.ProductAssets;
using EasyAbp.EShop.Plugins.Booking.ProductAssets.Dtos;
using EasyAbp.EShop.Plugins.Booking.Web.Pages.EShop.Plugins.Booking.ProductAssets.ProductAsset.ViewModels;
namespace EasyAbp.EShop.Plugins.Booking.Web.Pages.EShop.Plugins.Booking.ProductAssets.ProductAsset
{
public class CreateModalModel : BookingPageModel
{
[BindProperty]
public CreateProductAssetViewModel ViewModel { get; set; }
private readonly IProductAssetAppService _service;
public CreateModalModel(IProductAssetAppService service)
{
_service = service;
}
public virtual async Task<IActionResult> OnPostAsync()
{
var dto = ObjectMapper.Map<CreateProductAssetViewModel, CreateProductAssetDto>(ViewModel);
await _service.CreateAsync(dto);
return NoContent();
}
}
}

19
plugins/Booking/src/EasyAbp.EShop.Plugins.Booking.Web/Pages/EShop/Plugins/Booking/ProductAssets/ProductAsset/EditModal.cshtml

@ -0,0 +1,19 @@
@page
@using EasyAbp.EShop.Plugins.Booking.Localization
@using Microsoft.AspNetCore.Mvc.Localization
@using Volo.Abp.AspNetCore.Mvc.UI.Bootstrap.TagHelpers.Modal;
@inject IHtmlLocalizer<BookingResource> L
@model EasyAbp.EShop.Plugins.Booking.Web.Pages.EShop.Plugins.Booking.ProductAssets.ProductAsset.EditModalModel
@{
Layout = null;
}
<abp-dynamic-form abp-model="ViewModel" data-ajaxForm="true" asp-page="EditModal">
<abp-modal>
<abp-modal-header title="@L["EditProductAsset"].Value"></abp-modal-header>
<abp-modal-body>
<abp-input asp-for="Id" />
<abp-form-content />
</abp-modal-body>
<abp-modal-footer buttons="@(AbpModalButtons.Cancel|AbpModalButtons.Save)"></abp-modal-footer>
</abp-modal>
</abp-dynamic-form>

39
plugins/Booking/src/EasyAbp.EShop.Plugins.Booking.Web/Pages/EShop/Plugins/Booking/ProductAssets/ProductAsset/EditModal.cshtml.cs

@ -0,0 +1,39 @@
using System;
using System.Threading.Tasks;
using Microsoft.AspNetCore.Mvc;
using EasyAbp.EShop.Plugins.Booking.ProductAssets;
using EasyAbp.EShop.Plugins.Booking.ProductAssets.Dtos;
using EasyAbp.EShop.Plugins.Booking.Web.Pages.EShop.Plugins.Booking.ProductAssets.ProductAsset.ViewModels;
namespace EasyAbp.EShop.Plugins.Booking.Web.Pages.EShop.Plugins.Booking.ProductAssets.ProductAsset
{
public class EditModalModel : BookingPageModel
{
[HiddenInput]
[BindProperty(SupportsGet = true)]
public Guid Id { get; set; }
[BindProperty]
public EditProductAssetViewModel ViewModel { get; set; }
private readonly IProductAssetAppService _service;
public EditModalModel(IProductAssetAppService service)
{
_service = service;
}
public virtual async Task OnGetAsync()
{
var dto = await _service.GetAsync(Id);
ViewModel = ObjectMapper.Map<ProductAssetDto, EditProductAssetViewModel>(dto);
}
public virtual async Task<IActionResult> OnPostAsync()
{
var dto = ObjectMapper.Map<EditProductAssetViewModel, UpdateProductAssetDto>(ViewModel);
await _service.UpdateAsync(Id, dto);
return NoContent();
}
}
}

48
plugins/Booking/src/EasyAbp.EShop.Plugins.Booking.Web/Pages/EShop/Plugins/Booking/ProductAssets/ProductAsset/Index.cshtml

@ -0,0 +1,48 @@
@page
@using EasyAbp.EShop.Plugins.Booking.Permissions
@using Microsoft.AspNetCore.Authorization
@using Microsoft.AspNetCore.Mvc.Localization
@using Volo.Abp.AspNetCore.Mvc.UI.Layout
@using EasyAbp.EShop.Plugins.Booking.Web.Pages.EShop.Plugins.Booking.ProductAssets.ProductAsset
@using EasyAbp.EShop.Plugins.Booking.Localization
@using EasyAbp.EShop.Plugins.Booking.Web.Menus
@model IndexModel
@inject IPageLayout PageLayout
@inject IHtmlLocalizer<BookingResource> L
@inject IAuthorizationService Authorization
@{
PageLayout.Content.Title = L["ProductAsset"].Value;
PageLayout.Content.BreadCrumb.Add(L["Menu:ProductAsset"].Value);
PageLayout.Content.MenuItemName = BookingMenus.ProductAsset;
}
@section scripts
{
<abp-script src="/Pages/EShop/Plugins/Booking/ProductAssets/ProductAsset/index.js" />
}
@section styles
{
<abp-style src="/Pages/EShop/Plugins/Booking/ProductAssets/ProductAsset/index.css"/>
}
<abp-card>
<abp-card-header>
<abp-row>
<abp-column size-md="_6">
<abp-card-title>@L["ProductAsset"]</abp-card-title>
</abp-column>
<abp-column size-md="_6" class="text-end">
@if (await Authorization.IsGrantedAsync(BookingPermissions.ProductAsset.Create))
{
<abp-button id="NewProductAssetButton"
text="@L["CreateProductAsset"].Value"
icon="plus"
button-type="Primary" />
}
</abp-column>
</abp-row>
</abp-card-header>
<abp-card-body>
<abp-table striped-rows="true" id="ProductAssetTable" class="nowrap"/>
</abp-card-body>
</abp-card>

12
plugins/Booking/src/EasyAbp.EShop.Plugins.Booking.Web/Pages/EShop/Plugins/Booking/ProductAssets/ProductAsset/Index.cshtml.cs

@ -0,0 +1,12 @@
using System.Threading.Tasks;
namespace EasyAbp.EShop.Plugins.Booking.Web.Pages.EShop.Plugins.Booking.ProductAssets.ProductAsset
{
public class IndexModel : BookingPageModel
{
public virtual async Task OnGetAsync()
{
await Task.CompletedTask;
}
}
}

31
plugins/Booking/src/EasyAbp.EShop.Plugins.Booking.Web/Pages/EShop/Plugins/Booking/ProductAssets/ProductAsset/ViewModels/CreateProductAssetViewModel.cs

@ -0,0 +1,31 @@
using System;
using System.ComponentModel.DataAnnotations;
namespace EasyAbp.EShop.Plugins.Booking.Web.Pages.EShop.Plugins.Booking.ProductAssets.ProductAsset.ViewModels
{
public class CreateProductAssetViewModel
{
[Display(Name = "ProductAssetProductId")]
public Guid ProductId { get; set; }
[Display(Name = "ProductAssetProductSkuId")]
public Guid ProductSkuId { get; set; }
[Display(Name = "ProductAssetAssetId")]
public Guid AssetId { get; set; }
[Display(Name = "ProductAssetPeriodSchemeId")]
public Guid PeriodSchemeId { get; set; }
[Display(Name = "ProductAssetFromTime")]
public DateTime FromTime { get; set; }
[Display(Name = "ProductAssetToTime")]
public DateTime? ToTime { get; set; }
[Display(Name = "ProductAssetPrice")]
[Range(BookingConsts.MinimumPrice, BookingConsts.MaximumPrice)]
public decimal? Price { get; set; }
}
}

19
plugins/Booking/src/EasyAbp.EShop.Plugins.Booking.Web/Pages/EShop/Plugins/Booking/ProductAssets/ProductAsset/ViewModels/EditProductAssetViewModel.cs

@ -0,0 +1,19 @@
using System;
using System.ComponentModel.DataAnnotations;
namespace EasyAbp.EShop.Plugins.Booking.Web.Pages.EShop.Plugins.Booking.ProductAssets.ProductAsset.ViewModels
{
public class EditProductAssetViewModel
{
[Display(Name = "ProductAssetFromTime")]
public DateTime FromTime { get; set; }
[Display(Name = "ProductAssetToTime")]
public DateTime? ToTime { get; set; }
[Display(Name = "ProductAssetPrice")]
[Range(BookingConsts.MinimumPrice, BookingConsts.MaximumPrice)]
public decimal? Price { get; set; }
}
}

0
plugins/Booking/src/EasyAbp.EShop.Plugins.Booking.Web/Pages/EShop/Plugins/Booking/ProductAssets/ProductAsset/index.css

96
plugins/Booking/src/EasyAbp.EShop.Plugins.Booking.Web/Pages/EShop/Plugins/Booking/ProductAssets/ProductAsset/index.js

@ -0,0 +1,96 @@
$(function () {
var l = abp.localization.getResource('EasyAbpEShopPluginsBooking');
var service = easyAbp.eShop.plugins.booking.productAssets.productAsset;
var createModal = new abp.ModalManager(abp.appPath + 'EShop/Plugins/Booking/ProductAssets/ProductAsset/CreateModal');
var editModal = new abp.ModalManager(abp.appPath + 'EShop/Plugins/Booking/ProductAssets/ProductAsset/EditModal');
var dataTable = $('#ProductAssetTable').DataTable(abp.libs.datatables.normalizeConfiguration({
processing: true,
serverSide: true,
paging: true,
searching: false,
autoWidth: false,
scrollCollapse: true,
order: [[0, "asc"]],
ajax: abp.libs.datatables.createAjax(service.getList),
columnDefs: [
{
rowAction: {
items:
[
{
text: l('ProductAssetPeriods'),
action: function (data) {
document.location.href = abp.appPath + 'EShop/Plugins/Booking/ProductAssets/ProductAssetPeriod?ProductAssetId=' + data.record.id;
}
},
{
text: l('Edit'),
visible: abp.auth.isGranted('EasyAbp.EShop.Plugins.Booking.ProductAsset.Update'),
action: function (data) {
editModal.open({ id: data.record.id });
}
},
{
text: l('Delete'),
visible: abp.auth.isGranted('EasyAbp.EShop.Plugins.Booking.ProductAsset.Delete'),
confirmMessage: function (data) {
return l('ProductAssetDeletionConfirmationMessage', data.record.id);
},
action: function (data) {
service.delete(data.record.id)
.then(function () {
abp.notify.info(l('SuccessfullyDeleted'));
dataTable.ajax.reload();
});
}
}
]
}
},
{
title: l('ProductAssetAssetId'),
data: "assetId"
},
{
title: l('ProductAssetPrice'),
data: "price"
},
{
title: l('ProductAssetPeriodSchemeId'),
data: "periodSchemeId"
},
{
title: l('ProductAssetFromTime'),
data: "fromTime"
},
{
title: l('ProductAssetToTime'),
data: "toTime"
},
{
title: l('ProductAssetProductId'),
data: "productId"
},
{
title: l('ProductAssetProductSkuId'),
data: "productSkuId"
},
]
}));
createModal.onResult(function () {
dataTable.ajax.reload();
});
editModal.onResult(function () {
dataTable.ajax.reload();
});
$('#NewProductAssetButton').click(function (e) {
e.preventDefault();
createModal.open();
});
});

19
plugins/Booking/src/EasyAbp.EShop.Plugins.Booking.Web/Pages/EShop/Plugins/Booking/ProductAssets/ProductAssetPeriod/CreateModal.cshtml

@ -0,0 +1,19 @@
@page
@using Microsoft.AspNetCore.Mvc.Localization
@using Volo.Abp.AspNetCore.Mvc.UI.Bootstrap.TagHelpers.Modal;
@using EasyAbp.EShop.Plugins.Booking.Localization
@inject IHtmlLocalizer<BookingResource> L
@model EasyAbp.EShop.Plugins.Booking.Web.Pages.EShop.Plugins.Booking.ProductAssets.ProductAssetPeriod.CreateModalModel
@{
Layout = null;
}
<abp-dynamic-form abp-model="ViewModel" data-ajaxForm="true" asp-page="CreateModal">
<abp-modal>
<abp-modal-header title="@L["CreateProductAssetPeriod"].Value"></abp-modal-header>
<abp-modal-body>
<abp-input asp-for="ProductAssetId" />
<abp-form-content/>
</abp-modal-body>
<abp-modal-footer buttons="@(AbpModalButtons.Cancel|AbpModalButtons.Save)"></abp-modal-footer>
</abp-modal>
</abp-dynamic-form>

33
plugins/Booking/src/EasyAbp.EShop.Plugins.Booking.Web/Pages/EShop/Plugins/Booking/ProductAssets/ProductAssetPeriod/CreateModal.cshtml.cs

@ -0,0 +1,33 @@
using System;
using System.Threading.Tasks;
using Microsoft.AspNetCore.Mvc;
using EasyAbp.EShop.Plugins.Booking.ProductAssets;
using EasyAbp.EShop.Plugins.Booking.ProductAssets.Dtos;
using EasyAbp.EShop.Plugins.Booking.Web.Pages.EShop.Plugins.Booking.ProductAssets.ProductAssetPeriod.ViewModels;
namespace EasyAbp.EShop.Plugins.Booking.Web.Pages.EShop.Plugins.Booking.ProductAssets.ProductAssetPeriod
{
public class CreateModalModel : BookingPageModel
{
[HiddenInput]
[BindProperty(SupportsGet = true)]
public Guid ProductAssetId { get; set; }
[BindProperty]
public CreateProductAssetPeriodViewModel ViewModel { get; set; }
private readonly IProductAssetAppService _service;
public CreateModalModel(IProductAssetAppService service)
{
_service = service;
}
public virtual async Task<IActionResult> OnPostAsync()
{
var dto = ObjectMapper.Map<CreateProductAssetPeriodViewModel, CreateProductAssetPeriodDto>(ViewModel);
await _service.CreatePeriodAsync(ProductAssetId, dto);
return NoContent();
}
}
}

20
plugins/Booking/src/EasyAbp.EShop.Plugins.Booking.Web/Pages/EShop/Plugins/Booking/ProductAssets/ProductAssetPeriod/EditModal.cshtml

@ -0,0 +1,20 @@
@page
@using EasyAbp.EShop.Plugins.Booking.Localization
@using Microsoft.AspNetCore.Mvc.Localization
@using Volo.Abp.AspNetCore.Mvc.UI.Bootstrap.TagHelpers.Modal;
@inject IHtmlLocalizer<BookingResource> L
@model EasyAbp.EShop.Plugins.Booking.Web.Pages.EShop.Plugins.Booking.ProductAssets.ProductAssetPeriod.EditModalModel
@{
Layout = null;
}
<abp-dynamic-form abp-model="ViewModel" data-ajaxForm="true" asp-page="EditModal">
<abp-modal>
<abp-modal-header title="@L["EditProductAssetPeriod"].Value"></abp-modal-header>
<abp-modal-body>
<abp-input asp-for="ProductAssetId" />
<abp-input asp-for="PeriodId" />
<abp-form-content />
</abp-modal-body>
<abp-modal-footer buttons="@(AbpModalButtons.Cancel|AbpModalButtons.Save)"></abp-modal-footer>
</abp-modal>
</abp-dynamic-form>

45
plugins/Booking/src/EasyAbp.EShop.Plugins.Booking.Web/Pages/EShop/Plugins/Booking/ProductAssets/ProductAssetPeriod/EditModal.cshtml.cs

@ -0,0 +1,45 @@
using System;
using System.Linq;
using System.Threading.Tasks;
using Microsoft.AspNetCore.Mvc;
using EasyAbp.EShop.Plugins.Booking.ProductAssets;
using EasyAbp.EShop.Plugins.Booking.ProductAssets.Dtos;
using EasyAbp.EShop.Plugins.Booking.Web.Pages.EShop.Plugins.Booking.ProductAssets.ProductAssetPeriod.ViewModels;
namespace EasyAbp.EShop.Plugins.Booking.Web.Pages.EShop.Plugins.Booking.ProductAssets.ProductAssetPeriod
{
public class EditModalModel : BookingPageModel
{
[HiddenInput]
[BindProperty(SupportsGet = true)]
public Guid ProductAssetId { get; set; }
[HiddenInput]
[BindProperty(SupportsGet = true)]
public Guid PeriodId { get; set; }
[BindProperty]
public EditProductAssetPeriodViewModel ViewModel { get; set; }
private readonly IProductAssetAppService _service;
public EditModalModel(IProductAssetAppService service)
{
_service = service;
}
public virtual async Task OnGetAsync()
{
var dto = await _service.GetAsync(ProductAssetId);
ViewModel = ObjectMapper.Map<ProductAssetPeriodDto, EditProductAssetPeriodViewModel>(
dto.Periods.Single(x => x.PeriodId == PeriodId));
}
public virtual async Task<IActionResult> OnPostAsync()
{
var dto = ObjectMapper.Map<EditProductAssetPeriodViewModel, UpdateProductAssetPeriodDto>(ViewModel);
await _service.UpdatePeriodAsync(ProductAssetId, PeriodId, dto);
return NoContent();
}
}
}

52
plugins/Booking/src/EasyAbp.EShop.Plugins.Booking.Web/Pages/EShop/Plugins/Booking/ProductAssets/ProductAssetPeriod/Index.cshtml

@ -0,0 +1,52 @@
@page
@using Microsoft.AspNetCore.Authorization
@using Microsoft.AspNetCore.Mvc.Localization
@using Volo.Abp.AspNetCore.Mvc.UI.Layout
@using EasyAbp.EShop.Plugins.Booking.Web.Pages.EShop.Plugins.Booking.ProductAssets.ProductAssetPeriod
@using EasyAbp.EShop.Plugins.Booking.Localization
@using EasyAbp.EShop.Plugins.Booking.Permissions
@using EasyAbp.EShop.Plugins.Booking.Web.Menus
@model IndexModel
@inject IPageLayout PageLayout
@inject IHtmlLocalizer<BookingResource> L
@inject IAuthorizationService Authorization
@{
PageLayout.Content.Title = L["ProductAssetPeriod"].Value;
PageLayout.Content.BreadCrumb.Add(L["Menu:ProductAssetPeriod"].Value);
PageLayout.Content.MenuItemName = BookingMenus.ProductAsset;
}
@section scripts
{
<abp-script src="/Pages/EShop/Plugins/Booking/ProductAssets/ProductAssetPeriod/index.js" />
}
@section styles
{
<abp-style src="/Pages/EShop/Plugins/Booking/ProductAssets/ProductAssetPeriod/index.css"/>
}
<script>
let productAssetId = '@Model.ProductAssetId';
</script>
<abp-card>
<abp-card-header>
<abp-row>
<abp-column size-md="_6">
<abp-card-title>@L["ProductAssetPeriod"]</abp-card-title>
</abp-column>
<abp-column size-md="_6" class="text-end">
@if (await Authorization.IsGrantedAsync(BookingPermissions.ProductAsset.Update))
{
<abp-button id="NewProductAssetPeriodButton"
text="@L["CreateProductAssetPeriod"].Value"
icon="plus"
button-type="Primary"/>
}
</abp-column>
</abp-row>
</abp-card-header>
<abp-card-body>
<abp-table striped-rows="true" id="ProductAssetPeriodTable" class="nowrap"/>
</abp-card-body>
</abp-card>

17
plugins/Booking/src/EasyAbp.EShop.Plugins.Booking.Web/Pages/EShop/Plugins/Booking/ProductAssets/ProductAssetPeriod/Index.cshtml.cs

@ -0,0 +1,17 @@
using System;
using System.Threading.Tasks;
using Microsoft.AspNetCore.Mvc;
namespace EasyAbp.EShop.Plugins.Booking.Web.Pages.EShop.Plugins.Booking.ProductAssets.ProductAssetPeriod
{
public class IndexModel : BookingPageModel
{
[BindProperty(SupportsGet = true)]
public Guid ProductAssetId { get; set; }
public virtual async Task OnGetAsync()
{
await Task.CompletedTask;
}
}
}

16
plugins/Booking/src/EasyAbp.EShop.Plugins.Booking.Web/Pages/EShop/Plugins/Booking/ProductAssets/ProductAssetPeriod/ViewModels/CreateProductAssetPeriodViewModel.cs

@ -0,0 +1,16 @@
using System;
using System.ComponentModel.DataAnnotations;
namespace EasyAbp.EShop.Plugins.Booking.Web.Pages.EShop.Plugins.Booking.ProductAssets.ProductAssetPeriod.ViewModels
{
public class CreateProductAssetPeriodViewModel
{
[Display(Name = "ProductAssetPeriodPeriodId")]
public Guid PeriodId { get; set; }
[Display(Name = "ProductAssetPeriodPrice")]
[Range(BookingConsts.MinimumPrice, BookingConsts.MaximumPrice)]
public decimal Price { get; set; }
}
}

13
plugins/Booking/src/EasyAbp.EShop.Plugins.Booking.Web/Pages/EShop/Plugins/Booking/ProductAssets/ProductAssetPeriod/ViewModels/EditProductAssetPeriodViewModel.cs

@ -0,0 +1,13 @@
using System;
using System.ComponentModel.DataAnnotations;
namespace EasyAbp.EShop.Plugins.Booking.Web.Pages.EShop.Plugins.Booking.ProductAssets.ProductAssetPeriod.ViewModels
{
public class EditProductAssetPeriodViewModel
{
[Display(Name = "ProductAssetPeriodPrice")]
[Range(BookingConsts.MinimumPrice, BookingConsts.MaximumPrice)]
public decimal Price { get; set; }
}
}

0
plugins/Booking/src/EasyAbp.EShop.Plugins.Booking.Web/Pages/EShop/Plugins/Booking/ProductAssets/ProductAssetPeriod/index.css

80
plugins/Booking/src/EasyAbp.EShop.Plugins.Booking.Web/Pages/EShop/Plugins/Booking/ProductAssets/ProductAssetPeriod/index.js

@ -0,0 +1,80 @@
$(function () {
var l = abp.localization.getResource('EasyAbpEShopPluginsBooking');
var service = easyAbp.eShop.plugins.booking.productAssets.productAsset;
var createModal = new abp.ModalManager(abp.appPath + 'EShop/Plugins/Booking/ProductAssets/ProductAssetPeriod/CreateModal');
var editModal = new abp.ModalManager(abp.appPath + 'EShop/Plugins/Booking/ProductAssets/ProductAssetPeriod/EditModal');
var dataTable = $('#ProductAssetPeriodTable').DataTable(abp.libs.datatables.normalizeConfiguration({
processing: true,
serverSide: true,
paging: true,
searching: false,
autoWidth: false,
scrollCollapse: true,
order: [[0, "asc"]],
ajax: function (requestData, callback, settings) {
if (callback) {
service.get(productAssetId).then(function (result) {
callback({
recordsTotal: result.periods.length,
recordsFiltered: result.periods.length,
data: result.periods
});
});
}
},
columnDefs: [
{
rowAction: {
items:
[
{
text: l('Edit'),
visible: abp.auth.isGranted('EasyAbp.EShop.Plugins.Booking.ProductAsset.Update'),
action: function (data) {
editModal.open({ productAssetId: productAssetId, periodId: data.record.periodId });
}
},
{
text: l('Delete'),
visible: abp.auth.isGranted('EasyAbp.EShop.Plugins.Booking.ProductAsset.Update'),
confirmMessage: function (data) {
return l('ProductAssetPeriodDeletionConfirmationMessage', data.record.periodId);
},
action: function (data) {
service.deletePeriod(productAssetId, data.record.periodId)
.then(function () {
abp.notify.info(l('SuccessfullyDeleted'));
dataTable.ajax.reload();
});
}
}
]
}
},
{
title: l('ProductAssetPeriodPeriodId'),
data: "periodId"
},
{
title: l('ProductAssetPeriodPrice'),
data: "price"
},
]
}));
createModal.onResult(function () {
dataTable.ajax.reload();
});
editModal.onResult(function () {
dataTable.ajax.reload();
});
$('#NewProductAssetPeriodButton').click(function (e) {
e.preventDefault();
createModal.open({ productAssetId: productAssetId });
});
});

28
plugins/Booking/test/EasyAbp.EShop.Plugins.Booking.Application.Tests/ProductAssetCategories/ProductAssetCategoryAppServiceTests.cs

@ -0,0 +1,28 @@
using Shouldly;
using System.Threading.Tasks;
using Xunit;
namespace EasyAbp.EShop.Plugins.Booking.ProductAssetCategories
{
public class ProductAssetCategoryAppServiceTests : BookingApplicationTestBase
{
private readonly IProductAssetCategoryAppService _productAssetCategoryAppService;
public ProductAssetCategoryAppServiceTests()
{
_productAssetCategoryAppService = GetRequiredService<IProductAssetCategoryAppService>();
}
/*
[Fact]
public async Task Test1()
{
// Arrange
// Act
// Assert
}
*/
}
}

28
plugins/Booking/test/EasyAbp.EShop.Plugins.Booking.Application.Tests/ProductAssets/ProductAssetAppServiceTests.cs

@ -0,0 +1,28 @@
using Shouldly;
using System.Threading.Tasks;
using Xunit;
namespace EasyAbp.EShop.Plugins.Booking.ProductAssets
{
public class ProductAssetAppServiceTests : BookingApplicationTestBase
{
private readonly IProductAssetAppService _productAssetAppService;
public ProductAssetAppServiceTests()
{
_productAssetAppService = GetRequiredService<IProductAssetAppService>();
}
/*
[Fact]
public async Task Test1()
{
// Arrange
// Act
// Assert
}
*/
}
}

25
plugins/Booking/test/EasyAbp.EShop.Plugins.Booking.Domain.Tests/ProductAssetCategories/ProductAssetCategoryDomainTests.cs

@ -0,0 +1,25 @@
using System.Threading.Tasks;
using Shouldly;
using Xunit;
namespace EasyAbp.EShop.Plugins.Booking.ProductAssetCategories
{
public class ProductAssetCategoryDomainTests : BookingDomainTestBase
{
public ProductAssetCategoryDomainTests()
{
}
/*
[Fact]
public async Task Test1()
{
// Arrange
// Assert
// Assert
}
*/
}
}

25
plugins/Booking/test/EasyAbp.EShop.Plugins.Booking.Domain.Tests/ProductAssets/ProductAssetDomainTests.cs

@ -0,0 +1,25 @@
using System.Threading.Tasks;
using Shouldly;
using Xunit;
namespace EasyAbp.EShop.Plugins.Booking.ProductAssets
{
public class ProductAssetDomainTests : BookingDomainTestBase
{
public ProductAssetDomainTests()
{
}
/*
[Fact]
public async Task Test1()
{
// Arrange
// Assert
// Assert
}
*/
}
}

33
plugins/Booking/test/EasyAbp.EShop.Plugins.Booking.EntityFrameworkCore.Tests/EntityFrameworkCore/ProductAssetCategories/ProductAssetCategoryRepositoryTests.cs

@ -0,0 +1,33 @@
using System;
using System.Threading.Tasks;
using EasyAbp.EShop.Plugins.Booking.ProductAssetCategories;
using Volo.Abp.Domain.Repositories;
using Xunit;
namespace EasyAbp.EShop.Plugins.Booking.EntityFrameworkCore.ProductAssetCategories
{
public class ProductAssetCategoryRepositoryTests : BookingEntityFrameworkCoreTestBase
{
private readonly IProductAssetCategoryRepository _productAssetCategoryRepository;
public ProductAssetCategoryRepositoryTests()
{
_productAssetCategoryRepository = GetRequiredService<IProductAssetCategoryRepository>();
}
/*
[Fact]
public async Task Test1()
{
await WithUnitOfWorkAsync(async () =>
{
// Arrange
// Act
//Assert
});
}
*/
}
}

33
plugins/Booking/test/EasyAbp.EShop.Plugins.Booking.EntityFrameworkCore.Tests/EntityFrameworkCore/ProductAssets/ProductAssetRepositoryTests.cs

@ -0,0 +1,33 @@
using System;
using System.Threading.Tasks;
using EasyAbp.EShop.Plugins.Booking.ProductAssets;
using Volo.Abp.Domain.Repositories;
using Xunit;
namespace EasyAbp.EShop.Plugins.Booking.EntityFrameworkCore.ProductAssets
{
public class ProductAssetRepositoryTests : BookingEntityFrameworkCoreTestBase
{
private readonly IProductAssetRepository _productAssetRepository;
public ProductAssetRepositoryTests()
{
_productAssetRepository = GetRequiredService<IProductAssetRepository>();
}
/*
[Fact]
public async Task Test1()
{
await WithUnitOfWorkAsync(async () =>
{
// Arrange
// Act
//Assert
});
}
*/
}
}

1
samples/EShopSample/aspnet-core/src/EShopSample.Application.Contracts/EShopSample.Application.Contracts.csproj

@ -10,6 +10,7 @@
<ItemGroup>
<ProjectReference Include="..\..\..\..\..\integration\EasyAbp.EShop\src\EasyAbp.EShop.Application.Contracts\EasyAbp.EShop.Application.Contracts.csproj" />
<ProjectReference Include="..\..\..\..\..\plugins\Baskets\src\EasyAbp.EShop.Plugins.Baskets.Application.Contracts\EasyAbp.EShop.Plugins.Baskets.Application.Contracts.csproj" />
<ProjectReference Include="..\..\..\..\..\plugins\Booking\src\EasyAbp.EShop.Plugins.Booking.Application.Contracts\EasyAbp.EShop.Plugins.Booking.Application.Contracts.csproj" />
<ProjectReference Include="..\..\..\..\..\plugins\Coupons\src\EasyAbp.EShop.Plugins.Coupons.Application.Contracts\EasyAbp.EShop.Plugins.Coupons.Application.Contracts.csproj" />
<ProjectReference Include="..\EShopSample.Domain.Shared\EShopSample.Domain.Shared.csproj" />
</ItemGroup>

2
samples/EShopSample/aspnet-core/src/EShopSample.Application.Contracts/EShopSampleApplicationContractsModule.cs

@ -1,5 +1,6 @@
using EasyAbp.EShop;
using EasyAbp.EShop.Plugins.Baskets;
using EasyAbp.EShop.Plugins.Booking;
using EasyAbp.EShop.Plugins.Coupons;
using EasyAbp.PaymentService;
using EasyAbp.PaymentService.Prepayment;
@ -24,6 +25,7 @@ namespace EShopSample
typeof(AbpObjectExtendingModule),
typeof(EShopApplicationContractsModule),
typeof(EShopPluginsBasketsApplicationContractsModule),
typeof(EShopPluginsBookingApplicationContractsModule),
typeof(EShopPluginsCouponsApplicationContractsModule),
typeof(PaymentServiceApplicationContractsModule),
typeof(PaymentServiceWeChatPayApplicationContractsModule),

1
samples/EShopSample/aspnet-core/src/EShopSample.Application/EShopSample.Application.csproj

@ -10,6 +10,7 @@
<ItemGroup>
<ProjectReference Include="..\..\..\..\..\integration\EasyAbp.EShop\src\EasyAbp.EShop.Application\EasyAbp.EShop.Application.csproj" />
<ProjectReference Include="..\..\..\..\..\plugins\Baskets\src\EasyAbp.EShop.Plugins.Baskets.Application\EasyAbp.EShop.Plugins.Baskets.Application.csproj" />
<ProjectReference Include="..\..\..\..\..\plugins\Booking\src\EasyAbp.EShop.Plugins.Booking.Application\EasyAbp.EShop.Plugins.Booking.Application.csproj" />
<ProjectReference Include="..\..\..\..\..\plugins\Coupons\src\EasyAbp.EShop.Plugins.Coupons.Application\EasyAbp.EShop.Plugins.Coupons.Application.csproj" />
<ProjectReference Include="..\..\..\..\..\plugins\Coupons\src\EasyAbp.EShop.Orders.Plugins.Coupons\EasyAbp.EShop.Orders.Plugins.Coupons.csproj" />
<ProjectReference Include="..\EShopSample.Domain\EShopSample.Domain.csproj" />

2
samples/EShopSample/aspnet-core/src/EShopSample.Application/EShopSampleApplicationModule.cs

@ -1,6 +1,7 @@
using EasyAbp.EShop;
using EasyAbp.EShop.Orders.Plugins.Coupons;
using EasyAbp.EShop.Plugins.Baskets;
using EasyAbp.EShop.Plugins.Booking;
using EasyAbp.EShop.Plugins.Coupons;
using EasyAbp.PaymentService;
using EasyAbp.PaymentService.Prepayment;
@ -25,6 +26,7 @@ namespace EShopSample
typeof(AbpFeatureManagementApplicationModule),
typeof(EShopApplicationModule),
typeof(EShopPluginsBasketsApplicationModule),
typeof(EShopPluginsBookingApplicationModule),
typeof(EShopPluginsCouponsApplicationModule),
typeof(EShopOrdersPluginsCouponsModule),
typeof(PaymentServiceApplicationModule),

1
samples/EShopSample/aspnet-core/src/EShopSample.Domain.Shared/EShopSample.Domain.Shared.csproj

@ -22,6 +22,7 @@
<PackageReference Include="Volo.Abp.SettingManagement.Domain.Shared" Version="$(AbpVersion)" />
<ProjectReference Include="..\..\..\..\..\integration\EasyAbp.EShop\src\EasyAbp.EShop.Domain.Shared\EasyAbp.EShop.Domain.Shared.csproj" />
<ProjectReference Include="..\..\..\..\..\plugins\Baskets\src\EasyAbp.EShop.Plugins.Baskets.Domain.Shared\EasyAbp.EShop.Plugins.Baskets.Domain.Shared.csproj" />
<ProjectReference Include="..\..\..\..\..\plugins\Booking\src\EasyAbp.EShop.Plugins.Booking.Domain.Shared\EasyAbp.EShop.Plugins.Booking.Domain.Shared.csproj" />
<ProjectReference Include="..\..\..\..\..\plugins\Coupons\src\EasyAbp.EShop.Plugins.Coupons.Domain.Shared\EasyAbp.EShop.Plugins.Coupons.Domain.Shared.csproj" />
</ItemGroup>

2
samples/EShopSample/aspnet-core/src/EShopSample.Domain.Shared/EShopSampleDomainSharedModule.cs

@ -1,5 +1,6 @@
using EasyAbp.EShop;
using EasyAbp.EShop.Plugins.Baskets;
using EasyAbp.EShop.Plugins.Booking;
using EasyAbp.EShop.Plugins.Coupons;
using EasyAbp.PaymentService;
using EasyAbp.PaymentService.Prepayment;
@ -31,6 +32,7 @@ namespace EShopSample
typeof(AbpTenantManagementDomainSharedModule),
typeof(EShopDomainSharedModule),
typeof(EShopPluginsBasketsDomainSharedModule),
typeof(EShopPluginsBookingDomainSharedModule),
typeof(EShopPluginsCouponsDomainSharedModule),
typeof(PaymentServiceDomainSharedModule),
typeof(PaymentServiceWeChatPayDomainSharedModule),

Some files were not shown because too many files changed in this diff

Loading…
Cancel
Save