/// <summary>
 /// 设置实体
 /// </summary>
 /// <param name="workTaskPowerEntity">实体</param>
 private void SetEntity(SQLBuilder sqlBuilder, WorkTaskPowerEntity workTaskPowerEntity)
 {
     sqlBuilder.SetValue(WorkTaskPowerTable.FieldPowerName, workTaskPowerEntity.PowerName);
     sqlBuilder.SetValue(WorkTaskPowerTable.FieldStatus, workTaskPowerEntity.Status);
     sqlBuilder.SetValue(WorkTaskPowerTable.FieldWorkFlowId, workTaskPowerEntity.WorkFlowId);
     sqlBuilder.SetValue(WorkTaskPowerTable.FieldWorkTaskId, workTaskPowerEntity.WorkTaskId);
 }
        /// <summary>
        /// 更新实体
        /// </summary>
        /// <param name="workTaskPowerEntity">实体</param>
        public int UpdateEntity(WorkTaskPowerEntity workTaskPowerEntity)
        {
            SQLBuilder sqlBuilder = new SQLBuilder(DBProvider);

            sqlBuilder.BeginUpdate(this.CurrentTableName);
            this.SetEntity(sqlBuilder, workTaskPowerEntity);
            sqlBuilder.SetWhere(WorkTaskPowerTable.FieldPowerId, workTaskPowerEntity.PowerId);
            return(sqlBuilder.EndUpdate());
        }
Ejemplo n.º 3
0
        /// <summary>
        /// 设置任务节点的控制权限
        /// </summary>
        /// <param name="powerName">权限名</param>
        /// <param name="workflowid">workflowid</param>
        /// <param name="worktaskId">worktaskId</param>
        public string SetTaskPower(string powerName, string workflowid, string worktaskId)
        {
            string returnStr = string.Empty;

            try
            {
                //string sqlStr = "insert WorkTaskPower(PowerName,workflowid,WorktaskId) values (@powerName,@workflowid,@WorktaskId)";
                var entity = new WorkTaskPowerEntity
                {
                    PowerName  = powerName,
                    WorkFlowId = workflowid,
                    WorkTaskId = worktaskId
                };
                returnStr = new WorkTaskPowerManager(this.DBProvider).AddEntity(entity);
            }
            catch (Exception ex)
            {
                throw ex;
            }
            return(returnStr);
        }
        /// <summary>
        /// 添加实体
        /// </summary>
        /// <param name="workTaskPowerEntity">实体</param>
        public string AddEntity(WorkTaskPowerEntity workTaskPowerEntity)
        {
            string sequence = string.Empty;

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

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