/// <summary> /// 设置实体 /// </summary> /// <param name="sqlBuilder">Sql语句生成器</param> /// <param name="workFlowClassEntity">实体</param> private void SetEntity(SQLBuilder sqlBuilder, WorkFlowClassEntity workFlowClassEntity) { sqlBuilder.SetValue(WorkFlowClassTable.FieldCaption, workFlowClassEntity.Caption); sqlBuilder.SetValue(WorkFlowClassTable.FieldFatherId, workFlowClassEntity.FatherId); sqlBuilder.SetValue(WorkFlowClassTable.FieldDescription, workFlowClassEntity.Description); sqlBuilder.SetValue(WorkFlowClassTable.FieldClLevel, workFlowClassEntity.ClLevel); sqlBuilder.SetValue(WorkFlowClassTable.FieldClMgrUrl, workFlowClassEntity.ClMgrUrl); }
/// <summary> /// 更新实体 /// </summary> /// <param name="workFlowClassEntity">实体</param> public int UpdateEntity(WorkFlowClassEntity workFlowClassEntity) { var sqlBuilder = new SQLBuilder(DBProvider); sqlBuilder.BeginUpdate(this.CurrentTableName); this.SetEntity(sqlBuilder, workFlowClassEntity); sqlBuilder.SetWhere(WorkFlowClassTable.FieldWFClassId, workFlowClassEntity.WFClassId); return(sqlBuilder.EndUpdate()); }
/// <summary> /// 修改流程分类 /// </summary> /// <param name="userInfo">用户</param> /// <param name="entity">分类实体</param> /// <returns>大于0成功</returns> public int UpdateWorkFlowClass(UserInfo userInfo, WorkFlowClassEntity entity) { var returnValue = -1; var parameter = ParameterUtil.CreateWithMessage(userInfo, MethodBase.GetCurrentMethod(), this.serviceName, RDIFrameworkMessage.WorkFlowTemplateService_UpdateWorkFlowClass); ServiceUtil.ProcessWorkFlowDbWithTransaction(userInfo, parameter, dbProvider => { var manager = new WorkFlowClassManager(dbProvider, userInfo); returnValue = manager.UpdateWorkflowClass(entity); }); return(returnValue); }
/// <summary> /// 获得流程分类实体 /// </summary> /// <param name="userInfo">用户</param> /// <param name="classId">流程分类Id</param> /// <returns>分类实体</returns> public WorkFlowClassEntity GetWorkFlowClassInfo(UserInfo userInfo, string classId) { WorkFlowClassEntity returnValue = null; var parameter = ParameterUtil.CreateWithMessage(userInfo, MethodBase.GetCurrentMethod(), this.serviceName, RDIFrameworkMessage.WorkFlowTemplateService_GetWorkFlowClassInfo); ServiceUtil.ProcessWorkFlowDbWithTransaction(userInfo, parameter, dbProvider => { var manager = new WorkFlowClassManager(dbProvider, userInfo); returnValue = manager.GetWorkflowClassInfo(classId); }); return(returnValue); }
/// <summary> /// 修改一个流程分类 /// </summary> /// <param name="entity">分类实体</param> /// <returns>受影响的行数</returns> public int UpdateWorkflowClass(WorkFlowClassEntity entity) { int returnInt = -1; if (entity.WFClassId.Trim().Length == 0 || entity.WFClassId == null) { throw new Exception("UpdateWorkflowClass方法错误,WorkflowClassId 不能为空!"); } try { returnInt = this.UpdateEntity(entity); } catch (Exception ex) { throw ex; } return(returnInt); }
/// <summary> /// 新建一个流程分类模板 /// </summary> /// <param name="entity">分类实体</param> /// <returns>增加成功后的主键</returns> public string InsertWorkflowClass(WorkFlowClassEntity entity) { string returnStr = string.Empty; if (entity.WFClassId.Trim().Length == 0 || entity.WFClassId == null) { throw new Exception("InsertWorkFlowClass方法错误,WorkflowClassId 不能为空!"); } try { returnStr = this.AddEntity(entity); } catch (Exception ex) { throw ex; } return(returnStr); }
/// <summary> /// 添加实体 /// </summary> /// <param name="workFlowClassEntity">实体</param> public string AddEntity(WorkFlowClassEntity workFlowClassEntity) { var sequence = string.Empty; this.Identity = false; if (!string.IsNullOrEmpty(workFlowClassEntity.WFClassId)) { sequence = workFlowClassEntity.WFClassId.ToString(CultureInfo.InvariantCulture); } var sqlBuilder = new SQLBuilder(DBProvider, this.Identity, this.ReturnId); sqlBuilder.BeginInsert(this.CurrentTableName, WorkFlowClassTable.FieldWFClassId); if (!this.Identity) { if (string.IsNullOrEmpty(workFlowClassEntity.WFClassId)) { sequence = BusinessLogic.NewGuid(); workFlowClassEntity.WFClassId = sequence; } sqlBuilder.SetValue(WorkFlowClassTable.FieldWFClassId, workFlowClassEntity.WFClassId); } else { if (!this.ReturnId && (DBProvider.CurrentDbType == CurrentDbType.Oracle || DBProvider.CurrentDbType == CurrentDbType.DB2)) { if (DBProvider.CurrentDbType == CurrentDbType.Oracle) { sqlBuilder.SetFormula(WorkFlowClassTable.FieldWFClassId, "SEQ_" + this.CurrentTableName.ToUpper() + ".NEXTVAL "); } if (DBProvider.CurrentDbType == CurrentDbType.DB2) { sqlBuilder.SetFormula(WorkFlowClassTable.FieldWFClassId, "NEXT VALUE FOR SEQ_" + this.CurrentTableName.ToUpper()); } } else { if (this.Identity && (DBProvider.CurrentDbType == CurrentDbType.Oracle || DBProvider.CurrentDbType == CurrentDbType.DB2)) { if (string.IsNullOrEmpty(workFlowClassEntity.WFClassId)) { if (string.IsNullOrEmpty(sequence)) { var sequenceManager = new CiSequenceManager(DBProvider, this.Identity); sequence = sequenceManager.GetSequence(this.CurrentTableName); } workFlowClassEntity.WFClassId = sequence; } sqlBuilder.SetValue(WorkFlowClassTable.FieldWFClassId, workFlowClassEntity.WFClassId); } } } this.SetEntity(sqlBuilder, workFlowClassEntity); 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="workFlowClassEntity">实体</param> public int Update(WorkFlowClassEntity workFlowClassEntity) { return(this.UpdateEntity(workFlowClassEntity)); }
/// <summary> /// 添加 /// </summary> /// <param name="workFlowClassEntity">实体</param> /// <param name="identity">自增量方式</param> /// <param name="returnId">返回主键</param> /// <returns>主键</returns> public string Add(WorkFlowClassEntity workFlowClassEntity, bool identity, bool returnId) { this.Identity = identity; this.ReturnId = returnId; return(this.AddEntity(workFlowClassEntity)); }
/// <summary> /// 添加 /// </summary> /// <param name="workFlowClassEntity">实体</param> /// <returns>主键</returns> public string Add(WorkFlowClassEntity workFlowClassEntity) { return(this.AddEntity(workFlowClassEntity)); }