72 lines
2.2 KiB
C#
72 lines
2.2 KiB
C#
|
using RGD.DBUtility;
|
|||
|
using System;
|
|||
|
using System.Collections.Generic;
|
|||
|
using System.Data;
|
|||
|
|
|||
|
namespace RGD.DataService
|
|||
|
{
|
|||
|
/// <summary>
|
|||
|
/// 管理交互
|
|||
|
/// </summary>
|
|||
|
public class IOControlService
|
|||
|
{
|
|||
|
private static Dictionary<string, Model.MIOControlStatus> _IOControlStatus;
|
|||
|
|
|||
|
/// <summary>
|
|||
|
/// 加载到内存中的与管理任务交互的调度任务状态信息集合
|
|||
|
/// </summary>
|
|||
|
public static Dictionary<string, Model.MIOControlStatus> IOControlStatus
|
|||
|
{
|
|||
|
get { return IOControlService._IOControlStatus; }
|
|||
|
set { IOControlService._IOControlStatus = value; }
|
|||
|
}
|
|||
|
|
|||
|
public static void AddIOControlStatus()
|
|||
|
{
|
|||
|
_IOControlStatus = new Dictionary<string, Model.MIOControlStatus>();
|
|||
|
DataView dv = DbHelperSQL.Query("SELECT * FROM T_Base_IOControlStatus ").Tables[0].DefaultView;
|
|||
|
for (int i = 0; i < dv.Count; i++)
|
|||
|
{
|
|||
|
Model.MIOControlStatus ioStatus = new Model.MIOControlStatus();
|
|||
|
ioStatus.StatusCode = dv[i]["F_StatusCode"].ToString();
|
|||
|
if (dv[i]["F_StatusID"] == DBNull.Value)
|
|||
|
{
|
|||
|
ioStatus.StatusID = 0;
|
|||
|
}
|
|||
|
else
|
|||
|
{
|
|||
|
ioStatus.StatusID = Convert.ToInt32(dv[i]["F_StatusID"]);
|
|||
|
}
|
|||
|
if (dv[i]["F_Remark"] == DBNull.Value)
|
|||
|
{
|
|||
|
ioStatus.Remark = "-";
|
|||
|
}
|
|||
|
else
|
|||
|
{
|
|||
|
ioStatus.Remark = dv[i]["F_Remark"].ToString();
|
|||
|
}
|
|||
|
|
|||
|
_IOControlStatus.Add(ioStatus.StatusCode, ioStatus);
|
|||
|
}
|
|||
|
}
|
|||
|
|
|||
|
public static Model.MIOControlStatus GetIOControlStatus(string StatusCode)
|
|||
|
{
|
|||
|
try
|
|||
|
{
|
|||
|
if (_IOControlStatus.ContainsKey(StatusCode) == true)
|
|||
|
{
|
|||
|
return _IOControlStatus[StatusCode];
|
|||
|
}
|
|||
|
else
|
|||
|
{
|
|||
|
return null;
|
|||
|
}
|
|||
|
}
|
|||
|
catch (Exception)
|
|||
|
{
|
|||
|
return null;
|
|||
|
}
|
|||
|
}
|
|||
|
}
|
|||
|
}
|