fgfhgfhfhfh

This commit is contained in:
Adam 2024-06-21 15:11:44 +02:00
parent 3116489d3d
commit ef3596325b
4 changed files with 11 additions and 8 deletions

View File

@ -4,6 +4,6 @@ namespace TIAM.Entities.Products;
public interface IProductsRelation public interface IProductsRelation
{ {
public List<UserProductMapping> UserProductMappings { get; set; } //public List<UserProductMapping> UserProductMappings { get; set; }
public List<Product> Products { get; set; } public List<Product> Products { get; set; }
} }

View File

@ -8,9 +8,9 @@ using TIAM.Entities.Users;
namespace TIAM.Entities.ServiceProviders; namespace TIAM.Entities.ServiceProviders;
[Table("ServiceProviders")] [Table("ServiceProviders")]
public class Company : AcCompany<User, UserToCompany, Profile, Address>, ICompany public class Company : AcCompany<User, UserToCompany, Profile, Address>, ICompany, IProductsRelation
{ {
public virtual List<Product> Products { get; } = new(); public virtual List<Product> Products { get; set; } = new();
public Company() public Company()
{ {

View File

@ -130,7 +130,7 @@
<ProfileGridComponent ProfileId="((Company)context.DataItem).ProfileId" KeyboardNavigationEnabled="true" /> <ProfileGridComponent ProfileId="((Company)context.DataItem).ProfileId" KeyboardNavigationEnabled="true" />
</DxTabPage> </DxTabPage>
<DxTabPage Text="Products"> <DxTabPage Text="Products">
<ProductDetailGridComponent ContextId="((Company)context.DataItem).Id" KeyboardNavigationEnabled="true" /> <ProductDetailGridComponent ProductGrid="" ParentData="(Company)context.DataItem" KeyboardNavigationEnabled="true" />
</DxTabPage> </DxTabPage>
<DxTabPage Text="Address"> <DxTabPage Text="Address">
<AddressDetailGridComponent ParentData="((Company)context.DataItem).Profile" KeyboardNavigationEnabled="true" /> <AddressDetailGridComponent ParentData="((Company)context.DataItem).Profile" KeyboardNavigationEnabled="true" />

View File

@ -23,8 +23,8 @@
@inject AdminSignalRClient AdminSignalRClient; @inject AdminSignalRClient AdminSignalRClient;
<ProductDetailGrid @ref="_productGrid" <ProductDetailGrid @ref="ProductGrid"
ContextId="ContextId" DataSource="ParentData.Products"
Logger="_logger" Logger="_logger"
SignalRClient="AdminSignalRClient" SignalRClient="AdminSignalRClient"
OnGridEditModelSaving="DataItemSaving" OnGridEditModelSaving="DataItemSaving"
@ -81,8 +81,9 @@
@code { @code {
[Parameter] public bool KeyboardNavigationEnabled { get; set; } [Parameter] public bool KeyboardNavigationEnabled { get; set; }
[Parameter] public Guid? ContextId { get; set; } [Parameter] public Guid? ContextId { get; set; }
[Parameter] public IProductsRelation ParentData { get; set; } = null!;
private ProductDetailGrid _productGrid = null!; public ProductDetailGrid ProductGrid = null!;
private LoggerClient<ProductDetailGridComponent> _logger = null!; private LoggerClient<ProductDetailGridComponent> _logger = null!;
protected override void OnInitialized() protected override void OnInitialized()
{ {
@ -96,7 +97,7 @@
{ {
_logger.Debug($"Saving: {args.DataItem.Name}, {args.DataItem.ServiceProviderId}"); _logger.Debug($"Saving: {args.DataItem.Name}, {args.DataItem.ServiceProviderId}");
_productGrid.SaveChangesAsync(); ProductGrid.SaveChangesAsync();
} }
private void DataItemSaving(GridEditModelSavingEventArgs e) private void DataItemSaving(GridEditModelSavingEventArgs e)
@ -112,6 +113,8 @@
((Product)e.EditModel).Profile.Address = new Address(); ((Product)e.EditModel).Profile.Address = new Address();
((Product)e.EditModel).Profile.AddressId = _addressId; ((Product)e.EditModel).Profile.AddressId = _addressId;
((Product)e.EditModel).Profile.Address.Id = _addressId; ((Product)e.EditModel).Profile.Address.Id = _addressId;
((Product)e.EditModel).UserProductMappings.Add(new UserProductMapping(Guid.NewGuid, ParentData.));