using System;
using System.Collections.Generic;
using System.Text;
using System.ServiceModel;
using System.Data;
using SiaSun.LMS.Model;
using SiaSun.LMS.Common;
using System.Collections;
using System.Linq;
using System.Reflection;
namespace SiaSun.LMS.Implement
{
[ServiceBehavior(IncludeExceptionDetailInFaults = true, InstanceContextMode = InstanceContextMode.Single, ConcurrencyMode = ConcurrencyMode.Multiple, MaxItemsInObjectGraph = int.MaxValue)]
public class S_FlowService : S_BaseService, SiaSun.LMS.Interface.I_FlowService
{
public S_FlowService()
{
}
#region FLOW_PARA
/// 获取流程参数
/// 获取流程参数
///
/// 流程类型
///
public IList FlowGetParameters(string FLOW_TYPE_CODE)
{
return this._P_FLOW_PARA.GetListFlowTypeCode(FLOW_TYPE_CODE);
}
#endregion
#region FLOW_ACTION
/// 获取计划动作
/// 获取计划动作
///
/// 计划编号
///
public DataTable PlanGetAction(string PLAN_ID)
{
DataTable dt = this.GetList(string.Format("SELECT * FROM V_FLOW_PLAN_ACTION WHERE PLAN_ID = {0}", PLAN_ID));
return dt;
}
/// 获取计划动作
/// 获取计划动作
///
/// 计划编号
/// 默认动作
///
public DataTable PlanGetAction(string PLAN_ID, string FLOW_ACTION_DEFAULT)
{
DataTable dt = this.GetList(string.Format("SELECT * FROM V_FLOW_PLAN_ACTION WHERE FLOW_ACTION_DEFAULT ='{1}' AND PLAN_ID = {0}", PLAN_ID, FLOW_ACTION_DEFAULT));
return dt;
}
/// 获取任务动作
/// 获取任务动作
///
/// 任务编号
///
public DataTable ManageGetAction(string MANAGE_ID)
{
DataTable dt = this.GetList(string.Format("SELECT * FROM V_FLOW_MANAGE_ACTION WHERE MANAGE_ID = {0}", MANAGE_ID));
return dt;
}
/// 获取任务动作
/// 获取任务动作
///
/// 任务编号
/// 动作编码
///
public DataTable ManageGetAction(string MANAGE_ID, string ACTION_CODE)
{
DataTable dt = this.GetList(string.Format("SELECT * FROM V_FLOW_MANAGE_ACTION WHERE MANAGE_ID = {0} AND ACTION_CODE='{1}'", MANAGE_ID, ACTION_CODE));
return dt;
}
/// 获取控制动作
/// 获取控制动作
///
/// 任务编号
///
public DataTable ControlGetAction(string MANAGE_ID)
{
DataTable dt = this.GetList(string.Format("SELECT * FROM V_FLOW_CONTROL_ACTION WHERE MANAGE_ID = {0}", MANAGE_ID));
return dt;
}
/// 执行事件
/// 执行事件
///
/// 事件源
/// 返回结果
///
public bool EventExecute(string sEvent, out string sResult)
{
bool bResult = true;
sResult = string.Empty;
SiaSun.LMS.Common.Compiler cp = new SiaSun.LMS.Common.Compiler();
string sPath = AppDomain.CurrentDomain.BaseDirectory;
cp.lsRef.Add(sPath + @"\SiaSun.LMS.WCFHost.CP.exe");
cp.lsRef.Add(sPath + @"\SiaSun.LMS.Interface.dll");
cp.lsRef.Add(sPath + @"\SiaSun.LMS.Implement.dll");
cp.lsRef.Add(sPath + @"\SiaSun.LMS.Model.dll");
cp.lsRef.Add(sPath + @"\SiaSun.LMS.Common.dll");
cp.lsUsing.Add("SiaSun.LMS.WCFHost");
cp.strCode = sEvent;
bResult = cp.Excute(out sResult);
return bResult;
}
/// 执行任务事件
/// 执行计划事件
///
/// 计划事件模型
/// 返回结果
///
public bool PlanEventExecute(SiaSun.LMS.Model.PLAN_ACTION_EXCUTE mPLAN_ACTION_EXCUTE, out string sResult)
{
bool bResult = true;
sResult = string.Empty;
if (null == mPLAN_ACTION_EXCUTE)
{
bResult = false;
sResult = string.Format("操作方法不存在");
return false;
}
bResult = this.EventExecute(mPLAN_ACTION_EXCUTE.ACTION_EVENT, out sResult);
return bResult;
}
/// 执行任务事件
/// 执行任务事件
///
/// 任务事件模型
/// 返回结果
///
public bool ManageEventExecute(SiaSun.LMS.Model.MANAGE_ACTION_EXCUTE mt, out string sResult)
{
bool bResult = true;
sResult = string.Empty;
bResult = this.EventExecute(mt.ACTION_EVENT, out sResult);
if (null == mt)
{
bResult = false;
sResult = string.Format("mt不能为空");
return false;
}
return bResult;
}
#endregion
}
}