/// <summary>
        /// 更新实体
        /// </summary>
        /// <param name="workTaskEntity">实体</param>
        public int UpdateEntity(WorkTaskEntity workTaskEntity)
        {
            var sqlBuilder = new SQLBuilder(DBProvider);

            sqlBuilder.BeginUpdate(this.CurrentTableName);
            this.SetEntity(sqlBuilder, workTaskEntity);
            sqlBuilder.SetWhere(WorkTaskTable.FieldWorkTaskId, workTaskEntity.WorkTaskId);
            return(sqlBuilder.EndUpdate());
        }
Пример #2
0
        /// <summary>
        /// 修改任务节点
        /// </summary>
        /// <param name="userInfo">用户</param>
        /// <param name="entity">任务节点实体</param>
        /// <returns>大于0修改成功</returns>
        public int UpdateWorkTask(UserInfo userInfo, WorkTaskEntity entity)
        {
            var returnValue = -1;
            var parameter   = ParameterUtil.CreateWithMessage(userInfo, MethodBase.GetCurrentMethod(), this.serviceName, RDIFrameworkMessage.WorkFlowTemplateService_UpdateWorkTask);

            ServiceUtil.ProcessWorkFlowDbWithTransaction(userInfo, parameter, dbProvider =>
            {
                var manager = new WorkTaskManager(dbProvider, userInfo);
                returnValue = manager.UpdateTask(entity);
            });
            return(returnValue);
        }
 /// <summary>
 /// 设置实体
 /// </summary>
 /// <param name="sqlBuilder">Sql语句生成器</param>
 /// <param name="workTaskEntity">实体</param>
 private void SetEntity(SQLBuilder sqlBuilder, WorkTaskEntity workTaskEntity)
 {
     sqlBuilder.SetValue(WorkTaskTable.FieldWorkFlowId, workTaskEntity.WorkFlowId);
     sqlBuilder.SetValue(WorkTaskTable.FieldTaskTypeId, workTaskEntity.TaskTypeId);
     sqlBuilder.SetValue(WorkTaskTable.FieldTaskTypeAndOr, workTaskEntity.TaskTypeAndOr);
     sqlBuilder.SetValue(WorkTaskTable.FieldTaskCaption, workTaskEntity.TaskCaption);
     sqlBuilder.SetValue(WorkTaskTable.FieldIXPosition, workTaskEntity.IXPosition);
     sqlBuilder.SetValue(WorkTaskTable.FieldIYPosition, workTaskEntity.IYPosition);
     sqlBuilder.SetValue(WorkTaskTable.FieldDescription, workTaskEntity.Description);
     sqlBuilder.SetValue(WorkTaskTable.FieldCommands, workTaskEntity.Commands);
     sqlBuilder.SetValue(WorkTaskTable.FieldOperRule, workTaskEntity.OperRule);
     sqlBuilder.SetValue(WorkTaskTable.FieldIsJumpSelf, workTaskEntity.IsJumpSelf);
 }
Пример #4
0
        /// <summary>
        /// 修改任务节点
        /// </summary>
        /// <param name="entity">流程任务实体</param>
        public int UpdateTask(WorkTaskEntity entity)
        {
            int returnInt = -1;

            if (entity.WorkTaskId.Trim().Length == 0 || entity.WorkTaskId == null)
            {
                throw new Exception("UpdateTask方法错误,TaskId 不能为空!");
            }
            try
            {
                returnInt = this.UpdateEntity(entity);
            }
            catch (Exception ex)
            {
                throw ex;
            }
            return(returnInt);
        }
