/// <summary>
 /// 设置实体
 /// </summary>
 /// <param name="sqlBuilder"></param>
 /// <param name="accreditUserEntity">实体</param>
 private void SetEntity(SQLBuilder sqlBuilder, AccreditUserEntity accreditUserEntity)
 {
     sqlBuilder.SetValue(AccreditUserTable.FieldAccreditFromUserId, accreditUserEntity.AccreditFromUserId);
     sqlBuilder.SetValue(AccreditUserTable.FieldAccreditToUserId, accreditUserEntity.AccreditToUserId);
     sqlBuilder.SetValue(AccreditUserTable.FieldAccreditDateTime, accreditUserEntity.AccreditDateTime);
     sqlBuilder.SetValue(AccreditUserTable.FieldAccreditStatus, accreditUserEntity.AccreditStatus);
     sqlBuilder.SetValue(AccreditUserTable.FieldAcWorkflowId, accreditUserEntity.AcWorkflowId);
     sqlBuilder.SetValue(AccreditUserTable.FieldAcWorktaskId, accreditUserEntity.AcWorktaskId);
 }
        /// <summary>
        /// 更新实体
        /// </summary>
        /// <param name="accreditUserEntity">实体</param>
        public int UpdateEntity(AccreditUserEntity accreditUserEntity)
        {
            var sqlBuilder = new SQLBuilder(DBProvider);

            sqlBuilder.BeginUpdate(this.CurrentTableName);
            this.SetEntity(sqlBuilder, accreditUserEntity);
            sqlBuilder.SetWhere(AccreditUserTable.FieldAUserId, accreditUserEntity.AUserId);
            return(sqlBuilder.EndUpdate());
        }
Exemplo n.º 3
0
        /// <summary>
        ///
        /// </summary>
        /// <param name="auserid"></param>
        /// <returns></returns>
        public AccreditUserEntity GetAccreditUserInfo(string auserid)
        {
            AccreditUserEntity entity = null;
            DataTable          dt     = GetAccreditUserTable(auserid);

            if (dt != null && dt.Rows.Count > 0)
            {
                entity = BaseEntity.Create <AccreditUserEntity>(dt);
            }
            return(entity);
        }
        /// <summary>
        /// 更新任务授权
        /// </summary>
        /// <param name="userInfo">用户</param>
        /// <param name="entity">实体</param>
        /// <returns>大于0成功</returns>
        public int UpdateAccreditUser(UserInfo userInfo, AccreditUserEntity entity)
        {
            var returnValue = -1;
            var parameter   = ParameterUtil.CreateWithOutMessage(userInfo, MethodBase.GetCurrentMethod(), this.serviceName);

            ServiceUtil.ProcessWorkFlowDbWithTransaction(userInfo, parameter, dbProvider =>
            {
                var manager = new AccreditUserManager(dbProvider, userInfo);
                returnValue = manager.UpdateAccreditUser(entity);
            });
            return(returnValue);
        }
Exemplo n.º 5
0
        /// <summary>
        /// 增加AccreditUser
        /// </summary>
        /// <param name="entity">实体</param>
        /// <returns>增加成功后的主键</returns>
        public string Insert(AccreditUserEntity entity)
        {
            string returnStr = string.Empty;

            try
            {
                if (!accreditExists(entity.AccreditFromUserId, entity.AccreditToUserId, entity.AcWorkflowId, entity.AcWorktaskId)) //有效的授权是否存在
                {
                    returnStr = this.AddEntity(entity);
                }
            }
            catch (Exception ex)
            {
                throw ex;
            }
            return(returnStr);
        }
Exemplo n.º 6
0
 /// <summary>
 /// 任务授权
 /// </summary>
 /// <param name="fromUserId">授权UserId</param>
 /// <param name="toUserId">被授权UserId</param>
 /// <param name="workflowId">流程模板Id</param>
 /// <param name="worktaskId">任务模板Id</param>
 /// <returns></returns>
 public string AssignAccredit(string fromUserId, string toUserId, string workflowId, string worktaskId)
 {
     try
     {
         var au = new AccreditUserEntity
         {
             AUserId            = BusinessLogic.NewGuid(),
             AccreditFromUserId = fromUserId,
             AccreditToUserId   = toUserId,
             AcWorkflowId       = workflowId,
             AcWorktaskId       = worktaskId
         };
         return(string.IsNullOrEmpty(RDIFrameworkService.Instance.WorkFlowHelperService.InsertAccreditUser(this.CurrentUser, au)) ? WorkFlowConst.OtherErrorCode : WorkFlowConst.SuccessCode);
     }
     catch (Exception ex)
     {
         throw ex;
     }
 }
