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.

598 lines
28 KiB
C#

10 months ago
using System;
using System.Data;
using System.Data.SqlClient;
using System.Collections;
using System.Collections.Generic;
using DSWeb.Models;
using WebSqlHelper;
namespace DSWeb.EntityDA
{
public class WorkFlowStepDA
{
private const string PARM_WORKFLOW_STEP_GID = "@gid";
private const string PARM_WORKFLOW_STEP_NAME = "@name";
private const string PARM_WORKFLOW_STEP_DESCRIPTION = "@description";
private const string PARM_WORKFLOW_STEP_WORKFLOW_ID = "@workflow_id";
private const string PARM_WORKFLOW_STEP_STEP_NO = "@step_no";
private const string PARM_WORKFLOW_STEP_DEFAULT_AUDITOR = "@default_audit";
private const string PARM_WORKFLOW_STEP_AUDITOR = "@auditor";
private const string PARM_WORKFLOW_STEP_CREATE_USER = "@create_user";
private const string PARM_WORKFLOW_STEP_CREATE_TIME = "@create_time";
private const string PARM_WORKFLOW_STEP_MODIFIED_USER = "@modified_user";
private const string PARM_WORKFLOW_STEP_MODIFIED_TIME = "@modified_time";
private const string PARM_WORKFLOW_STEP_STATE = "@state";
private const string PARM_WORKFLOW_STEP_REMARK = "@remark";
private const string PARM_WORKFLOW_STEP_IS_MUST = "@is_must";
private const string PARM_WORKFLOW_STEP_IS_LAST = "@is_last";
private const string PARM_WORKFLOW_STEP_IS_DEPARTMENT = "@is_department";
private const string PARM_WORKFLOW_STEP_IS_PARALLEL = "@is_parallel";
private const string PARM_WORKFLOW_STEP_DEPARTMENT_ID = "@department_id";
private const string SQL_SELECT_WORKFLOW_STEP_BY_WORKFLOW_ID = " SELECT GID, NAME, DESCRIPTION, WORKFLOWID, STEPNO, DEFAULTAUDITOR, AUDITOR,CONDITIONID, ISMUST, ISLAST, GROUPID,"
+ " CREATEUSER,CREATETIME,MODIFIEDUSER,MODIFIEDTIME,REMARK,ISDEPARTMENT,ISPARALLEL,DEPARTMENTID FROM workflow_step WHERE WORKFLOWID = @workflow_id order by stepno";
private const string SQL_SELECT_WORKFLOW_STEP_BY_STEP_ID = " SELECT GID, NAME, DESCRIPTION, WORKFLOWID, STEPNO, DEFAULTAUDITOR, AUDITOR,CONDITIONID, ISMUST, ISLAST, GROUPID,"
+ " CREATEUSER,CREATETIME,MODIFIEDUSER,MODIFIEDTIME,REMARK,ISDEPARTMENT,ISPARALLEL,DEPARTMENTID FROM workflow_step WHERE GID = @gid";
private const string SQL_SELECT_WORKFLOW_STEP_EXIST_SAME_NAME = " SELECT COUNT(*) FROM workflow_step WHERE WORKFLOWID = @workflow_id AND (NAME = @name AND GID <> @gid) OR (DESCRIPTION = @description AND GID <> @gid) ";
private const string SQL_SELECT_RUNNING_WORKFLOW_STEP = " SELECT COUNT(*) FROM workflow_do as A LEFT JOIN workflow_step as B ON A.STEPID = B.GID WHERE A.ISFINISH <> 1 AND A.WORKFLOWID = @workflow_id";
private const string SQL_INSERT_WORKFLOW_STEP = " INSERT INTO workflow_step(GID,NAME,DESCRIPTION,WORKFLOWID,STEPNO,DEFAULTAUDITOR,AUDITOR,ISMUST,ISLAST,CREATEUSER,CREATETIME,REMARK,ISDEPARTMENT,ISPARALLEL,DEPARTMENTID) "
+ " VALUES(@gid,@name,@description,@workflow_id,@step_no,@default_audit,@auditor,@is_must,@is_last,@create_user,GETDATE(),@remark,@is_department,@is_parallel,@department_id) ";
private const string SQL_UPDATE_WORKFLOW_STEP = " UPDATE workflow_step SET NAME = @name,DESCRIPTION = @description,ISMUST = @is_must,ISLAST = @is_last,ISDEPARTMENT = @is_department,ISPARALLEL = @is_parallel,STEPNO = @step_no,MODIFIEDUSER = @modified_user,MODIFIEDTIME = GETDATE() "
+ " WHERE GID = @gid ";
private const string SQL_SELECT_WORKFLOW_STEP_IS_EXIST = " SELECT COUNT(*) FROM workflow_step WHERE GID = @gid ";
private const string SQL_UPDATE_WORKFLOW_STEP_AUDITOR = " UPDATE workflow_step SET AUDITOR = @auditor,MODIFIEDUSER = @modified_user,MODIFIEDTIME = GETDATE() WHERE GID = @gid";
private string SQL_SELECT_WORKFLOW_Step_Exist_WorkflowID = "select count(GID) from workflow_step where workflowid=@workflow_id ";
private const string SQL_DELETE_WORKFLOW_STEP_BY_STEPID = "delete FROM workflow_step WHERE GID = @gid ";
#region 检查是否为工作流workflow.gid定义了工作步骤workflow_step
/// <summary>
/// 检查是否为工作流workflow.gid定义了工作步骤workflow_step
/// </summary>
/// <param name="tempWorkFlowID">工作流GID</param>
/// <returns></returns>
public int DeletetWorkFlowStepByID(string strWorkFlowStepID)
{
int iResult = 0;
SqlParameter runningParm = new SqlParameter(PARM_WORKFLOW_STEP_GID, SqlDbType.VarChar, 36);
runningParm.Value = strWorkFlowStepID;
using (SqlConnection sqlConnection = new SqlConnection(SqlHelper.ConnectionStringLocalTransaction))
{
try
{
iResult = (int)SqlHelper.ExecuteScalar(sqlConnection, CommandType.Text, SQL_DELETE_WORKFLOW_STEP_BY_STEPID, runningParm);
}
catch
{
sqlConnection.Close();
}
}
return iResult;
}
#endregion
#region 检查是否为工作流workflow.gid定义了工作步骤workflow_step
/// <summary>
/// 检查是否为工作流workflow.gid定义了工作步骤workflow_step
/// </summary>
/// <param name="tempWorkFlowID">工作流GID</param>
/// <returns></returns>
public int GetExistWorkFlowID(string tempWorkFlowID)
{
int iResult = 0;
int iExistState = 0;
SqlParameter runningParm = new SqlParameter(PARM_WORKFLOW_STEP_WORKFLOW_ID, SqlDbType.VarChar, 36);
runningParm.Value = tempWorkFlowID;
using (SqlConnection sqlConnection = new SqlConnection(SqlHelper.ConnectionStringLocalTransaction))
{
try
{
iExistState = (int)SqlHelper.ExecuteScalar(sqlConnection, CommandType.Text, SQL_SELECT_WORKFLOW_Step_Exist_WorkflowID, runningParm);
if (iExistState > 0)
{
iResult = 1;//如果存在工作步骤返回1
}
else
{
iResult = 0;
}
}
catch
{
sqlConnection.Close();
}
}
return iResult;
}
#endregion
#region 更新工作流步骤审核人
/// <summary>
/// 更新工作流步骤审核人
/// </summary>
/// <param name="tempWorkFlowID">工作流GID</param>
/// <param name="tempWorkFlowStepID">工作流步骤GID</param>
/// <param name="tempAuditor">工作流步骤审核人</param>
/// <param name="tempOperator">更新操作人</param>
/// <returns>值1表示更新成功 值-1-2表示更新异常 值-3表示工作流内存在未完成的审核记录,不能修改工作流审核人信息</returns>
public int UpdateStepAuditor(string tempWorkFlowID,string tempWorkFlowStepID,string tempAuditor,string tempOperator)
{
int iResult = 0;
using (SqlTransaction sqlTran = SqlHelper.BeginTransaction(SqlHelper.ConnectionStringLocalTransaction))
{
try
{
int iExistState = 0;
SqlParameter runningParm = new SqlParameter(PARM_WORKFLOW_STEP_WORKFLOW_ID, SqlDbType.VarChar, 36);
runningParm.Value = tempWorkFlowID;
iExistState = (int)SqlHelper.ExecuteScalar(sqlTran, CommandType.Text, SQL_SELECT_RUNNING_WORKFLOW_STEP, runningParm);
if (iExistState > 0)
{
iResult = -3;//工作流内存在未完成的审核记录,不能修改工作流审核人信息
}
else
{
SqlParameter[] updateParms = new SqlParameter[] {
new SqlParameter(PARM_WORKFLOW_STEP_GID,SqlDbType.VarChar,36),
new SqlParameter(PARM_WORKFLOW_STEP_MODIFIED_USER,SqlDbType.VarChar,36),
new SqlParameter(PARM_WORKFLOW_STEP_AUDITOR,SqlDbType.VarChar,36)
};
updateParms[0].Value = tempWorkFlowStepID;
updateParms[1].Value = tempOperator;
updateParms[2].Value = tempAuditor;
SqlHelper.ExecuteNonQuery(sqlTran, CommandType.Text, SQL_UPDATE_WORKFLOW_STEP_AUDITOR, updateParms);
}
//事务提交
sqlTran.Commit();
if (iResult >= 0)
{
iResult = 1;//状态为1表示插入成功
}
}
catch (Exception execError)
{
iResult = -1;//有异常,插入失败
sqlTran.Rollback();
iResult = -2;//插入异常,事务已回滚成功
throw execError;
}
finally
{
SqlHelper.CloseConnection();
}
}
return iResult;
}
#endregion
#region 获取工作流所有步骤信息
/// <summary>
/// 获取工作流所有步骤信息
/// </summary>
/// <param name="tempWorkFlowGID">工作流GID</param>
/// <returns>返回所有步骤信息</returns>
public IList<WorkFlowStepEntity> GetWorkFlowSteps(string tempWorkFlowGID)
{
//初始化返回变量
IList<WorkFlowStepEntity> workFlowStepEntities = new List<WorkFlowStepEntity>();
//初始化参数并赋值
SqlParameter parm = new SqlParameter(PARM_WORKFLOW_STEP_WORKFLOW_ID, SqlDbType.VarChar, 36);
parm.Value = tempWorkFlowGID;
using (SqlDataReader sqlRead = SqlHelper.ExecuteReader(SqlHelper.ConnectionStringLocalTransaction, CommandType.Text, SQL_SELECT_WORKFLOW_STEP_BY_WORKFLOW_ID, parm))
{
try
{
//读取字段值
while (sqlRead.Read())
{
WorkFlowStepEntity workFlowStepEntity = new WorkFlowStepEntity();
if (!sqlRead.IsDBNull(0))
{
workFlowStepEntity.GID = sqlRead.GetString(0);
}
if (!sqlRead.IsDBNull(1))
{
workFlowStepEntity.Name = sqlRead.GetString(1);
}
if (!sqlRead.IsDBNull(2))
{
workFlowStepEntity.Description = sqlRead.GetString(2);
}
if (!sqlRead.IsDBNull(3))
{
workFlowStepEntity.WorkFlowID = sqlRead.GetString(3);
}
if (!sqlRead.IsDBNull(4))
{
workFlowStepEntity.StepNO = sqlRead.GetInt32(4);
}
if (!sqlRead.IsDBNull(5))
{
workFlowStepEntity.DefaultAuditor = sqlRead.GetString(5);
}
if (!sqlRead.IsDBNull(6))
{
workFlowStepEntity.Auditor = sqlRead.GetString(6);
}
if (!sqlRead.IsDBNull(7))
{
workFlowStepEntity.ConditionID = sqlRead.GetString(7);
}
if (!sqlRead.IsDBNull(8))
{
workFlowStepEntity.IsMust = sqlRead.GetBoolean(8);
}
if (!sqlRead.IsDBNull(9))
{
workFlowStepEntity.IsLast = sqlRead.GetBoolean(9);
}
if (!sqlRead.IsDBNull(10))
{
workFlowStepEntity.GroupID = sqlRead.GetString(10);
}
if (!sqlRead.IsDBNull(11))
{
workFlowStepEntity.CreateUser = sqlRead.GetString(11);
}
if (!sqlRead.IsDBNull(12))
{
workFlowStepEntity.CreateTime = sqlRead.GetDateTime(12);
}
if (!sqlRead.IsDBNull(13))
{
workFlowStepEntity.ModifiedUser = sqlRead.GetString(13);
}
if (!sqlRead.IsDBNull(14))
{
workFlowStepEntity.ModifiedTime = sqlRead.GetDateTime(14);
}
if (!sqlRead.IsDBNull(15))
{
workFlowStepEntity.Remark = sqlRead.GetString(15);
}
if (!sqlRead.IsDBNull(16))
{
workFlowStepEntity.IsDepartment = sqlRead.GetBoolean(16);
}
if (!sqlRead.IsDBNull(17))
{
workFlowStepEntity.IsParallel = sqlRead.GetBoolean(17);
}
if (!sqlRead.IsDBNull(18))
{
workFlowStepEntity.DepartmentID = sqlRead.GetString(18);
}
workFlowStepEntities.Add(workFlowStepEntity);
}
}
catch (Exception exceError)
{
//抛出异常
throw exceError;
}
}
return workFlowStepEntities;
}
#endregion
#region 根据工作流步骤GID获取步骤信息
/// <summary>
/// 根据工作流步骤GID获取步骤信息
/// </summary>
/// <param name="tempWorkFlowGID">工作流步骤GID</param>
/// <returns>返回步骤信息</returns>
public WorkFlowStepEntity GetSimpleWorkFlowStepByID(string tempWorkFlowStepID)
{
//初始化返回变量
WorkFlowStepEntity workFlowStepEntity = null;
//初始化参数并赋值
SqlParameter parm = new SqlParameter(PARM_WORKFLOW_STEP_GID, SqlDbType.VarChar, 36);
parm.Value = tempWorkFlowStepID;
using (SqlDataReader sqlRead = SqlHelper.ExecuteReader(SqlHelper.ConnectionStringLocalTransaction, CommandType.Text, SQL_SELECT_WORKFLOW_STEP_BY_STEP_ID, parm))
{
try
{
//读取字段值
while (sqlRead.Read())
{
workFlowStepEntity = new WorkFlowStepEntity();
if (!sqlRead.IsDBNull(0))
{
workFlowStepEntity.GID = sqlRead.GetString(0);
}
if (!sqlRead.IsDBNull(1))
{
workFlowStepEntity.Name = sqlRead.GetString(1);
}
if (!sqlRead.IsDBNull(2))
{
workFlowStepEntity.Description = sqlRead.GetString(2);
}
if (!sqlRead.IsDBNull(3))
{
workFlowStepEntity.WorkFlowID = sqlRead.GetString(3);
}
if (!sqlRead.IsDBNull(4))
{
workFlowStepEntity.StepNO = sqlRead.GetInt32(4);
}
if (!sqlRead.IsDBNull(5))
{
workFlowStepEntity.DefaultAuditor = sqlRead.GetString(5);
}
if (!sqlRead.IsDBNull(6))
{
workFlowStepEntity.Auditor = sqlRead.GetString(6);
}
if (!sqlRead.IsDBNull(7))
{
workFlowStepEntity.ConditionID = sqlRead.GetString(7);
}
if (!sqlRead.IsDBNull(8))
{
workFlowStepEntity.IsMust = sqlRead.GetBoolean(8);
}
if (!sqlRead.IsDBNull(9))
{
workFlowStepEntity.IsLast = sqlRead.GetBoolean(9);
}
if (!sqlRead.IsDBNull(10))
{
workFlowStepEntity.GroupID = sqlRead.GetString(10);
}
if (!sqlRead.IsDBNull(11))
{
workFlowStepEntity.CreateUser = sqlRead.GetString(11);
}
if (!sqlRead.IsDBNull(12))
{
workFlowStepEntity.CreateTime = sqlRead.GetDateTime(12);
}
if (!sqlRead.IsDBNull(13))
{
workFlowStepEntity.ModifiedUser = sqlRead.GetString(13);
}
if (!sqlRead.IsDBNull(14))
{
workFlowStepEntity.ModifiedTime = sqlRead.GetDateTime(14);
}
if (!sqlRead.IsDBNull(15))
{
workFlowStepEntity.Remark = sqlRead.GetString(15);
}
if (!sqlRead.IsDBNull(16))
{
workFlowStepEntity.IsDepartment = sqlRead.GetBoolean(16);
}
if (!sqlRead.IsDBNull(17))
{
workFlowStepEntity.IsParallel = sqlRead.GetBoolean(17);
}
if (!sqlRead.IsDBNull(18))
{
workFlowStepEntity.DepartmentID = sqlRead.GetString(18);
}
}
}
catch (Exception exceError)
{
//抛出异常
throw exceError;
}
}
return workFlowStepEntity;
}
#endregion
#region 通过SQL语句获取数据
/// <summary>
/// 通过SQL语句获取数据
/// </summary>
/// <param name="strSql">要执行查询的SQL语句</param>
/// <returns>返回DataSet数据</returns>
public DataSet GetDataSetBySql(string strSql)
{
DataSet dataSet = new DataSet();
dataSet = SqlHelper.ExecuteDataset(SqlHelper.ConnectionStringLocalTransaction, CommandType.Text, strSql);
return dataSet;
}
#endregion
#region 判断当前保存的工作流步骤信息是否有重复的名称
/// <summary>
/// 判断当前保存的工作流步骤信息是否有重复的名称
/// </summary>
/// <param name="tempWorkFlowID">当前工作流GID</param>
/// <param name="tempName">工作流步骤系统名称</param>
/// <param name="tempDescription">工作流步骤显示名称</param>
/// <param name="tempStepID">工作流步骤GID</param>
/// <returns>值1表示有重复的名称 值不等于1表示没有重复的名称</returns>
public int isExistSameNameStep(string tempWorkFlowID,string tempName,string tempDescription,string tempStepID)
{
int iResult = 0;
SqlParameter[] parms = new SqlParameter[] {
new SqlParameter(PARM_WORKFLOW_STEP_GID,SqlDbType.VarChar,36),
new SqlParameter(PARM_WORKFLOW_STEP_NAME,SqlDbType.VarChar,50),
new SqlParameter(PARM_WORKFLOW_STEP_DESCRIPTION,SqlDbType.VarChar,50),
new SqlParameter(PARM_WORKFLOW_STEP_WORKFLOW_ID,SqlDbType.VarChar,36)
};
parms[0].Value = tempStepID;
parms[1].Value = tempName;
parms[2].Value = tempDescription;
parms[3].Value = tempStepID;
using (SqlConnection sqlConnection = new SqlConnection(SqlHelper.ConnectionStringLocalTransaction))
{
try
{
iResult = (int)SqlHelper.ExecuteScalar(sqlConnection, CommandType.Text, SQL_SELECT_WORKFLOW_STEP_EXIST_SAME_NAME, parms);
}
catch
{
sqlConnection.Close();
}
}
return iResult;
}
#endregion
#region 查看当前工作流是否已经完成所有工作流步骤
/// <summary>
/// 查看当前工作流是否已经完成所有工作流步骤
/// </summary>
/// <param name="tempWorkFlowID">工作流GID</param>
/// <returns>值大于等于1表示存在未完成的工作流步骤 值等于0表示所有进行工作流的步骤都已完成</returns>
public int isRunningWorkFlowStep(string tempWorkFlowID)
{
int iResult = 0;
SqlParameter[] parms = new SqlParameter[] {
new SqlParameter(PARM_WORKFLOW_STEP_WORKFLOW_ID,SqlDbType.VarChar,36)
};
parms[0].Value = tempWorkFlowID;
using (SqlConnection sqlConnection = new SqlConnection(SqlHelper.ConnectionStringLocalTransaction))
{
try
{
iResult = (int)SqlHelper.ExecuteScalar(sqlConnection, CommandType.Text, SQL_SELECT_RUNNING_WORKFLOW_STEP, parms);
}
catch
{
sqlConnection.Close();
}
}
return iResult;
}
#endregion
public int SaveWorkFlowStep(IList<WorkFlowStepEntity> workFlowStepEntities)
{
int iResult = 0;
using (SqlTransaction sqlTran = SqlHelper.BeginTransaction(SqlHelper.ConnectionStringLocalTransaction))
{
try
{
foreach (WorkFlowStepEntity workFlowStep in workFlowStepEntities)
{
int iExistState = 0;
SqlParameter existParm = new SqlParameter(PARM_WORKFLOW_STEP_GID, SqlDbType.VarChar, 36);
existParm.Value = workFlowStep.GID;
iExistState = (int)SqlHelper.ExecuteScalar(sqlTran, CommandType.Text, SQL_SELECT_WORKFLOW_STEP_IS_EXIST, existParm);
if (iExistState > 0)
{
SqlParameter[] updateParms = new SqlParameter[] {
new SqlParameter(PARM_WORKFLOW_STEP_GID,SqlDbType.VarChar,36),
new SqlParameter(PARM_WORKFLOW_STEP_NAME,SqlDbType.VarChar,50),
new SqlParameter(PARM_WORKFLOW_STEP_DESCRIPTION,SqlDbType.VarChar,50),
new SqlParameter(PARM_WORKFLOW_STEP_IS_MUST,SqlDbType.Bit),
new SqlParameter(PARM_WORKFLOW_STEP_IS_LAST,SqlDbType.Bit),
new SqlParameter(PARM_WORKFLOW_STEP_IS_DEPARTMENT,SqlDbType.Bit),
new SqlParameter(PARM_WORKFLOW_STEP_IS_PARALLEL,SqlDbType.Bit),
new SqlParameter(PARM_WORKFLOW_STEP_STEP_NO,SqlDbType.Int),
new SqlParameter(PARM_WORKFLOW_STEP_MODIFIED_USER,SqlDbType.VarChar,36)
};
updateParms[0].Value = workFlowStep.GID;
updateParms[1].Value = workFlowStep.Name;
updateParms[2].Value = workFlowStep.Description;
updateParms[3].Value = workFlowStep.IsMust;
updateParms[4].Value = workFlowStep.IsLast;
updateParms[5].Value = workFlowStep.IsDepartment;
updateParms[6].Value = workFlowStep.IsParallel;
updateParms[7].Value = workFlowStep.StepNO;
updateParms[8].Value = workFlowStep.ModifiedUser;
SqlHelper.ExecuteNonQuery(sqlTran, CommandType.Text, SQL_UPDATE_WORKFLOW_STEP, updateParms);
}
else
{
SqlParameter[] insertParms = new SqlParameter[] {
new SqlParameter(PARM_WORKFLOW_STEP_GID,SqlDbType.VarChar,36),
new SqlParameter(PARM_WORKFLOW_STEP_NAME,SqlDbType.VarChar,50),
new SqlParameter(PARM_WORKFLOW_STEP_DESCRIPTION,SqlDbType.VarChar,50),
new SqlParameter(PARM_WORKFLOW_STEP_WORKFLOW_ID,SqlDbType.VarChar,36),
new SqlParameter(PARM_WORKFLOW_STEP_STEP_NO,SqlDbType.Int),
new SqlParameter(PARM_WORKFLOW_STEP_DEFAULT_AUDITOR,SqlDbType.VarChar,36),
new SqlParameter(PARM_WORKFLOW_STEP_AUDITOR,SqlDbType.VarChar,36),
new SqlParameter(PARM_WORKFLOW_STEP_IS_MUST,SqlDbType.Bit),
new SqlParameter(PARM_WORKFLOW_STEP_IS_LAST,SqlDbType.Bit),
new SqlParameter(PARM_WORKFLOW_STEP_CREATE_USER,SqlDbType.VarChar,36),
new SqlParameter(PARM_WORKFLOW_STEP_REMARK,SqlDbType.VarChar,100),
new SqlParameter(PARM_WORKFLOW_STEP_IS_DEPARTMENT,SqlDbType.Bit),
new SqlParameter(PARM_WORKFLOW_STEP_IS_PARALLEL,SqlDbType.Bit),
new SqlParameter(PARM_WORKFLOW_STEP_DEPARTMENT_ID,SqlDbType.VarChar,36)
};
insertParms[0].Value = workFlowStep.GID;
insertParms[1].Value = workFlowStep.Name;
insertParms[2].Value = workFlowStep.Description;
insertParms[3].Value = workFlowStep.WorkFlowID;
insertParms[4].Value = workFlowStep.StepNO;
insertParms[5].Value = workFlowStep.DefaultAuditor;
insertParms[6].Value = workFlowStep.Auditor;
insertParms[7].Value = workFlowStep.IsMust;
insertParms[8].Value = workFlowStep.IsLast;
insertParms[9].Value = workFlowStep.CreateUser;
insertParms[10].Value = workFlowStep.Remark;
insertParms[11].Value = workFlowStep.IsDepartment;
insertParms[12].Value = workFlowStep.IsParallel;
insertParms[13].Value = workFlowStep.DepartmentID;
SqlHelper.ExecuteNonQuery(sqlTran, CommandType.Text, SQL_INSERT_WORKFLOW_STEP, insertParms);
}
}
//事务提交
sqlTran.Commit();
iResult = 1;//状态为1表示插入成功
}
catch (Exception execError)
{
iResult = -1;//有异常,插入失败
sqlTran.Rollback();
iResult = -2;//插入异常,事务已回滚成功
throw execError;
}
finally
{
SqlHelper.CloseConnection();
}
}
return iResult;
}
}
}