Пример #5
0
        /// <summary>
        ///增加任务节点
        /// </summary>
        ///<param name="entity">流程任务实体</param>
        ///<returns>主键</returns>
        public string InsertTask(WorkTaskEntity entity)
        {
            string returnStr = string.Empty;

            if (entity.WorkTaskId.Trim().Length == 0 || entity.WorkTaskId == null)
            {
                throw new Exception("InsertTask方法错误,TaskId 不能为空!");
            }
            try
            {
                returnStr = this.AddEntity(entity);
            }
            catch (Exception ex)
            {
                throw ex;
            }
            return(returnStr);
        }
        /// <summary>
        /// 添加实体
        /// </summary>
        /// <param name="workTaskEntity">实体</param>
        public string AddEntity(WorkTaskEntity workTaskEntity)
        {
            var sequence = string.Empty;

            this.Identity = false;
            if (!string.IsNullOrEmpty(workTaskEntity.WorkTaskId))
            {
                sequence = workTaskEntity.WorkTaskId;
            }
            var sqlBuilder = new SQLBuilder(DBProvider, this.Identity, this.ReturnId);

            sqlBuilder.BeginInsert(this.CurrentTableName, WorkTaskTable.FieldWorkTaskId);
            if (!this.Identity)
            {
                if (string.IsNullOrEmpty(workTaskEntity.WorkTaskId))
                {
                    sequence = BusinessLogic.NewGuid();
                    workTaskEntity.WorkTaskId = sequence;
                }
                sqlBuilder.SetValue(WorkTaskTable.FieldWorkTaskId, workTaskEntity.WorkTaskId);
            }
            else
            {
                if (!this.ReturnId && (DBProvider.CurrentDbType == CurrentDbType.Oracle || DBProvider.CurrentDbType == CurrentDbType.DB2))
                {
                    if (DBProvider.CurrentDbType == CurrentDbType.Oracle)
                    {
                        sqlBuilder.SetFormula(WorkTaskTable.FieldWorkTaskId, "SEQ_" + this.CurrentTableName.ToUpper() + ".NEXTVAL ");
                    }
                    if (DBProvider.CurrentDbType == CurrentDbType.DB2)
                    {
                        sqlBuilder.SetFormula(WorkTaskTable.FieldWorkTaskId, "NEXT VALUE FOR SEQ_" + this.CurrentTableName.ToUpper());
                    }
                }
                else
                {
                    if (this.Identity && (DBProvider.CurrentDbType == CurrentDbType.Oracle || DBProvider.CurrentDbType == CurrentDbType.DB2))
                    {
                        if (string.IsNullOrEmpty(workTaskEntity.WorkTaskId))
                        {
                            if (string.IsNullOrEmpty(sequence))
                            {
                                var sequenceManager = new CiSequenceManager(DBProvider, this.Identity);
                                sequence = sequenceManager.GetSequence(this.CurrentTableName);
                            }
                            workTaskEntity.WorkTaskId = sequence;
                        }
                        sqlBuilder.SetValue(WorkTaskTable.FieldWorkTaskId, workTaskEntity.WorkTaskId);
                    }
                }
            }
            this.SetEntity(sqlBuilder, workTaskEntity);
            if (this.Identity && (DBProvider.CurrentDbType == CurrentDbType.SqlServer || DBProvider.CurrentDbType == CurrentDbType.Access))
            {
                sequence = sqlBuilder.EndInsert().ToString();
            }
            else
            {
                sqlBuilder.EndInsert();
            }
            return(sequence);
        }
 /// <summary>
 /// 更新
 /// </summary>
 /// <param name="workTaskEntity">实体</param>
 public int Update(WorkTaskEntity workTaskEntity)
 {
     return(this.UpdateEntity(workTaskEntity));
 }
 /// <summary>
 /// 添加
 /// </summary>
 /// <param name="workTaskEntity">实体</param>
 /// <param name="identity">自增量方式</param>
 /// <param name="returnId">返回主键</param>
 /// <returns>主键</returns>
 public string Add(WorkTaskEntity workTaskEntity, bool identity, bool returnId)
 {
     this.Identity = identity;
     this.ReturnId = returnId;
     return(this.AddEntity(workTaskEntity));
 }
 /// <summary>
 /// 添加
 /// </summary>
 /// <param name="workTaskEntity">实体</param>
 /// <returns>主键</returns>
 public string Add(WorkTaskEntity workTaskEntity)
 {
     return(this.AddEntity(workTaskEntity));
 }