/// <summary> /// 设置实体 /// </summary> /// <param name="sqlBuilder">SQL生成器</param> /// <param name="noteEntity">实体对象</param> private void SetEntity(SQLBuilder sqlBuilder, BaseNoteEntity noteEntity) { sqlBuilder.SetValue(BaseNoteEntity.FieldTitle, noteEntity.Title); sqlBuilder.SetValue(BaseNoteEntity.FieldCategoryId, noteEntity.CategoryId); sqlBuilder.SetValue(BaseNoteEntity.FieldCategoryFullName, noteEntity.CategoryFullName); sqlBuilder.SetValue(BaseNoteEntity.FieldColor, noteEntity.Color); sqlBuilder.SetValue(BaseNoteEntity.FieldContent, noteEntity.Content); sqlBuilder.SetValue(BaseNoteEntity.FieldEnabled, noteEntity.Enabled); sqlBuilder.SetValue(BaseNoteEntity.FieldImportant, noteEntity.Important); SetEntityExpand(sqlBuilder, noteEntity); }
/// <summary> /// 更新实体 /// </summary> /// <param name="noteEntity">实体对象</param> /// <returns>影响行数</returns> public int UpdateEntity(BaseNoteEntity noteEntity) { SQLBuilder sqlBuilder = new SQLBuilder(DbHelper); sqlBuilder.BeginUpdate(this.CurrentTableName); this.SetEntity(sqlBuilder, noteEntity); sqlBuilder.SetValue(BaseNoteEntity.FieldModifiedUserId, UserInfo.Id); sqlBuilder.SetDBNow(BaseNoteEntity.FieldModifiedOn); sqlBuilder.SetWhere(BaseNoteEntity.FieldId, noteEntity.Id); return(sqlBuilder.EndUpdate()); }
/// <summary> /// 添加一条记录 /// </summary> /// <param name="noteEntity">实体对象</param> /// <returns>主键</returns> public string AddEntity(BaseNoteEntity noteEntity) { string id = Guid.NewGuid().ToString(); SQLBuilder sqlBuilder = new SQLBuilder(DbHelper); sqlBuilder.BeginInsert(this.CurrentTableName); sqlBuilder.SetValue(BaseNoteEntity.FieldId, id); this.SetEntity(sqlBuilder, noteEntity); if (UserInfo != null) { sqlBuilder.SetValue(BaseNoteEntity.FieldCreateUserId, UserInfo.Id); sqlBuilder.SetDBNow(BaseNoteEntity.FieldCreateOn); } sqlBuilder.SetDBNow(BaseNoteEntity.FieldModifiedOn); return(sqlBuilder.EndInsert() > 0 ? id : string.Empty); }
public string Add(BaseNoteEntity noteEntity) { return(this.AddEntity(noteEntity)); }
partial void SetEntityExpand(SQLBuilder sqlBuilder, BaseNoteEntity noteEntity);
public int Update(BaseNoteEntity noteEntity) { return(this.UpdateEntity(noteEntity)); }
public string Add(BaseNoteEntity entity) { return(this.AddObject(entity)); }
partial void SetObjectExpand(SQLBuilder sqlBuilder, BaseNoteEntity entity);
public int Update(BaseNoteEntity entity) { return(this.UpdateObject(entity)); }