You cannot select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

104 lines
4.8 KiB
C#

using System;
using System.Data;
using System.Data.SqlClient;
using DSWeb.Models;
using WebSqlHelper;
namespace DSWeb.EntityDA
{
public class WorkFlowConditionDA
{
private const string PARM_WORKFLOW_CONDITION_GID = "@gid";
private const string PARM_WORKFLOW_CONDITION_NAME = "@name";
private const string PARM_WORKFLOW_CONDITION_DESCRIPTION = "@description";
private const string PARM_WORKFLOW_CONDITION_QUERY_TABLE = "@query_table";
private const string PARM_WORKFLOW_CONDITION_QUERY_SQL_STR = "@query_sql_str";
private const string PARM_WORKFLOW_CONDITION_CREATE_USER = "@create_user";
private const string PARM_WORKFLOW_CONDITION_CREATE_TIME = "@create_time";
private const string PARM_WORKFLOW_CONDITION_MODIFIED_USER = "@modified_user";
private const string PARM_WORKFLOW_CONDITION_MODIFIED_TIME = "@modified_time";
private const string PARM_WORKFLOW_CONDITION_STATE = "@state";
private const string PARM_WORKFLOW_CONDITION_REMARK = "@remark";
private const string SQL_SELECT_WORKFLOW_CONDITION_BY_GID = " SELECT GID, NAME, DESCRIPTION, QUERYTABLE, QUERYSQLSTR, CREATEUSER, CREATETIME, "
+ " MODIFIEDUSER, MODIFIEDTIME, STATE, REMARK FROM workflow_condition WHERE GID = @gid ";
#region 根据工作流条件Gid返回工作流条件信息
/// <summary>
/// 根据工作流条件Gid返回工作流条件信息
/// </summary>
/// <param name="tempConditionID"></param>
/// <returns>根据工作流条件Gid返回工作流条件信息 </returns>
public WorkFlowConditionEntity GetWorkFlowCondition(string tempConditionID)
{
//初始化返回变量
WorkFlowConditionEntity workFlowConditionEntity = null;
//初始化参数并赋值
SqlParameter parm = new SqlParameter(PARM_WORKFLOW_CONDITION_GID, SqlDbType.VarChar, 36);
parm.Value = tempConditionID;
//根据工作流条件Gid返回工作流条件信息
using (SqlDataReader sqlRead = SqlHelper.ExecuteReader(SqlHelper.ConnectionStringLocalTransaction, CommandType.Text, SQL_SELECT_WORKFLOW_CONDITION_BY_GID, parm))
{
try
{ //工作流条件表workflow_condition
workFlowConditionEntity = new WorkFlowConditionEntity();
//读取字段值
while (sqlRead.Read())
{
if (!sqlRead.IsDBNull(0))
{
workFlowConditionEntity.GID = sqlRead.GetString(0);
}
if (!sqlRead.IsDBNull(1))
{
workFlowConditionEntity.Name = sqlRead.GetString(1);
}
if (!sqlRead.IsDBNull(2))
{
workFlowConditionEntity.Description = sqlRead.GetString(2);
}
if (!sqlRead.IsDBNull(3))
{
workFlowConditionEntity.QueryTable = sqlRead.GetString(3);
}
if (!sqlRead.IsDBNull(4))
{
workFlowConditionEntity.QuerySqlStr = sqlRead.GetString(4);
}
if (!sqlRead.IsDBNull(5))
{
workFlowConditionEntity.CreateUser = sqlRead.GetString(5);
}
if (!sqlRead.IsDBNull(6))
{
workFlowConditionEntity.CreateTime = sqlRead.GetDateTime(6);
}
if (!sqlRead.IsDBNull(7))
{
workFlowConditionEntity.ModifiedUser = sqlRead.GetString(7);
}
if (!sqlRead.IsDBNull(8))
{
workFlowConditionEntity.ModifiedTime = sqlRead.GetDateTime(8);
}
if (!sqlRead.IsDBNull(9))
{
workFlowConditionEntity.State = sqlRead.GetInt32(9);
}
if (!sqlRead.IsDBNull(10))
{
workFlowConditionEntity.Remark = sqlRead.GetString(10);
}
}
}
catch (Exception exceError)
{
//抛出异常
throw exceError;
}
}
return workFlowConditionEntity;
}
#endregion
}
}