示例#1
0
        /// <summary>
        /// 保存或更新流程实例任务
        /// </summary>
        /// <param name="entity">实体</param>
        /// <param name="companyId">公司主键</param>
        /// <param name="departmentId">部门主键</param>
        public void SaveEntitys(WfTaskEntity entity, string companyId, string departmentId)
        {
            try
            {
                if (entity.auditors.Count > 0)
                {
                    foreach (var auditor in entity.auditors)
                    {
                        WfTaskEntity wfTaskEntity = new WfTaskEntity();
                        wfTaskEntity.F_ProcessId      = entity.F_ProcessId;
                        wfTaskEntity.F_NodeId         = entity.F_NodeId;
                        wfTaskEntity.F_NodeName       = entity.F_NodeName;
                        wfTaskEntity.F_TaskType       = entity.F_TaskType;
                        wfTaskEntity.F_TimeoutAction  = entity.F_TimeoutAction;
                        wfTaskEntity.F_TimeoutNotice  = entity.F_TimeoutNotice;
                        wfTaskEntity.F_PreviousId     = entity.F_PreviousId;
                        wfTaskEntity.F_PreviousName   = entity.F_PreviousName;
                        wfTaskEntity.F_CreateUserId   = entity.F_CreateUserId;
                        wfTaskEntity.F_CreateUserName = entity.F_CreateUserName;

                        wfTaskEntity.F_AuditorId   = auditor.auditorId;
                        wfTaskEntity.F_AuditorName = auditor.auditorName;

                        wfTaskEntity.F_CompanyId    = "1";
                        wfTaskEntity.F_DepartmentId = "1";
                        if (auditor.condition == 1)//1.同一个部门2.同一个公司
                        {
                            wfTaskEntity.F_DepartmentId = departmentId;
                        }
                        else if (auditor.condition == 2)
                        {
                            wfTaskEntity.F_CompanyId = companyId;
                        }

                        wfTaskEntity.Create();
                        this.BaseRepository().Insert(wfTaskEntity);
                    }
                }
                else
                {
                    entity.F_AuditorId = "1";
                    entity.Create();
                    this.BaseRepository().Insert(entity);
                }
            }
            catch (Exception ex)
            {
                if (ex is ExceptionEx)
                {
                    throw;
                }
                else
                {
                    throw ExceptionEx.ThrowServiceException(ex);
                }
            }
        }
示例#2
0
 /// <summary>
 /// 保存或更新流程实例任务
 /// </summary>
 /// <param name="entity">实体</param>
 public void SaveEntity(WfTaskEntity entity)
 {
     try
     {
         entity.Create();
         this.BaseRepository().Insert(entity);
     }
     catch (Exception ex)
     {
         if (ex is ExceptionEx)
         {
             throw;
         }
         else
         {
             throw ExceptionEx.ThrowServiceException(ex);
         }
     }
 }