84 lines
1.9 KiB
C#
84 lines
1.9 KiB
C#
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
|
|
}
|
|
} |