Exemplo n.º 7
0
        /// <summary>
        /// 更新AccreditUser
        /// </summary>
        /// <param name="entity">实体</param>
        /// <returns></returns>
        public int UpdateAccreditUser(AccreditUserEntity entity)
        {
            int returnInt = -1;

            if (entity.AUserId.Trim().Length == 0 || entity.AUserId == null)
            {
                throw new Exception("Update方法错误,AUserId不能为空!");
            }

            try
            {
                returnInt = this.UpdateEntity(entity);
            }
            catch (Exception ex)
            {
                throw ex;
            }
            return(returnInt);
        }
        /// <summary>
        /// 添加实体
        /// </summary>
        /// <param name="accreditUserEntity">实体</param>
        public string AddEntity(AccreditUserEntity accreditUserEntity)
        {
            var sequence = string.Empty;

            this.Identity = false;
            if (accreditUserEntity.AUserId != null)
            {
                sequence = accreditUserEntity.AUserId.ToString();
            }
            var sqlBuilder = new SQLBuilder(DBProvider, this.Identity, this.ReturnId);

            sqlBuilder.BeginInsert(this.CurrentTableName, AccreditUserTable.FieldAUserId);
            if (!this.Identity)
            {
                if (string.IsNullOrEmpty(accreditUserEntity.AUserId))
                {
                    sequence = BusinessLogic.NewGuid();
                    accreditUserEntity.AUserId = sequence;
                }
                sqlBuilder.SetValue(AccreditUserTable.FieldAUserId, accreditUserEntity.AUserId);
            }
            else
            {
                if (!this.ReturnId && (DBProvider.CurrentDbType == CurrentDbType.Oracle || DBProvider.CurrentDbType == CurrentDbType.DB2))
                {
                    if (DBProvider.CurrentDbType == CurrentDbType.Oracle)
                    {
                        sqlBuilder.SetFormula(AccreditUserTable.FieldAUserId, "SEQ_" + this.CurrentTableName.ToUpper() + ".NEXTVAL ");
                    }
                    if (DBProvider.CurrentDbType == CurrentDbType.DB2)
                    {
                        sqlBuilder.SetFormula(AccreditUserTable.FieldAUserId, "NEXT VALUE FOR SEQ_" + this.CurrentTableName.ToUpper());
                    }
                }
                else
                {
                    if (this.Identity && (DBProvider.CurrentDbType == CurrentDbType.Oracle || DBProvider.CurrentDbType == CurrentDbType.DB2))
                    {
                        if (string.IsNullOrEmpty(accreditUserEntity.AUserId))
                        {
                            if (string.IsNullOrEmpty(sequence))
                            {
                                var sequenceManager = new CiSequenceManager(DBProvider, this.Identity);
                                sequence = sequenceManager.GetSequence(this.CurrentTableName);
                            }
                            accreditUserEntity.AUserId = sequence;
                        }
                        sqlBuilder.SetValue(AccreditUserTable.FieldAUserId, accreditUserEntity.AUserId);
                    }
                }
            }
            this.SetEntity(sqlBuilder, accreditUserEntity);
            if (this.Identity && (DBProvider.CurrentDbType == CurrentDbType.SqlServer || DBProvider.CurrentDbType == CurrentDbType.Access))
            {
                sequence = sqlBuilder.EndInsert().ToString(CultureInfo.InvariantCulture);
            }
            else
            {
                sqlBuilder.EndInsert();
            }
            return(sequence);
        }
 /// <summary>
 /// 更新
 /// </summary>
 /// <param name="accreditUserEntity">实体</param>
 public int Update(AccreditUserEntity accreditUserEntity)
 {
     return(this.UpdateEntity(accreditUserEntity));
 }
 /// <summary>
 /// 添加
 /// </summary>
 /// <param name="accreditUserEntity">实体</param>
 /// <param name="identity">自增量方式</param>
 /// <param name="returnId">返回主键</param>
 /// <returns>主键</returns>
 public string Add(AccreditUserEntity accreditUserEntity, bool identity, bool returnId)
 {
     this.Identity = identity;
     this.ReturnId = returnId;
     return(this.AddEntity(accreditUserEntity));
 }
 /// <summary>
 /// 添加
 /// </summary>
 /// <param name="accreditUserEntity">实体</param>
 /// <returns>主键</returns>
 public string Add(AccreditUserEntity accreditUserEntity)
 {
     return(this.AddEntity(accreditUserEntity));
 }
Exemplo n.º 12
0
 /// <summary>
 /// 判断用户是否是该任务节点的操作者
 /// </summary>
 /// <param name="entity"></param>
 /// <returns></returns>
 public bool isTaskOperator(AccreditUserEntity entity)
 {
     return(IsTaskOperator(entity.AccreditFromUserId, entity.AcWorkflowId, entity.AcWorktaskId));
 }