Files
T-DAS/Epost.DAL/Cache/UserModelCacheDAL.cs

84 lines
1.9 KiB
C#
Raw Permalink Normal View History

2023-01-13 15:30:20 +08:00
using Epost.Model;
using System;
using System.Collections.Generic;
using System.ComponentModel;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
namespace Epost.DAL.Cache
{
public class UserModelCacheDAL
{
private static object lockobj = new object();
public static List<UserCodeModel> UserCodeList = new List<UserCodeModel>();//
#region
public List<UserCodeModel> GetUserCodeList()
{
return UserCodeList;
}
#endregion
#region
public void ClearUserCodeList()
{
foreach (var planitem in UserCodeList.ToArray())
{
UserCodeList.Remove(planitem);
}
}
#endregion
#region Job缓存处理方法
/// <summary>
/// Job缓存处理方法
/// </summary>
/// <param name="JobParam"></param>
/// <param name="ECommend"></param>
/// <returns></returns>
public bool UpdateUserCodeList(List<UserCodeModel> JobParam, EUserCommend CommendType)
{
lock (lockobj)
{
if (CommendType.Equals(EUserCommend.Create))
{
UserCodeList.AddRange(JobParam);
}
else if (CommendType.Equals(EUserCommend.Execute))
{
JobParam.ForEach(m => UserCodeList.Remove(m));
}
return true;
}
}
#endregion
}
public enum EUserCommend
{
/// <summary>
/// 接收扫描任务
/// </summary>
[Description("接收扫描任务")]
Create,
/// <summary>
/// 任务处理
/// </summary>
[Description("任务处理")]
Execute
}
}