// 这个是声明扩展方法 partial void SetEntityExpand(SQLBuilder sqlBuilder, BaseWorkFlowHistoryEntity baseWorkFlowHistoryEntity);
private string AddHistory(BaseWorkFlowCurrentEntity workFlowCurrentEntity) { BaseWorkFlowHistoryEntity workFlowHistoryEntity = new BaseWorkFlowHistoryEntity(); // 这些是待审核信息 workFlowHistoryEntity.CurrentFlowId = workFlowCurrentEntity.Id; workFlowHistoryEntity.WorkFlowId = workFlowCurrentEntity.WorkFlowId; workFlowHistoryEntity.ActivityId = workFlowCurrentEntity.ActivityId; workFlowHistoryEntity.ActivityFullName = workFlowCurrentEntity.ActivityFullName; workFlowHistoryEntity.ToUserId = workFlowCurrentEntity.ToUserId; workFlowHistoryEntity.ToUserRealName = workFlowCurrentEntity.ToUserRealName; workFlowHistoryEntity.ToRoleId = workFlowCurrentEntity.ToRoleId; workFlowHistoryEntity.ToRoleRealName = workFlowCurrentEntity.ToRoleRealName; if (string.IsNullOrEmpty(workFlowCurrentEntity.ToDepartmentId)) { workFlowHistoryEntity.ToDepartmentId = this.UserInfo.DepartmentId; workFlowHistoryEntity.ToDepartmentName = this.UserInfo.DepartmentName; } else { workFlowHistoryEntity.ToDepartmentId = workFlowCurrentEntity.ToDepartmentId; workFlowHistoryEntity.ToDepartmentName = workFlowCurrentEntity.ToDepartmentName; } workFlowHistoryEntity.AuditUserId = workFlowCurrentEntity.AuditUserId; workFlowHistoryEntity.AuditUserRealName = workFlowCurrentEntity.AuditUserRealName; workFlowHistoryEntity.AuditIdea = workFlowCurrentEntity.AuditIdea; workFlowHistoryEntity.AuditStatus = workFlowCurrentEntity.AuditStatus; workFlowHistoryEntity.AuditStatusName = workFlowCurrentEntity.AuditStatusName; workFlowHistoryEntity.SendDate = workFlowCurrentEntity.AuditDate; workFlowHistoryEntity.AuditDate = DateTime.Now; workFlowHistoryEntity.Description = workFlowCurrentEntity.Description; workFlowHistoryEntity.SortCode = workFlowCurrentEntity.SortCode; workFlowHistoryEntity.DeletionStateCode = workFlowCurrentEntity.DeletionStateCode; workFlowHistoryEntity.Enabled = workFlowCurrentEntity.Enabled; BaseWorkFlowHistoryManager workFlowHistoryManager = new BaseWorkFlowHistoryManager(DbHelper, UserInfo); return workFlowHistoryManager.AddEntity(workFlowHistoryEntity); }
/// <summary> /// 更新实体 /// </summary> /// <param name="baseWorkFlowHistoryEntity">实体</param> public int UpdateEntity(BaseWorkFlowHistoryEntity baseWorkFlowHistoryEntity) { SQLBuilder sqlBuilder = new SQLBuilder(DbHelper); sqlBuilder.BeginUpdate(this.CurrentTableName); this.SetEntity(sqlBuilder, baseWorkFlowHistoryEntity); if (UserInfo != null) { sqlBuilder.SetValue(BaseWorkFlowHistoryEntity.FieldModifiedUserId, UserInfo.Id); sqlBuilder.SetValue(BaseWorkFlowHistoryEntity.FieldModifiedBy, UserInfo.RealName); } sqlBuilder.SetDBNow(BaseWorkFlowHistoryEntity.FieldModifiedOn); sqlBuilder.SetWhere(BaseWorkFlowHistoryEntity.FieldId, baseWorkFlowHistoryEntity.Id); return sqlBuilder.EndUpdate(); }
/// <summary> /// 设置实体 /// </summary> /// <param name="baseWorkFlowHistoryEntity">实体</param> private void SetEntity(SQLBuilder sqlBuilder, BaseWorkFlowHistoryEntity baseWorkFlowHistoryEntity) { SetEntityExpand(sqlBuilder, baseWorkFlowHistoryEntity); sqlBuilder.SetValue(BaseWorkFlowHistoryEntity.FieldCurrentFlowId, baseWorkFlowHistoryEntity.CurrentFlowId); sqlBuilder.SetValue(BaseWorkFlowHistoryEntity.FieldWorkFlowId, baseWorkFlowHistoryEntity.WorkFlowId); sqlBuilder.SetValue(BaseWorkFlowHistoryEntity.FieldActivityId, baseWorkFlowHistoryEntity.ActivityId); sqlBuilder.SetValue(BaseWorkFlowHistoryEntity.FieldActivityFullName, baseWorkFlowHistoryEntity.ActivityFullName); sqlBuilder.SetValue(BaseWorkFlowHistoryEntity.FieldToDepartmentId, baseWorkFlowHistoryEntity.ToDepartmentId); sqlBuilder.SetValue(BaseWorkFlowHistoryEntity.FieldToDepartmentName, baseWorkFlowHistoryEntity.ToDepartmentName); sqlBuilder.SetValue(BaseWorkFlowHistoryEntity.FieldToUserId, baseWorkFlowHistoryEntity.ToUserId); sqlBuilder.SetValue(BaseWorkFlowHistoryEntity.FieldToUserRealName, baseWorkFlowHistoryEntity.ToUserRealName); sqlBuilder.SetValue(BaseWorkFlowHistoryEntity.FieldToRoleId, baseWorkFlowHistoryEntity.ToRoleId); sqlBuilder.SetValue(BaseWorkFlowHistoryEntity.FieldToRoleRealName, baseWorkFlowHistoryEntity.ToRoleRealName); sqlBuilder.SetValue(BaseWorkFlowHistoryEntity.FieldAuditUserId, baseWorkFlowHistoryEntity.AuditUserId); sqlBuilder.SetValue(BaseWorkFlowHistoryEntity.FieldAuditUserCode, baseWorkFlowHistoryEntity.AuditUserCode); sqlBuilder.SetValue(BaseWorkFlowHistoryEntity.FieldAuditUserRealName, baseWorkFlowHistoryEntity.AuditUserRealName); sqlBuilder.SetValue(BaseWorkFlowHistoryEntity.FieldSendDate, baseWorkFlowHistoryEntity.SendDate); sqlBuilder.SetValue(BaseWorkFlowHistoryEntity.FieldAuditDate, baseWorkFlowHistoryEntity.AuditDate); sqlBuilder.SetValue(BaseWorkFlowHistoryEntity.FieldAuditIdea, baseWorkFlowHistoryEntity.AuditIdea); sqlBuilder.SetValue(BaseWorkFlowHistoryEntity.FieldAuditStatus, baseWorkFlowHistoryEntity.AuditStatus); sqlBuilder.SetValue(BaseWorkFlowHistoryEntity.FieldAuditStatusName, baseWorkFlowHistoryEntity.AuditStatusName); sqlBuilder.SetValue(BaseWorkFlowHistoryEntity.FieldSortCode, baseWorkFlowHistoryEntity.SortCode); sqlBuilder.SetValue(BaseWorkFlowHistoryEntity.FieldEnabled, baseWorkFlowHistoryEntity.Enabled); sqlBuilder.SetValue(BaseWorkFlowHistoryEntity.FieldDeletionStateCode, baseWorkFlowHistoryEntity.DeletionStateCode); sqlBuilder.SetValue(BaseWorkFlowHistoryEntity.FieldDescription, baseWorkFlowHistoryEntity.Description); }
/// <summary> /// 更新 /// </summary> /// <param name="baseWorkFlowHistoryEntity">实体</param> public int Update(BaseWorkFlowHistoryEntity baseWorkFlowHistoryEntity) { return this.UpdateEntity(baseWorkFlowHistoryEntity); }
public BaseWorkFlowHistoryEntity GetEntity(int id) { BaseWorkFlowHistoryEntity baseWorkFlowHistoryEntity = new BaseWorkFlowHistoryEntity(this.GetDataTable(new KeyValuePair<string, object>(BaseWorkFlowHistoryEntity.FieldId, id))); return baseWorkFlowHistoryEntity; }
/// <summary> /// 添加实体 /// </summary> /// <param name="baseWorkFlowHistoryEntity">实体</param> public string AddEntity(BaseWorkFlowHistoryEntity baseWorkFlowHistoryEntity) { string sequence = string.Empty; if (baseWorkFlowHistoryEntity.SortCode == null || baseWorkFlowHistoryEntity.SortCode == 0) { BaseSequenceManager sequenceManager = new BaseSequenceManager(DbHelper, this.Identity); sequence = sequenceManager.GetSequence(this.CurrentTableName); baseWorkFlowHistoryEntity.SortCode = int.Parse(sequence); } SQLBuilder sqlBuilder = new SQLBuilder(DbHelper, this.Identity, this.ReturnId); sqlBuilder.BeginInsert(this.CurrentTableName, BaseWorkFlowHistoryEntity.FieldId); if (!this.Identity) { sqlBuilder.SetValue(BaseWorkFlowHistoryEntity.FieldId, baseWorkFlowHistoryEntity.Id); } else { if (!this.ReturnId && (DbHelper.CurrentDbType == DbTypes.Oracle || DbHelper.CurrentDbType == DbTypes.DB2)) { if (DbHelper.CurrentDbType == DbTypes.Oracle) { sqlBuilder.SetFormula(BaseWorkFlowHistoryEntity.FieldId, "SEQ_" + this.CurrentTableName.ToUpper() + ".NEXTVAL "); } if (DbHelper.CurrentDbType == DbTypes.DB2) { sqlBuilder.SetFormula(BaseWorkFlowHistoryEntity.FieldId, "NEXT VALUE FOR SEQ_" + this.CurrentTableName.ToUpper()); } } else { if (this.Identity && (DbHelper.CurrentDbType == DbTypes.Oracle || DbHelper.CurrentDbType == DbTypes.DB2)) { if (baseWorkFlowHistoryEntity.Id == null) { if (string.IsNullOrEmpty(sequence)) { BaseSequenceManager sequenceManager = new BaseSequenceManager(DbHelper, this.Identity); sequence = sequenceManager.GetSequence(this.CurrentTableName); } baseWorkFlowHistoryEntity.Id = int.Parse(sequence); } sqlBuilder.SetValue(BaseWorkFlowHistoryEntity.FieldId, baseWorkFlowHistoryEntity.Id); } } } this.SetEntity(sqlBuilder, baseWorkFlowHistoryEntity); if (UserInfo != null) { sqlBuilder.SetValue(BaseWorkFlowHistoryEntity.FieldCreateUserId, UserInfo.Id); sqlBuilder.SetValue(BaseWorkFlowHistoryEntity.FieldCreateBy, UserInfo.RealName); } sqlBuilder.SetDBNow(BaseWorkFlowHistoryEntity.FieldCreateOn); if (UserInfo != null) { sqlBuilder.SetValue(BaseWorkFlowHistoryEntity.FieldModifiedUserId, UserInfo.Id); sqlBuilder.SetValue(BaseWorkFlowHistoryEntity.FieldModifiedBy, UserInfo.RealName); } sqlBuilder.SetDBNow(BaseWorkFlowHistoryEntity.FieldModifiedOn); if (this.Identity && (DbHelper.CurrentDbType == DbTypes.SqlServer || DbHelper.CurrentDbType == DbTypes.Access)) { sequence = sqlBuilder.EndInsert().ToString(); } else { sqlBuilder.EndInsert(); } return sequence; }
/// <summary> /// 添加 /// </summary> /// <param name="baseWorkFlowHistoryEntity">实体</param> /// <param name="identity">自增量方式</param> /// <param name="returnId">返回主键</param> /// <returns>主键</returns> public string Add(BaseWorkFlowHistoryEntity baseWorkFlowHistoryEntity, bool identity, bool returnId) { this.Identity = identity; this.ReturnId = returnId; return this.AddEntity(baseWorkFlowHistoryEntity); }
/// <summary> /// 添加 /// </summary> /// <param name="baseWorkFlowHistoryEntity">实体</param> /// <returns>主键</returns> public string Add(BaseWorkFlowHistoryEntity baseWorkFlowHistoryEntity) { return this.AddEntity(baseWorkFlowHistoryEntity); }