| | |
| | | using WIDESEA_Core; |
| | | using WIDESEA_Core.BaseRepository; |
| | | using WIDESEA_Core.BaseServices; |
| | | using WIDESEA_Core.DB.Models; |
| | | using WIDESEA_Core.Enums; |
| | | using WIDESEA_Core.Helper; |
| | | using WIDESEA_Core.HostedService; |
| | | using WIDESEA_Core.Utilities; |
| | | using WIDESEA_DTO.Stock; |
| | | using WIDESEA_IStockRepository; |
| | |
| | | { |
| | | public partial class StockViewService : IStockViewService |
| | | { |
| | | private string GetDataRole(Type type) |
| | | { |
| | | try |
| | | { |
| | | UserRole? userRole = PermissionDataHostService.UserRoles.FirstOrDefault(x => x.UserId == App.User.UserId); |
| | | if (userRole == null) |
| | | throw new Exception($"æ æé"); |
| | | |
| | | if (type.IsAssignableFrom(typeof(BaseWarehouseEntity)) || type.GetProperty(nameof(BaseWarehouseEntity.WarehouseId)) != null) |
| | | { |
| | | if (userRole.WarehouseIds.Count > 0) |
| | | { |
| | | return $"{nameof(BaseWarehouseEntity.WarehouseId)} in ({userRole.WarehouseIds.Serialize().Replace("[", "").Replace("]", "")})"; |
| | | } |
| | | |
| | | else |
| | | return $"1 != 1"; |
| | | } |
| | | else |
| | | { |
| | | return "1 = 1"; |
| | | } |
| | | } |
| | | catch (Exception ex) |
| | | { |
| | | throw new Exception($"æ æéï¼{ex.Message}"); |
| | | } |
| | | } |
| | | } |
| | | } |