123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051 |
- using DBHelper;
- using Microsoft.EntityFrameworkCore;
- using System.Linq;
- using WCS.Entity.Protocol;
- namespace WCS.Service.Helpers
- {
- /// <summary>
- /// 系统设置
- /// </summary>
- public class SystemConfigHelpers
- {
- /// <summary>
- /// 获取指定设备配置信息 true表示设备启用,false标识设备未启用
- /// </summary>
- /// <param name="DEVICECODE">设备编号</param>
- /// <returns></returns>
- public static bool GetDeviceConfig(string DEVICECODE)
- {
- bool result = true;
- DB.Do(db =>
- {
- var systemConfig = db.Default.Set<WCS_SystemConfig>().AsNoTracking().SingleOrDefault(p => p.DEVICECODE == DEVICECODE);
- if (systemConfig != null) result = systemConfig.ENABLED;
- });
- return result;
- }
- /// <returns></returns>
- public static bool GetDeviceEnabled(string CODE)
- {
- bool isError = false;
- DB.Do(db =>
- {
- isError = db.Default.Set<WCS_SystemConfig>().AsNoTracking().Any(p => p.Code == CODE && p.ENABLED);
- });
- return isError;
- }
- public static bool GetDeviceIsUsed(string CODE)
- {
- bool result = false;
- DB.Do(db =>
- {
- var systemConfig = db.Default.Set<WCS_SystemConfig>().AsNoTracking().SingleOrDefault(p => p.DEVICECODE == CODE);
- if (systemConfig != null) result = systemConfig.ENABLED;
- });
- return result;
- }
- }
- }
|