This commit is contained in:
94
Epost.DAL/Cache/LightControlCacheDAL.cs
Normal file
94
Epost.DAL/Cache/LightControlCacheDAL.cs
Normal file
@ -0,0 +1,94 @@
|
||||
using LightContrl;
|
||||
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 LightControlCacheDAL
|
||||
{
|
||||
|
||||
private static object lockconobj = new object();
|
||||
public static List<LightcontrolModel> MainControlList = new List<LightcontrolModel>();//
|
||||
|
||||
#region 获取计划任务列表
|
||||
public List<LightcontrolModel> GetControlList()
|
||||
{
|
||||
return MainControlList;
|
||||
}
|
||||
#endregion
|
||||
|
||||
|
||||
|
||||
#region 初始化任务列表
|
||||
public void ClearControlList()
|
||||
{
|
||||
foreach (var planitem in MainControlList.ToArray())
|
||||
{
|
||||
MainControlList.Remove(planitem);
|
||||
}
|
||||
}
|
||||
#endregion
|
||||
|
||||
#region Job缓存处理方法
|
||||
/// <summary>
|
||||
/// Job缓存处理方法
|
||||
/// </summary>
|
||||
/// <param name="JobParam"></param>
|
||||
/// <param name="ECommend"></param>
|
||||
/// <returns></returns>
|
||||
public bool UpdateControlList(List<LightcontrolModel> JobParam, EcontrolCommend CommendType)
|
||||
{
|
||||
|
||||
lock (lockconobj)
|
||||
{
|
||||
|
||||
if (CommendType.Equals(EcontrolCommend.Create))
|
||||
{
|
||||
|
||||
MainControlList.AddRange(JobParam);
|
||||
}
|
||||
|
||||
else if (CommendType.Equals(EcontrolCommend.Execute))
|
||||
{
|
||||
JobParam.ForEach(m => MainControlList.Remove(m));
|
||||
|
||||
}
|
||||
|
||||
|
||||
return true;
|
||||
}
|
||||
}
|
||||
#endregion
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
}
|
||||
public enum EcontrolCommend
|
||||
{
|
||||
/// <summary>
|
||||
/// 创建
|
||||
/// </summary>
|
||||
[Description("创建")]
|
||||
Create,
|
||||
/// <summary>
|
||||
/// 删除
|
||||
/// </summary>
|
||||
[Description("删除")]
|
||||
Execute
|
||||
}
|
||||
|
||||
public class LightcontrolModel
|
||||
{
|
||||
private string _controlip = string.Empty;
|
||||
MainControl _maincontrol = new MainControl();
|
||||
|
||||
public MainControl maincontrol { get => _maincontrol; set => _maincontrol = value; }
|
||||
public string controlip { get => _controlip; set => _controlip = value; }
|
||||
}
|
||||
}
|
Reference in New Issue
Block a user