using Newtonsoft.Json;
|
using OfficeOpenXml.FormulaParsing.Excel.Functions.Information;
|
using OfficeOpenXml.FormulaParsing.Excel.Functions.Text;
|
using System;
|
using System.Collections.Generic;
|
using System.ComponentModel;
|
using System.Linq;
|
using System.Reflection;
|
using System.Text;
|
using System.Threading.Tasks;
|
using WIDESEA_Common.CommonEnum;
|
using WIDESEA_Common.LocationEnum;
|
using WIDESEA_Common.OrderEnum;
|
using WIDESEA_Common.StockEnum;
|
using WIDESEA_Common.TaskEnum;
|
using WIDESEA_Core;
|
using WIDESEA_Core.BaseRepository;
|
using WIDESEA_Core.BaseServices;
|
using WIDESEA_Core.Caches;
|
using WIDESEA_Core.DB;
|
using WIDESEA_Core.Enums;
|
using WIDESEA_Core.Helper;
|
using WIDESEA_Core.Utilities;
|
using WIDESEA_DTO.System;
|
using WIDESEA_IBasicRepository;
|
using WIDESEA_ISystemRepository;
|
using WIDESEA_ISystemService;
|
using WIDESEA_Model.Models;
|
|
namespace WIDESEA_SystemService
|
{
|
public class Sys_DictionaryService : ServiceBase<Sys_Dictionary, ISys_DictionaryRepository>, ISys_DictionaryService
|
{
|
private readonly IUnitOfWorkManage _unitOfWorkManage;
|
private readonly ICacheService _cacheService;
|
private readonly IBasicRepository _basicRepository;
|
private readonly ISupplierInfoRepository _supplierInfoRepository;
|
private readonly ISys_RoleDataPermissionRepository _roleDataPermissionRepository;
|
|
public Sys_DictionaryService(ISys_DictionaryRepository BaseDal, IUnitOfWorkManage unitOfWorkManage, ICacheService cacheService, IBasicRepository basicRepository, ISys_RoleDataPermissionRepository roleDataPermissionRepository, ISupplierInfoRepository supplierInfoRepository) : base(BaseDal)
|
{
|
_unitOfWorkManage = unitOfWorkManage;
|
_cacheService = cacheService;
|
_basicRepository = basicRepository;
|
_roleDataPermissionRepository = roleDataPermissionRepository;
|
_supplierInfoRepository = supplierInfoRepository;
|
}
|
|
public ISys_DictionaryRepository Repository => BaseDal;
|
|
public override WebResponseContent AddData(SaveModel saveModel)
|
{
|
string validResult = typeof(Sys_Dictionary).ValidateDicInEntity(saveModel.MainData, true, TProperties);
|
|
if (!string.IsNullOrEmpty(validResult))
|
{
|
return WebResponseContent.Instance.Error(validResult);
|
}
|
|
Sys_Dictionary dictionary = saveModel.MainData.DicToModel<Sys_Dictionary>();
|
if (!string.IsNullOrEmpty(_cacheService.Get(dictionary.DicNo)))
|
_cacheService.Remove(dictionary.DicNo);
|
return base.AddData(saveModel);
|
}
|
|
public override WebResponseContent UpdateData(SaveModel saveModel)
|
{
|
Sys_Dictionary dictionary = saveModel.MainData.DicToModel<Sys_Dictionary>();
|
_cacheService.Remove(dictionary.DicNo);
|
return base.UpdateData(saveModel);
|
}
|
|
public List<VueDictionaryDTO> GetVueDictionary(string[] dicNos)
|
{
|
if (dicNos == null || dicNos.Count() == 0) return new List<VueDictionaryDTO>();
|
List<VueDictionaryDTO> vueDictionaryDTOs = new List<VueDictionaryDTO>();
|
|
List<string> cacheDicNos = new List<string>();
|
foreach (string n in dicNos)
|
{
|
string str = _cacheService.Get(n);
|
if (!string.IsNullOrEmpty(str))
|
{
|
VueDictionaryDTO? vueDictionary = JsonConvert.DeserializeObject<VueDictionaryDTO>(str);
|
|
if (vueDictionary != null)
|
{
|
vueDictionaryDTOs.Add(vueDictionary);
|
cacheDicNos.Add(n);
|
}
|
}
|
}
|
if (dicNos.Where(x => !cacheDicNos.Contains(x)).Count() > 0)
|
{
|
List<VueDictionaryDTO> selectDics = BaseDal.GetDictionaries(dicNos.Where(x => !cacheDicNos.Contains(x))).Select(s => new VueDictionaryDTO
|
{
|
DicNo = s.DicNo,
|
Config = s.Config,
|
//dbSql = s.Sql,
|
Data = s.DicList.OrderByDescending(o => o.OrderNo).Select(list => new { key = list.DicValue, value = list.DicName }),
|
SaveCache = false
|
}).ToList();
|
|
foreach (var item in selectDics)
|
{
|
if (!_cacheService.Exists(item.DicNo) && item.SaveCache)
|
{
|
_cacheService.Add(item.DicNo, item.Serialize());
|
}
|
}
|
vueDictionaryDTOs.AddRange(selectDics);
|
}
|
|
//object GetSourceData(string dicNo, string dbSql, object data)
|
//{
|
// if (string.IsNullOrEmpty(dbSql))
|
// {
|
// return data;
|
// }
|
// return BaseDal.QueryObjectDataBySql(dbSql, null);
|
//}
|
//List<VueDictionaryDTO> vueDictionaryDTOs = dicConfig.Select(item => new VueDictionaryDTO
|
//{
|
// DicNo = item.dicNo,
|
// Config = item.config,
|
// Data = GetSourceData(item.dicNo, item.dbSql, item.list)
|
//}).ToList();
|
|
try
|
{
|
List<string> dicList = dicNos.ToList();
|
if (dicNos.Where(x => !cacheDicNos.Contains(x)).Count() > 0)
|
{
|
string str = AppSettings.Configuration["dics"];
|
if (!string.IsNullOrEmpty(str))
|
{
|
List<string> cusDics = new List<string>();
|
|
List<string> dics = str.Split(",").ToList();
|
|
foreach (var item in dics)
|
{
|
if (dicNos.Contains(item) && !cacheDicNos.Contains(item))
|
{
|
dicList.Remove(item);
|
cusDics.Add(item);
|
}
|
}
|
|
foreach (var item in cusDics)
|
{
|
VueDictionaryDTO vueDictionaryDTO = GetVueDictionary(item.Trim());
|
if (vueDictionaryDTO != null)
|
{
|
vueDictionaryDTOs.Add(vueDictionaryDTO);
|
if (!_cacheService.Exists(item) && vueDictionaryDTO.SaveCache)
|
{
|
_cacheService.Add(item, vueDictionaryDTO.Serialize());
|
}
|
}
|
}
|
}
|
}
|
}
|
catch
|
{
|
|
}
|
return vueDictionaryDTOs;
|
}
|
|
private VueDictionaryDTO GetVueDictionary(string key)
|
{
|
VueDictionaryDTO result = null;
|
try
|
{
|
switch (key)
|
{
|
case "warehouses":
|
{
|
List<object> data = new List<object>();
|
|
{
|
List<Dt_Warehouse> warehouses = _basicRepository.WarehouseRepository.QueryData();
|
int index = 0;
|
foreach (var item in warehouses)
|
{
|
data.Add(new { key = item.WarehouseId, value = item.WarehouseName });
|
index++;
|
}
|
}
|
|
result = new VueDictionaryDTO { DicNo = key, Config = "", Data = data };
|
}
|
break;
|
case "suppliers":
|
{
|
List<object> data = new List<object>();
|
|
{
|
List<Dt_SupplierInfo> supplierInfos = _supplierInfoRepository.QueryData();
|
int index = 0;
|
foreach (var item in supplierInfos)
|
{
|
data.Add(new { key = item.SupplierCode, value = item.SupplierCode });
|
index++;
|
}
|
}
|
|
result = new VueDictionaryDTO { DicNo = key, Config = "", Data = data };
|
}
|
break;
|
case "inboundState":
|
{
|
List<object> data = new List<object>();
|
Type type = typeof(InOrderStatusEnum);
|
List<int> enums = Enum.GetValues(typeof(InOrderStatusEnum)).Cast<int>().ToList();
|
int index = 0;
|
foreach (var item in enums)
|
{
|
FieldInfo? fieldInfo = typeof(InOrderStatusEnum).GetField(((InOrderStatusEnum)item).ToString());
|
DescriptionAttribute? description = fieldInfo.GetCustomAttribute<DescriptionAttribute>();
|
if (description != null)
|
{
|
data.Add(new { key = item.ToString(), value = description.Description });
|
}
|
else
|
{
|
data.Add(new { key = item.ToString(), value = item.ToString() });
|
}
|
index++;
|
}
|
|
result = new VueDictionaryDTO { DicNo = key, Config = "", Data = data };
|
}
|
break;
|
case "outboundStatusEnum":
|
{
|
List<object> data = new List<object>();
|
Type type = typeof(OutOrderStatusEnum);
|
List<int> enums = Enum.GetValues(typeof(OutOrderStatusEnum)).Cast<int>().ToList();
|
int index = 0;
|
foreach (var item in enums)
|
{
|
FieldInfo? fieldInfo = typeof(OutOrderStatusEnum).GetField(((OutOrderStatusEnum)item).ToString());
|
DescriptionAttribute? description = fieldInfo.GetCustomAttribute<DescriptionAttribute>();
|
if (description != null)
|
{
|
data.Add(new { key = item.ToString(), value = description.Description });
|
}
|
else
|
{
|
data.Add(new { key = item.ToString(), value = item.ToString() });
|
}
|
index++;
|
}
|
|
result = new VueDictionaryDTO { DicNo = key, Config = "", Data = data };
|
}
|
break;
|
case "inOrderType":
|
{
|
List<object> data = new List<object>();
|
|
{
|
Type type = typeof(InOrderTypeEnum);
|
List<int> enums = Enum.GetValues(typeof(InOrderTypeEnum)).Cast<int>().ToList();
|
int index = 0;
|
foreach (var item in enums)
|
{
|
FieldInfo? fieldInfo = typeof(InOrderTypeEnum).GetField(((InOrderTypeEnum)item).ToString());
|
DescriptionAttribute? description = fieldInfo.GetCustomAttribute<DescriptionAttribute>();
|
if (description != null)
|
{
|
data.Add(new { key = item.ToString(), value = description.Description });
|
}
|
else
|
{
|
data.Add(new { key = item.ToString(), value = item.ToString() });
|
}
|
index++;
|
}
|
}
|
|
result = new VueDictionaryDTO { DicNo = key, Config = "", Data = data };
|
}
|
break;
|
case "outOrderType":
|
{
|
List<object> data = new List<object>();
|
|
{
|
Type type = typeof(OutOrderTypeEnum);
|
List<int> enums = Enum.GetValues(typeof(OutOrderTypeEnum)).Cast<int>().ToList();
|
int index = 0;
|
foreach (var item in enums)
|
{
|
FieldInfo? fieldInfo = typeof(OutOrderTypeEnum).GetField(((OutOrderTypeEnum)item).ToString());
|
DescriptionAttribute? description = fieldInfo.GetCustomAttribute<DescriptionAttribute>();
|
if (description != null)
|
{
|
data.Add(new { key = item.ToString(), value = description.Description });
|
}
|
else
|
{
|
data.Add(new { key = item.ToString(), value = item.ToString() });
|
}
|
index++;
|
}
|
}
|
|
result = new VueDictionaryDTO { DicNo = key, Config = "", Data = data };
|
}
|
break;
|
case "orderDetailStatusEnum":
|
{
|
List<object> data = new List<object>();
|
|
{
|
Type type = typeof(OrderDetailStatusEnum);
|
List<int> enums = Enum.GetValues(typeof(OrderDetailStatusEnum)).Cast<int>().ToList();
|
int index = 0;
|
foreach (var item in enums)
|
{
|
FieldInfo? fieldInfo = typeof(OrderDetailStatusEnum).GetField(((OrderDetailStatusEnum)item).ToString());
|
DescriptionAttribute? description = fieldInfo.GetCustomAttribute<DescriptionAttribute>();
|
if (description != null)
|
{
|
data.Add(new { key = item.ToString(), value = description.Description });
|
}
|
else
|
{
|
data.Add(new { key = item.ToString(), value = item.ToString() });
|
}
|
index++;
|
}
|
}
|
|
result = new VueDictionaryDTO { DicNo = key, Config = "", Data = data };
|
}
|
break;
|
case "createType":
|
{
|
List<object> data = new List<object>();
|
|
{
|
Type type = typeof(OrderCreateTypeEnum);
|
List<int> enums = Enum.GetValues(typeof(OrderCreateTypeEnum)).Cast<int>().ToList();
|
int index = 0;
|
foreach (var item in enums)
|
{
|
FieldInfo? fieldInfo = typeof(OrderCreateTypeEnum).GetField(((OrderCreateTypeEnum)item).ToString());
|
DescriptionAttribute? description = fieldInfo.GetCustomAttribute<DescriptionAttribute>();
|
if (description != null)
|
{
|
data.Add(new { key = item.ToString(), value = description.Description });
|
}
|
else
|
{
|
data.Add(new { key = item.ToString(), value = item.ToString() });
|
}
|
index++;
|
}
|
}
|
|
result = new VueDictionaryDTO { DicNo = key, Config = "", Data = data };
|
}
|
break;
|
case "enableEnum":
|
{
|
List<object> data = new List<object>();
|
|
{
|
Type type = typeof(EnableEnum);
|
List<int> enums = Enum.GetValues(typeof(EnableEnum)).Cast<int>().ToList();
|
int index = 0;
|
foreach (var item in enums)
|
{
|
FieldInfo? fieldInfo = typeof(EnableEnum).GetField(((EnableEnum)item).ToString());
|
DescriptionAttribute? description = fieldInfo.GetCustomAttribute<DescriptionAttribute>();
|
if (description != null)
|
{
|
data.Add(new { key = item.ToString(), value = description.Description });
|
}
|
else
|
{
|
data.Add(new { key = item.ToString(), value = item.ToString() });
|
}
|
index++;
|
}
|
}
|
|
result = new VueDictionaryDTO { DicNo = key, Config = "", Data = data };
|
}
|
break;
|
case "enableStatusEnum":
|
{
|
List<object> data = new List<object>();
|
|
{
|
Type type = typeof(EnableStatusEnum);
|
List<int> enums = Enum.GetValues(typeof(EnableStatusEnum)).Cast<int>().ToList();
|
int index = 0;
|
foreach (var item in enums)
|
{
|
FieldInfo? fieldInfo = typeof(EnableStatusEnum).GetField(((EnableStatusEnum)item).ToString());
|
DescriptionAttribute? description = fieldInfo.GetCustomAttribute<DescriptionAttribute>();
|
if (description != null)
|
{
|
data.Add(new { key = item.ToString(), value = description.Description });
|
}
|
else
|
{
|
data.Add(new { key = item.ToString(), value = item.ToString() });
|
}
|
index++;
|
}
|
}
|
|
result = new VueDictionaryDTO { DicNo = key, Config = "", Data = data };
|
}
|
break;
|
case "locationStatusEnum":
|
{
|
List<object> data = new List<object>();
|
|
{
|
Type type = typeof(LocationStatusEnum);
|
List<int> enums = Enum.GetValues(typeof(LocationStatusEnum)).Cast<int>().ToList();
|
int index = 0;
|
foreach (var item in enums)
|
{
|
FieldInfo? fieldInfo = typeof(LocationStatusEnum).GetField(((LocationStatusEnum)item).ToString());
|
DescriptionAttribute? description = fieldInfo.GetCustomAttribute<DescriptionAttribute>();
|
if (description != null)
|
{
|
data.Add(new { key = item.ToString(), value = description.Description });
|
}
|
else
|
{
|
data.Add(new { key = item.ToString(), value = item.ToString() });
|
}
|
index++;
|
}
|
}
|
|
result = new VueDictionaryDTO { DicNo = key, Config = "", Data = data };
|
}
|
break;
|
case "locationTypeEnum":
|
{
|
List<object> data = new List<object>();
|
|
{
|
Type type = typeof(LocationTypeEnum);
|
List<int> enums = Enum.GetValues(typeof(LocationTypeEnum)).Cast<int>().ToList();
|
int index = 0;
|
foreach (var item in enums)
|
{
|
FieldInfo? fieldInfo = typeof(LocationTypeEnum).GetField(((LocationTypeEnum)item).ToString());
|
DescriptionAttribute? description = fieldInfo.GetCustomAttribute<DescriptionAttribute>();
|
if (description != null)
|
{
|
data.Add(new { key = item.ToString(), value = description.Description });
|
}
|
else
|
{
|
data.Add(new { key = item.ToString(), value = item.ToString() });
|
}
|
index++;
|
}
|
}
|
|
result = new VueDictionaryDTO { DicNo = key, Config = "", Data = data };
|
}
|
break;
|
case "taskTypeEnum":
|
{
|
List<object> data = new List<object>();
|
|
//{
|
// Type type = typeof(TaskTypeEnum);
|
// List<int> enums = Enum.GetValues(typeof(TaskTypeEnum)).Cast<int>().ToList();
|
// int index = 0;
|
// foreach (var item in enums)
|
// {
|
// FieldInfo? fieldInfo = typeof(TaskTypeEnum).GetField(((TaskTypeEnum)item).ToString());
|
// DescriptionAttribute? description = fieldInfo.GetCustomAttribute<DescriptionAttribute>();
|
// if (description != null)
|
// {
|
// data.Add(new { key = item.ToString(), value = description.Description });
|
// }
|
// else
|
// {
|
// data.Add(new { key = item.ToString(), value = item.ToString() });
|
// }
|
// index++;
|
// }
|
//}
|
|
result = new VueDictionaryDTO { DicNo = key, Config = "", Data = data };
|
}
|
break;
|
case "taskStatusEnum":
|
{
|
List<object> data = new List<object>();
|
|
{
|
Type type = typeof(TaskStatusEnum);
|
List<int> enums = Enum.GetValues(typeof(TaskStatusEnum)).Cast<int>().ToList();
|
int index = 0;
|
foreach (var item in enums)
|
{
|
FieldInfo? fieldInfo = typeof(TaskStatusEnum).GetField(((TaskStatusEnum)item).ToString());
|
DescriptionAttribute? description = fieldInfo.GetCustomAttribute<DescriptionAttribute>();
|
if (description != null)
|
{
|
data.Add(new { key = item.ToString(), value = description.Description });
|
}
|
else
|
{
|
data.Add(new { key = item.ToString(), value = item.ToString() });
|
}
|
index++;
|
}
|
}
|
|
//{
|
// Type type = typeof(TaskStatusEnum);
|
// List<int> enums = Enum.GetValues(typeof(TaskStatusEnum)).Cast<int>().ToList();
|
// int index = 0;
|
// foreach (var item in enums)
|
// {
|
// FieldInfo? fieldInfo = typeof(TaskStatusEnum).GetField(((TaskStatusEnum)item).ToString());
|
// DescriptionAttribute? description = fieldInfo.GetCustomAttribute<DescriptionAttribute>();
|
// if (description != null)
|
// {
|
// data.Add(new { key = item.ToString(), value = description.Description });
|
// }
|
// else
|
// {
|
// data.Add(new { key = item.ToString(), value = item.ToString() });
|
// }
|
// index++;
|
// }
|
//}
|
result = new VueDictionaryDTO { DicNo = key, Config = "", Data = data };
|
}
|
break;
|
case "stockStatusEmun":
|
{
|
List<object> data = new List<object>();
|
Type type = typeof(StockStatusEmun);
|
List<int> enums = Enum.GetValues(typeof(StockStatusEmun)).Cast<int>().ToList();
|
int index = 0;
|
foreach (var item in enums)
|
{
|
FieldInfo? fieldInfo = typeof(StockStatusEmun).GetField(((StockStatusEmun)item).ToString());
|
DescriptionAttribute? description = fieldInfo.GetCustomAttribute<DescriptionAttribute>();
|
if (description != null)
|
{
|
data.Add(new { key = item.ToString(), value = description.Description });
|
}
|
else
|
{
|
data.Add(new { key = item.ToString(), value = item.ToString() });
|
}
|
index++;
|
}
|
|
result = new VueDictionaryDTO { DicNo = key, Config = "", Data = data };
|
}
|
break;
|
case "stockChangeType":
|
{
|
List<object> data = new List<object>();
|
Type type = typeof(StockChangeTypeEnum);
|
List<int> enums = Enum.GetValues(typeof(StockChangeTypeEnum)).Cast<int>().ToList();
|
int index = 0;
|
foreach (var item in enums)
|
{
|
FieldInfo? fieldInfo = typeof(StockChangeTypeEnum).GetField(((StockChangeTypeEnum)item).ToString());
|
DescriptionAttribute? description = fieldInfo.GetCustomAttribute<DescriptionAttribute>();
|
if (description != null)
|
{
|
data.Add(new { key = item.ToString(), value = description.Description });
|
}
|
else
|
{
|
data.Add(new { key = item.ToString(), value = item.ToString() });
|
}
|
index++;
|
}
|
|
result = new VueDictionaryDTO { DicNo = key, Config = "", Data = data };
|
}
|
break;
|
case "outStockStatus":
|
{
|
List<object> data = new List<object>();
|
Type type = typeof(OutLockStockStatusEnum);
|
List<int> enums = Enum.GetValues(typeof(OutLockStockStatusEnum)).Cast<int>().ToList();
|
int index = 0;
|
foreach (var item in enums)
|
{
|
FieldInfo? fieldInfo = typeof(OutLockStockStatusEnum).GetField(((OutLockStockStatusEnum)item).ToString());
|
DescriptionAttribute? description = fieldInfo.GetCustomAttribute<DescriptionAttribute>();
|
if (description != null)
|
{
|
data.Add(new { key = item.ToString(), value = description.Description });
|
}
|
else
|
{
|
data.Add(new { key = item.ToString(), value = item.ToString() });
|
}
|
index++;
|
}
|
|
result = new VueDictionaryDTO { DicNo = key, Config = "", Data = data };
|
}
|
break;
|
case "receiveOrderTypeEnum":
|
{
|
List<object> data = new List<object>();
|
|
{
|
Type type = typeof(ReceiveOrderTypeEnum);
|
List<int> enums = Enum.GetValues(typeof(ReceiveOrderTypeEnum)).Cast<int>().ToList();
|
int index = 0;
|
foreach (var item in enums)
|
{
|
FieldInfo? fieldInfo = typeof(ReceiveOrderTypeEnum).GetField(((ReceiveOrderTypeEnum)item).ToString());
|
DescriptionAttribute? description = fieldInfo.GetCustomAttribute<DescriptionAttribute>();
|
if (description != null)
|
{
|
data.Add(new { key = item.ToString(), value = description.Description });
|
}
|
else
|
{
|
data.Add(new { key = item.ToString(), value = item.ToString() });
|
}
|
index++;
|
}
|
}
|
|
result = new VueDictionaryDTO { DicNo = key, Config = "", Data = data };
|
}
|
break;
|
case "authorityScope":
|
{
|
if (App.User.IsSuperAdmin)
|
{
|
List<Dt_Warehouse> warehouses = _basicRepository.WarehouseRepository.QueryData(x => true);
|
var data = warehouses.Select(x => new { key = x.WarehouseId, value = x.WarehouseName });
|
result = new VueDictionaryDTO { DicNo = key, Config = "", Data = data };
|
}
|
else
|
{
|
List<Sys_RoleDataPermission> roleDataPermissions = _roleDataPermissionRepository.QueryData(x => x.RoleId == App.User.RoleId);
|
var data = roleDataPermissions.Select(x => new { key = x.WarehouseId, value = x.WarehouseName });
|
result = new VueDictionaryDTO { DicNo = key, Config = "", Data = data };
|
}
|
}
|
break;
|
case "authorityScopes":
|
{
|
List<Sys_Role> roles = Repository.Db.Queryable<Sys_Role>().ToList();
|
List<object> data = new List<object>();
|
foreach (var item in roles)
|
{
|
List<Sys_RoleDataPermission> roleDataPermissions = _roleDataPermissionRepository.QueryData(x => x.RoleId == item.RoleId);
|
string value = "";
|
foreach (var roleDataPermission in roleDataPermissions)
|
{
|
value += (roleDataPermission.WarehouseName + ",");
|
}
|
if (roleDataPermissions.Count > 0)
|
data.Add(new { key = item.RoleId, value = value.Substring(0, value.Length - 1) });
|
else
|
data.Add(new { key = item.RoleId, value = "无权限" });
|
}
|
data.Add(new { key = -1, value = "无权限" });
|
result = new VueDictionaryDTO { DicNo = key, Config = "", Data = data, SaveCache = false };
|
}
|
|
break;
|
case "locationChangeType":
|
{
|
List<object> data = new List<object>();
|
|
{
|
Type type = typeof(LocationChangeType);
|
List<int> enums = Enum.GetValues(typeof(LocationChangeType)).Cast<int>().ToList();
|
int index = 0;
|
foreach (var item in enums)
|
{
|
FieldInfo? fieldInfo = typeof(LocationChangeType).GetField(((LocationChangeType)item).ToString());
|
DescriptionAttribute? description = fieldInfo.GetCustomAttribute<DescriptionAttribute>();
|
if (description != null)
|
{
|
data.Add(new { key = item.ToString(), value = description.Description });
|
}
|
else
|
{
|
data.Add(new { key = item.ToString(), value = item.ToString() });
|
}
|
index++;
|
}
|
}
|
|
result = new VueDictionaryDTO { DicNo = key, Config = "", Data = data };
|
}
|
break;
|
}
|
return result;
|
}
|
catch (Exception ex)
|
{
|
return null;
|
}
|
}
|
}
|
}
|