/// <summary>
 /// 设置实体
 /// </summary>
 /// <param name="sqlBuilder">Sql语句生成器</param>
 /// <param name="workTaskCommandsEntity">实体</param>
 private void SetEntity(SQLBuilder sqlBuilder, WorkTaskCommandsEntity workTaskCommandsEntity)
 {
     sqlBuilder.SetValue(WorkTaskCommandsTable.FieldWorkFlowId, workTaskCommandsEntity.WorkFlowId);
     sqlBuilder.SetValue(WorkTaskCommandsTable.FieldWorkTaskId, workTaskCommandsEntity.WorkTaskId);
     sqlBuilder.SetValue(WorkTaskCommandsTable.FieldCommandName, workTaskCommandsEntity.CommandName);
     sqlBuilder.SetValue(WorkTaskCommandsTable.FieldDescription, workTaskCommandsEntity.Description);
 }
        /// <summary>
        /// 更新实体
        /// </summary>
        /// <param name="workTaskCommandsEntity">实体</param>
        public int UpdateEntity(WorkTaskCommandsEntity workTaskCommandsEntity)
        {
            var sqlBuilder = new SQLBuilder(DBProvider);

            sqlBuilder.BeginUpdate(this.CurrentTableName);
            this.SetEntity(sqlBuilder, workTaskCommandsEntity);
            sqlBuilder.SetWhere(WorkTaskCommandsTable.FieldCommandId, workTaskCommandsEntity.CommandId);
            return(sqlBuilder.EndUpdate());
        }
        /// <summary>
        /// 得到WorkTaskCommandsEntity
        /// </summary>
        /// <param name="messageid">主键</param>
        /// <returns>WorkTaskCommandsEntity</returns>
        public WorkTaskCommandsEntity GetWorkServiceMessageInfo(string messageid)
        {
            WorkTaskCommandsEntity entity = null;
            DataTable dt = GetWorkServiceMessageTable(messageid);

            if (dt != null && dt.Rows.Count > 0)
            {
                entity = BaseEntity.Create <WorkTaskCommandsEntity>(dt);
            }

            return(entity);
        }
Exemple #4
0
        /// <summary>
        /// 修改任务命令
        /// </summary>
        /// <param name="userInfo">用户</param>
        /// <param name="entity">任务命令实体</param>
        /// <returns>大于0成功</returns>
        public int UpdateWorkTaskCommands(UserInfo userInfo, WorkTaskCommandsEntity entity)
        {
            var returnValue = -1;
            var parameter   = ParameterUtil.CreateWithMessage(userInfo, MethodBase.GetCurrentMethod(), this.serviceName, RDIFrameworkMessage.WorkFlowTemplateService_UpdateWorkTaskCommands);

            ServiceUtil.ProcessWorkFlowDbWithTransaction(userInfo, parameter, dbProvider =>
            {
                var manager = new WorkTaskCommandsManager(dbProvider, userInfo);
                returnValue = manager.UpdateWorkTaskCommands(entity);
            });
            return(returnValue);
        }
        /// <summary>
        /// 修改任务命令
        /// </summary>
        /// <param name="entity">任务命令实体</param>
        /// <returns>大于0成功</returns>
        public int UpdateWorkTaskCommands(WorkTaskCommandsEntity entity)
        {
            int returnInt = -1;

            if (entity.CommandId.Trim().Length == 0 || entity.CommandId == null)
            {
                throw new Exception("UpdateWorkTaskCommands方法错误,commandId 不能为空!");
            }
            try
            {
                returnInt = this.UpdateEntity(entity);
            }
            catch (Exception ex)
            {
                throw ex;
            }
            return(returnInt);
        }
        /// <summary>
        /// 增加任务命令
        /// </summary>
        /// <param name="entity">任务命令实体</param>
        /// <returns>主键</returns>
        public string InsertWorkTaskCommands(WorkTaskCommandsEntity entity)
        {
            string returnStr = string.Empty;

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

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

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