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

            sqlBuilder.BeginUpdate(this.CurrentTableName);
            this.SetEntity(sqlBuilder, operatorEntity);
            sqlBuilder.SetWhere(OperatorTable.FieldOperatorId, operatorEntity.OperatorId);
            return(sqlBuilder.EndUpdate());
        }
 /// <summary>
 /// 设置实体
 /// </summary>
 /// <param name="sqlBuilder">Sql语句生成器</param>
 /// <param name="operatorEntity">实体</param>
 private void SetEntity(SQLBuilder sqlBuilder, OperatorEntity operatorEntity)
 {
     sqlBuilder.SetValue(OperatorTable.FieldWorkFlowId, operatorEntity.WorkFlowId);
     sqlBuilder.SetValue(OperatorTable.FieldWorkTaskId, operatorEntity.WorkTaskId);
     sqlBuilder.SetValue(OperatorTable.FieldNextType, operatorEntity.NextType);
     sqlBuilder.SetValue(OperatorTable.FieldOperType, operatorEntity.OperType);
     sqlBuilder.SetValue(OperatorTable.FieldOperContent, operatorEntity.OperContent);
     sqlBuilder.SetValue(OperatorTable.FieldRelation, operatorEntity.Relation);
     sqlBuilder.SetValue(OperatorTable.FieldDescription, operatorEntity.Description);
     sqlBuilder.SetValue(OperatorTable.FieldOperDisplay, operatorEntity.OperDisplay);
     sqlBuilder.SetValue(OperatorTable.FieldInorExclude, operatorEntity.InorExclude);
 }
        /// <summary>
        /// 修改处理者
        /// </summary>
        /// <param name="userInfo">用户</param>
        /// <param name="entity">处理者实体</param>
        /// <returns>大于0成功</returns>
        public int UpdateOperator(UserInfo userInfo, OperatorEntity entity)
        {
            var returnValue = -1;
            var parameter   = ParameterUtil.CreateWithMessage(userInfo, MethodBase.GetCurrentMethod(), this.serviceName, RDIFrameworkMessage.WorkFlowUserControlService_UpdateOperator);

            ServiceUtil.ProcessWorkFlowDbWithTransaction(userInfo, parameter, dbProvider =>
            {
                var manager = new OperatorManager(dbProvider, userInfo);
                returnValue = manager.UpdateOperator(entity);
            });
            return(returnValue);
        }
Пример #4
0
        /// <summary>
        /// 修改处理者
        /// </summary>
        /// <param name="entity">处理者实体</param>
        public int UpdateOperator(OperatorEntity entity)
        {
            int returnInt = -1;

            if (entity.OperatorId.Trim().Length == 0 || entity.OperatorId == null)
            {
                throw new Exception("UpdateOperator方法错误,OperatorId 不能为空!");
            }
            try
            {
                returnInt = this.UpdateEntity(entity);
            }
            catch (Exception ex)
            {
                throw ex;
            }
            return(returnInt);
        }
Пример #5
0
        /// <summary>
        /// 增加处理者
        /// </summary>
        /// <param name="entity">处理者实体</param>
        /// <returns></returns>
        public string InsertOperator(OperatorEntity entity)
        {
            string returnString = string.Empty;

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

            this.Identity = false;
            if (operatorEntity.OperatorId != null)
            {
                sequence = operatorEntity.OperatorId.ToString(CultureInfo.InvariantCulture);
            }
            var sqlBuilder = new SQLBuilder(DBProvider, this.Identity, this.ReturnId);

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