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

83 lines
1.8 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 ChangeBoxCache
{
private static object lockcgobj = new object();
public static List<ChangeBoxModel> CgBoxList = new List<ChangeBoxModel>();//
#region
public List<ChangeBoxModel> GetBoxList()
{
return CgBoxList;
}
#endregion
#region
public void ClearBoxList()
{
foreach (var planitem in CgBoxList.ToArray())
{
CgBoxList.Remove(planitem);
}
}
#endregion
#region Job缓存处理方法
/// <summary>
/// Job缓存处理方法
/// </summary>
/// <param name="JobParam"></param>
/// <param name="ECommend"></param>
/// <returns></returns>
public bool UpdateBoxList(List<ChangeBoxModel> JobParam, EChangeboxCommend CommendType)
{
lock (lockcgobj)
{
if (CommendType.Equals(EChangeboxCommend.Create))
{
CgBoxList.AddRange(JobParam);
}
else if (CommendType.Equals(EChangeboxCommend.Execute))
{
JobParam.ForEach(m => CgBoxList.Remove(m));
}
return true;
}
}
#endregion
}
public enum EChangeboxCommend
{
/// <summary>
/// 接收扫描任务
/// </summary>
[Description("接收扫描任务")]
Create,
/// <summary>
/// 任务处理
/// </summary>
[Description("任务处理")]
Execute
}
}