merge
This commit is contained in:
commit
35b26bd5be
|
|
@ -12,6 +12,7 @@ using TIAM.Entities.Users;
|
||||||
using TIAM.Models.Dtos.Users;
|
using TIAM.Models.Dtos.Users;
|
||||||
using TIAM.Entities.Transfers;
|
using TIAM.Entities.Transfers;
|
||||||
using AyCode.Core.Extensions;
|
using AyCode.Core.Extensions;
|
||||||
|
using TIAM.Entities.ServiceProviders;
|
||||||
|
|
||||||
namespace TIAM.Database.Test
|
namespace TIAM.Database.Test
|
||||||
{
|
{
|
||||||
|
|
@ -222,6 +223,48 @@ namespace TIAM.Database.Test
|
||||||
|
|
||||||
#endregion UserProductMapping
|
#endregion UserProductMapping
|
||||||
|
|
||||||
|
#region Product
|
||||||
|
//[DataTestMethod]
|
||||||
|
//[DataRow(["e24f6942-2210-47d7-8660-ace0ef302bae", "8e6a4170-0e15-4f8a-bdd2-46f9dbc63b93", "540271F6-C604-4C16-8160-D5A7CAFEDF00", "49c7805b-d8cd-4308-b1c5-7a54e5ee6287"])]
|
||||||
|
public async Task ProductCrudTest(string[] productIdCompanyIdUserIdUserToCompanyIdStrings)
|
||||||
|
{
|
||||||
|
var productId = Guid.Parse(productIdCompanyIdUserIdUserToCompanyIdStrings[0]);
|
||||||
|
var companyId = Guid.Parse(productIdCompanyIdUserIdUserToCompanyIdStrings[1]);
|
||||||
|
var userId = Guid.Parse(productIdCompanyIdUserIdUserToCompanyIdStrings[2]); //test@tiam.hu
|
||||||
|
var userToCompanyId = Guid.Parse(productIdCompanyIdUserIdUserToCompanyIdStrings[3]);
|
||||||
|
|
||||||
|
await Dal.RemoveProductAsync(productId); //kitöröljük a szemetet, ha korábbról bentmaradt - J.
|
||||||
|
|
||||||
|
var company = new Company(companyId, "Test unit company...", null);
|
||||||
|
|
||||||
|
Assert.IsTrue(await Dal.AddCompanyAsync(company));
|
||||||
|
Assert.IsNotNull(company);
|
||||||
|
|
||||||
|
company = await Dal.GetCompanyByIdAsync(companyId);
|
||||||
|
|
||||||
|
Assert.IsNotNull(company);
|
||||||
|
Assert.IsTrue(company.UserToServiceProviders.Count == 0);
|
||||||
|
Assert.IsTrue(company.Id == companyId);
|
||||||
|
|
||||||
|
company.OwnerId = userId;
|
||||||
|
Assert.IsTrue(await Dal.UpdateCompanyAsync(company));
|
||||||
|
|
||||||
|
company = await Dal.GetCompanyByIdAsync(companyId);
|
||||||
|
|
||||||
|
Assert.IsNotNull(company);
|
||||||
|
Assert.IsNotNull(company.UserToServiceProviders);
|
||||||
|
Assert.IsTrue(company.UserToServiceProviders.Any(x=>x.UserId == userId && x.ServiceProviderId == companyId));
|
||||||
|
|
||||||
|
company.CommissionPercent = 5;
|
||||||
|
Assert.IsTrue(await Dal.UpdateCompanyAsync(company));
|
||||||
|
|
||||||
|
Assert.IsTrue(await Dal.RemoveCompanyAsync(company)); //mielőbb kitöröljük, h ne maradjon szemét a db-ben - J.
|
||||||
|
|
||||||
|
company = await Dal.GetCompanyByIdAsync(companyId);
|
||||||
|
Assert.IsNull(company); //a korábbi törlés miatt NULL kell legyen - J.
|
||||||
|
}
|
||||||
|
#endregion Product
|
||||||
|
|
||||||
[DataTestMethod]
|
[DataTestMethod]
|
||||||
[DataRow("540271F6-C604-4C16-8160-D5A7CAFEDF00")]
|
[DataRow("540271F6-C604-4C16-8160-D5A7CAFEDF00")]
|
||||||
[DataRow("dcf451d2-cc4c-4ac2-8c1f-da00041be1fd")]
|
[DataRow("dcf451d2-cc4c-4ac2-8c1f-da00041be1fd")]
|
||||||
|
|
@ -297,6 +340,47 @@ namespace TIAM.Database.Test
|
||||||
Assert.IsTrue(users.Count > 0);
|
Assert.IsTrue(users.Count > 0);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
#region Company
|
||||||
|
[DataTestMethod]
|
||||||
|
[DataRow(["8e6a4170-0e15-4f8a-bdd2-46f9dbc63b93", "540271F6-C604-4C16-8160-D5A7CAFEDF00", "49c7805b-d8cd-4308-b1c5-7a54e5ee6287"])]
|
||||||
|
public async Task CompanyCrudTest(string[] companyIdUserIdUserToCompanyIdStrings)
|
||||||
|
{
|
||||||
|
var companyId = Guid.Parse(companyIdUserIdUserToCompanyIdStrings[0]);
|
||||||
|
var userId = Guid.Parse(companyIdUserIdUserToCompanyIdStrings[1]); //test@tiam.hu
|
||||||
|
var userToCompanyId = Guid.Parse(companyIdUserIdUserToCompanyIdStrings[2]);
|
||||||
|
|
||||||
|
await Dal.RemoveCompanyAsync(companyId); //kitöröljük a szemetet, ha korábbról bentmaradt - J.
|
||||||
|
|
||||||
|
var company = new Company(companyId, "Test unit company...", null);
|
||||||
|
|
||||||
|
Assert.IsTrue(await Dal.AddCompanyAsync(company));
|
||||||
|
Assert.IsNotNull(company);
|
||||||
|
|
||||||
|
company = await Dal.GetCompanyByIdAsync(companyId);
|
||||||
|
|
||||||
|
Assert.IsNotNull(company);
|
||||||
|
Assert.IsTrue(company.UserToServiceProviders.Count == 0);
|
||||||
|
Assert.IsTrue(company.Id == companyId);
|
||||||
|
|
||||||
|
company.OwnerId = userId;
|
||||||
|
Assert.IsTrue(await Dal.UpdateCompanyAsync(company));
|
||||||
|
|
||||||
|
company = await Dal.GetCompanyByIdAsync(companyId);
|
||||||
|
|
||||||
|
Assert.IsNotNull(company);
|
||||||
|
Assert.IsNotNull(company.UserToServiceProviders);
|
||||||
|
Assert.IsTrue(company.UserToServiceProviders.Any(x=>x.UserId == userId && x.ServiceProviderId == companyId));
|
||||||
|
|
||||||
|
company.CommissionPercent = 5;
|
||||||
|
Assert.IsTrue(await Dal.UpdateCompanyAsync(company));
|
||||||
|
|
||||||
|
Assert.IsTrue(await Dal.RemoveCompanyAsync(company)); //mielőbb kitöröljük, h ne maradjon szemét a db-ben - J.
|
||||||
|
|
||||||
|
company = await Dal.GetCompanyByIdAsync(companyId);
|
||||||
|
Assert.IsNull(company); //a korábbi törlés miatt NULL kell legyen - J.
|
||||||
|
}
|
||||||
|
#endregion Company
|
||||||
|
|
||||||
#region Transfer
|
#region Transfer
|
||||||
[DataTestMethod]
|
[DataTestMethod]
|
||||||
[DataRow("6216f9fb-1dda-44bd-9d85-431f3cb09fde")]
|
[DataRow("6216f9fb-1dda-44bd-9d85-431f3cb09fde")]
|
||||||
|
|
|
||||||
|
|
@ -36,6 +36,7 @@ namespace TIAM.Database.DataLayers.Admins
|
||||||
public Task<List<Car>> GetAllCarsAsync() => SessionAsync(ctx => ctx.Cars.OrderBy(x => x.Manufacture).ThenBy(x => x.CarModel).ToList());
|
public Task<List<Car>> GetAllCarsAsync() => SessionAsync(ctx => ctx.Cars.OrderBy(x => x.Manufacture).ThenBy(x => x.CarModel).ToList());
|
||||||
public Car? GetCarById(Guid carId) => Session(ctx => ctx.Cars.FirstOrDefault(x => x.Id == carId));
|
public Car? GetCarById(Guid carId) => Session(ctx => ctx.Cars.FirstOrDefault(x => x.Id == carId));
|
||||||
public List<Car> GetCarByUserProductMappingId(Guid userProductMappingId) => Session(ctx => ctx.Cars.Where(x => x.UserProductMappingId == userProductMappingId).ToList());
|
public List<Car> GetCarByUserProductMappingId(Guid userProductMappingId) => Session(ctx => ctx.Cars.Where(x => x.UserProductMappingId == userProductMappingId).ToList());
|
||||||
|
public Task<List<Car>> GetCarByUserProductMappingIdAsync(Guid userProductMappingId) => SessionAsync(ctx => ctx.Cars.Where(x => x.UserProductMappingId == userProductMappingId).ToList());
|
||||||
public Task<bool> AddCarAsync(Car car) => TransactionAsync(ctx => ctx.Cars.Add(car).State == EntityState.Added);
|
public Task<bool> AddCarAsync(Car car) => TransactionAsync(ctx => ctx.Cars.Add(car).State == EntityState.Added);
|
||||||
public Task<bool> UpdateCarAsync(Car car) => TransactionAsync(ctx => ctx.Cars.Update(car).State == EntityState.Modified);
|
public Task<bool> UpdateCarAsync(Car car) => TransactionAsync(ctx => ctx.Cars.Update(car).State == EntityState.Modified);
|
||||||
public Task<bool> RemoveCarAsync(Car car) => TransactionAsync(ctx => ctx.Cars.Remove(car).State == EntityState.Deleted);
|
public Task<bool> RemoveCarAsync(Car car) => TransactionAsync(ctx => ctx.Cars.Remove(car).State == EntityState.Deleted);
|
||||||
|
|
@ -118,18 +119,25 @@ namespace TIAM.Database.DataLayers.Admins
|
||||||
public Task<bool> RemoveUserAsync(Guid userId) => TransactionAsync(ctx => ctx.RemoveUser(userId));
|
public Task<bool> RemoveUserAsync(Guid userId) => TransactionAsync(ctx => ctx.RemoveUser(userId));
|
||||||
|
|
||||||
public Product? GetProductById(Guid contextId, bool includeUsers = true) => Session(ctx => ctx.GetProductById(contextId, includeUsers));
|
public Product? GetProductById(Guid contextId, bool includeUsers = true) => Session(ctx => ctx.GetProductById(contextId, includeUsers));
|
||||||
|
public Task<Product?> GetProductByIdAsync(Guid contextId, bool includeUsers = true) => SessionAsync(ctx => ctx.GetProductById(contextId, includeUsers));
|
||||||
|
|
||||||
public string GetProductsJson(bool includeUsers = true) => Session(ctx => ctx.ProductsWithUserRelations(includeUsers).ToJson());
|
public string GetProductsJson(bool includeUsers = true) => Session(ctx => ctx.ProductsWithUserRelations(includeUsers).ToJson());
|
||||||
public List<Product> GetProductsByServiceProviderId(Guid serviceProviderId, bool includeUsers = true) => Session(ctx => ctx.GetProductsByServiceProviderId(serviceProviderId, includeUsers).ToList());
|
public List<Product> GetProductsByServiceProviderId(Guid serviceProviderId, bool includeUsers = true) => Session(ctx => ctx.GetProductsByCompanyId(serviceProviderId, includeUsers).ToList());
|
||||||
public string GetProductsJsonByServiceProviderId(Guid serviceProviderId, bool includeUsers = true) => Session(ctx => ctx.GetProductsByServiceProviderId(serviceProviderId, includeUsers).ToJson());
|
public string GetProductsJsonByServiceProviderId(Guid serviceProviderId, bool includeUsers = true) => Session(ctx => ctx.GetProductsByCompanyId(serviceProviderId, includeUsers).ToJson());
|
||||||
public Task<bool> AddProductAsync(Product product) => TransactionAsync(ctx => ctx.AddProduct(product));
|
public Task<bool> AddProductAsync(Product product) => TransactionAsync(ctx => ctx.AddProduct(product));
|
||||||
|
|
||||||
public Task<bool> UpdateProductAsync(Product product) => TransactionAsync(ctx => ctx.UpdateProduct(product));
|
public Task<bool> UpdateProductAsync(Product product) => TransactionAsync(ctx => ctx.UpdateProduct(product));
|
||||||
public Task<bool> RemoveProductAsync(Product product) => TransactionAsync(ctx => ctx.RemoveProduct(product));
|
public Task<bool> RemoveProductAsync(Product product) => TransactionAsync(ctx => ctx.RemoveProduct(product));
|
||||||
|
public Task<bool> RemoveProductAsync(Guid productId) => TransactionAsync(ctx => ctx.RemoveProduct(productId));
|
||||||
|
|
||||||
public UserProductMapping? GetUserProductMappingById(Guid userProductMappingId, bool autoInclude = true) => Session(ctx => ctx.GetUserProductMappingById(userProductMappingId, autoInclude));
|
public UserProductMapping? GetUserProductMappingById(Guid userProductMappingId, bool autoInclude = true) => Session(ctx => ctx.GetUserProductMappingById(userProductMappingId, autoInclude));
|
||||||
public List<UserProductMapping>? GetAllUserProductMappings(bool autoInclude = true) => Session(ctx => ctx.UserProductMappings).ToList();
|
|
||||||
public Task<UserProductMapping?> GetUserProductMappingByIdAsync(Guid userProductMappingId, bool autoInclude = true) => SessionAsync(ctx => ctx.GetUserProductMappingById(userProductMappingId, autoInclude));
|
public Task<UserProductMapping?> GetUserProductMappingByIdAsync(Guid userProductMappingId, bool autoInclude = true) => SessionAsync(ctx => ctx.GetUserProductMappingById(userProductMappingId, autoInclude));
|
||||||
|
public List<UserProductMapping> GetUserProductMappingsByUserId(Guid userId, bool autoInclude = true) => Session(ctx => ctx.GetUserProductMappingsByUserId(userId, autoInclude).ToList());
|
||||||
|
public Task<List<UserProductMapping>> GetUserProductMappingsByUserIdAsync(Guid userId, bool autoInclude = true) => SessionAsync(ctx => ctx.GetUserProductMappingsByUserId(userId, autoInclude).ToList());
|
||||||
|
public Task<List<UserProductMapping>> GetUserProductMappingsByProductIdAsync(Guid productId, bool autoInclude = true) => SessionAsync(ctx => ctx.GetUserProductMappingsByProductId(productId, autoInclude).ToList());
|
||||||
|
public List<UserProductMapping> GetAllUserProductMappings(bool autoInclude = true) => Session(ctx => ctx.UserProductMappings).ToList();
|
||||||
|
public Task<List<UserProductMapping>> GetAllUserProductMappingsAsync(bool autoInclude = true) => SessionAsync(ctx => ctx.UserProductMappings.ToList());
|
||||||
|
|
||||||
|
|
||||||
public List<PermissionContextMapping> GetPermissionContextsView(Guid subjectId, Guid contextId)
|
public List<PermissionContextMapping> GetPermissionContextsView(Guid subjectId, Guid contextId)
|
||||||
=> Session(x => x.GetPermissionContextsView(subjectId, contextId).ToList());
|
=> Session(x => x.GetPermissionContextsView(subjectId, contextId).ToList());
|
||||||
|
|
@ -217,26 +225,17 @@ namespace TIAM.Database.DataLayers.Admins
|
||||||
|
|
||||||
#endregion EmailMessage
|
#endregion EmailMessage
|
||||||
|
|
||||||
|
#region ServiceProviders
|
||||||
//15. (IServiceProviderDataService) Create service provider
|
//15. (IServiceProviderDataService) Create service provider
|
||||||
public Task<bool> CreateServiceProviderAsync(Company serviceProvider) => TransactionAsync(ctx => ctx.AddServiceProvider<Company, Profile, Address>(serviceProvider));
|
public Task<bool> AddCompanyAsync(Company serviceProvider) => TransactionAsync(ctx => ctx.AddCompany<Company, Profile, Address>(serviceProvider));
|
||||||
|
|
||||||
//public bool CreateProductAsync(Product product)
|
public Task<List<Company>> GetCompaniesAsync() => SessionAsync(ctx => ctx.GetCompanies().ToList());
|
||||||
//{
|
|
||||||
// Context.CreateProduct(product);
|
|
||||||
// GlobalLogger.Info($@"Saving product to db {product.Id}, {product.Name}, {product.ServiceProviderId}");
|
|
||||||
// var result = Context.SaveChangesAsync();
|
|
||||||
// return result.Result > 0;
|
|
||||||
//}
|
|
||||||
|
|
||||||
public Task<List<Company>> GetServiceProvidersAsync() => SessionAsync(ctx => ctx.GetServiceProviders().ToList());
|
public Task<string> GetCompaniesJsonAsync() => SessionAsync(ctx => ctx.Companies.ToJson());
|
||||||
|
public string GetCompaniesJson() => Session(ctx => ctx.Companies.ToJson());
|
||||||
|
|
||||||
public Task<string> GetServiceProvidersJsonAsync() => SessionAsync(ctx => ctx.Companies.ToJson());
|
public virtual Task<Company?> GetCompanyByIdAsync(Guid id) => SessionAsync(ctx => ctx.GetCompanyById(id));
|
||||||
public string GetServiceProvidersJson() => Session(ctx => ctx.Companies.ToJson());
|
public virtual Task<List<Company>> GetCompaniesByOwnerIdAsync(Guid id) => SessionAsync(ctx => ctx.GetCompaniesByOwnerId(id));
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
public virtual Task<Company?> GetServiceProviderByIdAsync(Guid id) => SessionAsync(ctx => ctx.GetServiceProviderById(id));
|
|
||||||
public virtual Task<List<Company>> GetServiceProvidersByOwnerIdAsync(Guid id) => SessionAsync(ctx => ctx.GetServiceProvidersByOwnerId(id));
|
|
||||||
|
|
||||||
//public Task<UserProductMapping> CreateUserProductMappingAsync(UserProductMapping userProductMapping)
|
//public Task<UserProductMapping> CreateUserProductMappingAsync(UserProductMapping userProductMapping)
|
||||||
//{
|
//{
|
||||||
|
|
@ -245,17 +244,12 @@ namespace TIAM.Database.DataLayers.Admins
|
||||||
// return Context.SaveChangesAsync().ContinueWith(x => userProductMapping);
|
// return Context.SaveChangesAsync().ContinueWith(x => userProductMapping);
|
||||||
//}
|
//}
|
||||||
|
|
||||||
#region ServiceProviders
|
|
||||||
|
|
||||||
//14. (IserviceProviderDataService) Update service provider
|
//14. (IserviceProviderDataService) Update service provider
|
||||||
public Task<bool> UpdateCompanyAsync(Company company) => TransactionAsync(ctx => ctx.UpdateServiceProvider<Company, Profile, Address>(company));
|
public Task<bool> UpdateCompanyAsync(Company company) => TransactionAsync(ctx => ctx.UpdateCompany(company));
|
||||||
|
|
||||||
|
|
||||||
//13. (IserviceProviderDataService) delete service provider
|
//13. (IserviceProviderDataService) delete service provider
|
||||||
public Task<bool> RemoveCompanyAsync(Guid id) => TransactionAsync(ctx => ctx.RemoveServiceProvider(id));
|
public Task<bool> RemoveCompanyAsync(Guid companyId) => TransactionAsync(ctx => ctx.RemoveProductsByCompanyId(companyId) && ctx.RemoveCompany(companyId));
|
||||||
public Task<bool> RemoveCompanyAsync(Company company) => TransactionAsync(ctx => ctx.RemoveServiceProvider(company));
|
|
||||||
|
|
||||||
|
|
||||||
|
public Task<bool> RemoveCompanyAsync(Company company) => RemoveCompanyAsync(company.Id);
|
||||||
#endregion
|
#endregion
|
||||||
|
|
||||||
#region PermissionTypes
|
#region PermissionTypes
|
||||||
|
|
@ -490,17 +484,6 @@ namespace TIAM.Database.DataLayers.Admins
|
||||||
|
|
||||||
#region Products
|
#region Products
|
||||||
|
|
||||||
//* 21. (IServiceProviderDataService) delete product
|
|
||||||
public Task<bool> DeleteProductByIdAsync(Guid productId)
|
|
||||||
{
|
|
||||||
return TransactionAsync(ctx =>
|
|
||||||
{
|
|
||||||
ctx.DeleteProductById(productId);
|
|
||||||
|
|
||||||
return true;
|
|
||||||
});
|
|
||||||
}
|
|
||||||
|
|
||||||
//4. (IPermissionService) AssignPermissionToUserForContextAsync
|
//4. (IPermissionService) AssignPermissionToUserForContextAsync
|
||||||
public Task<bool> AssignPermissionToUserForContextAsync(UserProductMapping userProductMapping, PermissionsType permission)
|
public Task<bool> AssignPermissionToUserForContextAsync(UserProductMapping userProductMapping, PermissionsType permission)
|
||||||
{
|
{
|
||||||
|
|
@ -529,13 +512,6 @@ namespace TIAM.Database.DataLayers.Admins
|
||||||
|
|
||||||
#region UserProductMappings
|
#region UserProductMappings
|
||||||
|
|
||||||
//23. (IServiceProviderDataService) Get Assigned Users By ProductId
|
|
||||||
public Task<List<UserProductMapping>> GetUserProductMappingsByProductIdAsync(Guid productId)
|
|
||||||
{
|
|
||||||
return Context.UserProductMappings.Where(x => x.ProductId == productId).ToListAsync();
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
//24 . (IServiceProviderDataService) Remove Assigned Users By Product Id
|
//24 . (IServiceProviderDataService) Remove Assigned Users By Product Id
|
||||||
public Task RemoveUserProductMappingsByContextId(Guid productId)
|
public Task RemoveUserProductMappingsByContextId(Guid productId)
|
||||||
{
|
{
|
||||||
|
|
|
||||||
|
|
@ -21,6 +21,7 @@ namespace TIAM.Database.DbContexts.Admins
|
||||||
public DbSet<User> Users { get; set; }
|
public DbSet<User> Users { get; set; }
|
||||||
public DbSet<Profile> Profiles { get; set; }
|
public DbSet<Profile> Profiles { get; set; }
|
||||||
public DbSet<Company> Companies { get; set; }
|
public DbSet<Company> Companies { get; set; }
|
||||||
|
public DbSet<UserToCompany> UserToCompanies { get; set; }
|
||||||
public DbSet<UserToken> UserTokens { get; set; }
|
public DbSet<UserToken> UserTokens { get; set; }
|
||||||
|
|
||||||
public DbSet<TransferDestination> TransferDestinations { get; set; }
|
public DbSet<TransferDestination> TransferDestinations { get; set; }
|
||||||
|
|
|
||||||
|
|
@ -93,39 +93,39 @@ namespace TIAM.Database.DbContexts.Admins
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
public static bool CreateProduct(this IAdminDbContext ctx, Product myproduct)
|
//public static bool CreateProduct(this IAdminDbContext ctx, Product myproduct)
|
||||||
{
|
//{
|
||||||
if (myproduct == null) return false;
|
// if (myproduct == null) return false;
|
||||||
|
|
||||||
//Automatically add assigneduser for owner
|
// //Automatically add assigneduser for owner
|
||||||
Company? company = ctx.Companies.FirstOrDefault(x => x.Id == myproduct.ServiceProviderId);
|
// Company? company = ctx.Companies.FirstOrDefault(x => x.Id == myproduct.ServiceProviderId);
|
||||||
if (company == null || company.OwnerId.IsNullOrEmpty()) return false;
|
// if (company == null || company.OwnerId.IsNullOrEmpty()) return false;
|
||||||
|
|
||||||
var userProductMapping = new UserProductMapping(myproduct.Id, company.OwnerId.Value);
|
// var userProductMapping = new UserProductMapping(myproduct.Id, company.OwnerId.Value);
|
||||||
|
|
||||||
ctx.CreateAssignedUser(userProductMapping);
|
// ctx.CreateAssignedUser(userProductMapping);
|
||||||
ctx.AddProduct(myproduct);
|
// ctx.AddProduct(myproduct);
|
||||||
|
|
||||||
return true;
|
// return true;
|
||||||
}
|
//}
|
||||||
|
|
||||||
public static bool CreateAssignedUser(this IAdminDbContext ctx, UserProductMapping userProductMapping)
|
//public static bool CreateAssignedUser(this IAdminDbContext ctx, UserProductMapping userProductMapping)
|
||||||
{
|
//{
|
||||||
if (userProductMapping == null) return false;
|
// if (userProductMapping == null) return false;
|
||||||
|
|
||||||
ctx.UserProductMappings.Add(userProductMapping);
|
// ctx.UserProductMappings.Add(userProductMapping);
|
||||||
|
|
||||||
return true;
|
// return true;
|
||||||
}
|
//}
|
||||||
|
|
||||||
public static Company CreateServiceProvider(this IAdminDbContext ctx, Company serviceProvider)
|
//public static Company CreateServiceProvider(this IAdminDbContext ctx, Company serviceProvider)
|
||||||
{
|
//{
|
||||||
if (serviceProvider == null || serviceProvider.OwnerId.IsNullOrEmpty()) return null;
|
// if (serviceProvider == null || serviceProvider.OwnerId.IsNullOrEmpty()) return null;
|
||||||
|
|
||||||
ctx.Companies.Add(serviceProvider);
|
// ctx.Companies.Add(serviceProvider);
|
||||||
var userProductMapping = new UserProductMapping(serviceProvider.Id, serviceProvider.OwnerId.Value);
|
// var userProductMapping = new UserProductMapping(serviceProvider.Id, serviceProvider.OwnerId.Value);
|
||||||
ctx.CreateAssignedUser(userProductMapping);
|
// ctx.CreateAssignedUser(userProductMapping);
|
||||||
return serviceProvider;
|
// return serviceProvider;
|
||||||
}
|
//}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -17,6 +17,7 @@ namespace TIAM.Database.DbContexts.ServiceProviders
|
||||||
public DbSet<TransferDestinationToProduct> TransferDestinationToProducts { get; set; }
|
public DbSet<TransferDestinationToProduct> TransferDestinationToProducts { get; set; }
|
||||||
|
|
||||||
public DbSet<Company> Companies { get; set; }
|
public DbSet<Company> Companies { get; set; }
|
||||||
|
public DbSet<UserToCompany> UserToCompanies { get; set; }
|
||||||
public DbSet<Profile> Profiles { get; set; }
|
public DbSet<Profile> Profiles { get; set; }
|
||||||
|
|
||||||
public DbSet<User> Users { get; set; }
|
public DbSet<User> Users { get; set; }
|
||||||
|
|
|
||||||
|
|
@ -1,9 +1,12 @@
|
||||||
using Microsoft.EntityFrameworkCore;
|
using Microsoft.EntityFrameworkCore;
|
||||||
|
using TIAM.Database.DbSets.Profiles;
|
||||||
|
using TIAM.Database.DbSets.Users;
|
||||||
|
using TIAM.Entities.Addresses;
|
||||||
using TIAM.Entities.Products;
|
using TIAM.Entities.Products;
|
||||||
|
|
||||||
namespace TIAM.Database.DbSets.Products;
|
namespace TIAM.Database.DbSets.Products;
|
||||||
|
|
||||||
public interface IProductDbSet
|
public interface IProductDbSet : IProfileDbSet, IUserProductMappingDbSet
|
||||||
{
|
{
|
||||||
public DbSet<Product> Products { get; set; }
|
public DbSet<Product> Products { get; set; }
|
||||||
}
|
}
|
||||||
|
|
@ -1,6 +1,11 @@
|
||||||
using AyCode.Core.Extensions;
|
using AyCode.Core.Extensions;
|
||||||
|
using AyCode.Database.DbSets.Profiles;
|
||||||
|
using AyCode.Interfaces.Addresses;
|
||||||
|
using AyCode.Interfaces.Profiles;
|
||||||
using Microsoft.EntityFrameworkCore;
|
using Microsoft.EntityFrameworkCore;
|
||||||
|
using TIAM.Entities.Addresses;
|
||||||
using TIAM.Entities.Products;
|
using TIAM.Entities.Products;
|
||||||
|
using TIAM.Entities.Profiles;
|
||||||
|
|
||||||
namespace TIAM.Database.DbSets.Products;
|
namespace TIAM.Database.DbSets.Products;
|
||||||
|
|
||||||
|
|
@ -19,8 +24,29 @@ public static class ProductDbSetExtensions
|
||||||
=> ctx.Products.Update(product).State == EntityState.Modified;
|
=> ctx.Products.Update(product).State == EntityState.Modified;
|
||||||
|
|
||||||
public static bool RemoveProduct(this IProductDbSet ctx, Product product)
|
public static bool RemoveProduct(this IProductDbSet ctx, Product product)
|
||||||
=> ctx.Products.Remove(product).State == EntityState.Deleted;
|
{
|
||||||
|
ctx.RemoveProfile(product.ProfileId);
|
||||||
|
ctx.UserProductMappings.RemoveRange(ctx.UserProductMappings.Where(x => x.ProductId == product.Id));
|
||||||
|
//TODO: Transfer, etc... - J.
|
||||||
|
|
||||||
|
return ctx.Products.Remove(product).State == EntityState.Deleted;
|
||||||
|
}
|
||||||
|
|
||||||
|
public static bool RemoveProduct(this IProductDbSet ctx, Guid productId)
|
||||||
|
{
|
||||||
|
var product = ctx.GetProductById(productId);
|
||||||
|
return product == null || ctx.RemoveProduct(product);
|
||||||
|
}
|
||||||
|
|
||||||
|
public static bool RemoveProductsByCompanyId(this IProductDbSet ctx, Guid companyId)
|
||||||
|
{
|
||||||
|
var products = ctx.GetProductsByCompanyId(companyId);
|
||||||
|
|
||||||
|
foreach (var product in products)
|
||||||
|
ctx.RemoveProduct(product);
|
||||||
|
|
||||||
|
return true;
|
||||||
|
}
|
||||||
#endregion Add, Update, Remove
|
#endregion Add, Update, Remove
|
||||||
|
|
||||||
public static IQueryable<Product> ProductsWithUserRelations(this IProductDbSet ctx, bool autoInclude = true)
|
public static IQueryable<Product> ProductsWithUserRelations(this IProductDbSet ctx, bool autoInclude = true)
|
||||||
|
|
@ -33,7 +59,7 @@ public static class ProductDbSetExtensions
|
||||||
public static Product? GetProductById(this IProductDbSet ctx, Guid productId, bool includeUsers = true)
|
public static Product? GetProductById(this IProductDbSet ctx, Guid productId, bool includeUsers = true)
|
||||||
=> ctx.ProductsWithUserRelations(includeUsers).FirstOrDefault(x => x.Id == productId);
|
=> ctx.ProductsWithUserRelations(includeUsers).FirstOrDefault(x => x.Id == productId);
|
||||||
|
|
||||||
public static IQueryable<Product> GetProductsByServiceProviderId(this IProductDbSet ctx, Guid serviceProviderId, bool includeUsers = true)
|
public static IQueryable<Product> GetProductsByCompanyId(this IProductDbSet ctx, Guid serviceProviderId, bool includeUsers = true)
|
||||||
=> ctx.ProductsWithUserRelations(includeUsers).Where(x => x.ServiceProviderId == serviceProviderId);
|
=> ctx.ProductsWithUserRelations(includeUsers).Where(x => x.ServiceProviderId == serviceProviderId);
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
@ -0,0 +1,10 @@
|
||||||
|
using AyCode.Database.DbSets.Profiles;
|
||||||
|
using TIAM.Database.DbSets.Addresses;
|
||||||
|
using TIAM.Entities.Addresses;
|
||||||
|
using TIAM.Entities.Profiles;
|
||||||
|
|
||||||
|
namespace TIAM.Database.DbSets.Profiles;
|
||||||
|
|
||||||
|
public interface IProfileDbSet : IAcProfileDbSetBase<Profile, Address>, IAddressDbSet
|
||||||
|
{
|
||||||
|
}
|
||||||
|
|
@ -2,9 +2,10 @@
|
||||||
using TIAM.Entities.Addresses;
|
using TIAM.Entities.Addresses;
|
||||||
using TIAM.Entities.Profiles;
|
using TIAM.Entities.Profiles;
|
||||||
using TIAM.Entities.ServiceProviders;
|
using TIAM.Entities.ServiceProviders;
|
||||||
|
using TIAM.Entities.Users;
|
||||||
|
|
||||||
namespace TIAM.Database.DbSets.ServiceProvider;
|
namespace TIAM.Database.DbSets.ServiceProvider;
|
||||||
|
|
||||||
public interface ICompanyDbSet : IAcCompanyDbSetBase<Company, Profile, Address>
|
public interface ICompanyDbSet : IAcCompanyDbSetBase<Company, Profile, Address, UserToCompany>
|
||||||
{
|
{
|
||||||
}
|
}
|
||||||
|
|
@ -7,6 +7,7 @@
|
||||||
</PropertyGroup>
|
</PropertyGroup>
|
||||||
|
|
||||||
<ItemGroup>
|
<ItemGroup>
|
||||||
|
<PackageReference Include="MessagePack.Annotations" Version="2.5.168" />
|
||||||
<PackageReference Include="Microsoft.EntityFrameworkCore" Version="8.0.6" />
|
<PackageReference Include="Microsoft.EntityFrameworkCore" Version="8.0.6" />
|
||||||
<PackageReference Include="Microsoft.EntityFrameworkCore.Proxies" Version="8.0.6" />
|
<PackageReference Include="Microsoft.EntityFrameworkCore.Proxies" Version="8.0.6" />
|
||||||
<PackageReference Include="Microsoft.EntityFrameworkCore.SqlServer" Version="8.0.6" />
|
<PackageReference Include="Microsoft.EntityFrameworkCore.SqlServer" Version="8.0.6" />
|
||||||
|
|
|
||||||
|
|
@ -19,10 +19,11 @@ public class SignalRTags : AcSignalRTags
|
||||||
|
|
||||||
public const int GetCompany = 12;
|
public const int GetCompany = 12;
|
||||||
public const int GetCompanies = 13;
|
public const int GetCompanies = 13;
|
||||||
public const int GetCompaniesByContextId = 14;
|
public const int GetCompaniesById = 14;
|
||||||
public const int UpdateCompany = 15;
|
public const int GetCompaniesByContextId = 15;
|
||||||
public const int AddCompany = 16;
|
public const int UpdateCompany = 16;
|
||||||
public const int RemoveCompany = 17;
|
public const int AddCompany = 17;
|
||||||
|
public const int RemoveCompany = 18;
|
||||||
|
|
||||||
public const int GetTransferToDriver = 22;
|
public const int GetTransferToDriver = 22;
|
||||||
//public const int GetTransferToDrivers = 23;
|
//public const int GetTransferToDrivers = 23;
|
||||||
|
|
@ -53,6 +54,7 @@ public class SignalRTags : AcSignalRTags
|
||||||
public const int GetUserProductMappingsByProductId = 44;
|
public const int GetUserProductMappingsByProductId = 44;
|
||||||
public const int GetUserProductMappingsByUserId = 45;
|
public const int GetUserProductMappingsByUserId = 45;
|
||||||
public const int GetUserProductMappingById = 46;
|
public const int GetUserProductMappingById = 46;
|
||||||
|
public const int GetUserProductMappingsById = 47;
|
||||||
|
|
||||||
public const int GetCarsForUserProductMapping = 50;
|
public const int GetCarsForUserProductMapping = 50;
|
||||||
public const int CreateCar = 51;
|
public const int CreateCar = 51;
|
||||||
|
|
|
||||||
|
|
@ -225,7 +225,6 @@ else
|
||||||
<div class="card-footer p-4">
|
<div class="card-footer p-4">
|
||||||
<div class="d-flex justify-content-between">
|
<div class="d-flex justify-content-between">
|
||||||
<DxButton Click="@((e) => UpdateTransferEventHandler(e, true))">Save Changes</DxButton>
|
<DxButton Click="@((e) => UpdateTransferEventHandler(e, true))">Save Changes</DxButton>
|
||||||
|
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
|
|
@ -234,8 +233,6 @@ else
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
</section>
|
</section>
|
||||||
|
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
</DxTabPage>
|
</DxTabPage>
|
||||||
|
|
|
||||||
|
|
@ -29,14 +29,14 @@
|
||||||
OnGridEditModelSaving="DataItemSaving"
|
OnGridEditModelSaving="DataItemSaving"
|
||||||
OnGridItemDeleting="DataItemDeleting"
|
OnGridItemDeleting="DataItemDeleting"
|
||||||
OnGridItemChanged="DataItemChanged"
|
OnGridItemChanged="DataItemChanged"
|
||||||
PageSize="5"
|
|
||||||
AutoExpandAllGroupRows="true"
|
|
||||||
KeyboardNavigationEnabled="KeyboardNavigationEnabled"
|
KeyboardNavigationEnabled="KeyboardNavigationEnabled"
|
||||||
KeyFieldName="Id"
|
KeyFieldName="Id"
|
||||||
ValidationEnabled="false"
|
ValidationEnabled="false"
|
||||||
|
TextWrapEnabled="false"
|
||||||
|
AutoExpandAllGroupRows="true"
|
||||||
EditMode="GridEditMode.EditForm"
|
EditMode="GridEditMode.EditForm"
|
||||||
ColumnResizeMode="GridColumnResizeMode.NextColumn"
|
ColumnResizeMode="GridColumnResizeMode.NextColumn"
|
||||||
ShowFilterRow="false">
|
DetailExpandButtonDisplayMode="DetailExpandButtonDisplayMode">
|
||||||
<Columns>
|
<Columns>
|
||||||
<DxGridCommandColumn NewButtonVisible="false" DeleteButtonVisible="false" Width="70" MinWidth="70" FixedPosition="GridColumnFixedPosition.Left" />
|
<DxGridCommandColumn NewButtonVisible="false" DeleteButtonVisible="false" Width="70" MinWidth="70" FixedPosition="GridColumnFixedPosition.Left" />
|
||||||
<DxGridDataColumn FieldName="Id" GroupIndex="0" ShowInColumnChooser="AcDomain.IsDeveloperVersion" Visible="AcDomain.IsDeveloperVersion" DisplayFormat="N" />
|
<DxGridDataColumn FieldName="Id" GroupIndex="0" ShowInColumnChooser="AcDomain.IsDeveloperVersion" Visible="AcDomain.IsDeveloperVersion" DisplayFormat="N" />
|
||||||
|
|
@ -62,6 +62,7 @@
|
||||||
[Parameter] public IAcAddressRelation<Address> ParentData { get; set; } = null!;
|
[Parameter] public IAcAddressRelation<Address> ParentData { get; set; } = null!;
|
||||||
[Parameter] public IList<Address>? DataSource { get; set; }
|
[Parameter] public IList<Address>? DataSource { get; set; }
|
||||||
[Parameter] public EventCallback<Address> OnAddressChanged { get; set; }
|
[Parameter] public EventCallback<Address> OnAddressChanged { get; set; }
|
||||||
|
[Parameter] public GridDetailExpandButtonDisplayMode DetailExpandButtonDisplayMode { get; set; } = GridDetailExpandButtonDisplayMode.Never;
|
||||||
|
|
||||||
private Guid? _contextId = null!;
|
private Guid? _contextId = null!;
|
||||||
private AddressDetailGrid _addressGrid = null!;
|
private AddressDetailGrid _addressGrid = null!;
|
||||||
|
|
|
||||||
|
|
@ -18,7 +18,7 @@
|
||||||
|
|
||||||
|
|
||||||
<CarDetailGrid Logger="_logger"
|
<CarDetailGrid Logger="_logger"
|
||||||
ContextIds="ContextIds"
|
ContextIds="new [] {ContextId}"
|
||||||
GetAllMessageTag="GetAllTag"
|
GetAllMessageTag="GetAllTag"
|
||||||
SignalRClient="AdminSignalRClient"
|
SignalRClient="AdminSignalRClient"
|
||||||
PageSize="10"
|
PageSize="10"
|
||||||
|
|
@ -29,10 +29,11 @@
|
||||||
CustomizeEditModel="CustomizeEditModel"
|
CustomizeEditModel="CustomizeEditModel"
|
||||||
EditMode="GridEditMode.EditForm"
|
EditMode="GridEditMode.EditForm"
|
||||||
ColumnResizeMode="GridColumnResizeMode.NextColumn"
|
ColumnResizeMode="GridColumnResizeMode.NextColumn"
|
||||||
|
DetailExpandButtonDisplayMode="DetailExpandButtonDisplayMode"
|
||||||
ShowFilterRow="true">
|
ShowFilterRow="true">
|
||||||
<Columns>
|
<Columns>
|
||||||
<DxGridCommandColumn NewButtonVisible="true" Width="8%" FixedPosition="GridColumnFixedPosition.Left" />
|
<DxGridCommandColumn Width="135" MinWidth="135" FixedPosition="GridColumnFixedPosition.Left" />
|
||||||
<DxGridDataColumn FieldName="Id" ShowInColumnChooser="AcDomain.IsDeveloperVersion" Visible="AcDomain.IsDeveloperVersion" />
|
<DxGridDataColumn FieldName="Id" SortIndex="0" ShowInColumnChooser="AcDomain.IsDeveloperVersion" Visible="AcDomain.IsDeveloperVersion" DisplayFormat="N" />
|
||||||
<DxGridDataColumn FieldName="UserProductMappingId" />
|
<DxGridDataColumn FieldName="UserProductMappingId" />
|
||||||
<DxGridDataColumn FieldName="CountryCode"/>
|
<DxGridDataColumn FieldName="CountryCode"/>
|
||||||
<DxGridDataColumn FieldName="LicencePlate"/>
|
<DxGridDataColumn FieldName="LicencePlate"/>
|
||||||
|
|
@ -45,88 +46,65 @@
|
||||||
</Columns>
|
</Columns>
|
||||||
<DetailRowTemplate>
|
<DetailRowTemplate>
|
||||||
@{
|
@{
|
||||||
if (ShowNestedRows)
|
<DxTabs>
|
||||||
{
|
|
||||||
<DxTabs>
|
|
||||||
|
|
||||||
<DxTabPage Text="Driving permissions assigned">
|
<DxTabPage Text="Driving permissions assigned">
|
||||||
<UserProductMappingGridComponent GetAllTag="SignalRTags.GetUserProductMappingById" ContextId="((Car)context.DataItem).UserProductMappingId" KeyboardNavigationEnabled="true" />
|
<UserProductMappingGridComponent GetAllTag="SignalRTags.GetUserProductMappingsById" ContextIds="new[] { ((Car)context.DataItem).UserProductMappingId }" KeyboardNavigationEnabled="true"/>
|
||||||
</DxTabPage>
|
</DxTabPage>
|
||||||
|
|
||||||
</DxTabs>
|
</DxTabs>
|
||||||
}
|
|
||||||
}
|
}
|
||||||
</DetailRowTemplate>
|
</DetailRowTemplate>
|
||||||
|
|
||||||
<EditFormTemplate Context="UserEditFormContext">
|
<EditFormTemplate Context="userEditFormContext">
|
||||||
@{
|
@{
|
||||||
var car = (Car)UserEditFormContext.EditModel;
|
var car = (Car)userEditFormContext.EditModel;
|
||||||
}
|
}
|
||||||
<DxFormLayout CssClass="w-100">
|
<DxFormLayout CssClass="w-100">
|
||||||
<DxFormLayoutItem Caption="Country code" ColSpanMd="4">
|
<DxFormLayoutItem Caption="Country code" ColSpanMd="4">
|
||||||
@UserEditFormContext.GetEditor("CountryCode")
|
@userEditFormContext.GetEditor("CountryCode")
|
||||||
</DxFormLayoutItem>
|
</DxFormLayoutItem>
|
||||||
<DxFormLayoutItem Caption="Licence plate" ColSpanMd="4">
|
<DxFormLayoutItem Caption="Licence plate" ColSpanMd="4">
|
||||||
@UserEditFormContext.GetEditor("LicencePlate")
|
@userEditFormContext.GetEditor("LicencePlate")
|
||||||
</DxFormLayoutItem>
|
</DxFormLayoutItem>
|
||||||
<DxFormLayoutItem Caption="Color" ColSpanMd="4">
|
<DxFormLayoutItem Caption="Color" ColSpanMd="4">
|
||||||
@UserEditFormContext.GetEditor("Color")
|
@userEditFormContext.GetEditor("Color")
|
||||||
</DxFormLayoutItem>
|
</DxFormLayoutItem>
|
||||||
<DxFormLayoutItem Caption="Manufacturer" ColSpanMd="4">
|
<DxFormLayoutItem Caption="Manufacturer" ColSpanMd="4">
|
||||||
@UserEditFormContext.GetEditor("Manufacture")
|
@userEditFormContext.GetEditor("Manufacture")
|
||||||
</DxFormLayoutItem>
|
</DxFormLayoutItem>
|
||||||
<DxFormLayoutItem Caption="Car model" ColSpanMd="4">
|
<DxFormLayoutItem Caption="Car model" ColSpanMd="4">
|
||||||
@UserEditFormContext.GetEditor("CarModel")
|
@userEditFormContext.GetEditor("CarModel")
|
||||||
</DxFormLayoutItem>
|
</DxFormLayoutItem>
|
||||||
<DxFormLayoutItem Caption="Year of make" ColSpanMd="4">
|
<DxFormLayoutItem Caption="Year of make" ColSpanMd="4">
|
||||||
@UserEditFormContext.GetEditor("YearOfMake")
|
@userEditFormContext.GetEditor("YearOfMake")
|
||||||
</DxFormLayoutItem>
|
</DxFormLayoutItem>
|
||||||
<DxFormLayoutItem Caption="Seat number" ColSpanMd="4">
|
<DxFormLayoutItem Caption="Seat number" ColSpanMd="4">
|
||||||
@UserEditFormContext.GetEditor("SeatNumber")
|
@userEditFormContext.GetEditor("SeatNumber")
|
||||||
</DxFormLayoutItem>
|
</DxFormLayoutItem>
|
||||||
<DxFormLayoutItem Caption="Motor type" ColSpanMd="4">
|
<DxFormLayoutItem Caption="Motor type" ColSpanMd="4">
|
||||||
@UserEditFormContext.GetEditor("CarMotorType")
|
@userEditFormContext.GetEditor("CarMotorType")
|
||||||
</DxFormLayoutItem>
|
</DxFormLayoutItem>
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
</DxFormLayout>
|
</DxFormLayout>
|
||||||
</EditFormTemplate>
|
</EditFormTemplate>
|
||||||
|
|
||||||
</CarDetailGrid>
|
</CarDetailGrid>
|
||||||
|
|
||||||
@code {
|
@code {
|
||||||
[Parameter]
|
[Parameter] public Guid ContextId { get; set; }
|
||||||
public bool KeyboardNavigationEnabled { get; set; }
|
[Parameter] public bool KeyboardNavigationEnabled { get; set; }
|
||||||
|
|
||||||
[Parameter] public ICarRelation ParentData { get; set; } = null!;
|
[Parameter] public ICarRelation ParentData { get; set; } = null!;
|
||||||
|
|
||||||
[Parameter] public int GetAllTag { get; set; } = SignalRTags.GetAllCars;
|
[Parameter] public int GetAllTag { get; set; } = SignalRTags.GetAllCars;
|
||||||
|
[Parameter] public GridDetailExpandButtonDisplayMode DetailExpandButtonDisplayMode { get; set; } = GridDetailExpandButtonDisplayMode.Never;
|
||||||
|
|
||||||
[Parameter] public bool ShowNestedRows { get; set; } = false;
|
private LoggerClient<CarDetailGridComponent> _logger = null!;
|
||||||
|
|
||||||
[Parameter] public Guid? ContextId { get; set; }
|
protected override void OnInitialized()
|
||||||
|
|
||||||
private Guid[] ContextIds = new Guid[0];
|
|
||||||
|
|
||||||
private LoggerClient<CarDetailGridComponent> _logger;
|
|
||||||
|
|
||||||
protected override void OnParametersSet()
|
|
||||||
{
|
|
||||||
if (ContextId != null)
|
|
||||||
{
|
|
||||||
ContextIds = new Guid[1];
|
|
||||||
ContextIds[0] = (Guid)ContextId;
|
|
||||||
}
|
|
||||||
base.OnParametersSet();
|
|
||||||
}
|
|
||||||
|
|
||||||
protected override async Task OnInitializedAsync()
|
|
||||||
{
|
{
|
||||||
_logger = new LoggerClient<CarDetailGridComponent>(LogWriters.ToArray());
|
_logger = new LoggerClient<CarDetailGridComponent>(LogWriters.ToArray());
|
||||||
|
|
||||||
|
base.OnInitialized();
|
||||||
//_logger.Info($"DetailGridData: {_detailGridData.Count}");
|
|
||||||
}
|
}
|
||||||
|
|
||||||
void CustomizeEditModel(GridCustomizeEditModelEventArgs e)
|
void CustomizeEditModel(GridCustomizeEditModelEventArgs e)
|
||||||
|
|
@ -134,53 +112,25 @@
|
||||||
if (e.IsNew)
|
if (e.IsNew)
|
||||||
{
|
{
|
||||||
var newCar = new Car
|
var newCar = new Car
|
||||||
{
|
{
|
||||||
Id = Guid.NewGuid(),
|
Id = Guid.NewGuid(),
|
||||||
UserProductMappingId = (Guid)ContextId,
|
UserProductMappingId = ContextId!,
|
||||||
CountryCode = 1,
|
CountryCode = 1,
|
||||||
LicencePlate = "ABC123",
|
LicencePlate = "ABC123",
|
||||||
Color = "White",
|
Color = "White",
|
||||||
Manufacture = "Manufacturer",
|
Manufacture = "Manufacturer",
|
||||||
CarModel = "Car model",
|
CarModel = "Car model",
|
||||||
YearOfMake = DateTime.Now.Year,
|
YearOfMake = DateTime.Now.Year,
|
||||||
SeatNumber = 5,
|
SeatNumber = 5,
|
||||||
CarMotorType = TIAM.Core.Enums.CarMotorType.Electric
|
CarMotorType = TIAM.Core.Enums.CarMotorType.Electric
|
||||||
};
|
};
|
||||||
|
|
||||||
e.EditModel = newCar;
|
e.EditModel = newCar;
|
||||||
}
|
}
|
||||||
|
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
//
|
//
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
async Task EditModelSaving(GridEditModelSavingEventArgs e)
|
|
||||||
{
|
|
||||||
if (e.IsNew)
|
|
||||||
|
|
||||||
_logger.Info("New orderData added");
|
|
||||||
else
|
|
||||||
_logger.Info("orderData updated");
|
|
||||||
|
|
||||||
await UpdateDataAsync();
|
|
||||||
}
|
|
||||||
|
|
||||||
async Task DataItemDeleting(GridDataItemDeletingEventArgs e)
|
|
||||||
{
|
|
||||||
|
|
||||||
_logger.Info("orderData deleted");
|
|
||||||
|
|
||||||
}
|
|
||||||
|
|
||||||
async Task UpdateDataAsync()
|
|
||||||
{
|
|
||||||
//refresh grid
|
|
||||||
_logger.Info("orderData grid refreshed");
|
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
@ -18,7 +18,7 @@
|
||||||
|
|
||||||
|
|
||||||
<CarGrid Logger="_logger"
|
<CarGrid Logger="_logger"
|
||||||
ContextIds="ContextIds"
|
ContextIds="new [] {ContextId}"
|
||||||
GetAllMessageTag="GetAllTag"
|
GetAllMessageTag="GetAllTag"
|
||||||
SignalRClient="AdminSignalRClient"
|
SignalRClient="AdminSignalRClient"
|
||||||
PageSize="10"
|
PageSize="10"
|
||||||
|
|
@ -29,10 +29,11 @@
|
||||||
CustomizeEditModel="CustomizeEditModel"
|
CustomizeEditModel="CustomizeEditModel"
|
||||||
EditMode="GridEditMode.EditForm"
|
EditMode="GridEditMode.EditForm"
|
||||||
ColumnResizeMode="GridColumnResizeMode.NextColumn"
|
ColumnResizeMode="GridColumnResizeMode.NextColumn"
|
||||||
|
DetailExpandButtonDisplayMode="DetailExpandButtonDisplayMode"
|
||||||
ShowFilterRow="true">
|
ShowFilterRow="true">
|
||||||
<Columns>
|
<Columns>
|
||||||
<DxGridCommandColumn NewButtonVisible="true" Width="8%" FixedPosition="GridColumnFixedPosition.Left" />
|
<DxGridCommandColumn Width="135" MinWidth="135" FixedPosition="GridColumnFixedPosition.Left" />
|
||||||
<DxGridDataColumn FieldName="Id" ShowInColumnChooser="AcDomain.IsDeveloperVersion" Visible="AcDomain.IsDeveloperVersion" />
|
<DxGridDataColumn FieldName="Id" SortIndex="0" ShowInColumnChooser="AcDomain.IsDeveloperVersion" Visible="AcDomain.IsDeveloperVersion" DisplayFormat="N" />
|
||||||
<DxGridDataColumn FieldName="UserProductMappingId" />
|
<DxGridDataColumn FieldName="UserProductMappingId" />
|
||||||
<DxGridDataColumn FieldName="CountryCode"/>
|
<DxGridDataColumn FieldName="CountryCode"/>
|
||||||
<DxGridDataColumn FieldName="LicencePlate"/>
|
<DxGridDataColumn FieldName="LicencePlate"/>
|
||||||
|
|
@ -45,127 +46,69 @@
|
||||||
</Columns>
|
</Columns>
|
||||||
<DetailRowTemplate>
|
<DetailRowTemplate>
|
||||||
@{
|
@{
|
||||||
if (ShowNestedRows)
|
<DxTabs>
|
||||||
{
|
|
||||||
<DxTabs>
|
|
||||||
|
|
||||||
<DxTabPage Text="Driving permissions assigned">
|
<DxTabPage Text="Driving permissions assigned">
|
||||||
<UserProductMappingGridComponent ShowNestedRows="true" GetAllTag="SignalRTags.GetUserProductMappingById" ContextId="((Car)context.DataItem).UserProductMappingId" KeyboardNavigationEnabled="true" />
|
<UserProductMappingGridComponent GetAllTag="SignalRTags.GetUserProductMappingsById" ContextIds="new[] { ((Car)context.DataItem).UserProductMappingId }" KeyboardNavigationEnabled="true"/>
|
||||||
</DxTabPage>
|
</DxTabPage>
|
||||||
|
|
||||||
</DxTabs>
|
</DxTabs>
|
||||||
}
|
|
||||||
}
|
}
|
||||||
</DetailRowTemplate>
|
</DetailRowTemplate>
|
||||||
|
|
||||||
<EditFormTemplate Context="UserEditFormContext">
|
<EditFormTemplate Context="userEditFormContext">
|
||||||
@{
|
@{
|
||||||
var car = (Car)UserEditFormContext.EditModel;
|
var car = (Car)userEditFormContext.EditModel;
|
||||||
}
|
}
|
||||||
<DxFormLayout CssClass="w-100">
|
<DxFormLayout CssClass="w-100">
|
||||||
<DxFormLayoutItem Caption="Country code" ColSpanMd="4">
|
<DxFormLayoutItem Caption="Country code" ColSpanMd="4">
|
||||||
@UserEditFormContext.GetEditor("CountryCode")
|
@userEditFormContext.GetEditor("CountryCode")
|
||||||
</DxFormLayoutItem>
|
</DxFormLayoutItem>
|
||||||
<DxFormLayoutItem Caption="Licence plate" ColSpanMd="4">
|
<DxFormLayoutItem Caption="Licence plate" ColSpanMd="4">
|
||||||
@UserEditFormContext.GetEditor("LicencePlate")
|
@userEditFormContext.GetEditor("LicencePlate")
|
||||||
</DxFormLayoutItem>
|
</DxFormLayoutItem>
|
||||||
<DxFormLayoutItem Caption="Color" ColSpanMd="4">
|
<DxFormLayoutItem Caption="Color" ColSpanMd="4">
|
||||||
@UserEditFormContext.GetEditor("Color")
|
@userEditFormContext.GetEditor("Color")
|
||||||
</DxFormLayoutItem>
|
</DxFormLayoutItem>
|
||||||
<DxFormLayoutItem Caption="Manufacturer" ColSpanMd="4">
|
<DxFormLayoutItem Caption="Manufacturer" ColSpanMd="4">
|
||||||
@UserEditFormContext.GetEditor("Manufacture")
|
@userEditFormContext.GetEditor("Manufacture")
|
||||||
</DxFormLayoutItem>
|
</DxFormLayoutItem>
|
||||||
<DxFormLayoutItem Caption="Licence plate" ColSpanMd="4">
|
<DxFormLayoutItem Caption="Licence plate" ColSpanMd="4">
|
||||||
@UserEditFormContext.GetEditor("CarModel")
|
@userEditFormContext.GetEditor("CarModel")
|
||||||
</DxFormLayoutItem>
|
</DxFormLayoutItem>
|
||||||
<DxFormLayoutItem Caption="Licence plate" ColSpanMd="4">
|
<DxFormLayoutItem Caption="Licence plate" ColSpanMd="4">
|
||||||
@UserEditFormContext.GetEditor("YearOfMake")
|
@userEditFormContext.GetEditor("YearOfMake")
|
||||||
</DxFormLayoutItem>
|
</DxFormLayoutItem>
|
||||||
<DxFormLayoutItem Caption="Licence plate" ColSpanMd="4">
|
<DxFormLayoutItem Caption="Licence plate" ColSpanMd="4">
|
||||||
@UserEditFormContext.GetEditor("SeatNumber")
|
@userEditFormContext.GetEditor("SeatNumber")
|
||||||
</DxFormLayoutItem>
|
</DxFormLayoutItem>
|
||||||
<DxFormLayoutItem Caption="Licence plate" ColSpanMd="4">
|
<DxFormLayoutItem Caption="Licence plate" ColSpanMd="4">
|
||||||
@UserEditFormContext.GetEditor("CarMotorType")
|
@userEditFormContext.GetEditor("CarMotorType")
|
||||||
</DxFormLayoutItem>
|
</DxFormLayoutItem>
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
</DxFormLayout>
|
</DxFormLayout>
|
||||||
</EditFormTemplate>
|
</EditFormTemplate>
|
||||||
|
|
||||||
</CarGrid>
|
</CarGrid>
|
||||||
|
|
||||||
@code {
|
@code {
|
||||||
[Parameter]
|
[Parameter] public Guid ContextId { get; set; }
|
||||||
public bool KeyboardNavigationEnabled { get; set; }
|
[Parameter] public bool KeyboardNavigationEnabled { get; set; }
|
||||||
|
|
||||||
[Parameter] public ICarRelation ParentData { get; set; } = null!;
|
[Parameter] public ICarRelation ParentData { get; set; } = null!;
|
||||||
|
|
||||||
[Parameter] public int GetAllTag { get; set; } = SignalRTags.GetAllCars;
|
[Parameter] public int GetAllTag { get; set; } = SignalRTags.GetAllCars;
|
||||||
|
[Parameter] public GridDetailExpandButtonDisplayMode DetailExpandButtonDisplayMode { get; set; } = GridDetailExpandButtonDisplayMode.Never;
|
||||||
|
|
||||||
[Parameter] public bool ShowNestedRows { get; set; } = false;
|
private LoggerClient<CarGridComponent> _logger = null!;
|
||||||
|
|
||||||
[Parameter] public Guid? ContextId { get; set; }
|
protected override void OnInitialized()
|
||||||
|
|
||||||
private Guid[] ContextIds = new Guid[0];
|
|
||||||
|
|
||||||
private LoggerClient<CarGridComponent> _logger;
|
|
||||||
|
|
||||||
protected override void OnParametersSet()
|
|
||||||
{
|
|
||||||
if (ContextId != null)
|
|
||||||
{
|
|
||||||
ContextIds = new Guid[1];
|
|
||||||
ContextIds[0] = (Guid)ContextId;
|
|
||||||
}
|
|
||||||
base.OnParametersSet();
|
|
||||||
}
|
|
||||||
|
|
||||||
protected override async Task OnInitializedAsync()
|
|
||||||
{
|
{
|
||||||
_logger = new LoggerClient<CarGridComponent>(LogWriters.ToArray());
|
_logger = new LoggerClient<CarGridComponent>(LogWriters.ToArray());
|
||||||
|
|
||||||
|
base.OnInitialized();
|
||||||
//_logger.Info($"DetailGridData: {_detailGridData.Count}");
|
|
||||||
}
|
}
|
||||||
|
|
||||||
void CustomizeEditModel(GridCustomizeEditModelEventArgs e)
|
void CustomizeEditModel(GridCustomizeEditModelEventArgs e)
|
||||||
{
|
{
|
||||||
if (!e.IsNew) return;
|
if (!e.IsNew) return;
|
||||||
|
|
||||||
// var newProductMapping = new UserProductMapping
|
|
||||||
// {
|
|
||||||
// ProductId = Guid.NewGuid(),
|
|
||||||
// UserId = UserModelDtoDetail.Id,
|
|
||||||
// Permissions = 1
|
|
||||||
// };
|
|
||||||
|
|
||||||
//e.EditModel = newProductMapping;
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
async Task EditModelSaving(GridEditModelSavingEventArgs e)
|
|
||||||
{
|
|
||||||
if (e.IsNew)
|
|
||||||
|
|
||||||
_logger.Info("New orderData added");
|
|
||||||
else
|
|
||||||
_logger.Info("orderData updated");
|
|
||||||
|
|
||||||
await UpdateDataAsync();
|
|
||||||
}
|
|
||||||
|
|
||||||
async Task DataItemDeleting(GridDataItemDeletingEventArgs e)
|
|
||||||
{
|
|
||||||
|
|
||||||
_logger.Info("orderData deleted");
|
|
||||||
|
|
||||||
}
|
|
||||||
|
|
||||||
async Task UpdateDataAsync()
|
|
||||||
{
|
|
||||||
//refresh grid
|
|
||||||
_logger.Info("orderData grid refreshed");
|
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
@ -12,6 +12,7 @@
|
||||||
@using AyCode.Core.Loggers
|
@using AyCode.Core.Loggers
|
||||||
@using AyCode.Services.Loggers
|
@using AyCode.Services.Loggers
|
||||||
@using AyCode.Core
|
@using AyCode.Core
|
||||||
|
@using AyCode.Core.Extensions
|
||||||
@inject IServiceProviderDataService ServiceProviderDataService
|
@inject IServiceProviderDataService ServiceProviderDataService
|
||||||
@inject IEnumerable<IAcLogWriterClientBase> LogWriters
|
@inject IEnumerable<IAcLogWriterClientBase> LogWriters
|
||||||
@inject AdminSignalRClient AdminSignalRClient
|
@inject AdminSignalRClient AdminSignalRClient
|
||||||
|
|
@ -31,14 +32,14 @@
|
||||||
<label for="emailID" class="demo-text mt-4 mb-1">
|
<label for="emailID" class="demo-text mt-4 mb-1">
|
||||||
Put user email here
|
Put user email here
|
||||||
</label>
|
</label>
|
||||||
<DxMaskedInput @ref="emailInput"
|
<DxMaskedInput @ref="_emailInput"
|
||||||
@bind-Value="@Email"
|
@bind-Value="@Email"
|
||||||
CssClass="cw-320"
|
CssClass="cw-320"
|
||||||
Mask="@EmailMask"
|
Mask="@EmailMask"
|
||||||
InputId="emailID"
|
InputId="emailID"
|
||||||
MaskMode="MaskMode.RegEx" />
|
MaskMode="MaskMode.RegEx" />
|
||||||
<DxButton @ref="button1" CssClass="popup-button my-1 ms-2" Visible="true" RenderStyle="ButtonRenderStyle.Primary" Text="Find user" Click="@FindUser" />
|
<DxButton @ref="_button1" CssClass="popup-button my-1 ms-2" Visible="true" RenderStyle="ButtonRenderStyle.Primary" Text="Find user" Click="@FindUser" />
|
||||||
<div style="@errorCss" @ref="errorMessage"><p>User not found, type another email please</p></div>
|
<div style="@_errorCss" @ref="_errorMessage"><p>User not found, type another email please</p></div>
|
||||||
<DxGrid Data="@FoundUsers" RowClick="@OnRowClick">
|
<DxGrid Data="@FoundUsers" RowClick="@OnRowClick">
|
||||||
<Columns>
|
<Columns>
|
||||||
<DxGridDataColumn FieldName="Id" Caption="ID" />
|
<DxGridDataColumn FieldName="Id" Caption="ID" />
|
||||||
|
|
@ -54,9 +55,10 @@
|
||||||
</div>
|
</div>
|
||||||
</FooterContentTemplate>
|
</FooterContentTemplate>
|
||||||
</DxPopup>
|
</DxPopup>
|
||||||
|
|
||||||
<UserProductMappingDriverGrid Logger="_logger"
|
<UserProductMappingDriverGrid Logger="_logger"
|
||||||
@ref="_driverGrid"
|
@ref="_driverGrid"
|
||||||
ContextIds="ContextIds"
|
ContextIds="new [] {ContextId}"
|
||||||
GetAllMessageTag="GetAllTag"
|
GetAllMessageTag="GetAllTag"
|
||||||
SignalRClient="AdminSignalRClient"
|
SignalRClient="AdminSignalRClient"
|
||||||
PageSize="10"
|
PageSize="10"
|
||||||
|
|
@ -68,18 +70,17 @@
|
||||||
CustomizeEditModel="CustomizeEditModel"
|
CustomizeEditModel="CustomizeEditModel"
|
||||||
EditMode="GridEditMode.EditForm"
|
EditMode="GridEditMode.EditForm"
|
||||||
ColumnResizeMode="GridColumnResizeMode.NextColumn"
|
ColumnResizeMode="GridColumnResizeMode.NextColumn"
|
||||||
|
DetailExpandButtonDisplayMode="DetailExpandButtonDisplayMode"
|
||||||
ShowFilterRow="true">
|
ShowFilterRow="true">
|
||||||
<Columns>
|
<Columns>
|
||||||
<DxGridCommandColumn NewButtonVisible="true" Width="8%" FixedPosition="GridColumnFixedPosition.Left" />
|
<DxGridCommandColumn Width="135" MinWidth="135" FixedPosition="GridColumnFixedPosition.Left" />
|
||||||
<DxGridDataColumn FieldName="Id" ShowInColumnChooser="AcDomain.IsDeveloperVersion" Visible="AcDomain.IsDeveloperVersion" />
|
<DxGridDataColumn FieldName="Id" SortIndex="0" ShowInColumnChooser="AcDomain.IsDeveloperVersion" Visible="AcDomain.IsDeveloperVersion" DisplayFormat="N" />
|
||||||
<DxGridDataColumn FieldName="UserId" />
|
<DxGridDataColumn FieldName="UserId" />
|
||||||
<DxGridDataColumn FieldName="ProductId" Width="40%" />
|
<DxGridDataColumn FieldName="ProductId" Width="40%" />
|
||||||
<DxGridDataColumn FieldName="Permissions" />
|
<DxGridDataColumn FieldName="Permissions" />
|
||||||
</Columns>
|
</Columns>
|
||||||
<DetailRowTemplate>
|
<DetailRowTemplate>
|
||||||
@{
|
@{
|
||||||
if (ShowNestedRows)
|
|
||||||
{
|
|
||||||
<DxTabs>
|
<DxTabs>
|
||||||
|
|
||||||
<DxTabPage Text="Products">
|
<DxTabPage Text="Products">
|
||||||
|
|
@ -89,7 +90,6 @@
|
||||||
<CarDetailGridComponent GetAllTag="SignalRTags.GetCarsForUserProductMapping" ContextId="((UserProductMapping)context.DataItem).Id" KeyboardNavigationEnabled="true" />
|
<CarDetailGridComponent GetAllTag="SignalRTags.GetCarsForUserProductMapping" ContextId="((UserProductMapping)context.DataItem).Id" KeyboardNavigationEnabled="true" />
|
||||||
</DxTabPage>
|
</DxTabPage>
|
||||||
</DxTabs>
|
</DxTabs>
|
||||||
}
|
|
||||||
}
|
}
|
||||||
</DetailRowTemplate>
|
</DetailRowTemplate>
|
||||||
|
|
||||||
|
|
@ -122,18 +122,11 @@
|
||||||
</UserProductMappingDriverGrid>
|
</UserProductMappingDriverGrid>
|
||||||
|
|
||||||
@code {
|
@code {
|
||||||
[Parameter]
|
[Parameter] public Guid ContextId { get; set; }
|
||||||
public bool KeyboardNavigationEnabled { get; set; }
|
[Parameter] public bool KeyboardNavigationEnabled { get; set; }
|
||||||
|
|
||||||
[Parameter] public IProductRelation ParentData { get; set; } = null!;
|
[Parameter] public IProductRelation ParentData { get; set; } = null!;
|
||||||
|
|
||||||
[Parameter] public int GetAllTag { get; set; } = SignalRTags.GetAllUserProductMappings;
|
[Parameter] public int GetAllTag { get; set; } = SignalRTags.GetAllUserProductMappings;
|
||||||
|
[Parameter] public GridDetailExpandButtonDisplayMode DetailExpandButtonDisplayMode { get; set; } = GridDetailExpandButtonDisplayMode.Never;
|
||||||
[Parameter] public bool ShowNestedRows { get; set; } = false;
|
|
||||||
|
|
||||||
[Parameter] public Guid? ContextId { get; set; }
|
|
||||||
|
|
||||||
private Guid[] ContextIds = new Guid[0];
|
|
||||||
|
|
||||||
private LoggerClient<UserProductMappingGridComponent> _logger;
|
private LoggerClient<UserProductMappingGridComponent> _logger;
|
||||||
|
|
||||||
|
|
@ -141,43 +134,40 @@
|
||||||
|
|
||||||
private UserProductMappingDriverGrid _driverGrid;
|
private UserProductMappingDriverGrid _driverGrid;
|
||||||
|
|
||||||
private UserProductMapping tempProductMapping;
|
private UserProductMapping _tempProductMapping;
|
||||||
|
|
||||||
bool PopupVisible { get; set; }
|
bool PopupVisible { get; set; }
|
||||||
private DxMaskedInput<string> emailInput;
|
private DxMaskedInput<string> _emailInput;
|
||||||
private DxButton button1;
|
private DxButton _button1;
|
||||||
private ElementReference errorMessage;
|
private ElementReference _errorMessage;
|
||||||
private string errorCss = "display: none;";
|
private string _errorCss = "display: none;";
|
||||||
private List<UserModelDto> FoundUsers { get; set; } = new List<UserModelDto>();
|
private List<UserModelDto> FoundUsers { get; set; } = new List<UserModelDto>();
|
||||||
|
|
||||||
|
|
||||||
private string Email { get; set; } = "email@email.com";
|
private string Email { get; set; } = "email@email.com";
|
||||||
string EmailMask { get; set; } = @"(\w|[.-])+@(\w|-)+\.(\w|-){2,4}";
|
string EmailMask { get; set; } = @"(\w|[.-])+@(\w|-)+\.(\w|-){2,4}";
|
||||||
UserModelDto ChosenUser = null;
|
UserModelDto _chosenUser = null!;
|
||||||
|
|
||||||
protected override void OnParametersSet()
|
protected override void OnInitialized()
|
||||||
{
|
|
||||||
if (ContextId != null)
|
|
||||||
{
|
|
||||||
ContextIds = new Guid[1];
|
|
||||||
ContextIds[0] = (Guid)ContextId;
|
|
||||||
}
|
|
||||||
base.OnParametersSet();
|
|
||||||
}
|
|
||||||
|
|
||||||
protected override async Task OnInitializedAsync()
|
|
||||||
{
|
{
|
||||||
_logger = new LoggerClient<UserProductMappingGridComponent>(LogWriters.ToArray());
|
_logger = new LoggerClient<UserProductMappingGridComponent>(LogWriters.ToArray());
|
||||||
|
|
||||||
|
base.OnInitialized();
|
||||||
//_logger.Info($"DetailGridData: {_detailGridData.Count}");
|
|
||||||
}
|
}
|
||||||
|
|
||||||
void CustomizeEditModel(GridCustomizeEditModelEventArgs e)
|
void CustomizeEditModel(GridCustomizeEditModelEventArgs e)
|
||||||
{
|
{
|
||||||
if (!e.IsNew) return;
|
if (!e.IsNew) return;
|
||||||
UserProductMapping newUPM = (UserProductMapping)e.EditModel;
|
|
||||||
newUPM.ProductId = (Guid)ContextId!;
|
if (ContextId.IsNullOrEmpty())
|
||||||
|
{
|
||||||
|
_logger.Warning($"ContextId.IsNullOrEmpty()");
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
|
var newUpm = (UserProductMapping)e.EditModel;
|
||||||
|
newUpm.ProductId = ContextId;
|
||||||
|
|
||||||
var newProductMapping = new UserProductMapping
|
var newProductMapping = new UserProductMapping
|
||||||
{
|
{
|
||||||
Id = Guid.NewGuid(),
|
Id = Guid.NewGuid(),
|
||||||
|
|
@ -188,48 +178,20 @@
|
||||||
//e.EditModel = newProductMapping;
|
//e.EditModel = newProductMapping;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
async Task EditModelSaving(GridEditModelSavingEventArgs e)
|
|
||||||
{
|
|
||||||
if (e.IsNew)
|
|
||||||
|
|
||||||
_logger.Info("New orderData added");
|
|
||||||
else
|
|
||||||
_logger.Info("orderData updated");
|
|
||||||
|
|
||||||
await UpdateDataAsync();
|
|
||||||
}
|
|
||||||
|
|
||||||
async Task DataItemDeleting(GridDataItemDeletingEventArgs e)
|
|
||||||
{
|
|
||||||
|
|
||||||
_logger.Info("orderData deleted");
|
|
||||||
|
|
||||||
}
|
|
||||||
|
|
||||||
async Task UpdateDataAsync()
|
|
||||||
{
|
|
||||||
//refresh grid
|
|
||||||
_logger.Info("orderData grid refreshed");
|
|
||||||
}
|
|
||||||
|
|
||||||
async Task FindUser()
|
async Task FindUser()
|
||||||
{
|
{
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
var userModelDto = await UserDataService.GetUserByEmailAsync(Email);
|
var userModelDto = await UserDataService.GetUserByEmailAsync(Email);
|
||||||
if (userModelDto != null)
|
if (userModelDto != null)
|
||||||
{
|
{
|
||||||
ChosenUser = userModelDto;
|
_chosenUser = userModelDto;
|
||||||
FoundUsers.Add(ChosenUser);
|
FoundUsers.Add(_chosenUser);
|
||||||
emailInput.Enabled = false;
|
_emailInput.Enabled = false;
|
||||||
button1.Visible = false;
|
_button1.Visible = false;
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
emailInput.Value = "email@email.com";
|
_emailInput.Value = "email@email.com";
|
||||||
errorCss = "display: block";
|
_errorCss = "display: block";
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
@ -249,17 +211,18 @@
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
public async Task SubmitForm(object result)
|
public Task SubmitForm(object result)
|
||||||
{
|
{
|
||||||
|
|
||||||
|
|
||||||
_logger.Info($"Submitted nested form: {result.GetType().FullName}");
|
_logger.Info($"Submitted nested form: {result.GetType().FullName}");
|
||||||
|
return Task.CompletedTask;
|
||||||
}
|
}
|
||||||
|
|
||||||
public async Task ShowPopup(UserProductMapping emptyProductMapping)
|
public Task ShowPopup(UserProductMapping emptyProductMapping)
|
||||||
{
|
{
|
||||||
tempProductMapping = emptyProductMapping;
|
_tempProductMapping = emptyProductMapping;
|
||||||
PopupVisible = true;
|
PopupVisible = true;
|
||||||
|
|
||||||
|
return Task.CompletedTask;
|
||||||
}
|
}
|
||||||
|
|
||||||
private async Task OnUserSelected(Guid userId)
|
private async Task OnUserSelected(Guid userId)
|
||||||
|
|
@ -272,10 +235,12 @@
|
||||||
{
|
{
|
||||||
await SelectUser((Guid)e.Grid.GetRowValue(e.VisibleIndex, "Id"));
|
await SelectUser((Guid)e.Grid.GetRowValue(e.VisibleIndex, "Id"));
|
||||||
}
|
}
|
||||||
|
|
||||||
private async Task SelectUser(Guid id)
|
private async Task SelectUser(Guid id)
|
||||||
{
|
{
|
||||||
PopupVisible = false;
|
PopupVisible = false;
|
||||||
tempProductMapping.UserId = id;
|
_tempProductMapping.UserId = id;
|
||||||
|
|
||||||
await OnUserSelected(id);
|
await OnUserSelected(id);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
@ -283,7 +248,7 @@
|
||||||
{
|
{
|
||||||
if (e.ElementType == GridElementType.DataRow && (int)e.Grid.GetRowValue(e.VisibleIndex, "Permissions") == 1)
|
if (e.ElementType == GridElementType.DataRow && (int)e.Grid.GetRowValue(e.VisibleIndex, "Permissions") == 1)
|
||||||
{
|
{
|
||||||
e.Style="display: none";
|
e.Style = "display: none";
|
||||||
}
|
}
|
||||||
// else if (e.ElementType == GridElementType.HeaderCell)
|
// else if (e.ElementType == GridElementType.HeaderCell)
|
||||||
// {
|
// {
|
||||||
|
|
@ -291,7 +256,4 @@
|
||||||
|
|
||||||
// }
|
// }
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
@ -37,7 +37,7 @@
|
||||||
Click="ColumnChooserButton_Click" />
|
Click="ColumnChooserButton_Click" />
|
||||||
</div>
|
</div>
|
||||||
|
|
||||||
<CarGridComponent ShowNestedRows="true" GetAllTag="SignalRTags.GetAllCars"></CarGridComponent>
|
<CarGridComponent DetailExpandButtonDisplayMode="GridDetailExpandButtonDisplayMode.Auto" GetAllTag="SignalRTags.GetAllCars"></CarGridComponent>
|
||||||
|
|
||||||
</div>
|
</div>
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -37,7 +37,7 @@
|
||||||
Click="ColumnChooserButton_Click" />
|
Click="ColumnChooserButton_Click" />
|
||||||
</div>
|
</div>
|
||||||
|
|
||||||
<DriverGridComponent ShowNestedRows="true" ContextId="Guid.Parse(TransferProductId)" GetAllTag="SignalRTags.GetUserProductMappingsByProductId"></DriverGridComponent>
|
<DriverGridComponent DetailExpandButtonDisplayMode="GridDetailExpandButtonDisplayMode.Auto" ContextId="Guid.Parse(TransferProductId)" GetAllTag="SignalRTags.GetUserProductMappingsByProductId"></DriverGridComponent>
|
||||||
|
|
||||||
</div>
|
</div>
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -16,6 +16,7 @@
|
||||||
@using AyCode.Core
|
@using AyCode.Core
|
||||||
@using TIAM.Entities.Products
|
@using TIAM.Entities.Products
|
||||||
@using TIAM.Entities.Users
|
@using TIAM.Entities.Users
|
||||||
|
@using TIAM.Services
|
||||||
@layout AdminLayout
|
@layout AdminLayout
|
||||||
@inject IEnumerable<IAcLogWriterClientBase> LogWriters
|
@inject IEnumerable<IAcLogWriterClientBase> LogWriters
|
||||||
@inject IStringLocalizer<TIAMResources> localizer
|
@inject IStringLocalizer<TIAMResources> localizer
|
||||||
|
|
@ -133,7 +134,7 @@
|
||||||
<ProfileGridComponent ParentData="((Company)context.DataItem)" KeyboardNavigationEnabled="true" />
|
<ProfileGridComponent ParentData="((Company)context.DataItem)" KeyboardNavigationEnabled="true" />
|
||||||
</DxTabPage>
|
</DxTabPage>
|
||||||
<DxTabPage Text="Products">
|
<DxTabPage Text="Products">
|
||||||
<ProductDetailGridComponent @ref="_productDetailGridComponent" GetAllTag="SignalRTags.GetProductsByOwnerId" OnGridEditModelSaving="OnProductGridItemSaving" ContextId="((Company)context.DataItem).Id" ParentData="(Company)context.DataItem" KeyboardNavigationEnabled="true" />
|
<ProductDetailGridComponent @ref="_productDetailGridComponent" DetailExpandButtonDisplayMode="GridDetailExpandButtonDisplayMode.Auto" GetAllTag="SignalRTags.GetProductsByOwnerId" OnGridEditModelSaving="OnProductGridItemSaving" ContextId="((Company)context.DataItem).Id" 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" />
|
||||||
|
|
|
||||||
|
|
@ -37,7 +37,7 @@
|
||||||
Click="ColumnChooserButton_Click" />
|
Click="ColumnChooserButton_Click" />
|
||||||
</div>
|
</div>
|
||||||
|
|
||||||
<UserProductMappingGridComponent ShowNestedRows="true" GetAllTag="SignalRTags.GetAllUserProductMappings"></UserProductMappingGridComponent>
|
<UserProductMappingGridComponent DetailExpandButtonDisplayMode="GridDetailExpandButtonDisplayMode.Auto" GetAllTag="SignalRTags.GetAllUserProductMappings"></UserProductMappingGridComponent>
|
||||||
|
|
||||||
</div>
|
</div>
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -16,6 +16,7 @@
|
||||||
@using TIAMWebApp.Shared.Application.Services
|
@using TIAMWebApp.Shared.Application.Services
|
||||||
@using AyCode.Interfaces.Addresses
|
@using AyCode.Interfaces.Addresses
|
||||||
@using TIAM.Entities.Emails
|
@using TIAM.Entities.Emails
|
||||||
|
@using AyCode.Blazor.Components.Services
|
||||||
@inject IEnumerable<IAcLogWriterClientBase> LogWriters
|
@inject IEnumerable<IAcLogWriterClientBase> LogWriters
|
||||||
@inject AdminSignalRClient AdminSignalRClient;
|
@inject AdminSignalRClient AdminSignalRClient;
|
||||||
|
|
||||||
|
|
@ -24,6 +25,7 @@
|
||||||
Logger="_logger"
|
Logger="_logger"
|
||||||
SignalRClient="AdminSignalRClient"
|
SignalRClient="AdminSignalRClient"
|
||||||
ContextIds="new[] {ContextId}"
|
ContextIds="new[] {ContextId}"
|
||||||
|
KeyFieldName="Id"
|
||||||
CustomizeElement="CustomizeElement"
|
CustomizeElement="CustomizeElement"
|
||||||
TextWrapEnabled="false">
|
TextWrapEnabled="false">
|
||||||
|
|
||||||
|
|
@ -49,9 +51,9 @@
|
||||||
if (!emailMessage.IsReaded)
|
if (!emailMessage.IsReaded)
|
||||||
{
|
{
|
||||||
emailMessage.IsReaded = true;
|
emailMessage.IsReaded = true;
|
||||||
_messageGrid.UpdateDataItemAsync(emailMessage).Forget();
|
|
||||||
|
|
||||||
InvokeAsync(StateHasChanged).Forget();
|
_messageGrid.UpdateDataItemAsync(emailMessage).Forget();
|
||||||
|
//InvokeAsync(StateHasChanged).ContinueWith(x => _messageGrid.UpdateDataItemAsync(emailMessage).Forget());
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
</DetailRowTemplate>
|
</DetailRowTemplate>
|
||||||
|
|
|
||||||
|
|
@ -18,30 +18,26 @@
|
||||||
@using AyCode.Interfaces.Addresses
|
@using AyCode.Interfaces.Addresses
|
||||||
@using AyCode.Core
|
@using AyCode.Core
|
||||||
@inject IStringLocalizer<TIAMResources> Localizer
|
@inject IStringLocalizer<TIAMResources> Localizer
|
||||||
@inject IServiceProviderDataService serviceProviderDataService
|
|
||||||
@inject IUserDataService userDataService
|
|
||||||
@inject ITransferDataService transferDataService
|
|
||||||
@inject IEnumerable<IAcLogWriterClientBase> LogWriters
|
@inject IEnumerable<IAcLogWriterClientBase> LogWriters
|
||||||
@inject AdminSignalRClient AdminSignalRClient;
|
@inject AdminSignalRClient AdminSignalRClient;
|
||||||
|
|
||||||
|
|
||||||
<ProductDetailGrid @ref="_productGrid"
|
<ProductDetailGrid @ref="_productGrid"
|
||||||
GetAllMessageTag="GetAllTag"
|
ContextIds="new[] {ContextId}"
|
||||||
DataSource = "productList"
|
DataSource="ParentData?.Products ?? []"
|
||||||
ContextIds="new[] {(Guid)ContextId}"
|
GetAllMessageTag="GetAllTag"
|
||||||
Logger="_logger"
|
Logger="_logger"
|
||||||
SignalRClient="AdminSignalRClient"
|
SignalRClient="AdminSignalRClient"
|
||||||
OnGridEditModelSaving="DataItemSaving"
|
OnGridEditModelSaving="DataItemSaving"
|
||||||
OnGridItemDeleting="DataItemDeleting"
|
OnGridItemDeleting="DataItemDeleting"
|
||||||
OnGridItemChanged="DataItemChanged"
|
OnGridItemChanged="DataItemChanged"
|
||||||
PageSize="5"
|
TextWrapEnabled="false"
|
||||||
AutoExpandAllGroupRows="true"
|
|
||||||
KeyboardNavigationEnabled="KeyboardNavigationEnabled"
|
KeyboardNavigationEnabled="KeyboardNavigationEnabled"
|
||||||
KeyFieldName="Id"
|
KeyFieldName="Id"
|
||||||
ValidationEnabled="false"
|
ValidationEnabled="false"
|
||||||
EditMode="GridEditMode.EditForm"
|
EditMode="GridEditMode.EditForm"
|
||||||
ColumnResizeMode="GridColumnResizeMode.NextColumn"
|
ColumnResizeMode="GridColumnResizeMode.NextColumn"
|
||||||
ShowFilterRow="true">
|
DetailExpandButtonDisplayMode="DetailExpandButtonDisplayMode">
|
||||||
<Columns>
|
<Columns>
|
||||||
<DxGridCommandColumn NewButtonVisible="true" Width="135" MinWidth="135" FixedPosition="GridColumnFixedPosition.Left" />
|
<DxGridCommandColumn NewButtonVisible="true" Width="135" MinWidth="135" FixedPosition="GridColumnFixedPosition.Left" />
|
||||||
<DxGridDataColumn FieldName="Id" SortIndex="0" ShowInColumnChooser="AcDomain.IsDeveloperVersion" Visible="AcDomain.IsDeveloperVersion" DisplayFormat="N"/>
|
<DxGridDataColumn FieldName="Id" SortIndex="0" ShowInColumnChooser="AcDomain.IsDeveloperVersion" Visible="AcDomain.IsDeveloperVersion" DisplayFormat="N"/>
|
||||||
|
|
@ -55,7 +51,7 @@
|
||||||
<DetailRowTemplate>
|
<DetailRowTemplate>
|
||||||
<DxTabs>
|
<DxTabs>
|
||||||
<DxTabPage Text="Permissions">
|
<DxTabPage Text="Permissions">
|
||||||
<UserProductMappingGridComponent ShowNestedRows="false" ContextId="((Product)context.DataItem).Id" GetAllTag="SignalRTags.GetUserProductMappingsByProductId">
|
<UserProductMappingGridComponent DetailExpandButtonDisplayMode="GridDetailExpandButtonDisplayMode.Never" ContextIds="new [] {((Product)context.DataItem).Id}" GetAllTag="SignalRTags.GetUserProductMappingsByProductId">
|
||||||
</UserProductMappingGridComponent>
|
</UserProductMappingGridComponent>
|
||||||
</DxTabPage>
|
</DxTabPage>
|
||||||
<DxTabPage Text="Profile">
|
<DxTabPage Text="Profile">
|
||||||
|
|
@ -63,22 +59,22 @@
|
||||||
</DxTabPage>
|
</DxTabPage>
|
||||||
</DxTabs>
|
</DxTabs>
|
||||||
</DetailRowTemplate>
|
</DetailRowTemplate>
|
||||||
<EditFormTemplate Context="EditFormContext">
|
<EditFormTemplate Context="editFormContext">
|
||||||
@{
|
@{
|
||||||
var transfer2 = (Product)EditFormContext.EditModel;
|
var transfer2 = (Product)editFormContext.EditModel;
|
||||||
}
|
}
|
||||||
<DxFormLayout CssClass="w-100">
|
<DxFormLayout CssClass="w-100">
|
||||||
<DxFormLayoutItem Caption=@Localizer.GetString(ResourceKeys.ProductName) ColSpanMd="4">
|
<DxFormLayoutItem Caption=@Localizer.GetString(ResourceKeys.ProductName) ColSpanMd="4">
|
||||||
@EditFormContext.GetEditor("Name")
|
@editFormContext.GetEditor("Name")
|
||||||
</DxFormLayoutItem>
|
</DxFormLayoutItem>
|
||||||
<DxFormLayoutItem Caption=@Localizer.GetString(ResourceKeys.ProductType) ColSpanMd="4">
|
<DxFormLayoutItem Caption=@Localizer.GetString(ResourceKeys.ProductType) ColSpanMd="4">
|
||||||
@EditFormContext.GetEditor("ProductType")
|
@editFormContext.GetEditor("ProductType")
|
||||||
</DxFormLayoutItem>
|
</DxFormLayoutItem>
|
||||||
<DxFormLayoutItem Caption=@Localizer.GetString(ResourceKeys.Price) ColSpanMd="4">
|
<DxFormLayoutItem Caption=@Localizer.GetString(ResourceKeys.Price) ColSpanMd="4">
|
||||||
@EditFormContext.GetEditor("Price")
|
@editFormContext.GetEditor("Price")
|
||||||
</DxFormLayoutItem>
|
</DxFormLayoutItem>
|
||||||
<DxFormLayoutItem Caption=@Localizer.GetString(ResourceKeys.ProductDescription) ColSpanMd="4">
|
<DxFormLayoutItem Caption=@Localizer.GetString(ResourceKeys.ProductDescription) ColSpanMd="4">
|
||||||
@EditFormContext.GetEditor("Description")
|
@editFormContext.GetEditor("Description")
|
||||||
</DxFormLayoutItem>
|
</DxFormLayoutItem>
|
||||||
|
|
||||||
|
|
||||||
|
|
@ -89,13 +85,13 @@
|
||||||
|
|
||||||
@code {
|
@code {
|
||||||
[Parameter] public bool KeyboardNavigationEnabled { get; set; }
|
[Parameter] public bool KeyboardNavigationEnabled { get; set; }
|
||||||
[Parameter] public Guid? ContextId { get; set; } = null;
|
[Parameter] public Guid ContextId { get; set; }
|
||||||
[Parameter] public IProductsRelation ParentData { get; set; } = null!;
|
[Parameter] public IProductsRelation? ParentData { get; set; } = null!;
|
||||||
[Parameter] public EventCallback<GridEditModelSavingEventArgs> OnGridEditModelSaving { get; set; }
|
[Parameter] public EventCallback<GridEditModelSavingEventArgs> OnGridEditModelSaving { get; set; }
|
||||||
[Parameter] public int GetAllTag { get; set; } = SignalRTags.GetProductsByContextId;
|
[Parameter] public int GetAllTag { get; set; } = SignalRTags.GetProductsByContextId;
|
||||||
|
[Parameter] public GridDetailExpandButtonDisplayMode DetailExpandButtonDisplayMode { get; set; } = GridDetailExpandButtonDisplayMode.Never;
|
||||||
|
|
||||||
private ProductDetailGrid _productGrid;
|
private ProductDetailGrid _productGrid = null!;
|
||||||
private List<Product> productList = new List<Product>();
|
|
||||||
private LoggerClient<ProductDetailGridComponent> _logger = null!;
|
private LoggerClient<ProductDetailGridComponent> _logger = null!;
|
||||||
protected override void OnInitialized()
|
protected override void OnInitialized()
|
||||||
{
|
{
|
||||||
|
|
@ -121,31 +117,12 @@
|
||||||
// }
|
// }
|
||||||
// else
|
// else
|
||||||
|
|
||||||
base.OnParametersSet();
|
await base.OnParametersSetAsync();
|
||||||
}
|
|
||||||
|
|
||||||
protected override async Task OnAfterRenderAsync(bool firstRender)
|
|
||||||
{
|
|
||||||
// if(firstRender)
|
|
||||||
// {
|
|
||||||
|
|
||||||
// _productGrid.GetAllMessageTag = GetAllTag;
|
|
||||||
|
|
||||||
// // if (ParentData != null)
|
|
||||||
// // {
|
|
||||||
// // _productGrid.DataSource = new List<Product>();
|
|
||||||
// // _productGrid.DataSource = ParentData.Products;
|
|
||||||
// // }
|
|
||||||
|
|
||||||
|
|
||||||
// }
|
|
||||||
}
|
}
|
||||||
|
|
||||||
private void DataItemChanged(GridDataItemChangedEventArgs<Product> args)
|
private void DataItemChanged(GridDataItemChangedEventArgs<Product> args)
|
||||||
{
|
{
|
||||||
_logger.Debug($"Saving: {args.DataItem.Name}, {args.DataItem.ServiceProviderId}");
|
_logger.Debug($"Saving: {args.DataItem.Name}, {args.DataItem.ServiceProviderId}");
|
||||||
|
|
||||||
//ProductGrid.SaveChangesAsync();
|
|
||||||
}
|
}
|
||||||
|
|
||||||
public async Task DataItemSaving(GridEditModelSavingEventArgs e)
|
public async Task DataItemSaving(GridEditModelSavingEventArgs e)
|
||||||
|
|
|
||||||
|
|
@ -12,8 +12,6 @@
|
||||||
@using TIAM.Entities.Addresses
|
@using TIAM.Entities.Addresses
|
||||||
@using TIAM.Entities.Profiles
|
@using TIAM.Entities.Profiles
|
||||||
@using Profile = TIAM.Entities.Profiles.Profile
|
@using Profile = TIAM.Entities.Profiles.Profile
|
||||||
@inject IServiceProviderDataService serviceProviderDataService
|
|
||||||
@inject IUserDataService userDataService
|
|
||||||
@inject IEnumerable<IAcLogWriterClientBase> LogWriters
|
@inject IEnumerable<IAcLogWriterClientBase> LogWriters
|
||||||
@inject AdminSignalRClient AdminSignalRClient
|
@inject AdminSignalRClient AdminSignalRClient
|
||||||
|
|
||||||
|
|
@ -21,14 +19,14 @@
|
||||||
ContextIds="new[] {ParentData.ProfileId}"
|
ContextIds="new[] {ParentData.ProfileId}"
|
||||||
Logger="_logger"
|
Logger="_logger"
|
||||||
SignalRClient="AdminSignalRClient"
|
SignalRClient="AdminSignalRClient"
|
||||||
PageSize="5"
|
|
||||||
AutoExpandAllGroupRows="true"
|
|
||||||
KeyboardNavigationEnabled="KeyboardNavigationEnabled"
|
KeyboardNavigationEnabled="KeyboardNavigationEnabled"
|
||||||
KeyFieldName="Id"
|
KeyFieldName="Id"
|
||||||
ValidationEnabled="false"
|
ValidationEnabled="false"
|
||||||
|
TextWrapEnabled="false"
|
||||||
|
AutoExpandAllGroupRows="true"
|
||||||
EditMode="GridEditMode.EditForm"
|
EditMode="GridEditMode.EditForm"
|
||||||
ColumnResizeMode="GridColumnResizeMode.NextColumn"
|
ColumnResizeMode="GridColumnResizeMode.NextColumn"
|
||||||
ShowFilterRow="false">
|
DetailExpandButtonDisplayMode="DetailExpandButtonDisplayMode">
|
||||||
<Columns>
|
<Columns>
|
||||||
<DxGridCommandColumn NewButtonVisible="false" DeleteButtonVisible="false" Width="70" MinWidth="70" FixedPosition="GridColumnFixedPosition.Left" />
|
<DxGridCommandColumn NewButtonVisible="false" DeleteButtonVisible="false" Width="70" MinWidth="70" FixedPosition="GridColumnFixedPosition.Left" />
|
||||||
<DxGridDataColumn FieldName="Id" GroupIndex="0" ShowInColumnChooser="AcDomain.IsDeveloperVersion" Visible="AcDomain.IsDeveloperVersion" DisplayFormat="N" />
|
<DxGridDataColumn FieldName="Id" GroupIndex="0" ShowInColumnChooser="AcDomain.IsDeveloperVersion" Visible="AcDomain.IsDeveloperVersion" DisplayFormat="N" />
|
||||||
|
|
@ -48,9 +46,8 @@
|
||||||
</ProfileDetailGrid>
|
</ProfileDetailGrid>
|
||||||
|
|
||||||
@code {
|
@code {
|
||||||
[Parameter]
|
[Parameter] public GridDetailExpandButtonDisplayMode DetailExpandButtonDisplayMode { get; set; } = GridDetailExpandButtonDisplayMode.Never;
|
||||||
public bool KeyboardNavigationEnabled { get; set; }
|
[Parameter] public bool KeyboardNavigationEnabled { get; set; }
|
||||||
|
|
||||||
[Parameter] public IProfileForeignKey ParentData { get; set; } = null!;
|
[Parameter] public IProfileForeignKey ParentData { get; set; } = null!;
|
||||||
|
|
||||||
private ProfileDetailGrid _profileGrid = null!;
|
private ProfileDetailGrid _profileGrid = null!;
|
||||||
|
|
@ -64,6 +61,8 @@
|
||||||
protected override void OnParametersSet()
|
protected override void OnParametersSet()
|
||||||
{
|
{
|
||||||
_logger.DebugConditional(ParentData.ProfileId.ToString());
|
_logger.DebugConditional(ParentData.ProfileId.ToString());
|
||||||
|
|
||||||
base.OnParametersSet();
|
base.OnParametersSet();
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -29,47 +29,40 @@
|
||||||
CustomizeEditModel="CustomizeEditModel"
|
CustomizeEditModel="CustomizeEditModel"
|
||||||
EditMode="GridEditMode.EditForm"
|
EditMode="GridEditMode.EditForm"
|
||||||
ColumnResizeMode="GridColumnResizeMode.NextColumn"
|
ColumnResizeMode="GridColumnResizeMode.NextColumn"
|
||||||
|
DetailExpandButtonDisplayMode="DetailExpandButtonDisplayMode"
|
||||||
ShowFilterRow="true">
|
ShowFilterRow="true">
|
||||||
<Columns>
|
<Columns>
|
||||||
<DxGridCommandColumn NewButtonVisible="true" Width="8%" FixedPosition="GridColumnFixedPosition.Left" />
|
<DxGridCommandColumn Width="135" MinWidth="135" DeleteButtonVisible="AcDomain.IsDeveloperVersion" EditButtonVisible="AcDomain.IsDeveloperVersion" FixedPosition="GridColumnFixedPosition.Left" />
|
||||||
<DxGridDataColumn FieldName="Id" ShowInColumnChooser="AcDomain.IsDeveloperVersion" Visible="AcDomain.IsDeveloperVersion" />
|
<DxGridDataColumn FieldName="Id" SortIndex="0" ShowInColumnChooser="AcDomain.IsDeveloperVersion" Visible="AcDomain.IsDeveloperVersion" DisplayFormat="N" />
|
||||||
<DxGridDataColumn FieldName="UserId" />
|
<DxGridDataColumn FieldName="UserId" />
|
||||||
<DxGridDataColumn FieldName="ProductId" Width="40%" />
|
<DxGridDataColumn FieldName="ProductId" Width="40%" />
|
||||||
<DxGridDataColumn FieldName="Permissions" />
|
<DxGridDataColumn FieldName="Permissions" />
|
||||||
</Columns>
|
</Columns>
|
||||||
<DetailRowTemplate>
|
<DetailRowTemplate>
|
||||||
@{
|
@{
|
||||||
if (ShowNestedRows)
|
<DxTabs>
|
||||||
{
|
<DxTabPage Text="Products">
|
||||||
<DxTabs>
|
<ProductDetailGridComponent GetAllTag="SignalRTags.GetProductsById" ContextId="((UserProductMapping)context.DataItem).ProductId" KeyboardNavigationEnabled="true"/>
|
||||||
|
</DxTabPage>
|
||||||
<DxTabPage Text="Products">
|
</DxTabs>
|
||||||
<ProductDetailGridComponent GetAllTag="SignalRTags.GetProductsById" ContextId="((UserProductMapping)context.DataItem).ProductId" KeyboardNavigationEnabled="true" />
|
|
||||||
</DxTabPage>
|
|
||||||
|
|
||||||
|
|
||||||
</DxTabs>
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
</DetailRowTemplate>
|
</DetailRowTemplate>
|
||||||
|
|
||||||
<EditFormTemplate Context="UserEditFormContext">
|
<EditFormTemplate Context="userEditFormContext">
|
||||||
@{
|
@{
|
||||||
var transfer2 = (UserProductMapping)UserEditFormContext.EditModel;
|
var transfer2 = (UserProductMapping)userEditFormContext.EditModel;
|
||||||
}
|
}
|
||||||
<DxFormLayout CssClass="w-100">
|
<DxFormLayout CssClass="w-100">
|
||||||
<DxFormLayoutItem Caption="UserId" ColSpanMd="4">
|
<DxFormLayoutItem Caption="UserId" ColSpanMd="4">
|
||||||
@UserEditFormContext.GetEditor("UserId")
|
@userEditFormContext.GetEditor("UserId")
|
||||||
</DxFormLayoutItem>
|
</DxFormLayoutItem>
|
||||||
<DxFormLayoutItem Caption="Product:" ColSpanMd="4">
|
<DxFormLayoutItem Caption="Product:" ColSpanMd="4">
|
||||||
<DxComboBox Data="@_availableProducts" TextFieldName="Name" @bind-Value="((UserProductMapping)UserEditFormContext.EditModel).ProductId" />
|
<DxComboBox Data="@_availableProducts" TextFieldName="Name" @bind-Value="((UserProductMapping)userEditFormContext.EditModel).ProductId" />
|
||||||
</DxFormLayoutItem>
|
</DxFormLayoutItem>
|
||||||
<DxFormLayoutItem Caption="Permissions" ColSpanMd="4">
|
<DxFormLayoutItem Caption="Permissions" ColSpanMd="4">
|
||||||
@UserEditFormContext.GetEditor("Permissions")
|
@userEditFormContext.GetEditor("Permissions")
|
||||||
</DxFormLayoutItem>
|
</DxFormLayoutItem>
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
</DxFormLayout>
|
</DxFormLayout>
|
||||||
</EditFormTemplate>
|
</EditFormTemplate>
|
||||||
|
|
||||||
|
|
@ -83,11 +76,9 @@
|
||||||
|
|
||||||
[Parameter] public int GetAllTag { get; set; } = SignalRTags.GetAllUserProductMappings;
|
[Parameter] public int GetAllTag { get; set; } = SignalRTags.GetAllUserProductMappings;
|
||||||
|
|
||||||
[Parameter] public bool ShowNestedRows { get; set; } = false;
|
[Parameter] public GridDetailExpandButtonDisplayMode DetailExpandButtonDisplayMode { get; set; } = GridDetailExpandButtonDisplayMode.Never;
|
||||||
|
|
||||||
[Parameter] public Guid? ContextId { get; set; }
|
[Parameter] public Guid[]? ContextIds { get; set; }
|
||||||
|
|
||||||
private Guid[] ContextIds = new Guid[0];
|
|
||||||
|
|
||||||
private LoggerClient<UserProductMappingGridComponent> _logger;
|
private LoggerClient<UserProductMappingGridComponent> _logger;
|
||||||
|
|
||||||
|
|
@ -95,22 +86,12 @@
|
||||||
|
|
||||||
private ProductDetailGridComponent bleh;
|
private ProductDetailGridComponent bleh;
|
||||||
|
|
||||||
protected override void OnParametersSet()
|
|
||||||
{
|
|
||||||
if (ContextId != null)
|
|
||||||
{
|
|
||||||
ContextIds = new Guid[1];
|
|
||||||
ContextIds[0] = (Guid)ContextId;
|
|
||||||
}
|
|
||||||
base.OnParametersSet();
|
|
||||||
}
|
|
||||||
|
|
||||||
protected override async Task OnInitializedAsync()
|
protected override void OnInitialized()
|
||||||
{
|
{
|
||||||
_logger = new LoggerClient<UserProductMappingGridComponent>(LogWriters.ToArray());
|
_logger = new LoggerClient<UserProductMappingGridComponent>(LogWriters.ToArray());
|
||||||
|
|
||||||
|
base.OnInitialized();
|
||||||
//_logger.Info($"DetailGridData: {_detailGridData.Count}");
|
|
||||||
}
|
}
|
||||||
|
|
||||||
void CustomizeEditModel(GridCustomizeEditModelEventArgs e)
|
void CustomizeEditModel(GridCustomizeEditModelEventArgs e)
|
||||||
|
|
@ -126,30 +107,4 @@
|
||||||
|
|
||||||
//e.EditModel = newProductMapping;
|
//e.EditModel = newProductMapping;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
async Task EditModelSaving(GridEditModelSavingEventArgs e)
|
|
||||||
{
|
|
||||||
if (e.IsNew)
|
|
||||||
|
|
||||||
_logger.Info("New orderData added");
|
|
||||||
else
|
|
||||||
_logger.Info("orderData updated");
|
|
||||||
|
|
||||||
await UpdateDataAsync();
|
|
||||||
}
|
|
||||||
|
|
||||||
async Task DataItemDeleting(GridDataItemDeletingEventArgs e)
|
|
||||||
{
|
|
||||||
|
|
||||||
_logger.Info("orderData deleted");
|
|
||||||
|
|
||||||
}
|
|
||||||
|
|
||||||
async Task UpdateDataAsync()
|
|
||||||
{
|
|
||||||
//refresh grid
|
|
||||||
_logger.Info("orderData grid refreshed");
|
|
||||||
}
|
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
@ -101,7 +101,12 @@ namespace TIAMSharedUI.Shared.Components.Grids
|
||||||
var changedEventArgs = new GridDataItemChangedEventArgs<TDataItem>(this, args.Item, args.TrackingState);
|
var changedEventArgs = new GridDataItemChangedEventArgs<TDataItem>(this, args.Item, args.TrackingState);
|
||||||
await OnGridItemChanged.InvokeAsync(changedEventArgs);
|
await OnGridItemChanged.InvokeAsync(changedEventArgs);
|
||||||
|
|
||||||
await InvokeAsync(StateHasChanged);
|
if (!changedEventArgs.CancelStateChangeInvoke)
|
||||||
|
{
|
||||||
|
//BeginUpdate();
|
||||||
|
await InvokeAsync(StateHasChanged); //TODO: bezárja a DetailRow-t! pl: az email-nél IsReaded=true update... - J.
|
||||||
|
//EndUpdate();
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
private Task OnDataSourceLoaded()
|
private Task OnDataSourceLoaded()
|
||||||
|
|
@ -311,5 +316,6 @@ namespace TIAMSharedUI.Shared.Components.Grids
|
||||||
public TiamGrid<TDataItem> Grid { get; }
|
public TiamGrid<TDataItem> Grid { get; }
|
||||||
public TDataItem DataItem { get; }
|
public TDataItem DataItem { get; }
|
||||||
public TrackingState TrackingState { get; }
|
public TrackingState TrackingState { get; }
|
||||||
|
public bool CancelStateChangeInvoke { get; set; }
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -99,6 +99,7 @@ namespace TIAMWebApp.Server.Controllers
|
||||||
}
|
}
|
||||||
|
|
||||||
[NonAction]
|
[NonAction]
|
||||||
|
[ApiExplorerSettings(IgnoreApi = true)]
|
||||||
[SignalR(SignalRTags.UpdateMessage)]
|
[SignalR(SignalRTags.UpdateMessage)]
|
||||||
public async Task<EmailMessage?> UpdateMessages([FromBody] EmailMessage message)
|
public async Task<EmailMessage?> UpdateMessages([FromBody] EmailMessage message)
|
||||||
{
|
{
|
||||||
|
|
|
||||||
|
|
@ -18,6 +18,7 @@ using AyCode.Services.SignalRs;
|
||||||
using AyCode.Utils.Extensions;
|
using AyCode.Utils.Extensions;
|
||||||
using TIAM.Entities.Drivers;
|
using TIAM.Entities.Drivers;
|
||||||
using TIAM.Services;
|
using TIAM.Services;
|
||||||
|
using TIAM.Entities.Products;
|
||||||
|
|
||||||
namespace TIAMWebApp.Server.Controllers
|
namespace TIAMWebApp.Server.Controllers
|
||||||
{
|
{
|
||||||
|
|
@ -49,10 +50,10 @@ namespace TIAMWebApp.Server.Controllers
|
||||||
|
|
||||||
//if (company.OwnerId.IsNullOrEmpty()) company.OwnerId = Guid.Parse("540271F6-C604-4C16-8160-D5A7CAFEDF00"); //TESZT - J.
|
//if (company.OwnerId.IsNullOrEmpty()) company.OwnerId = Guid.Parse("540271F6-C604-4C16-8160-D5A7CAFEDF00"); //TESZT - J.
|
||||||
|
|
||||||
company.SetProfile(new Profile(Guid.NewGuid(), company.Name));
|
//company.SetProfile(new Profile(Guid.NewGuid(), company.Name));
|
||||||
company.Profile.SetAddress(new Address(Guid.NewGuid(), "Controller AddCompanyAsync; address text..."));
|
//company.Profile.SetAddress(new Address(Guid.NewGuid(), "Controller AddCompanyAsync; address text..."));
|
||||||
|
|
||||||
return await adminDal.CreateServiceProviderAsync(company);
|
return await adminDal.AddCompanyAsync(company);
|
||||||
|
|
||||||
case TrackingState.Update:
|
case TrackingState.Update:
|
||||||
return await adminDal.UpdateCompanyAsync(company);
|
return await adminDal.UpdateCompanyAsync(company);
|
||||||
|
|
@ -106,7 +107,7 @@ namespace TIAMWebApp.Server.Controllers
|
||||||
[SignalR(SignalRTags.GetCompanies)]
|
[SignalR(SignalRTags.GetCompanies)]
|
||||||
public async Task<string> GetServiceProviders()
|
public async Task<string> GetServiceProviders()
|
||||||
{
|
{
|
||||||
return await adminDal.GetServiceProvidersJsonAsync();
|
return await adminDal.GetCompaniesJsonAsync();
|
||||||
}
|
}
|
||||||
|
|
||||||
//18.
|
//18.
|
||||||
|
|
@ -114,15 +115,23 @@ namespace TIAMWebApp.Server.Controllers
|
||||||
[HttpPost]
|
[HttpPost]
|
||||||
[Route(APIUrls.GetServiceProviderByIdRouteName)]
|
[Route(APIUrls.GetServiceProviderByIdRouteName)]
|
||||||
[SignalR(SignalRTags.GetCompany)]
|
[SignalR(SignalRTags.GetCompany)]
|
||||||
public async Task<string> GetServiceProviderById([FromBody] Guid id)
|
public async Task<Company?> GetServiceProviderById([FromBody] Guid id)
|
||||||
{
|
{
|
||||||
_logger.Info($@"GetServiceProviderById called with id: {id}");
|
_logger.Info($@"GetServiceProviderById called with id: {id}");
|
||||||
List<Company> compList = new List<Company>();
|
|
||||||
var result = await adminDal.GetServiceProviderByIdAsync(id);
|
return await adminDal.GetCompanyByIdAsync(id);
|
||||||
compList.Add(result);
|
|
||||||
return compList.ToJson();
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
[NonAction]
|
||||||
|
[ApiExplorerSettings(IgnoreApi = true)]
|
||||||
|
[SignalR(SignalRTags.GetCompaniesById)]
|
||||||
|
public async Task<List<Company>> GetServiceProvidersById(Guid id)
|
||||||
|
{
|
||||||
|
_logger.Info($@"GetServiceProvidersById called with id: {id}");
|
||||||
|
|
||||||
|
var company = await GetServiceProviderById(id);
|
||||||
|
return company == null ? [] : [company];
|
||||||
|
}
|
||||||
|
|
||||||
//17.
|
//17.
|
||||||
[Authorize]
|
[Authorize]
|
||||||
|
|
@ -134,7 +143,7 @@ namespace TIAMWebApp.Server.Controllers
|
||||||
{
|
{
|
||||||
_logger.Info($@"GetServiceProvidersByOwnerId called with ownerId: {ownerId}");
|
_logger.Info($@"GetServiceProvidersByOwnerId called with ownerId: {ownerId}");
|
||||||
|
|
||||||
var serviceProviders = await adminDal.GetServiceProvidersAsync();
|
var serviceProviders = await adminDal.GetCompaniesAsync();
|
||||||
|
|
||||||
//return serviceProviders.Where(x => x.OwnerId == ownerId).ToList();
|
//return serviceProviders.Where(x => x.OwnerId == ownerId).ToList();
|
||||||
var myServiceproviders = serviceProviders.Where(x => x.OwnerId == ownerId).ToDictionary(x => x.Id, x => x.Name);
|
var myServiceproviders = serviceProviders.Where(x => x.OwnerId == ownerId).ToDictionary(x => x.Id, x => x.Name);
|
||||||
|
|
@ -152,7 +161,7 @@ namespace TIAMWebApp.Server.Controllers
|
||||||
{
|
{
|
||||||
_logger.Info($@"GetServiceProvidersByOwnerId called with ownerId: {ownerId}");
|
_logger.Info($@"GetServiceProvidersByOwnerId called with ownerId: {ownerId}");
|
||||||
|
|
||||||
var serviceProviders = await adminDal.GetServiceProvidersByOwnerIdAsync(ownerId);
|
var serviceProviders = await adminDal.GetCompaniesByOwnerIdAsync(ownerId);
|
||||||
|
|
||||||
//return serviceProviders.Where(x => x.OwnerId == ownerId).ToList();
|
//return serviceProviders.Where(x => x.OwnerId == ownerId).ToList();
|
||||||
//var myServiceproviders = serviceProviders.Where(x => x.OwnerId == ownerId).ToDictionary(x => x.Id, x => x.Name);
|
//var myServiceproviders = serviceProviders.Where(x => x.OwnerId == ownerId).ToDictionary(x => x.Id, x => x.Name);
|
||||||
|
|
@ -203,7 +212,7 @@ namespace TIAMWebApp.Server.Controllers
|
||||||
[SignalR(SignalRTags.DeleteUserProductMapping)]
|
[SignalR(SignalRTags.DeleteUserProductMapping)]
|
||||||
public async Task<string> DeleteUserProductMapping(UserProductMapping userProductMapping)
|
public async Task<string> DeleteUserProductMapping(UserProductMapping userProductMapping)
|
||||||
{
|
{
|
||||||
_logger.Info($"UpdateUserProductMapping called! + {userProductMapping.Id}");
|
_logger.Info($"DeleteUserProductMapping called! + {userProductMapping.Id}");
|
||||||
|
|
||||||
var result = await adminDal.RemoveUserProductMappingAsync(userProductMapping.Id);
|
var result = await adminDal.RemoveUserProductMappingAsync(userProductMapping.Id);
|
||||||
|
|
||||||
|
|
@ -215,64 +224,57 @@ namespace TIAMWebApp.Server.Controllers
|
||||||
[HttpPost]
|
[HttpPost]
|
||||||
[Route(APIUrls.GetUserProductMappingsByProductIdRouteName)]
|
[Route(APIUrls.GetUserProductMappingsByProductIdRouteName)]
|
||||||
[SignalR(SignalRTags.GetUserProductMappingsByProductId)]
|
[SignalR(SignalRTags.GetUserProductMappingsByProductId)]
|
||||||
public async Task<string> GetUserProductMappingsByProductId(Guid productId)
|
public async Task<List<UserProductMapping>> GetUserProductMappingsByProductId(Guid productId)
|
||||||
{
|
{
|
||||||
_logger.Info($@"GetUserProductMappingsByUserId called with serviceProviderId: {productId}");
|
_logger.Info($@"GetUserProductMappingsByProductId called with serviceProviderId: {productId}");
|
||||||
|
|
||||||
var userProductMappings = adminDal.GetAllUserProductMappings();
|
return await adminDal.GetUserProductMappingsByProductIdAsync(productId);
|
||||||
|
|
||||||
var myUserProductMappings = userProductMappings.Where(x => x.ProductId == productId).ToList();
|
|
||||||
//put serviceprovider id and name into a dictionary
|
|
||||||
|
|
||||||
return myUserProductMappings.ToJson();
|
|
||||||
}
|
}
|
||||||
|
|
||||||
[AllowAnonymous]
|
[AllowAnonymous]
|
||||||
[HttpPost]
|
[HttpPost]
|
||||||
[Route(APIUrls.GetUserProductMappingsByUserIdRouteName)]
|
[Route(APIUrls.GetUserProductMappingsByUserIdRouteName)]
|
||||||
[SignalR(SignalRTags.GetUserProductMappingsByUserId)]
|
[SignalR(SignalRTags.GetUserProductMappingsByUserId)]
|
||||||
public async Task<string> GetUserProductMappingsByUserId(Guid userId)
|
public async Task<List<UserProductMapping>> GetUserProductMappingsByUserId(Guid userId)
|
||||||
{
|
{
|
||||||
_logger.Info($@"GetUserProductMappingsByUserId called with userId: {userId}");
|
_logger.Info($@"GetUserProductMappingsByUserId called with userId: {userId}");
|
||||||
|
|
||||||
var userProductMappings = adminDal.GetAllUserProductMappings();
|
return (await adminDal.GetUserProductMappingsByUserIdAsync(userId)).OrderBy(x => x.ProductId).ToList();
|
||||||
|
|
||||||
var myUserProductMappings = userProductMappings.Where(x => x.UserId == userId).OrderBy(x => x.ProductId).ToList();
|
|
||||||
//put serviceprovider id and name into a dictionary
|
|
||||||
|
|
||||||
return myUserProductMappings.ToJson();
|
|
||||||
}
|
}
|
||||||
|
|
||||||
[AllowAnonymous]
|
[AllowAnonymous]
|
||||||
[HttpPost]
|
[HttpPost]
|
||||||
[Route(APIUrls.GetUserProductMappingByIdRouteName)]
|
[Route(APIUrls.GetUserProductMappingByIdRouteName)]
|
||||||
[SignalR(SignalRTags.GetUserProductMappingById)]
|
[SignalR(SignalRTags.GetUserProductMappingById)]
|
||||||
public async Task<string> GetUserProductMappingById(Guid id)
|
public async Task<UserProductMapping?> GetUserProductMappingById(Guid id)
|
||||||
{
|
{
|
||||||
_logger.Info($@"GetUserProductMappingsByUserId called with userId: {id}");
|
_logger.Info($@"GetUserProductMappingById called with userId: {id}");
|
||||||
|
|
||||||
var userProductMappings = adminDal.GetAllUserProductMappings();
|
var userproductMapping = await adminDal.GetUserProductMappingByIdAsync(id);
|
||||||
|
return userproductMapping;
|
||||||
|
}
|
||||||
|
|
||||||
var myUserProductMappings = userProductMappings.Where(x => x.Id == id).ToList();
|
[NonAction]
|
||||||
//put serviceprovider id and name into a dictionary
|
[ApiExplorerSettings(IgnoreApi = true)]
|
||||||
|
[SignalR(SignalRTags.GetUserProductMappingsById)]
|
||||||
|
public async Task<List<UserProductMapping>> GetUserProductMappingsById(Guid id)
|
||||||
|
{
|
||||||
|
_logger.Info($@"GetUserProductMappingsById called with userId: {id}");
|
||||||
|
|
||||||
return myUserProductMappings.ToJson();
|
var userproductMapping = await adminDal.GetUserProductMappingByIdAsync(id);
|
||||||
|
return userproductMapping == null ? [] : [userproductMapping];
|
||||||
}
|
}
|
||||||
|
|
||||||
[AllowAnonymous]
|
[AllowAnonymous]
|
||||||
[HttpPost]
|
[HttpPost]
|
||||||
[Route(APIUrls.GetAllUserProductMappingsRouteName)]
|
[Route(APIUrls.GetAllUserProductMappingsRouteName)]
|
||||||
[SignalR(SignalRTags.GetAllUserProductMappings)]
|
[SignalR(SignalRTags.GetAllUserProductMappings)]
|
||||||
public async Task<string> GetAllUserProductMappings()
|
public async Task<List<UserProductMapping>> GetAllUserProductMappings()
|
||||||
{
|
{
|
||||||
_logger.Info($@"GetAllUserProductMappings called");
|
_logger.Info($@"GetAllUserProductMappings called");
|
||||||
|
|
||||||
|
var companyies = (await adminDal.GetAllUserProductMappingsAsync()).OrderBy(x => x.ProductId).ToList();
|
||||||
var serviceProviders = adminDal.GetAllUserProductMappings()!.OrderBy(x => x.ProductId);
|
return companyies;
|
||||||
|
|
||||||
//put serviceprovider id and name into a dictionary
|
|
||||||
|
|
||||||
return serviceProviders.ToJson();
|
|
||||||
}
|
}
|
||||||
|
|
||||||
[AllowAnonymous]
|
[AllowAnonymous]
|
||||||
|
|
@ -283,8 +285,7 @@ namespace TIAMWebApp.Server.Controllers
|
||||||
{
|
{
|
||||||
_logger.Info($@"GetCarsForUserProductMapping called with userProductMappingId: {userProductMappingId}");
|
_logger.Info($@"GetCarsForUserProductMapping called with userProductMappingId: {userProductMappingId}");
|
||||||
|
|
||||||
var cars = adminDal.GetCarByUserProductMappingId(userProductMappingId);
|
var cars = await adminDal.GetCarByUserProductMappingIdAsync(userProductMappingId);
|
||||||
|
|
||||||
return cars;
|
return cars;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
@ -297,7 +298,6 @@ namespace TIAMWebApp.Server.Controllers
|
||||||
_logger.Info($@"GetAllCars called ");
|
_logger.Info($@"GetAllCars called ");
|
||||||
|
|
||||||
var cars = await adminDal.GetAllCarsAsync();
|
var cars = await adminDal.GetAllCarsAsync();
|
||||||
|
|
||||||
return cars;
|
return cars;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
@ -339,12 +339,10 @@ namespace TIAMWebApp.Server.Controllers
|
||||||
[Tags("Finished", "Cars")]
|
[Tags("Finished", "Cars")]
|
||||||
[EndpointSummary("Create car")]
|
[EndpointSummary("Create car")]
|
||||||
[SignalR(SignalRTags.CreateCar)]
|
[SignalR(SignalRTags.CreateCar)]
|
||||||
public async Task<Car> CreateCar(Car car)
|
public async Task<Car?> CreateCar(Car car)
|
||||||
{
|
{
|
||||||
var result = await CarDataChanging(car, TrackingState.Add);
|
var result = await CarDataChanging(car, TrackingState.Add);
|
||||||
if (result)
|
return result ? car : null;
|
||||||
return car;
|
|
||||||
else return null;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
[AllowAnonymous]
|
[AllowAnonymous]
|
||||||
|
|
@ -353,12 +351,10 @@ namespace TIAMWebApp.Server.Controllers
|
||||||
[Tags("Finished", "Cars")]
|
[Tags("Finished", "Cars")]
|
||||||
[EndpointSummary("Update car")]
|
[EndpointSummary("Update car")]
|
||||||
[SignalR(SignalRTags.UpdateCar)]
|
[SignalR(SignalRTags.UpdateCar)]
|
||||||
public async Task<Car> UpdateCar(Car car)
|
public async Task<Car?> UpdateCar(Car car)
|
||||||
{
|
{
|
||||||
var result = await CarDataChanging(car, TrackingState.Update);
|
var result = await CarDataChanging(car, TrackingState.Update);
|
||||||
if (result)
|
return result ? car : null;
|
||||||
return car;
|
|
||||||
else return null;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
@ -377,7 +373,6 @@ namespace TIAMWebApp.Server.Controllers
|
||||||
[SignalR(SignalRTags.AddProduct)]
|
[SignalR(SignalRTags.AddProduct)]
|
||||||
public async Task<IActionResult> AddProduct([FromBody] Product product)
|
public async Task<IActionResult> AddProduct([FromBody] Product product)
|
||||||
{
|
{
|
||||||
|
|
||||||
_logger.Info(@"AddProduct called");
|
_logger.Info(@"AddProduct called");
|
||||||
|
|
||||||
if (product == null)
|
if (product == null)
|
||||||
|
|
@ -386,7 +381,7 @@ namespace TIAMWebApp.Server.Controllers
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
var result = adminDal.AddProductAsync(product);
|
var result = await adminDal.AddProductAsync(product);
|
||||||
return Ok(product);
|
return Ok(product);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
@ -458,19 +453,12 @@ namespace TIAMWebApp.Server.Controllers
|
||||||
[HttpGet]
|
[HttpGet]
|
||||||
[Route(APIUrls.GetAllProductsRouteName)]
|
[Route(APIUrls.GetAllProductsRouteName)]
|
||||||
[Tags("In-Progress", "Product")]
|
[Tags("In-Progress", "Product")]
|
||||||
public async Task<string> GetAllProducts()
|
public Task<string> GetAllProducts()
|
||||||
{
|
{
|
||||||
_logger.Info("GetAllProducts called");
|
_logger.Info("GetAllProducts called");
|
||||||
|
|
||||||
var products = adminDal.GetProductsJson();
|
var products = adminDal.GetProductsJson();
|
||||||
if (products != null)
|
return Task.FromResult(products);
|
||||||
{
|
|
||||||
return products;
|
|
||||||
}
|
|
||||||
else
|
|
||||||
{
|
|
||||||
return null;
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
[AllowAnonymous]
|
[AllowAnonymous]
|
||||||
|
|
@ -478,14 +466,11 @@ namespace TIAMWebApp.Server.Controllers
|
||||||
[Route(APIUrls.GetProductByIdRouteName)]
|
[Route(APIUrls.GetProductByIdRouteName)]
|
||||||
[Tags("In-Progress", "Product")]
|
[Tags("In-Progress", "Product")]
|
||||||
[SignalR(SignalRTags.GetProductById)]
|
[SignalR(SignalRTags.GetProductById)]
|
||||||
public async Task<Product> GetProductById(Guid productId)
|
public async Task<Product?> GetProductById(Guid productId)
|
||||||
{
|
{
|
||||||
_logger.Info("GetAllProducts called");
|
_logger.Info("GetAllProducts called");
|
||||||
|
|
||||||
var products = adminDal.GetProductById(productId);
|
return await adminDal.GetProductByIdAsync(productId);
|
||||||
|
|
||||||
return products;
|
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
@ -497,12 +482,7 @@ namespace TIAMWebApp.Server.Controllers
|
||||||
_logger.Info("GetAllProducts called");
|
_logger.Info("GetAllProducts called");
|
||||||
|
|
||||||
var product = await GetProductById(productId);
|
var product = await GetProductById(productId);
|
||||||
var products = new List<Product>();
|
return product == null ? [] : [product];
|
||||||
if (product != null) {
|
|
||||||
products.Add(product);
|
|
||||||
}
|
|
||||||
return products;
|
|
||||||
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
@ -15,7 +15,7 @@
|
||||||
<PackageReference Include="Microsoft.AspNetCore.Components.WebAssembly.Server" Version="8.0.6" />
|
<PackageReference Include="Microsoft.AspNetCore.Components.WebAssembly.Server" Version="8.0.6" />
|
||||||
<PackageReference Include="Microsoft.AspNetCore.SignalR.Common" Version="8.0.6" />
|
<PackageReference Include="Microsoft.AspNetCore.SignalR.Common" Version="8.0.6" />
|
||||||
<PackageReference Include="Microsoft.EntityFrameworkCore.SqlServer" Version="8.0.6" />
|
<PackageReference Include="Microsoft.EntityFrameworkCore.SqlServer" Version="8.0.6" />
|
||||||
<PackageReference Include="Microsoft.OpenApi" Version="1.6.14" />
|
<PackageReference Include="Microsoft.OpenApi" Version="1.6.15" />
|
||||||
<PackageReference Include="QRCoderNetCore" Version="1.0.0" />
|
<PackageReference Include="QRCoderNetCore" Version="1.0.0" />
|
||||||
<PackageReference Include="SendGrid" Version="9.29.3" />
|
<PackageReference Include="SendGrid" Version="9.29.3" />
|
||||||
<PackageReference Include="SkiaSharp" Version="2.88.8" />
|
<PackageReference Include="SkiaSharp" Version="2.88.8" />
|
||||||
|
|
|
||||||
|
|
@ -121,6 +121,8 @@ namespace TIAMWebApp.Shared.Application.Services
|
||||||
_logger.DetailConditional($"companyPropertiesByOwner async: {string.Join("; ", response.ResponseData!.Values)}");
|
_logger.DetailConditional($"companyPropertiesByOwner async: {string.Join("; ", response.ResponseData!.Values)}");
|
||||||
|
|
||||||
callback.Invoke(response.ResponseData);
|
callback.Invoke(response.ResponseData);
|
||||||
|
|
||||||
|
return Task.CompletedTask;
|
||||||
}, id);
|
}, id);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -50,6 +50,8 @@ namespace Tiam.Services.Client.Tests
|
||||||
Assert.IsTrue(response.Status == SignalResponseStatus.Success);
|
Assert.IsTrue(response.Status == SignalResponseStatus.Success);
|
||||||
|
|
||||||
company = response.ResponseData;
|
company = response.ResponseData;
|
||||||
|
|
||||||
|
return Task.CompletedTask;
|
||||||
}, companyId);
|
}, companyId);
|
||||||
|
|
||||||
await TaskHelper.WaitToAsync(() => company != null, 5000, 50);
|
await TaskHelper.WaitToAsync(() => company != null, 5000, 50);
|
||||||
|
|
@ -77,6 +79,8 @@ namespace Tiam.Services.Client.Tests
|
||||||
Assert.IsTrue(response.Status == SignalResponseStatus.Success);
|
Assert.IsTrue(response.Status == SignalResponseStatus.Success);
|
||||||
|
|
||||||
companies = response.ResponseData;
|
companies = response.ResponseData;
|
||||||
|
|
||||||
|
return Task.CompletedTask;
|
||||||
});
|
});
|
||||||
|
|
||||||
await TaskHelper.WaitToAsync(() => companies != null, 5000, 50);
|
await TaskHelper.WaitToAsync(() => companies != null, 5000, 50);
|
||||||
|
|
|
||||||
|
|
@ -10,10 +10,13 @@
|
||||||
</PropertyGroup>
|
</PropertyGroup>
|
||||||
|
|
||||||
<ItemGroup>
|
<ItemGroup>
|
||||||
<PackageReference Include="coverlet.collector" Version="6.0.0" />
|
<PackageReference Include="coverlet.collector" Version="6.0.2">
|
||||||
<PackageReference Include="Microsoft.NET.Test.Sdk" Version="17.8.0" />
|
<PrivateAssets>all</PrivateAssets>
|
||||||
<PackageReference Include="MSTest.TestAdapter" Version="3.1.1" />
|
<IncludeAssets>runtime; build; native; contentfiles; analyzers; buildtransitive</IncludeAssets>
|
||||||
<PackageReference Include="MSTest.TestFramework" Version="3.1.1" />
|
</PackageReference>
|
||||||
|
<PackageReference Include="Microsoft.NET.Test.Sdk" Version="17.10.0" />
|
||||||
|
<PackageReference Include="MSTest.TestAdapter" Version="3.4.3" />
|
||||||
|
<PackageReference Include="MSTest.TestFramework" Version="3.4.3" />
|
||||||
</ItemGroup>
|
</ItemGroup>
|
||||||
|
|
||||||
<ItemGroup>
|
<ItemGroup>
|
||||||
|
|
|
||||||
Loading…
Reference in New Issue